device: unify identifier matching; case-insensitive names everywhere - #95
Merged
Conversation
… everywhere Extract the name-or-host matcher duplicated across device remove, device default, and device rename into findConfiguredDeviceIndex (device-lookup.ts), and use it for runtime -d resolution too. -d now matches names case-insensitively and accepts a host URL, the same rules as the management commands; previously -d Kitchen failed against a device named kitchen while device remove Kitchen worked. Close the remaining gap in device add: the duplicate-name guard was case-sensitive, so an update could save Kitchen alongside kitchen and make one unreachable by name. The guard now compares case-insensitively; a case-only rename of the same row is still allowed. Also document the npm 12 allow-git install workaround in the README dev section.
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.
What
Follow-up to #94, addressing two inconsistencies in how device identifiers are matched, plus a contributor-facing install note.
device remove(inline),device default, anddevice rename. It's now a singlefindConfiguredDeviceIndex()indevice-lookup.ts, also used by runtime-dresolution (resolveConfiguredDevice).-dwas exact-match —play -d Kitchenfailed against a device namedkitchenwhiledevice remove Kitchenworked.-dnow matches case-insensitively and accepts a host URL (so unnamed legacy entries are targetable), the same rules as the management commands.add. The duplicate-name guard indevice addwas case-sensitive, so an update could saveKitchenalongsidekitchen— making one unreachable by name under case-insensitive lookup. The guard now compares case-insensitively; a case-only rename of the same row is still allowed.--allow-gitworkaround fornpm ci(git-URL dependency on@feralfile/source-resolver; npm 12 defaultsallow-git=none).Behavior change
resolveConfiguredDevicepreviously did exact-match lookups; the test pinning that (multi-device.test.ts) treated a config holding bothKitchenandkitchenas disambiguatable. Such configs can no longer be created (the add/rename guards reject them); for legacy configs that still contain case-duplicates, lookups deterministically resolve to the first row. The avahi-parse test header's case-preservation rationale is updated accordingly (names still round-trip verbatim as display labels).Testing
add(conflict rejected, same-row case rename allowed).resolveConfiguredDevicecases: case-insensitive name, host-URL targeting, legacy case-duplicate first-match.npm run checkgreen: 444 tests, format, lint, copy lint.