Skip to content

fix(deep-link): install snippets into the vault the sheet disclosed - #154

Merged
kipavy merged 1 commit into
devfrom
fix/deeplink-disclosed-vault
Aug 19, 2026
Merged

fix(deep-link): install snippets into the vault the sheet disclosed#154
kipavy merged 1 commit into
devfrom
fix/deeplink-disclosed-vault

Conversation

@kipavy

@kipavy kipavy commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Follow-up 2 of 3 from the #150/#152 review (follow-up 1 shipped in #153).

The bug

src/components/terminal/deepLinkConfirmSpecs.tsx resolved the destination vault twice for one snippet-install sheet: once in details for the "installs into " note, and again inside accept. The spec is not a component, so both reads go straight to useVaultStore.getState() — two reads, two answers. Change the selected vault while the sheet is open and the write lands somewhere the sheet never named.

The fix

load resolves the vault alongside the catalogue entry and returns both (SnippetInstallLoad { entry, vault }); the note and accept read that one captured value. installTargetVault() had a single call site afterwards and is gone.

Practically unreachable today — the sheet is modal — but the disclosure is the whole point of that note, and it should be authoritative rather than incidentally correct.

Tests

DeepLinkConfirmModal.test.tsx: the vault mock became mutable (reset per test), and a new test moves the selection from team-a to team-b after the sheet has painted its destination, then accepts and asserts installCatalogEntries still receives team-a. Fails on dev with expected 'team-b' to be 'team-a', passes here.

Verification

  • Real typecheck node ./node_modules/typescript/bin/tsc --noEmit -p tsconfig.json: exit 0, no output.
  • Full CI=true vitest run: 479/480 files, 3719/3720 tests. Sole failure tests/pluginBundleBuild.test.ts (35057ms, 5000ms budget) — the documented contention flake. Proven not mine: it passes 8/8 on pristine origin/dev (detached worktree) and 8/8 twice on this branch run alone. The box is carrying a stray vite process at ~88% CPU, load average 4.75 on 2 cores.

The snippet-install spec read installTargetVault() once for the destination note
and again inside accept, so the vault named to the user and the vault written to
were two separate reads of a store the spec touches directly. Changing the vault
selection while the sheet is open redirected the write away from the disclosure.

`load` now returns the entry together with the vault it resolved, and both the
note and accept read that one value.
@kipavy
kipavy merged commit 2b1ae08 into dev Aug 19, 2026
4 checks passed
@kipavy
kipavy deleted the fix/deeplink-disclosed-vault branch August 19, 2026 14:55
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.

1 participant