Skip to content

feat(account): ovis recover lists and releases waiting rows at the PC's terminal (S2-15) - #4304

Closed
devswha wants to merge 73 commits into
feat/s2-17-safe-start-mergefrom
feat/s2-15-recover-release
Closed

devswha wants to merge 73 commits into
feat/s2-17-safe-start-mergefrom
feat/s2-15-recover-release

Conversation

@devswha

@devswha devswha commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

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.

@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 added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
@devswha
devswha force-pushed the feat/s2-15-recover-release branch from 223f723 to c228e31 Compare November 20, 2026 06:03
@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: 2566725
Status: ✅  Deploy successful!
Preview URL: https://9cf67c89.ovis.pages.dev
Branch Preview URL: https://feat-s2-15-recover-release.ovis.pages.dev

View logs

…OVIS_ACCOUNT_OPENS_ALL

S2-11 (rows P5, P8, P13, P21, R1, R2, R6, T19/T20 in 2d, T36, T37, E12, E49).
With the flag on, a remote caller (any access but this PC itself) Revokes its
own row and rows whose key's every row joined this PC after it; an older or
unorderable row, duplicates included, is refused older_device with "removing
an older device is done from that PC or from an older device", and Revoke all
from afar is refused local_required. A signed remove of another key needs a
signer older here than every row of that key; a signed leave always commits.

Wire: GET /api/devices gives a remote caller remote_revoke per row (allowed,
older, unorderable) and revoke_all: local_only.
…at the PC only (T20, rule B)

POST /api/relay/reset-identity ends every relay row whatever its age, which is
a Revoke all; with OVIS_ACCOUNT_OPENS_ALL on only this PC itself may ask, and
any other caller is refused local_required.
…OVIS_ACCOUNT_OPENS_ALL

S2-17 (rows P7, P8, P12-P15, P22-P24, S13, T14, T28, T31, T41, T48, T61, T73,
T27 in 2d, E17, E21, E29, E37, E47). With the flag on, a sibling state folder
is merged before anything is served, each file by its own rule: the safety log
as a union by id, account-pc.json's clears as a union with a binding standing
only when no clear names it (two standing accounts fail closed), the removal
evidence as a union by (key, account) and by id, the enrollment barrier when
either folder has one, and the held keys as a union. A merge that cannot be
made fails the PC closed. A row only the sibling holds is not imported while
the merged log holds a lock, a block or a freeze in force, and stays in the
sibling's file; a row whose key differs between the copies is dropped. The end
of an enrollment is journalled before its barrier ends. The log answers
receipts(key) and blockIds() for the account read.
…is screen, and a row says its origin (P11, T46), red
…nds the rows it does not let in (P11, T46)

With the flag on: SafetyLog.appendLock(binding) and appendUnlock(lockId, binding)
write the lock and its ending themselves, signed pc under the PC's binding, and
refuse with no binding. DeviceStore.originOf(rowId) gives a row's origin;
endUnlockedRows() ends every row not confirmed on this PC's screen in one turn,
sessions closed first, journalled as drops for the lock. While a lock stands, a
row not confirmed on this screen is refused at sign-in whether or not its
teardown ran.
… (T70, T73, T69)

removeKey({target, by: 'local'}) removes a row by id, or a key with or without
a row here: its Revoke stands and is journalled (remove, how recover) before
the rows go, and the blocks that key signed are lifted by the PC. Refused while
this PC's account state is unreadable. SafetyLog.appendLift ends one block this
log holds and its freeze, under this PC's account; forget also ends its marker.
… its own confirm, the first list key only by a proved sign-in (P22, T7, T11, T72, T59), red
…irm (P22, T7, T11, T72, T59)

With the flag on, a link that moves the key of a row whose origin is pc changes
nothing at once: the new key waits in memory as the row's replacement, five
minutes at most, dropped by a decline, a newer link or a restart.
replaceConfirmed takes it only for that very key and when G3 admits it in the
turn; the row then holds the key and its account, with origin pc, how link and
a new number. A link that moves any other key takes a new number and never the
old one. provedListKey sets the first device's list key once, from a sign-in
that proved it.
…P24)

removeKey and revokeAll take the OS user the recovery socket ran them for, and
write it on their journal lines, how recover.
…t the app opting in is refused and changes nothing (T7), red
…pproved key (T7)

linkAccountKey takes replacement; without it, a link that would replace the key
of a row whose origin is pc throws ReplacementNeedsAppError and changes nothing,
so an app that cannot show the fingerprint it computes never asks for a blind
confirm.
…of a row ends its whole release; usage names recover (security-triage pre-read)

Red before the fix.
…undoes, through the shared contract (T70, R11, P23)

Red: server/account/recovery-acts.ts does not exist yet.
…undoes, through the shared contract (T70, R11, P23)
… flag on, opens none with it off, and releases nothing while its log cannot be read (R11, T70, P23)

Red: the server does not open the recovery socket yet.
… flag on, journals each release and undo, and asks the log live (R11, T70, P23)
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
… when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
…d an undo changes nothing while it cannot be read (S19, P23)
@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Collapsed into #4312 (S2-15, S2-16 and S2-18 in one PR on top of S2-17, by the lead's rule). Receipts for this piece are carried in #4312's body.

@devswha devswha closed this Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
…s when a row was last seen, a failed undo journal is said, and with the flag off recover is no command (T70, E46)

Red: gate pre-review of #4304.
Co-authored-by: sisyphus-dev-ai <[email protected]>
devswha added a commit that referenced this pull request Nov 20, 2026
… each recovery act (S19, P23)

Red: gate pre-review A2 of #4304.
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