Skip to content

Async Apply: deck clicks wait on DNS when the sender isn't ready, and overlapping applies revert each other #136

Closed

Description

@Skeyelab

Parent

#12

What's wrong

Found in the pre-merge review of #129 (#84, #109). BridgeModel.apply is now async. It awaits osc.connect whenever the host or port changed or !osc.isReady.

  1. Deck clicks wait on DNS. While the Syndicate host can't be opened (a .local name not found, Syndicate's Mac asleep), every deck click in the panel (setDeck → apply) waits for a fresh lookup, up to the 5 s timeout, before the deck changes. Mid-set, a deck switch must be immediate and must not depend on the network.
  2. Lost updates. apply reads old = settings before the await and saves new after it. Two applies in flight can finish out of order, for example a deck click while a host change is resolving, or two quick deck clicks. The later-finishing one saves settings built from the earlier state, which reverts the other's change. The panel picker now runs apply in a detached Task, so this is easy to hit.

This one comes from reading the code, not a probe: apply is app code with no test seam yet.

Fix

  • Only (re)connect when the host or port actually changed. A deck or LED change never awaits the network. Leave "not ready" to the background connect and reresolve.
  • Serialize applies: one at a time, or re-read settings after the await and apply only the edited fields (as BridgeSettings.rebased does for the Settings draft, Deck picker: demo mode and a stale Settings draft #90).

Acceptance criteria

  • A deck click while the host is unresolvable changes the deck at once.
  • A deck click during a slow host change doesn't revert the host, and the host change doesn't revert the deck.
  • Test-first with /tdd where there's a seam. The deck-change path can move into a testable Core helper.
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 workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions