Leave a vault from the app and the extension, also one a sync problem names (#1003) #29

Merged
backmeupplz merged 61 commits from board/1003-da9661 into main 2026-11-28 12:56:22 +00:00
Owner

Stacked on #18 (#979, branch board/979-ebe940), which adds POST /v1/vaults/{id}/leave, Session::leave_vault and the sync problems that name a vault you pay for. Merge #18 first. This PR then targets main: Forgejo retargets it when #18's branch is deleted, or retarget it by hand.

Board: #1003

What changes

Client (client/src/lib.rs)

  • Which vault a problem offers to leave.
    • Session::problems is now Vec<Problem { text, leave: Option<Hex> }>. Problem derefs to and displays as its text, so the CLI is unchanged.
    • Only sync sets leave, at the three places it writes a plaintext vault leave hint. The front ends never parse text, so a server's error text with a planted hint can't put Leave on a different vault.
  • Leave is never offered for your own vault.
    • leave is set only when leavable(id) holds. That needs !is_own(id) and, when this device has no verified roster for the vault, no device of yours ever verified it (keyring.rosters). A fresh device can't tell which of those vaults you created, and a server can hide one to get it offered. An agent's vault keeps its Leave.
    • The known ceiling is a server that also serves a fresh device an older keyring. It's marked with a ponytail: comment, and #998's CLI hint has the same one.
    • create_vault records the new vault's checkpoint in the keyring right away (best effort), so that window doesn't wait for the next sync.
  • is_own is copied verbatim from #998 (PR 26). Whichever PR merges second keeps a single copy. The hint wording for your own vaults stays #998's job.
  • Async leave. leaves_ownerless_async and leave_vault_async let the browser call them. The blocking versions wrap them.

FFI (ffi/src/lib.rs)

  • leave_check(account, vault) returns three things: the vault's name (none for a vault the device can't open), whether you're its only owner while others still use it, and whether it has unsent changes.
  • leave_vault(account, vault) is signed with the identity key, and also works by id for a vault the device can't open. It drops that vault's problems.
  • AccountInfo.problem_vaults lines up with problems and comes from Problem::leave.

Apple app

  • Vault settings get Leave vault, except on the default vault. A split view's detail column says "You're no longer in this vault".
  • The sync banner gets Leave…. Vaults lists each problem that names a vault with Leave…, so a vault the device can't open stays reachable. Rows are keyed by index.
  • All three confirm with the CLI's warnings: deleted if nobody else uses it, the only-owner warning, and lost unsent changes. For a vault with no name here, the warning names the vault's id.
  • A leave that fails still reloads, because the server may already have taken it.

Browser extension

  • wasm sync returns {text, leave}. The new Account.leaveCheck(vault) and Account.leaveVault(vault) take and put back the session.
  • background.js:
    • every problem is now {text, key, vault};
    • the new leaveCheck and leave actions save the account's copy and lock it on signed_out;
    • a failed local save after a successful leave isn't reported as a failed leave.
  • The popup:
    • strips the CLI hint and capitalises, as the app does;
    • shows Leave… on a problem that names a vault;
    • confirms inline with the same warnings, wrapped in full.
  • The settings page shows problems the same way.

Tests

  • client/src/tests.rs covers own vaults:
    • leave is set on the vaults sync names for leaving;
    • never on your own vault when it's hidden or replayed;
    • never on a fresh device's default vault;
    • never on a fresh device's other vault, hidden before its maker synced again.
    • Each new assert was checked to fail without its guard.
  • ffi/src/tests.rs leaving_a_vault:
    • the only-owner warning;
    • a handed-over vault left from the problem;
    • an agent-only vault left by its id;
    • a planted hint gets no Leave, and leaving the vault it names leaves that problem alone;
    • the vaults stay gone after a restart.
  • wasm/src/extension/tests.rs leaving_a_vault_a_problem_names covers the extension's check, leave and JSON shape.
  • Local runs:
    • cargo clippy --locked --all-targets -- -D warnings and cargo test --locked pass;
    • cargo check -p plaintext-wasm --target wasm32-unknown-unknown passes;
    • the Mac PlaintextTests pass (6/6).
  • The UI flows (app and popup) were compile-checked and unit-tested, not driven by hand.

🤖 Generated with Claude Code

Stacked on #18 (#979, branch `board/979-ebe940`), which adds `POST /v1/vaults/{id}/leave`, `Session::leave_vault` and the sync problems that name a vault you pay for. **Merge #18 first.** This PR then targets `main`: Forgejo retargets it when #18's branch is deleted, or retarget it by hand. Board: #1003 ## What changes ### Client (`client/src/lib.rs`) - **Which vault a problem offers to leave.** - `Session::problems` is now `Vec<Problem { text, leave: Option<Hex> }>`. `Problem` derefs to and displays as its text, so the CLI is unchanged. - Only sync sets `leave`, at the three places it writes a `plaintext vault leave` hint. The front ends never parse text, so a server's error text with a planted hint can't put Leave on a different vault. - **Leave is never offered for your own vault.** - `leave` is set only when `leavable(id)` holds. That needs `!is_own(id)` and, when this device has no verified roster for the vault, no device of yours ever verified it (`keyring.rosters`). A fresh device can't tell which of those vaults you created, and a server can hide one to get it offered. An agent's vault keeps its Leave. - The known ceiling is a server that also serves a fresh device an older keyring. It's marked with a `ponytail:` comment, and #998's CLI hint has the same one. - `create_vault` records the new vault's checkpoint in the keyring right away (best effort), so that window doesn't wait for the next sync. - **`is_own` is copied verbatim from #998 (PR 26).** Whichever PR merges second keeps a single copy. The hint *wording* for your own vaults stays #998's job. - **Async leave.** `leaves_ownerless_async` and `leave_vault_async` let the browser call them. The blocking versions wrap them. ### FFI (`ffi/src/lib.rs`) - `leave_check(account, vault)` returns three things: the vault's name (none for a vault the device can't open), whether you're its only owner while others still use it, and whether it has unsent changes. - `leave_vault(account, vault)` is signed with the identity key, and also works by id for a vault the device can't open. It drops that vault's problems. - `AccountInfo.problem_vaults` lines up with `problems` and comes from `Problem::leave`. ### Apple app - Vault settings get **Leave vault**, except on the default vault. A split view's detail column says "You're no longer in this vault". - The sync banner gets **Leave…**. **Vaults** lists each problem that names a vault with **Leave…**, so a vault the device can't open stays reachable. Rows are keyed by index. - All three confirm with the CLI's warnings: deleted if nobody else uses it, the only-owner warning, and lost unsent changes. For a vault with no name here, the warning names the vault's id. - A leave that fails still reloads, because the server may already have taken it. ### Browser extension - wasm `sync` returns `{text, leave}`. The new `Account.leaveCheck(vault)` and `Account.leaveVault(vault)` take and put back the session. - background.js: - every problem is now `{text, key, vault}`; - the new `leaveCheck` and `leave` actions save the account's copy and lock it on `signed_out`; - a failed local save after a successful leave isn't reported as a failed leave. - The popup: - strips the CLI hint and capitalises, as the app does; - shows **Leave…** on a problem that names a vault; - confirms inline with the same warnings, wrapped in full. - The settings page shows problems the same way. ## Tests - `client/src/tests.rs` covers own vaults: - `leave` is set on the vaults sync names for leaving; - never on your own vault when it's hidden or replayed; - never on a fresh device's default vault; - never on a fresh device's other vault, hidden before its maker synced again. - Each new assert was checked to fail without its guard. - `ffi/src/tests.rs` `leaving_a_vault`: - the only-owner warning; - a handed-over vault left from the problem; - an agent-only vault left by its id; - a planted hint gets no Leave, and leaving the vault it names leaves that problem alone; - the vaults stay gone after a restart. - `wasm/src/extension/tests.rs` `leaving_a_vault_a_problem_names` covers the extension's check, leave and JSON shape. - Local runs: - `cargo clippy --locked --all-targets -- -D warnings` and `cargo test --locked` pass; - `cargo check -p plaintext-wasm --target wasm32-unknown-unknown` passes; - the Mac `PlaintextTests` pass (6/6). - The UI flows (app and popup) were compile-checked and unit-tested, not driven by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
FFI leave_check (name, only owner, unsent changes), leave_vault (signed
with the identity key, also by id for a vault the device can't open) and
problem_vault (the vault a sync problem offers to leave). The app shows a
Leave action in a vault's settings and on the banner, and confirms with
the CLI's warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vaults lists the vaults a sync problem offers to leave; test leaving one the device can't open
Some checks failed
Apple / Apple (pull_request) Successful in 41s
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
464b681567
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: a server's error text can't offer to leave your own vault; leaving shows the next problem
All checks were successful
Apple / Apple (pull_request) Successful in 36s
CI / wasm (pull_request) Successful in 1m55s
CI / check (pull_request) Successful in 5m7s
ada8bb89cd
AccountInfo.problem_vaults is worked out from the session and never names a
vault you created. Leaving matches the banner's account too, the next
problem shows right away, and a vault detail left in a split view says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: sync says which vault each problem offers to leave; the extension can leave it too
Some checks failed
Apple / Apple (pull_request) Successful in 54s
release / build (macos-latest, true, aarch64-apple-darwin) (pull_request) Successful in 7m28s
release / build (macos-latest, true, x86_64-apple-darwin) (pull_request) Successful in 8m2s
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
release / build (ubuntu-24.04, false, x86_64-pc-windows-gnu) (pull_request) Has been cancelled
release / build (ubuntu-24.04, true, aarch64-unknown-linux-musl) (pull_request) Has been cancelled
release / build (ubuntu-24.04, true, x86_64-unknown-linux-musl) (pull_request) Has been cancelled
release / release (pull_request) Has been cancelled
release / homebrew (pull_request) Has been cancelled
release / docker (pull_request) Has been cancelled
ac0ce1477e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: never offer to leave your own vault (is_own, as in #998), also hidden or on a fresh device; a failed local save after leaving isn't a failed leave
Some checks failed
Apple / Apple (pull_request) Successful in 38s
release / build (macos-latest, true, aarch64-apple-darwin) (pull_request) Successful in 4m54s
release / build (macos-latest, true, x86_64-apple-darwin) (pull_request) Successful in 5m49s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
release / build (ubuntu-24.04, false, x86_64-pc-windows-gnu) (pull_request) Failing after 12s
release / build (ubuntu-24.04, true, aarch64-unknown-linux-musl) (pull_request) Failing after 13s
release / build (ubuntu-24.04, true, x86_64-unknown-linux-musl) (pull_request) Failing after 13s
release / release (pull_request) Has been skipped
release / homebrew (pull_request) Has been skipped
release / docker (pull_request) Has been skipped
369e2e9e6d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: a fresh device offers to leave only vaults none of your devices verified; the popup's leave warning wraps in full
Some checks failed
Apple / Apple (pull_request) Successful in 40s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
be41303a5a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: a new vault goes into the keyring's checkpoints right away, so a fresh device never offers to leave it
Some checks failed
Apple / Apple (pull_request) Successful in 34s
CI / check (pull_request) Successful in 5m44s
CI / wasm (pull_request) Successful in 6m9s
Android / android (pull_request) Has been cancelled
6c3ab4c795
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
backmeupplz changed title from App: leave a vault, also one a sync problem names (#1003) to Leave a vault from the app and the extension, also one a sync problem names (#1003) 2026-11-28 05:55:29 +00:00
Merge remote-tracking branch 'origin/board/979-ebe940' into board/1003-da9661
Some checks failed
Apple / Apple (pull_request) Successful in 30s
CI / check (pull_request) Successful in 5m44s
CI / wasm (pull_request) Successful in 5m6s
Android / android (pull_request) Has been cancelled
7b0510125e
# Conflicts:
#	client/src/lib.rs
Merge remote-tracking branch 'origin/board/979-ebe940' into board/1003-da9661
Some checks failed
Apple / Apple (pull_request) Successful in 50s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
3c2f399fc4
# Conflicts:
#	client/src/lib.rs
Merge fix: the unlisted-vault warning is a Problem too
Some checks failed
Apple / Apple (pull_request) Successful in 35s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
ea3be78b08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: leaving a vault the server stopped listing drops its unsent changes; the confirmation warns about them
Some checks failed
Apple / Apple (pull_request) Successful in 32s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
69f8bfcee1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge remote-tracking branch 'origin/board/979-ebe940' into board/1003-da9661
Some checks failed
Apple / Apple (pull_request) Successful in 37s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
2df0ef3e23
# Conflicts:
#	client/src/lib.rs
Merge remote-tracking branch 'origin/board/979-ebe940' into board/1003-da9661
All checks were successful
Apple / Apple (pull_request) Successful in 38s
CI / check (pull_request) Successful in 5m24s
CI / wasm (pull_request) Successful in 5m48s
Android / android (pull_request) Successful in 19m10s
841a4203b1
backmeupplz changed target branch from board/979-ebe940 to main 2026-11-28 08:45:40 +00:00
Merge main (PR 18 squash-merged; its tree equals 24c59d8, already merged here)
Some checks failed
Apple / Apple (pull_request) Successful in 1m11s
CI / check (pull_request) Successful in 5m58s
CI / wasm (pull_request) Successful in 6m25s
Android / android (pull_request) Has been cancelled
05c4e192ee
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leaving a vault drops every problem about it; the banner prefers one that offers Leave
Some checks failed
Apple / Apple (pull_request) Successful in 42s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
e8c0385018
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A vault's Leave problem comes first; empty names count as none; the popup drops a left vault's banners
All checks were successful
Apple / Apple (pull_request) Successful in 33s
CI / check (pull_request) Successful in 6m27s
CI / wasm (pull_request) Successful in 6m7s
Android / android (pull_request) Successful in 24m44s
c48a172dd6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The popup's leave confirmation outlives a sync and keeps focus; the app drops a left vault's banner
Some checks failed
Apple / Apple (pull_request) Successful in 35s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
935ae17c96
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A leave clears the banner that offered it; the save offer leaves a leave confirmation alone
All checks were successful
Apple / Apple (pull_request) Successful in 27s
CI / check (pull_request) Successful in 6m12s
CI / wasm (pull_request) Successful in 5m58s
Android / android (pull_request) Successful in 30m53s
5898211a82
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The popup capitalises only the client's sync text; the failed-save comment says what happens
Some checks failed
Apple / Apple (pull_request) Successful in 28s
Android / android (pull_request) Has been cancelled
CI / check (pull_request) Has been cancelled
CI / wasm (pull_request) Has been cancelled
b3d296e76d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed first sync's error reads as a sentence; the failed-save comment says the next sync hides the vault
All checks were successful
Apple / Apple (pull_request) Successful in 30s
CI / check (pull_request) Successful in 6m8s
CI / wasm (pull_request) Successful in 5m33s
Android / android (pull_request) Successful in 25m57s
618ca09650
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge main (#998): own-vault checks from main, Problem leave/vault from this branch
All checks were successful
Apple / Apple (pull_request) Successful in 27s
CI / check (pull_request) Successful in 8m11s
CI / wasm (pull_request) Successful in 6m54s
Android / android (pull_request) Successful in 25m23s
26119a1251
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
backmeupplz deleted branch board/1003-da9661 2026-11-28 12:56:25 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
backmeupplz/plaintext!29
No description provided.