Skip to content

fix(desktop): tell of a vault a cancelled join leaves on the list - #199

Merged
frostyard-machines merged 1 commit into
mainfrom
fix/join-cleanup-on-cancel
Nov 11, 2026
Merged

frostyard-machines merged 1 commit into
mainfrom
fix/join-cleanup-on-cancel

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Summary

Fixes #194.

The bug: since #182 (9b369da, for #164), the join flow drops any answer whose run is no longer current. Every cancel makes the run stale. So when a join was cancelled and its vault couldn't be removed from the list, the warning was dropped, and so was vault.add's lost-answer warning (#176). The vault stayed on the list and the user wasn't told. That is X56 again, and the part of X54 that #176 left (review of #145).

This PR:

  • Shows the warning after a cancel. A failure that may leave a vault on the list (vaultLeft) now shows as a notice when its run was cancelled or replaced. The two such failures are cleanupFailed and the lost answer of vault.add. Any other stale answer is still dropped, so a stale join still can't finish the new run (desktop: a finished join isn't checked against the current one #164). The cleanup message now says "the join was cancelled" instead of "context canceled".
  • Tells runs apart with a ticket instead of a count. The vault manager's reset() zeroes the join flow when the manager closes. So a count restarted at 1 for the next run, a number an older run still held, and that run's answer could finish the new one. Each run now gets its own *joinTicket.
  • Spec: docs/specs/ui.md (the join panel) says what a stopped flow shows: nothing, except a vault that may stay on the list. It already required a notice "where the panel is gone".
  • Test support: desktoptest.StartNotesdWith passes rpctest's options, so a test can swap in a fake domain of a real notesd.

Not changed: if a join succeeds just before the cancel lands, its answer is still dropped. The vault it joined shows up in the list through notesd's vault.added event.

Risk tier

Risk tier: 2. This changes behavior in the desktop window. No changed path is in .github/risk-paths.json, so it gets the default L3.

Verification

  • make check green (host)

  • Race detector on ./internal/desktop/window/ and ./internal/desktop/desktoptest/; make desktop-build

  • Revert test. With main's internal/desktop/window/vaults.go (812bc59) under the new tests:

    • TestACancelledJoinStillTellsOfTheVaultItLeft fails with timed out waiting for the warning.
    • TestAnAnswerFromBeforeTheDialogClosedIsStale fails with the answer from before the dialog closed finished the new join: "invalidParams: \":invalid\" is not a hub URL".

    With the fix but no notice, the first test still fails. Command: go test -count=1 -run 'TestACancelledJoinStillTellsOfTheVaultItLeft|TestAnAnswerFromBeforeTheDialogClosedIsStale' ./internal/desktop/window/

  • Guard and 1 .memory/corrections.jsonl line added

The tests:

  • TestACancelledJoinStillTellsOfTheVaultItLeft takes the real path. It runs a real notesd with two fake domains: sync is paired with one hub, and its sync.join holds. Vault refuses vault.remove. The test opens Manage vaults, clicks Join, fills the panel and clicks Join again. While notesd is joining, it presses Escape. Then it checks for a notice naming "Shared", saying the join was cancelled, and pointing to Manage vaults.
  • TestAnAnswerFromBeforeTheDialogClosedIsStale closes the manager between two joins and replays the older run's answer.
  • TestLostAddAnswerExplainsPossibleVault now also checks that the lost answer is a vaultLeft.

Since #182 a join drops every answer from a run that is no longer
current, and every cancel makes it so. A cleanup failure after a cancel,
and vault.add's lost answer, were dropped with it, so a vault could stay
on the list unannounced (X56 again, and X54's rest). Those two failures
are now a vaultLeft, which shows as a notice when its run is stale; any
other stale answer is still dropped (#164).

A run is now a ticket, not a count: the vault manager's reset zeroes the
flow, and a count started again at a number an older run held, so that
run's answer could finish the new one.

Fixes #194.
@github-actions github-actions Bot added the level:L3 Skim label Nov 11, 2026
@frostyard-machines
frostyard-machines merged commit 8f5308f into main Nov 11, 2026
10 checks passed
@frostyard-machines
frostyard-machines deleted the fix/join-cleanup-on-cancel branch November 11, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop: a cancelled join drops its cleanup failure, so a vault can stay on the list unannounced

2 participants