Skip to content

fix(tools): clean up and stabilise list_devices output#117

Merged
xunholy merged 1 commit into
mainfrom
fix/list-devices-output
Jun 24, 2026
Merged

fix(tools): clean up and stabilise list_devices output#117
xunholy merged 1 commit into
mainfrom
fix/list-devices-output

Conversation

@xunholy

@xunholy xunholy commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-on from v0.749's device-config shorthand. Two issues in the list_devices view:

  • Empty type for shorthand devices: the bare-string form sets only File, so the listing printed - garage (type: , file: ...) with a dangling type: . Now omitted when empty → - garage (file: ...).
  • Non-deterministic order: 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. Both are now sorted by name for a stable, readable listing.

Verification

  • 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.

Files: internal/tools/system.go, internal/tools/list_devices_test.go.

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.
@xunholy xunholy merged commit a82ad87 into main Jun 24, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant