Skip to content

RepositorySettings: whole-snapshot .binding writeback reverts externally written openActionID #623

Description

@onevcat

Problem

RepositorySettingsFeature's case .binding writes the entire RepositorySettings snapshot back to @Shared(.repositorySettings(rootURL)) (RepositorySettingsFeature.swift:373-400). Meanwhile AppFeature writes openActionID directly into the same shared storage from the main-window toolbar (AppFeature.swift:559-585) without syncing the open Settings pane's snapshot. Notably, AppFeature.swift:850-854 does sync runScript for exactly this reason — the hazard is known but inconsistently handled.

Failure scenario

  1. Open Settings → some repository pane (snapshot captured).
  2. In the main window toolbar, pick a new "Open in" app (openActionID written to @Shared).
  3. Toggle anything in the still-open Settings pane.
    → The stale snapshot (old openActionID) is written back wholesale; the toolbar pin silently reverts.

Suggested fix

Either sync state.settings.repositorySettings?.settings.openActionID in .openActionSelectionChanged / .openActionResetToAutomatic (mirroring the runScript handling), or make the .binding writeback field-targeted (compare setGlobalCommandEnabled, RepositorySettingsFeature.swift:233-244).

Origin

TCA-conventions audit of the Settings area (2026-07-30), agent finding — not yet re-verified line by line; confirm the exact write sites before fixing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions