fix(tools): clean up and stabilise list_devices output#117
Merged
Conversation
Follow-on from the v0.749 device-config shorthand. Two issues in the list_devices view: - Shorthand devices (the bare-string form that sets only File) have an empty Type, so the listing printed "- garage (type: , file: ...)" with a dangling "type: ". Now the type is omitted when empty: "- garage (file: ...)". - The handler ranged over the devices map (and each device's commands map) directly, so output order was random per call — it churned between runs and couldn't be asserted in a test. Now both are sorted by name for a stable, readable listing. Verified: new TestListDevices_OutputStableAndOmitsEmptyType pins the exact output for a shorthand device and a full type/file/commands device; task ci green (lint 0 / vet / build / test:full 0 fail / govulncheck clean); task eval 12/12. internal/tools/system.go, internal/tools/list_devices_test.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-on from v0.749's device-config shorthand. Two issues in the
list_devicesview:File, so the listing printed- garage (type: , file: ...)with a danglingtype:. Now omitted when empty →- garage (file: ...).Verification
TestListDevices_OutputStableAndOmitsEmptyTypepins the exact output for a shorthand device and a fulltype/file/commandsdevice.task cigreen (lint 0 / vet / build / test:full 0 fail / govulncheck clean);task eval12/12.Files:
internal/tools/system.go,internal/tools/list_devices_test.go.