Skip to content

feat(account): apply account records on the PC, link pairings, collect the mailbox - #2843

Closed
devswha wants to merge 21 commits into
feat/account-admissionfrom
feat/account-pc
Closed

devswha wants to merge 21 commits into
feat/account-admissionfrom
feat/account-pc

Conversation

@devswha

@devswha devswha commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

The PC side of linking devices through an account, as specified in docs/account.md (#2834), on top of the one admission rule (#2840). AUTH and the mux frames are unchanged; devices.json stays the only authority.

Stacked on #2840 → #2834 → #2696.

  • Records (server/account/records.ts, server/devices.ts): an add signed by a drive member of this PC's account inserts a member row with added_by and is announced like any enrollment. A remove writes a tombstone first, then revokes every row with that key (its relay sessions end with auth_revoked). No account record clears a tombstone, so a replayed add is refused (tombstoned); a pairing made on this PC clears it, and a remote approval of a tombstoned key is refused. A member that was removed signs nothing more. Records of another account answer account_mismatch; batches answer every outcome and never fail as a whole. Tombstones live in account-tombstones.json beside devices.json, so the legacy state-dir merge, which rewrites devices.json with its known fields, cannot drop them.
  • Routes (server/account/routes.ts): /api/account/status, /link, /records, /enroll. Drive access only, directly or through the relay, with the app's mutation guard. A link comes over the linked row's own relay session, names that session's server_id and that row, and swaps the row's key to the account key in one write. This is also how the PC gets its first member, and how a row left behind by a PC that was off is linked later; status.unlinked lists such rows. enroll is for a member of that account and carries add records only.
  • Mailbox (server/account/mailbox.ts): while the PC has members and a relay identity, it pulls its records from the account service every five minutes. It authenticates with a server proof for the new account role, and acknowledges every processed record, refused ones included. The service URL is OVIS_ACCOUNT_SERVICE_URL (https, or http on loopback), defaulting to https://account.ovis.sh.
  • Feature account is selected in WELCOME for a client that offers it. The relay peer context now carries the session's server_id.
  • Reset relay identity leaves the account: it already revokes every relay device, members included, and with no members nothing is pulled.

Validation

  • server/account/account.contract.test.ts (11 tests, real RelaySessions with Noise, mkdtempSync state, port: 0, the in-memory account service from feat(account): contract for linking devices through an account #2834) covers:
    • a first link, a refused link (other row, other PC, stale key, key in use, off the relay), and the half-moved PC;
    • an add applied, with stranger, foreign-account, forged and malformed records refused;
    • a remove that cuts the device off, a replayed add refused, and a pairing on the PC letting the key back;
    • a removed member that signs nothing more, enroll rules, watch devices refused, and the account feature;
    • a mailbox pull that applies a removal for a PC that was off and acknowledges a refused record too;
    • reset identity leaving the account.
  • relay/server-proof.test.ts: the local relay refuses a control socket answered with an account-role proof (the test fails if the MAC stops covering the role).
  • Mutations, each turning a test red: no signer-membership check, no tombstone check, no link owner/PC check, no account-mismatch check, no member check for enroll, no tombstone clear on a local pairing, acknowledging only part of a page, and not selecting the feature.
  • bun run check fast at 0c322cd: workflow syntax, generated files, typecheck, build and unit tests (10973 pass, 0 fail) all ok.

Closes #2862

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

devswha added a commit that referenced this pull request Nov 5, 2026
…e mailbox

Review fixes (omo and Codex on #2843):
- a revoke on the PC leaves a tombstone, so a replayed add cannot undo it;
- a code started through the relay, or a remote approval, never clears or
  bypasses a tombstone, and an unreadable tombstone file fails closed;
- a stop between two writes is finished on start, told apart by time;
  until then a stale row neither signs in, signs nor approves;
- a remove signed before the PC paired the key again leaves it be;
- a link must start from the key its session signed in with, and never
  takes a key another row holds;
- the mailbox collects nothing while removals could not be applied, sends
  a last ack at its page limit, and a bad service address is its error;
- tombstones merge across sibling state dirs; Portal and open LAN windows
  are refused on /api/account/*.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Review in place of CodeRabbit

CodeRabbit skips this PR (its base is not the default branch), so two review agents stand in (AGENTS.md: a PR touching authentication). Both reviewed 0c322cd: the omo code review answered BLOCK, and the Codex review of the authorization rules found the issues below. Every one is resolved in 10ac0a6, each with a test that fails without its fix.

Severity Finding Reproduced Resolution
HIGH With an unreadable account-tombstones.json, the mailbox acknowledged removals refused as account_unavailable, so they were lost and the removed device stayed in. Yes (omo) The mailbox collects nothing while the tombstone file cannot be read, and shows why as its error.
HIGH A removal stopped between its two writes (tombstone, then revoke) left the row signing in, signing records and approving. Yes (simulated stop) On start the PC finishes it. A row made before its key's removal is revoked; one made after it (a local pairing stopped before clearing the tombstone) keeps its device, and the tombstone goes. Until then such a row neither signs in, signs nor approves.
HIGH A session signed in with a row's old key could link the row again, from the row's current key to a key of its own. By reading A link must start from the key its own session signed in with (old_key), carried in the relay peer context.
HIGH A revoke on the PC did not win: an old signed add for that key applied again. By reading Revoke and Revoke all leave a tombstone for the device's relay key, written before the revoke.
HIGH A code started by an account member through the relay cleared a tombstone, though only a pairing made on this PC may. By reading A code remembers where it was started; one started through the relay is refused for a tombstoned key and clears nothing.
HIGH An unreadable tombstone file failed open for remote approvals. By reading Remote approvals and relay-started codes are refused while it cannot be read.
HIGH / MEDIUM Sibling state dirs merged devices.json but not the tombstones. Yes (omo) mergeAccountTombstones writes the union to both, keeping each key's later removal.
MEDIUM A local re-pairing was undone by the same old remove replayed. Yes (omo) A remove signed before this PC paired the key again leaves that pairing be (unchanged).
MEDIUM Clearing a tombstone before the pairing's own write could lose both on a stop. By reading The tombstone is cleared after the row is written; the start-up repair covers the gap.
MEDIUM A self-link could duplicate a key another row holds. By reading A link never takes a key another row holds, its own old_key included.
MEDIUM Portal visitors could read /api/account/status, and an open LAN window could post records. By reading /api/account/* answers owner_only to both.
MEDIUM The docs said a remove of an absent key is unchanged. By reading The docs now say it still leaves its tombstone, so the key cannot be added later.
LOW A bad OVIS_ACCOUNT_SERVICE_URL would stop the server from starting. By reading It shows as the mailbox's error instead.
LOW A pull that stopped at its page limit left its last page unacknowledged. By reading One more call acknowledges it.
LOW The mailbox waits for the relay to be on, not just for an identity on disk. n/a Kept on purpose: the docs now say "while its relay is on". Loading the identity would create one, and members exist only through the relay.

Validation at 10ac0a6: bun run check fast all ok (typecheck, build, unit tests 10973 pass, 0 fail). bun test server/account/ server/dispatch.test.ts: all pass; each fix above was removed in turn and turned its test red.

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Second review round

The omo code review of 10ac0a6 (with its own Codex run) answered BLOCK.

HIGH, reproduced, fixed in b2e7151. The rule that a pairing made on this PC outlasts an older remove compared against any row's creation time. A PC that was off and then took a member's add and remove together (from its mailbox) kept the device and wrote no tombstone. Only rows paired on this PC itself (no added_by) are spared now; a row an add or a remote approval made goes, however late the remove arrives. New test: "a PC that was off and gets a member's add and remove together ends without the device". It fails before the fix.

The rest stay open as follow-ups, per this lane's rule of one extra fix round:

  • MEDIUM: while account-tombstones.json is unreadable, Revoke removes the device but cannot write its tombstone. After the file is fixed, an old add brings the key back. Fix: refuse to revoke then, or keep the tombstones apart and merge them on recovery.
  • MEDIUM: a refused record is acknowledged, so a new member's remove that arrives before that member's own add is refused (signer_not_member) and lost. This is documented, and needs two clients racing. Fix: keep signer_not_member refusals unacknowledged for a later pull.
  • MEDIUM: turning the relay off does not clear the identity the mailbox uses, so pulls go on although the docs say "while its relay is on".
  • MEDIUM: if the sibling state dir's tombstone file cannot be read, the merge is skipped silently instead of setting accountError on the active store.
  • LOW: merging two state dirs keeps the active dir's row for an id, which can undo a link done in the other dir. Not a security hole: the device re-links on its next connection.

Validation at b2e7151: bun run check fast all ok (typecheck, build, unit tests 10973 pass, 0 fail); bun test server/account/: 22 pass.

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Third review round (final for this lane)

The omo review of b2e7151 answered BLOCK on one reproduced HIGH.

HIGH, reproduced, fixed in d7811e6. A row paired with a code that an account member started through the relay had no added_by. It therefore counted as "paired on this PC" and outlasted an older remove, which the mailbox then acknowledged as unchanged. Such a row now records the member as added_by: a remove takes it, and its announcement names that member. Only pairings made on this PC are spared. New test: "a pairing by a code started through the relay does not outlast an older remove". It fails before the fix.

MEDIUM, documented. The order of a remove against a local re-pairing uses the signer's issued_at and the PC's clock, so a PC whose clock is minutes off can misjudge a remove signed within those minutes. docs/account.md now says so instead of "issued_at is only shown".

These MEDIUM and LOW findings stay open as follow-ups (the first three were listed in the previous comment):

  • MEDIUM: a revoke while account-tombstones.json is unreadable leaves no tombstone.
  • MEDIUM: a sibling dir's unreadable tombstone file skips the merge without setting accountError on the active store.
  • MEDIUM: a refused signer_not_member record is acknowledged and lost.
  • LOW: a code started by a directly paired drive device on another machine counts as a pairing on this PC. That device already has PC-level authority, so this is a wording point in the docs.

Validation at d7811e6: bun run check fast all ok (typecheck, build, unit tests 10973 pass, 0 fail); bun test server/account/ server/relay/: 167 pass.

devswha added a commit that referenced this pull request Nov 5, 2026
…ough a broken file or a merge

Final review fixes on #2843:
- an add whose key is not a P-256 point is refused: stored, it left a
  devices.json no store could read, locking out every device;
- a revoke while account-tombstones.json cannot be read writes its
  tombstone to a pending file, folded back in once the file is fixed;
- merging two state dirs keeps the account key of a row linked in either;
- a member's relay code lets nobody in once the member is revoked.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Fourth review round

The omo review of d7811e6 (with its Codex run) answered BLOCK. Fixed in ae93279, each with a test that fails without its fix:

Severity Finding Resolution
MEDIUM, treated as blocking An add whose key is not a P-256 point was stored: the signature covers only the signer. The next start then found a devices.json no store could read, locking every device out. Refused as record_invalid before anything is written.
HIGH A revoke while account-tombstones.json cannot be read left no tombstone, so after the file was fixed an old add brought the key back. The tombstone goes to account-tombstones.pending.json. The PC reads that too, and folds it into the main file once the main file can be read.
HIGH Merging two state dirs kept the active dir's copy of a row, undoing a link done in the other dir (old key, no account). mergeRegistries (server/state-merge.ts) keeps the account key and account of a row linked in either dir.
MEDIUM (predates this PR) A code an account member started through the relay still worked after the member was revoked. Such a code lets nobody in once its member is revoked or demoted.
LOW The mailbox keeps pulling after the relay is turned off (the identity stays loaded). Left as a follow-up. It reads only records for the PC's own account.

The open MEDIUMs listed in the earlier comments stay follow-ups: a sibling dir's unreadable tombstone file, and signer_not_member refusals being acknowledged.

Validation at ae93279: bun run check fast all ok (typecheck, build, unit tests 10973 pass, 0 fail); bun test server/account/ server/relay/ server/state-merge*.test.ts server/devices.test.ts: all pass.

…t the mailbox

The PC side of linking devices through an account (docs/account.md):
- records: a drive member's add inserts a member row (added_by), its
  remove writes a tombstone and revokes the key; no account record clears
  a tombstone, a pairing on this PC does. A member removed signs nothing.
- /api/account/{status,link,records,enroll}: drive only, through the
  relay too; link proves the row's key over its own session and gives
  the PC its first member; enroll only from a member, adds only.
- mailbox: pulls this PC's records with a server proof for the account
  role (the relay never accepts it), acks every processed record.
- the account feature in WELCOME; reset relay identity leaves the account.
…e mailbox

Review fixes (omo and Codex on #2843):
- a revoke on the PC leaves a tombstone, so a replayed add cannot undo it;
- a code started through the relay, or a remote approval, never clears or
  bypasses a tombstone, and an unreadable tombstone file fails closed;
- a stop between two writes is finished on start, told apart by time;
  until then a stale row neither signs in, signs nor approves;
- a remove signed before the PC paired the key again leaves it be;
- a link must start from the key its session signed in with, and never
  takes a key another row holds;
- the mailbox collects nothing while removals could not be applied, sends
  a last ack at its page limit, and a bad service address is its error;
- tombstones merge across sibling state dirs; Portal and open LAN windows
  are refused on /api/account/*.
The omo re-review reproduced a PC that was off taking a member's add and
remove together and keeping the device: the rule that a newer local
pairing wins also spared rows the add itself had just made. Only rows
without added_by (paired on this PC) are spared now.
…'s addition

The omo review reproduced a row paired with a code an account member
started through the relay outlasting an older remove, as if it had been
paired on this PC. Such a row now records the member as added_by, so a
remove takes it; only pairings made on this PC are spared.
…ough a broken file or a merge

Final review fixes on #2843:
- an add whose key is not a P-256 point is refused: stored, it left a
  devices.json no store could read, locking out every device;
- a revoke while account-tombstones.json cannot be read writes its
  tombstone to a pending file, folded back in once the file is fixed;
- merging two state dirs keeps the account key of a row linked in either;
- a member's relay code lets nobody in once the member is revoked.
… no account

The omo review reproduced a regression from the previous round: a code a
relay device started on a PC in no account recorded its starter and then
failed the member check. A code now records whether it was started
through the relay (never clearing or bypassing a tombstone) apart from
the member that started it, if any. A member's code is checked on the
cookie path too, and the sibling-dir merge reads pending tombstones.
…e account's PCs

An add record's device gets id hex(SHA-256('ovis-account-device/1' ||
server_id || key))[0:16] (accountDeviceId), so the client signs in with
it without asking. A drive member may introduce the account's PCs it
verified to a device a member added (POST /api/account/introduce); the
device reads them over its own session (GET /api/account/introduction).
Kept in memory for 10 minutes; each PC still admits by its own list.
@devswha
devswha force-pushed the feat/account-admission branch from 68bf8cc to e83842f Compare November 5, 2026 02:54
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Fifth round, and the contract additions

HIGH, reproduced by the omo review of ae93279, fixed in 0f583ac. On a PC in no account, a code a relay device started recorded that device as its starter, then failed the member check, so the new device could not pair. That broke the existing "connect another device" flow on every PC. A code now records two things apart: whether it was started through the relay (then it never clears or bypasses a tombstone), and which account member started it, if any (that member becomes added_by, and the code dies with the member). New end-to-end test: "on a PC in no account a code a relay device started still pairs a new device". It fails before the fix. The same commit checks a member's code on the cookie path too, and makes the sibling-dir merge read pending tombstones (the review's MEDIUM and LOW).

Contract additions agreed with the client lane, in eff9192 (spec in #2834):

  • A device an add puts on a PC gets the id hex(SHA-256("ovis-account-device/1" || server_id || key))[0:16] (accountDeviceId), so the client signs in without asking.
  • POST /api/account/introduce (a drive member, for a device a member added, only PCs whose server_id derives from their key) and GET /api/account/introduction (the new device, over its own session). They are kept in memory for 10 minutes.

Each rule has a test that fails when the rule is removed.

Validation at eff9192: bun run check fast all ok (typecheck, build, unit tests 10981 pass, 0 fail).

… members' accounts to drivers

Codex review of #2843: a device admitted with a code or by comparing
digits never signed with its key, so its session may not link, introduce
or read an introduction; a session from a row's older key acts as no
member; a code started through the relay always records its starter as
added_by, so an older remove still takes the device. As agreed with the
client lane, GET /api/devices adds account, account_key and added_by to
members' rows for callers with drive access only.
# Conflicts:
#	docs/account.md
#	server/devices.ts
#	server/relay/service.ts
… a fresh admission of that key

The lead's rule for design 5.3: a comparison with pair-intent-account
outside the owner's pairing window is taken only on a PC in an account
with a member to approve it, for a key the account's mailbox (pulled with
the PC's server proof) has an admission of at most 10 minutes for, at
most 5 a minute. It is shown to account members only and needs their
pick of the digits; anything else is refused before any prompt and not
counted. The mailbox reads an identity already on disk too.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Deploying ovis with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1560397
Status: ✅  Deploy successful!
Preview URL: https://747f796e.ovis.pages.dev
Branch Preview URL: https://feat-account-pc.ovis.pages.dev

View logs

…p former keys out of member actions

Codex's final review of #2843: cached admissions are kept per account,
PC identity and key, so none carries over after the PC changes account
or identity; a session from a row's former key cannot start a member's
code or hear members-only prompts; refused join requests do not spend the
PC's five joins a minute, and a miss pulls the mailbox at most every ten
seconds; the comparison's deadline is extended before the pull; a
watching device reads its own introduction; a client may require the
features the PC selects.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Sixth and seventh rounds, main, and the account-join rule

main and the updated stack are merged in, with no force-push.

Joining through the account outside the owner's pairing window (design 5.3): a comparison with pair-intent-account is taken without the window only when all of these hold:

  • the PC belongs to an account and has a drive member;
  • the account's mailbox, pulled with the PC's server proof, has an admission of at most 10 minutes naming exactly that PAIR_REQUEST key;
  • the PC has taken at most 5 such joins in the last minute.

It is shown to account members only (remote-pairings), never to the PC's own windows, and still needs a member's pick of the digits. Anything else is refused before any prompt and not counted. Tests cover:

  • no admission;
  • an admission for another key or another account;
  • a stale admission;
  • the PC intent;
  • the rate limit, which refused requests don't spend;
  • the approved path.

Also agreed with the client lane: GET /api/devices adds account, account_key and added_by to members' rows, for drive callers only.

Codex review of eff9192, HIGHs reproduced or traced and fixed in d58dd0f:

  • A device admitted with a code or by comparing digits never signed with its key. It no longer counts as holding that key, so it cannot link, introduce or read an introduction.
  • A session from a row's former key acted as a member. Member actions now need the row's current key.
  • A code started through the relay by a non-member left no provenance. It now records its starter as added_by, so an older remove still takes the device.

Codex review of 3b9b63f, fixed in 2a318b5:

  • HIGH: cached admissions carried over after the PC changed account or relay identity. They are now scoped to both.
  • HIGH: a session from a former key could start a member's code.
  • MEDIUM: refused requests spent the join budget, and every miss pulled the mailbox. Now only admitted joins count, and a miss pulls at most every 10 seconds.
  • MEDIUM: the comparison's deadline is extended before the pull, and freshness is checked after it.
  • MEDIUM: members-only prompts are sent only to sessions holding the row's current key.
  • MEDIUM: a watching device reads its own introduction.
  • LOW: a client may require the features the PC selects.

Each fix has a test that fails without it.

Left as follow-ups:

  • LOW: the newer machine-events WebSocket path does not deliver remote-pairings yet (the client lane's screens use it).
  • The MEDIUMs listed in the earlier comments.

Validation at 2a318b5: bun run check fast all ok (typecheck, build, unit tests 11392 pass, 0 fail).

… merge, fail closed on a sibling's tombstones

omo review of 2a318b5: a remove refused because its signer's own add
came later in the same pull is tried again once the pull is read; of two
copies of a linked row the later link (linked_at) wins; a sibling dir's
unreadable tombstone file blocks account records on the active store; a
row a member added goes with its key's tombstone on start whatever its
time.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Eighth round

The omo review of 2a318b5 (with its Codex run) answered BLOCK. All four findings are fixed in 612d9d4, each with a test that fails without its fix:

Severity Finding Resolution
HIGH A remove that reached the PC before its signer's own add in the same pull was refused (signer_not_member), acknowledged, and lost. Records refused for that reason are tried again once the whole pull has been read.
HIGH Merging two state dirs kept the active dir's account key when both copies of a row were linked, undoing a later link. A link records linked_at, and the later link wins.
MEDIUM A sibling dir's unreadable tombstone file was skipped silently. The active store then refuses account records (accountError), as for its own unreadable file.
MEDIUM Start-up repair kept a tombstoned row a member added if it looked newer. A row with added_by goes with its key's tombstone whatever its time, as a remove takes it.

Validation at 612d9d4: bun run check fast all ok (typecheck, build, unit tests 11399 pass, 0 fail).

…their page is acknowledged

omo review of 612d9d4: the single retry ran after the page's ack was
sent, so a failed next request lost the remove, and a chain of adds two
deep still lost it. Records refused for a missing signer are now retried
after each page, before the next request acknowledges it, until a pass
applies nothing more.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Ninth round

The omo review of 612d9d4 answered BLOCK on two reproduced HIGHs in the previous round's retry of early removes. Both are fixed in 787ebd4:

  • Ack before the retry: the retry ran after the page's acknowledgement had gone out, so a failed next request lost the remove.
  • One pass only: a chain of adds read in reverse two deep still lost the remove.

Records refused for a missing signer are now retried after each page, before the next request acknowledges it, until a pass applies nothing more. New test: "a remove at the end of a chain of adds read in reverse in one pull still applies". It fails with a single pass.

Also merged in: the contract's GET /v1/admissions (#2834).

Left as follow-ups:

  • MEDIUM (unreproduced): a tombstone cleared by a local re-pairing in one state dir can come back from the other dir's merge.
  • LOW: an open event stream keeps hearing members-only prompts after its row is re-linked; the decision route still checks the key.
  • LOW: a local revoke now leaves a tombstone on a PC in no account too, so pairing the same key again with a relay-started code is refused.

Validation at 787ebd4: bun run check fast all ok (typecheck, build, unit tests 11393 pass, 0 fail).

As agreed with the client lane: a machines event device-removed
{ event_id, device_id, label, removed_at, by } goes to streams with drive
access whenever a device loses its access: a revoke on the PC (by 'pc'),
through the app (by that device), or an account remove (by its signer).
… restarts

omo review of 787ebd4: a remove whose signer's own add came in a later
pull was refused and acknowledged, so the removed device stayed. Records
refused only for a missing signer now wait in account-pending.json and
are tried on every pull until they apply (at most 1000). A failing
identity read is the mailbox's error, not a throw.
@devswha

devswha commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner Author

Tenth round, and the device-removed event

HIGH, reproduced by the omo review of 787ebd4, fixed in 803b91e. A remove whose signer's own add arrived in a later pull was refused, acknowledged, and lost. Records refused only because their signer is not a member yet now wait in the PC's state dir (account-pending.json). They are tried on every pull, a restart included, until they apply; at most 1000 wait. New test: "a remove that reaches the PC a pull before its signer's own add still applies, even after a restart". It fails if the waiting records are not kept. A failing identity read is now the mailbox's error rather than a throw.

Agreed with the client lane, in 955ff07: a machines event device-removed { event_id, device_id, label, removed_at, by } goes to driving streams only. by is "pc", the device that revoked it through the app, or the signer of an account remove. Tests cover the drive and watch views.

Left as follow-ups (LOW):

  • A session from a row's old key keeps drive access after a link. Member actions already need the current key.
  • Local revokes on a PC in no account now leave tombstones, and those never shrink.

Validation at 803b91e: bun run check fast all ok (typecheck, build, unit tests).

…ledged

omo review of 803b91e: waiting removes were written only when a pull
finished, so a stop after the service took the acknowledgement lost them,
and a failure mid-retry dropped the ones taken out. They are now saved
after each page's retry, before the next request acknowledges it, and on
failure; a record leaves the list only once its outcome is known.
…UNT_SERVICE_URL names

As agreed with the client lane: when OVIS_ACCOUNT_SERVICE_URL is an https
origin, the PC's own pages add exactly that origin to connect-src; nothing
when it is unset or not https.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Eleventh round, and the PC pages' account service

HIGH, reproduced by the omo review of 803b91e, fixed in 1b36924. Removes waiting on their signer were written to disk only when a pull finished. A stop after the service took the page's acknowledgement lost them, and a failure partway through a retry dropped the records taken out (the review's MEDIUM). They are now saved after each page's retry, before the next request acknowledges that page, and again on failure. A record leaves the list only once its outcome is known. The test checks that the remove is on disk at the moment the acknowledgement leaves; it fails without the save.

Agreed with the client lane, in 433333b: when OVIS_ACCOUNT_SERVICE_URL is an https origin, the PC's own pages add exactly that origin to connect-src; nothing is added when it is unset or not https. A test covers set, unset and http.

Validation at 433333b: bun run check fast all ok (typecheck, build, unit tests 0 fail).

…events WebSocket

The default client takes machine events over the WebSocket, which only
subscribed local approvers to relay-pairings, so a drive account member
connected through the relay never saw a join waiting for its pick of the
digits. It now subscribes such members to remote-pairings as the SSE path
does (the row's current key required); watching devices still hear none.

Closes #2862
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Remote pairings over the machine-events WebSocket (#2862)

The default client takes machine events over the WebSocket. That path subscribed only local approvers to relay-pairings, so a drive account member connected through the relay never saw an account join waiting for its pick of the digits.

Fixed in a940639: the WebSocket path now subscribes such members to remote-pairings, exactly as the SSE path does; the session must hold the row's current key. Watching devices still hear none.

Tests in server/relay/pair-sas.contract.test.ts, over a real relay session:

  • A drive member's socket receives the waiting join, with its key and choices. This test failed before the fix.
  • A watching member's socket receives none. This test fails if any relay session is subscribed.

Closes #2862.

Validation at a940639: bun run check fast all ok (typecheck, build, unit tests 0 fail).

# Conflicts:
#	server/relay/session.ts
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Landed as part of #2867 (the whole account stack was merged there in one squash).

@devswha devswha closed this Nov 5, 2026
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