Skip to content

feat(account): ovis recover admits, removes, lifts and revokes all at the PC (S2-16) - #4305

Closed
devswha wants to merge 60 commits into
feat/s2-15-recover-releasefrom
feat/s2-16-recover-actions
Closed

devswha wants to merge 60 commits into
feat/s2-15-recover-releasefrom
feat/s2-16-recover-actions

Conversation

@devswha

@devswha devswha commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Stacked on S2-15 (#4304) and carrying S2-13's commits (#4301) until that merges; review the S2-16 commits only.

What

Behind OVIS_ACCOUNT_OPENS_ALL (off by default), ovis recover at the PC also admits a waiting device, removes a key, lifts a block and revokes every device, as this PC's own user (device-row-states rows P22, P23, P24, T37, T69, T70):

  • S2-00 contract change (its own commits, a red test and the change, each titled "S2-00 contract change"; SHAs filled in at the PR head): in shared/account-devices-api.ts an admit act names the fingerprint the terminal showed; parseRecoveryAction refuses an admit without one matching PAIR_FINGERPRINT_PATTERN, and still refuses unknown fields.
  • server/account/recovery-acts.ts: RecoverySeams and the acts admit, remove, lift, revoke_all; list also names the devices waiting for this PC's screen, with their fingerprints. While this PC's log cannot be read, every act that writes refuses log_unreadable; list still answers.
  • server/account/recovery-server.ts (openPcRecovery, called from server/index.ts:539): the socket and its seams, through this PC's stores; the safety log is read on every request (!devices.failsClosed && SafetyLog.open(stateDir).readable), and every writing act is refused while it cannot be read. admit goes through the waiting device's own pairing (KeyProofPairings.approve(id, fingerprint, "recover")), so its session is let in too; the fingerprint must be that waiting key's. A key a standing block or freeze targets is refused before the waiting entry is taken: the answer names it and ovis recover --lift <id>, and the entry stays for a later admit (a lift admits nobody by itself). A lock or an unreadable log admits nobody. remove and revoke_all use Track A's removeKey / revokeAll with this PC's OS user; lift appends the PC's lift with its cause recover (Track A's appendLift(blockId, binding, { cause })) and journals it (kind lift, how recover, by the OS user).
  • scripts/plugin-recover.ts: ovis recover --admit <waiting id> shows the device's name and fingerprint, and sends the admit only on a terminal's yes.

Tests (each names its row)

Against a real server's recovery socket (server/account/recovery.contract.test.ts): the right fingerprint admits once with origin recover; a wrong one, a second admit, and an admit while locked are refused, and the waiting entry is gone; remove ends the row; a lift of an unknown block is refused; revoke-all ends every row; lift, remove and revoke-all are journalled with recover and this PC's user; every writing act refuses while the log is unreadable. Unit tests in recovery-acts.test.ts, CLI tests in scripts/plugin-recover.test.ts.

New exports and their production callers

Export Production caller
RecoverySeams (server/account/recovery-acts.ts) server/account/recovery-server.ts (the seams object built in openPcRecovery)
recoveryActs (now with seams) server/account/recovery-server.ts:62
openPcRecovery (server/account/recovery-server.ts) server/index.ts:539
parseRecoveryAction (admit now requires a fingerprint, shared/account-devices-api.ts:193) server/account/recovery-acts.ts:31
PAIR_FINGERPRINT_PATTERN (from S2-13, shared/pair-fingerprint.ts) shared/account-devices-api.ts:206

Track A seams this PR wires: appendLift (server/index.ts:535), removeKey (:532), revokeAll(user) (:539); KeyProofPairings.approve(..., "recover") from S2-13 (server/index.ts, admitPending).

Gates

Pre-read: security-triage YES. Reviews at this head: hub (reads the contract commit), security-triage, dori review, gate reviewer.

Postponed (ledger, after the switch-on)

  • R3-A1: ovis recover --admit should pass an age freeze for that key alone, through the same freeze-pass rule as a screen confirm (P23); today it is refused until the lift, which fails closed. A block that names the key stays refused.
  • B7/B8 (history): remove and revoke-all journal first (Track A's journal-first change); a recovery admit journals how recover and the OS user (Track A's admitConfirmed({ source: "recover", by })).

@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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
devswha force-pushed the feat/s2-16-recover-actions branch from f5fa989 to 59b482e Compare November 20, 2026 05:42
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying ovis with  Cloudflare Pages  Cloudflare Pages

Latest commit: c8fc4b7
Status: ✅  Deploy successful!
Preview URL: https://7f41c6ca.ovis.pages.dev
Branch Preview URL: https://feat-s2-16-recover-actions.ovis.pages.dev

View logs

devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
@devswha
devswha force-pushed the feat/s2-15-recover-release branch from 223f723 to c228e31 Compare November 20, 2026 06:03
@devswha
devswha force-pushed the feat/s2-16-recover-actions branch from 0510d34 to 0e6faaf Compare November 20, 2026 06:03
devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
…he proof holds only for the signing key (T71, T72)

Red: shared/pair-fingerprint.ts does not exist yet.
… single-challenge (S31, T71, T72)

Red: server/account/pending.ts does not exist yet.
…EY_PENDING, and the key-proof-1 feature (T71, T72)
…n its own direction (T71, T72)

Red: the engine knows no key proof frame yet.
…es one; no route approves (S31, T71, T72)

Red: the list, the decline and the event do not exist yet.
…one, and tells drive streams (S31, T71, T72)
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… T70)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… (P23, T37, T69, T70, P22)

Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
Red: gate pre-review of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…70, E48)

Red: gate round 2 of #4305.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
…behind OVIS_ACCOUNT_OPENS_ALL (S2-15, S2-16, S2-18) (#4312)

Track B's recovery and strict-access work in one PR on top of Track A's
S2-17 (lead's rule: one branch, one CI run). Everything is behind
`OVIS_ACCOUNT_OPENS_ALL` (off by default; off = main). It replaces #4304
(S2-15), #4305 (S2-16) and #4302 (S2-18); S2-13 (#4301) is separate and
merges after S2-08.

## Receipts (each piece cleared at its own head before this collapse)
| Piece | Cleared head | Relay hub gate | security-triage | Own gate |
Ledger / postponed |
|---|---|---|---|---|---|
| S2-15 `ovis recover` list, release, undo | 2566725 (range-diff of
223f723) | r2 CLEAR | YES | CLEAR | F1 = D's S2-27 seam (release lookup
wired there) |
| S2-16 `ovis recover` admit, remove, lift, revoke-all, standing blocks
| 655f79b (c8fc4b7 + A's T51 test adapted to the key proof) | r3 CLEAR
(cap) | YES | r3 CLEAR | R3-A1 (age-freeze pass for a recover admit),
B7/B8 (journal order; A's journal-first lands on S2-17) |
| S2-18 strict mode and the PC lock | 958d846 (range-diff of 1a2e303 /
cbfa9b1) | r3 + R3-J re-check CLEAR | YES | CLEAR | H1: ledger/s2-18-r2
@ c61c258 |

This branch is S2-16's cleared head (which contains S2-15) plus S2-18's
commits; range-diff it against the three heads above. One fix commit
after the collapse: `fix(account): one services object carries the
recovery, pending and lock pieces...` (the services object had been kept
three times by the merge). The other hand resolutions are additive:
`server/index.ts`, `server/dispatch.ts` and
`scripts/conventions.test.ts` keep both the recovery/pending pieces and
the lock pieces where each added beside the other.

---

# S2-15: ovis recover, list / release / undo
## What

Behind `OVIS_ACCOUNT_OPENS_ALL` (off by default), `ovis recover` at the
PC lists the rows that wait and releases one for a while, at a terminal,
as this PC's own user (device-row-states rows R11, T70, P23):

- `server/account/recovery.ts` (new): the recovery socket
`<stateDir>/recover/recover.sock`. Not opened on Windows; refused when
the state folder, or the `recover` folder in it, is not this user's own
and private. `RecoveryReleases` holds temporary releases of waiting
rows; sources register their rows (`registerRecoverySource`); sessions
under a release watch it, so an undo closes exactly them; an undo ends a
release whole.
- `server/account/recovery-acts.ts` (new): the acts the socket answers,
each parsed by S2-00's `RecoveryAction`: list, release (journal first,
per row), undo. The user named in the journal is this PC's OS user,
never the request's.
- `scripts/plugin-recover.ts`, `scripts/plugin.ts`: `ovis recover`
lists; `--release <row>` asks at a terminal, one row at a time;
`--undo`.
- `server/index.ts`: with the flag on the server opens the socket and
journals each release and undo (`DeviceJournal`, kind `release`, how
`recover`); whether the log can be read is asked live, and while it
cannot, the list still answers and nothing is released.

With the flag off no socket is opened.

## Since the first review round
- A row already released is not released again (`AlreadyReleasedError`):
one release, one set of sessions, one undo that closes them all.
- `list` says when this PC last saw each waiting row (`last_seen_at`,
from the source's `lastSeenAt`).
- Every act reads the safety log as it comes (`!devices.failsClosed &&
SafetyLog.open(stateDir).readable`, asked per request): a log damaged
after the start makes list say `log_unreadable` and refuses release and
undo.
- An undo whose journal entry could not be written still takes effect,
and the CLI prints the warning and exits 1.
- With the flag off, `recover` is not a command and the usage does not
offer it (scripts/plugin.ts reads the flag from the environment,
importing nothing, so the plugin still loads without packages).
- `server/conventions.test.ts` names the recovery socket in
`UNIX_CONNECT_ALLOWED` (it is this PC's own socket, not herdr's).

## Tests (each names its row)

`server/account/recovery.contract.test.ts` against a real server (R11
socket on with the flag, none with it off; P23 list answers and nothing
releases while the log is unreadable); `recovery.test.ts` (owner check,
release/undo), `recovery-acts.test.ts`; `scripts/plugin-recover.test.ts`
(terminal-only release, undo, usage).

## New exports and their production callers

| Export | Production caller |
|---|---|
| `runRecover` (`scripts/plugin-recover.ts`) | `scripts/plugin.ts:1268`
|
| `askRecovery` (`server/account/recovery.ts`) |
`scripts/plugin.ts:1273` |
| `openRecoverySocket` (`server/account/recovery.ts`) |
`server/index.ts:518` |
| `RecoveryReleases` (`server/account/recovery.ts`) |
`server/index.ts:508` (constructed) |
| `recoveryActs` (`server/account/recovery-acts.ts`) |
`server/index.ts:518` |
| `releaseRefusal`, `ReleaseJournalError` (`server/account/recovery.ts`)
| `server/account/recovery-acts.ts:23`, `:38` |
| `RECOVER_DIR`, `RECOVER_SOCKET` (`server/account/recovery.ts`) |
inside the module (`:54`, `:58`, `:111`) |
| `RecoveryReleases.registerRecoverySource`, `releaseOf`, `watch`
(`server/account/recovery.ts`) | the release lookup stays exported: seam
for S2-27 (devices.json and account rows: D's S2-27 registers them; no
row waits for an account read on Track A's stack) (Track D wires
`CatchUpGate.released` and `AccountDeviceStore.release()` to it in its
restack onto a main with this PR) |

## Gates

Pre-read: security-triage YES. Reviews at this head: hub,
security-triage, `dori review`, gate reviewer.


---

# S2-16: ovis recover, admit / remove / lift / revoke-all
## What

Behind `OVIS_ACCOUNT_OPENS_ALL` (off by default), `ovis recover` at the
PC also admits a waiting device, removes a key, lifts a block and
revokes every device, as this PC's own user (device-row-states rows P22,
P23, P24, T37, T69, T70):

- **S2-00 contract change** (its own commits, a red test and the change,
each titled "S2-00 contract change"; SHAs filled in at the PR head): in
`shared/account-devices-api.ts` an `admit` act names the fingerprint the
terminal showed; `parseRecoveryAction` refuses an admit without one
matching `PAIR_FINGERPRINT_PATTERN`, and still refuses unknown fields.
- `server/account/recovery-acts.ts`: `RecoverySeams` and the acts
`admit`, `remove`, `lift`, `revoke_all`; `list` also names the devices
waiting for this PC's screen, with their fingerprints. While this PC's
log cannot be read, every act that writes refuses `log_unreadable`;
`list` still answers.
- `server/account/recovery-server.ts` (`openPcRecovery`, called from
`server/index.ts:539`): the socket and its seams, through this PC's
stores; the safety log is read on every request (`!devices.failsClosed
&& SafetyLog.open(stateDir).readable`), and every writing act is refused
while it cannot be read. `admit` goes through the waiting device's own
pairing (`KeyProofPairings.approve(id, fingerprint, "recover")`), so its
session is let in too; the fingerprint must be that waiting key's. A key
a standing block or freeze targets is refused before the waiting entry
is taken: the answer names it and `ovis recover --lift <id>`, and the
entry stays for a later admit (a lift admits nobody by itself). A lock
or an unreadable log admits nobody. `remove` and `revoke_all` use Track
A's `removeKey` / `revokeAll` with this PC's OS user; `lift` appends the
PC's lift with its cause `recover` (Track A's `appendLift(blockId,
binding, { cause })`) and journals it (kind `lift`, how `recover`, by
the OS user).
- `scripts/plugin-recover.ts`: `ovis recover --admit <waiting id>` shows
the device's name and fingerprint, and sends the admit only on a
terminal's yes.

## Tests (each names its row)

Against a real server's recovery socket
(`server/account/recovery.contract.test.ts`): the right fingerprint
admits once with origin recover; a wrong one, a second admit, and an
admit while locked are refused, and the waiting entry is gone; remove
ends the row; a lift of an unknown block is refused; revoke-all ends
every row; lift, remove and revoke-all are journalled with recover and
this PC's user; every writing act refuses while the log is unreadable.
Unit tests in `recovery-acts.test.ts`, CLI tests in
`scripts/plugin-recover.test.ts`.

## New exports and their production callers

| Export | Production caller |
|---|---|
| `RecoverySeams` (`server/account/recovery-acts.ts`) |
`server/account/recovery-server.ts` (the seams object built in
`openPcRecovery`) |
| `recoveryActs` (now with `seams`) |
`server/account/recovery-server.ts:62` |
| `openPcRecovery` (`server/account/recovery-server.ts`) |
`server/index.ts:539` |
| `parseRecoveryAction` (admit now requires a fingerprint,
`shared/account-devices-api.ts:193`) |
`server/account/recovery-acts.ts:31` |
| `PAIR_FINGERPRINT_PATTERN` (from S2-13, `shared/pair-fingerprint.ts`)
| `shared/account-devices-api.ts:206` |

Track A seams this PR wires: `appendLift` (`server/index.ts:535`),
`removeKey` (`:532`), `revokeAll(user)` (`:539`);
`KeyProofPairings.approve(..., "recover")` from S2-13
(`server/index.ts`, `admitPending`).

## Gates

Pre-read: security-triage YES. Reviews at this head: hub (reads the
contract commit), security-triage, `dori review`, gate reviewer.


## Postponed (ledger, after the switch-on)
- R3-A1: `ovis recover --admit` should pass an age freeze for that key
alone, through the same freeze-pass rule as a screen confirm (P23);
today it is refused until the lift, which fails closed. A block that
names the key stays refused.
- B7/B8 (history): remove and revoke-all journal first (Track A's
journal-first change); a recovery admit journals how `recover` and the
OS user (Track A's `admitConfirmed({ source: "recover", by })`).


---

# S2-18: strict mode and the PC lock
## What

Behind `OVIS_ACCOUNT_OPENS_ALL` (off by default), a locked PC, or one
whose safety log cannot be read (strict), lets in nothing but what is
proved at the PC itself (device-row-states rows P11, S19, N4):

- `server/lock-boundary.ts` (new): one guard after access in the
dispatcher. While locked or strict, the access token, Portal, the
tailscale-serve owner identity, open LAN and an unproved loopback are
refused; only PC-local paths (the screen, `ovis recover`, SSH as this
user) remain. The guard never reads the lock record's account: a lock
stays until an unlock names its id, whatever the binding does later.
- `server/account/lock-routes.ts` (new): `GET /api/account/lock`
`{bound, locked, strict, confirm: available|unsupported, preview?}` (the
preview only while unlocked and bound); `POST /api/account/lock` and
`/unlock {lock}` answer `202 {confirm}` and put the act on this PC's
screen, and only the screen's approval writes the record; `409 not_bound
| already_locked | not_locked | no_screen_proof` (no screen proof on
macOS and Windows this release); through the relay or from a paired
device, `403 local_required`; a watching device, `403 read_only`. A
local window may read the lock and ask to unlock; it never counts as
screen proof (N4).
- The lock takes effect in the turn the screen approves it: rows not
approved at this PC's screen end through the store (`endUnlockedRows`),
and every connection and machine-event stream let in on another grant
(the access token, a loopback window, Portal, a Tailscale login, the
open LAN) ends too (`LockSignal`, `server/lock-boundary.ts`;
`SocketData.untilLock`). This PC's own programs keep working.
- Strict is every source the device store fails closed on
(`devices.failsClosed`: the safety log, the admission order, removal
evidence, the journal), at dispatch and in the lock status.
- A removal the lock journalled is finished from the journal at start,
and refused at sign-in until it is (Track A's S2-17 finisher).
- A connection or stream admitted before a lock's approval and opened
after it ends as it opens (`untilLockFrom`, which takes the lock count
at admission).
- An approved unlock names the lock's own account, so it ends that lock
whatever the binding did since.
- On a PC with an access token, the owner's own window (loopback, not
forwarded, with the token) may still read the lock and ask for an
unlock; nothing else.
- While this run holds a lock's removals it could not write (Track A's
`pendingLockRemovals()`), an unlock is refused `409
lock_removals_pending` before the screen is asked, and an earlier prompt
approved meanwhile writes nothing. Screen wording: "Repair this PC's
state folder first: the devices this lock signs out are not written
yet."
- Uses Track A's `appendLock` / `appendUnlock` / `endUnlockedRows` /
`originOf`.

With the flag off nothing changes.

## Tests (each names its row)

`server/account/lock.contract.test.ts` (strict counts as locked for
every non-row grant; the lock survives its binding being cleared or
moved; N4) and `server/lock-boundary.test.ts`.

## New exports and their production callers

| Export | Production caller |
|---|---|
| `lockBoundary` (`server/lock-boundary.ts`) | `server/dispatch.ts:259`
|
| `lockRoutes` (`server/account/lock-routes.ts`) |
`server/dispatch.ts:595` through `services.lockRoutes` (constructed in
`server/index.ts`) |
| `unauthorizedJson` (`server/auth.ts`, already exported; its argument
and answers change) | `server/dispatch.ts` (three call sites) |
| `untilLockFrom` (`server/lock-boundary.ts`) | `server/dispatch.ts:274`
|
| `LockStore.removalsPending` (`server/account/lock-routes.ts`) |
`server/index.ts:538` |
| `LockSignal` (`server/lock-boundary.ts`) | `server/index.ts`
(constructed, fired by the lock store's `lock`), `server/dispatch.ts`
(`untilLock` for sockets and streams), `server/core/connections.ts`
(`admit`) |

Track A seams this PR wires: `appendLock`, `appendUnlock`,
`endUnlockedRows` (`server/index.ts:509`, `:510`), `originOf`
(`server/dispatch.ts:260`, `server/lock-boundary.ts:27`).

## Gates

Reviews at this head: hub, security-triage, `dori review`, gate
reviewer.


## Ledger (after the switch-on)
- H1 (history): a lock or unlock is reported applied although its folder
could not be synced; failing test on `ledger/s2-18-r2` @ `c61c2583`
(`server/account/lock-sync.ledger.test.ts`).



## Notes
- On a Linux PC with `OVIS_ACCOUNT_OPENS_ALL` on, an old app without
`key-proof-1` is answered `unsupported_version` for relay pairing
(S2-13's key proof, under this PR): it must update before it can pair.
Flag off: pairing as on main.
- While locked or strict, no browser window drives this PC in this
release, its own included (N4 as decided): only the lock read and the
unlock request reach it, and the desktop owner channel, the confirm page
and `ovis recover` work. That is by design (`lockBoundary(...,
localProof: false)`), not a gap.

## Validation
`bun run typecheck` clean; `bun test server/account/ shared/
server/lock-boundary.test.ts server/access.test.ts
server/dispatch.test.ts scripts/plugin-recover.test.ts
scripts/plugin.test.ts scripts/conventions.test.ts
server/conventions.test.ts`: 1870 pass, 0 fail
(TMPDIR=$HOME/.cache/ovis-tmp/s2-track-b, HERDR_TEST_MODE=unit). Full
`bun run check fast` runs in CI.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
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