Skip to content

feat(sync): device profiles carry their own sync_path; remove inert match_path_contains - #265

Merged
lqdev merged 1 commit into
mainfrom
feat/issue-264-device-profile-sync-path
Jun 6, 2026
Merged

feat(sync): device profiles carry their own sync_path; remove inert match_path_contains#265
lqdev merged 1 commit into
mainfrom
feat/issue-264-device-profile-sync-path

Conversation

@lqdev

@lqdev lqdev commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Device profiles can now carry their own sync_path. Activating a profile points the Sync buffer's active sync target at that device — so switching to your FiiO profile targets the FiiO, switching to the Innioasis targets the Innioasis, every time.

Closes #264.

What changed

  • src/config.rs — Added sync_path: Option<String> (#[serde(default)]) to DeviceProfile. Removed the inert match_path_contains field (it was never read by any logic — a placeholder for auto-selection that's now superseded by sync_path).
  • src/ui/app.rs — New apply_profile_sync_target helper, called from set_device_profile_direct and the two startup buffer-creation sites. Switching to a profile with a sync_path sets the active sync target to it.

Behavior

  • :set-device-profile <name> always re-applies the profile's sync_path (and at startup for active_device_profile).
  • Manual selection keeps session-level precedencep (pick directory) or selecting a saved target still overrides the active target, and does not rewrite the profile's sync_path. Re-running :set-device-profile snaps back to the configured path.
  • Unavailable path (device unplugged) is still applied, with a non-error heads-up message so the switch clearly succeeded.
  • A profile with no sync_path leaves the active target unchanged.
  • A profile switch does not bump a saved target's use_count (stays "real syncs only").
  • No new command — sync_path is authored in config.json, like the rest of a profile.

Compatibility

Existing config.json files are unaffected: DeviceProfile has no deny_unknown_fields, so a leftover match_path_contains key is ignored on load.

Tests

New unit tests (all pass): switch applies the target; no-sync_path leaves it unchanged; an unavailable path still sets the target; a manual override followed by re-switch resets to the configured path; config round-trips sync_path. cargo fmt --check, cargo clippy -- -D warnings, and cargo test (708 lib tests) all clean.

Docs

docs/DEVICE_PROFILES.md (schema row + worked example + a "Sync target follows the profile" section), docs/KEYBINDINGS.md, README.md, and CHANGELOG.md.

Add an optional sync_path to DeviceProfile. Activating a profile (via
:set-device-profile or for active_device_profile at startup) sets the
Sync buffer's active sync target to that path, so switching profiles
points the target at the right device every time.

Manual selection keeps session-level precedence: p / picking a saved
target still overrides the active target without rewriting the profile,
and re-running :set-device-profile snaps it back to the configured path.
An unavailable path (device unplugged) is still applied with a heads-up
message. A profile switch does not bump saved-target use_count.

Remove the inert match_path_contains field (never read anywhere;
superseded by sync_path). Existing config.json is unaffected — the key
is ignored on load.

Docs: DEVICE_PROFILES.md, KEYBINDINGS.md, README, CHANGELOG.

Closes #264

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 6, 2026 01:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

@lqdev
lqdev merged commit c350004 into main Jun 6, 2026
1 check passed
@lqdev
lqdev deleted the feat/issue-264-device-profile-sync-path branch June 6, 2026 02:18
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.

feat(sync): device profile carries its own sync_path; remove inert match_path_contains

2 participants