Skip to content

feat(app): sign in to the account's PCs with a key of this sign-in's own (S2-30, behind OVIS_ACCOUNT_OPENS_ALL) - #4294

Closed
devswha wants to merge 32 commits into
mainfrom
feat/s2-30-app-account-open
Closed

devswha wants to merge 32 commits into
mainfrom
feat/s2-30-app-account-open

Conversation

@devswha

@devswha devswha commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

S2-30: the app signs in to open the account's PCs (behind OVIS_ACCOUNT_OPENS_ALL)

Track E, plan row S2-30. Device table rows: P1, P2, P18, G5, R7, T34, T40, T59, section 5b. Builds on S2-00 (#4278) and on Track D's S2-25 relay refusal codes.

What changes

  • Each sign-in makes a key of its own (apart from the account key), proves it to the account service once (POST /v1/devices/challenge, POST /v1/devices, S2-19) and keeps its number in the account's order (src/lib/account/signInKey.ts, AccountService.registerDeviceKey). A key registers once per account, so a new sign-in always makes a new key (security-triage, S2-19 verdict).

  • A PC offers the account path only when its trusted WS features list account-opens-all/1 (HerdrSocket.accountOpensAll).

  • The relay HELLO offers the mux feature account-opens-all-1 only when the app signs in with its sign-in key (RelayChannelOptions.accountOpensAll); a PC with the release on may then refuse with held (and its HoldState), not_listed or admission instead of a bare auth failure. openRefusalOf / nextOpenStep decide: held waits on the PC's own hold, not_listed retries once then offers QR or digits, admission offers QR or digits at once; anything else keeps today's handling.

  • accountDevice / withAccountDevice sign in to a PC as this sign-in key's account row (accountDeviceId(server_id, key)), pinned to the PC's own key; the row's key never moves (T40).

Draft status

Draft by the relay hub's order: it turns ready only after Track D's S2-29 merges and this branch is rebased onto main. It carries a local copy of D's ACCOUNT_OPENS_ALL_MUX_FEATURE constant, dropped on that rebase (D renames it ACCOUNT_OPENS_ALL_FEATURE in shared/relay-mux.ts).

Wire

  • Client HELLO gains account-opens-all-1 only with accountOpensAll: true; an older PC selects nothing new and answers as today.
  • No new HTTP route on the PC. Account service routes are S2-19's.

New exports and their production callers

Export Caller (file:line)
accountDevice src/lib/relay/shell.tsx:407
ACCOUNT_OPENS_ALL_MUX_FEATURE shared/relay-channel.ts:142, shared/relay-channel.ts:208
AccountOpenUnsupportedError shared/relay-channel.ts:23, shared/relay-channel.ts:267
AccountRowImmutableError src/lib/account/accountDevice.ts:21, src/lib/account/accountDevice.ts:38
isFatalRelayError src/lib/relay/transport.ts:291, src/lib/relay/transport.ts:355
myPcs src/components/AccountSection.tsx:795, src/components/RelayAccountPcs.tsx:24
newKey src/lib/account/signInKey.ts:18, src/lib/account/store.ts:134
nextOpenStep src/lib/relay/shell.tsx:298
openRefusalOf src/lib/relay/shell.tsx:296, src/lib/relay/transport.ts:60
registerSigningBytes shared/account-records.ts:173, src/lib/account/service.ts:383
signInKey src/lib/account/store.ts:77, src/lib/relay/accountController.ts:327
withAccountDevice src/lib/relay/shell.tsx:407

Flag off

Nothing is offered or sent: the service answers 404 (registration returns null), PCs list no capability, and HELLO is unchanged.

Tests (written first, each red before its code)

  • caaf00e test(app): register this sign-in's own key, keep QR or digits when the service has no release (T34, G5, T40, P18)
  • db09308 feat(app): register this sign-in's own key with the account service, null when it has no release (T34, G5, T40, P18)
  • 39717c3 test(app): only a PC that lists account-opens-all/1 offers it (G5)
  • ddb2b8f feat(app): read account-opens-all/1 from a PC's trusted features (G5)
  • 87b78a0 test(app): a held account sign-in waits, an unlisted one retries once then offers QR or digits (T34, G5)
  • 5b7b482 feat(app): decide the next step when a PC refuses the account sign-in (T34, G5)
  • 0ed6f9b test(app): each sign-in registers a key of its own once and keeps its number (T34, P18, P21, G5)
  • 1a39d8f feat(app): each sign-in registers a key of its own and keeps its number (T34, P18, P21, G5)
  • a89d360 test(app): read held, not_listed and admission from the PC's refusal, anything else keeps today's handling (T34, G5)
  • eddcf3f feat(app): read the PC's account refusal from the relay sign-in error (T34, G5)
  • a0cf7b8 test(app): offer the account-opens-all mux feature in the relay HELLO only when asked (T34, G5)
  • 19f2861 feat(app): offer the account-opens-all mux feature in HELLO when signing in with the sign-in key (T34, G5)
  • 811de61 test(app): sign in to a PC as this sign-in key's account row, whose key never moves (T34, T40)
  • 60b6612 feat(app): sign in to a PC as this sign-in key's account row and never move its key (T34, T40)

Validation

bun run check fast on the stack top feat/s2-36 at 43234892 (contains S2-30..S2-36), on main 0839031, via dori heavy: workflow syntax, generated types/themes fresh, typecheck, build, unit tests (145 s), actionlint all ok. Per-branch: each tip's own tests + i18n + conventions + typecheck. Electron suite (S2-35) 131/131.

…e service has no release (T34, G5, T40, P18)
…null when it has no release (T34, G5, T40, P18)
… anything else keeps today's handling (T34, G5)
@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 and others added 15 commits November 20, 2026 10:32
…hrough a lost answer or two calls at once (P18, T34)
@devswha

devswha commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #4311 (Track E's cleared set collapsed into one PR on the relay hub's speed-up rule).

@devswha devswha closed this Nov 20, 2026
devswha added a commit that referenced this pull request Nov 20, 2026
…LL (S2-30..S2-34, S2-37 line) (#4311)

## Track E step 2: the app's account screens (S2-30, S2-31, S2-32, S2-33
minimal, S2-34, one S2-37 line), behind OVIS_ACCOUNT_OPENS_ALL

One PR for Track E's cleared set (relay-hub speed-up rule). Based on
Track D's #4324 head (`feat/s2-26-account-row-rights` 56b1e12, on main
a79d6ca with Tracks A and B merged); it merges right after #4324 and is
retargeted to main then. Supersedes #4294 (S2-30) and #4296 (S2-31).
Cleared by range-diff against the cleared heads (hub + security-triage,
latest: 150/150 '=' at e5ccb30).

### Flag off
With OVIS_ACCOUNT_OPENS_ALL off, a PC lists no account-opens-all/1 and
the app shows and sends nothing new; the PC's roster refuses the
account-records forward exactly as main does (403 forbidden, a5090b6 /
4f7bc54).

### Pieces and receipts
| Piece | Device table rows | Cleared head | Receipts | Ledger |
|---|---|---|---|---|
| S2-30 account open from the sign-in key | T34, T40, P7, P18, G5 |
e472ee0 (+ wire tests b0b57ca) | gate r1-r3, r3 CLEAR; t13r YES |
none |
| S2-31 device notices of the selected PC | P10, P15, T34, T57, T58 |
b441382 | gate r1-r3 CLEAR on 5fc3526; close-X and two-step label
deltas: hub read + t13r YES; lead OK on '2단계 인증 확인 안 됨' | none |
| S2-32 Not me with per-PC receipts | T51, T60, T65 | 4f7bc54 |
pre-review r1-r3; hub cleared 4f7bc54; t13r YES (d8b558a) |
postponed: already_applied wording, Not me after a refused refresh |
| S2-33 the new device's wait card (minimal) | T53, T57, T67, P17 |
f0b174b | hub r2: own commits clear; t13r YES (range-diff) | none |
| S2-34 pairing fingerprint on both surfaces | T71, T72, P11 | aa61b12
| hub cleared at r2; t13r YES (range-diff) | postponed: device wait up
to 5 s past PENDING_MS |
| S2-37 one line: relay-only PC limit on setup | T70 | 888aa72 | hub
cleared r3; t13r YES (range-diff) | none |

Postponed until after switch-on (final scope): It's me, S2-35, S2-36,
the rest of S2-37. Track B's S2-13 commits sit under S2-34 as
cherry-picks (pairing fingerprint, key proof, pending keys, b8edf9e);
they drop out when #4301 merges.

### Changed at the collapse (besides the rebase onto D)
- Conflicts resolved by keeping both sides: shared/relay-channel.ts (E's
negotiation guard + D's hold/receipts forwarding), shared/relay-mux.ts
(D's held/not_listed/admission + B's key_proof_required),
shared/relay-mux-engine.test.ts (both test blocks).
- e6dcb8d: the app offers Track D's ACCOUNT_OPENS_ALL_FEATURE; E's
copy of the constant is gone.
- ee7c9f4: S2-30's wire-byte tests folded in (they need D's decoder).
- One new pin for S2-33: a decoded held refusal reaches the shell's wait
card with its deadline, and with none while the notice is unpublished.

### Since the collapse (each red first; hub checked, security-triage
YES)
- CodeRabbit round: tab race on the sign-in key, lost registration
reply, holds without a deadline and clock skew, open admissions across a
reconnect, a late decline reply, pending keys on sign-out, and a failed
account-service post of Not me's block now kept with a one-tap retry of
the same signed ids (ledger S32-1 for durable retry). New sentence (lead
OK): 'The block did not go through yet.' / '차단이 아직 전달되지 않았어요.' + 'Try
again'.
- Docs: '### Limits of this release' in docs/account.md.
- Rebased onto Track D: B's S2-13 cherry-picks dropped (on main); the
roster block test now signs with members older than any join hold on a
PC that has caught up.

### End-to-end (loopback relay + fake account service, flag on; not
staging)
List admission with the app event socket staying open; the Google 'not
confirmed' notice; Not me through the owner-only roster forward; the
held wait card; fingerprint pairing + Decline; Revoke all: all PASS
(scripts/account-opens-all-e2e-qa.ts, local branch). Not run here: a
block queued before list admission, lift by an older two-step signer
(staging).

### Captures
http://100.106.153.26:18765/s2-screens/ (owner OK; lead OK on the one
new sentence).

### Exports (each new export with its production caller, tests excluded)

##### S2-30
## New exports and their production callers
| Export | Caller (file:line) |
|---|---|
| `accountDevice` | src/lib/relay/shell.tsx:407 |
| `ACCOUNT_OPENS_ALL_MUX_FEATURE` | shared/relay-channel.ts:142,
shared/relay-channel.ts:208 |
| `AccountOpenUnsupportedError` | shared/relay-channel.ts:23,
shared/relay-channel.ts:267 |
| `AccountRowImmutableError` | src/lib/account/accountDevice.ts:21,
src/lib/account/accountDevice.ts:38 |
| `isFatalRelayError` | src/lib/relay/transport.ts:291,
src/lib/relay/transport.ts:355 |
| `myPcs` | src/components/AccountSection.tsx:795,
src/components/RelayAccountPcs.tsx:24 |
| `newKey` | src/lib/account/signInKey.ts:18,
src/lib/account/store.ts:134 |
| `nextOpenStep` | src/lib/relay/shell.tsx:298 |
| `openRefusalOf` | src/lib/relay/shell.tsx:296,
src/lib/relay/transport.ts:60 |
| `registerSigningBytes` | shared/account-records.ts:173,
src/lib/account/service.ts:383 |
| `signInKey` | src/lib/account/store.ts:77,
src/lib/relay/accountController.ts:327 |
| `withAccountDevice` | src/lib/relay/shell.tsx:407 |

### Flag off
Nothing is offered or sent: the service answers 404 (registration
returns null), PCs list no capability, and HELLO is unchanged.

### Tests (written first, each red before its code)
- caaf00e test(app): register this sign-in's own key, keep QR or
digits when the service has no release (T34, G5, T40, P18)
- db09308 feat(app): register this sign-in's own key with the account
service, null when it has no release (T34, G5, T40, P18)
- 39717c3 test(app): only a PC that lists account-opens-all/1 offers
it (G5)
- ddb2b8f feat(app): read account-opens-all/1 from a PC's trusted
features (G5)
- 87b78a0 test(app): a held account sign-in waits, an unlisted one
retries once then offers QR or digits (T34, G5)
- 5b7b482 feat(app): decide the next step when a PC refuses the
account sign-in (T34, G5)
- 0ed6f9b test(app): each sign-in registers a key of its own once and
keeps its number (T34, P18, P21, G5)
- 1a39d8f feat(app): each sign-in registers a key of its own and keeps
its number (T34, P18, P21, G5)
- a89d360 test(app): read held, not_listed and admission from the PC's
refusal, anything else keeps today's handling (T34, G5)
- eddcf3f feat(app): read the PC's account refusal from the relay
sign-in error (T34, G5)
- a0cf7b8 test(app): offer the account-opens-all mux feature in the
relay HELLO only when asked (T34, G5)
- 19f2861 feat(app): offer the account-opens-all mux feature in HELLO
when signing in with the sign-in key (T34, G5)
- 811de61 test(app): sign in to a PC as this sign-in key's account
row, whose key never moves (T34, T40)
- 60b6612 feat(app): sign in to a PC as this sign-in key's account row
and never move its key (T34, T40)

### Validation
`bun run check fast` on the stack top feat/s2-36 at 43234892 (contains
S2-30..S2-36), on main 0839031, via dori heavy: workflow syntax,
generated types/themes fresh, typecheck, build, unit tests (145 s),
actionlint all ok. Per-branch: each tip's own tests + i18n + conventions
+ typecheck. Electron suite (S2-35) 131/131.

##### S2-31
## New exports and their production callers
| Export | Caller (file:line) |
|---|---|
| `DeviceNotices` | src/App.tsx:1137 |
| `keyFingerprint` | src/components/DevicePairedNotice.tsx:39 |
| `noticeSeen` | src/lib/useDeviceNotices.ts:47 |
| `TOLD_KINDS` | src/components/DevicePairedNotice.tsx:20 |
| `useDeviceNotices` | src/App.tsx:337 |
| `withNoticeAcked` | src/lib/useDeviceNotices.ts:52 |
| `withNoticeDecided` | src/lib/useDeviceNotices.ts:59 |
| `withNoticeReplay` | src/lib/useDeviceNotices.ts:38 |

### Flag off
Nothing new is shown or sent: the PC lists no account-opens-all/1, so
every new path stays closed.

### Tests (written first, each red before its code)
- c4ca972 test(app): device notices replay once, ack without deciding,
keep an open admission (T57, P15)
- 1b3a400 feat(app): keep each PC's device notices in journal order
until decided (T57, P15)
- 1341a2a test(app): each PC's notices show once, are acknowledged
once, and a dismiss decides nothing (T57, G5)
- b1b22d2 feat(app): show each PC's device notices and acknowledge
them on that PC (T57, G5)

### Captures
http://100.106.153.26:18765/s2-screens/ (owner OK required before merge)

### Validation
`bun run check fast` on the stack top feat/s2-36 at 43234892 (contains
S2-30..S2-36), on main 0839031, via dori heavy: workflow syntax,
generated types/themes fresh, typecheck, build, unit tests (145 s),
actionlint all ok. Per-branch: each tip's own tests + i18n + conventions
+ typecheck. Electron suite (S2-35) 131/131.

### Since the gate-CLEAR head 5fc3526 (hub + t13r YES on each delta)
- Owner's close X: e7f47e1 red, d82159a fix (an open admission
notice hides locally only; no onDismiss, no ack, no answer).
- Two-step label (owner's Google decision, lead OK on the wording):
e06d278, 182a66c, 8d567de reds; b441382 fix (a list admission
whose two_step is present and not set/verified shows '2단계 인증 확인 안 됨' /
'Two-step sign-in not confirmed' even without a method).

#### New exports and production callers (tests excluded)

| Export | Production caller |
|---|---|
| DeviceNotices | src/App.tsx:1137 |
| keyFingerprint | server/push.ts:440, server/push.ts:599,
server/push.ts:605 |
| noticeSeen | src/lib/useDeviceNotices.ts:47 |
| NoticeSocket | src/lib/useDeviceNotices.ts:20 |
| PcNotices | src/lib/deviceNotices.ts:27, src/lib/deviceNotices.ts:41,
src/lib/deviceNotices.ts:45 |
| TOLD_KINDS | src/components/DevicePairedNotice.tsx:21 |
| useDeviceNotices | src/App.tsx:337 |
| withNoticeAcked | src/lib/useDeviceNotices.ts:52 |
| withNoticeDecided | src/lib/useDeviceNotices.ts:59 |
| withNoticeReplay | src/lib/useDeviceNotices.ts:38 |

None is tests-only.

##### S2-32

| Export | Production caller |
|---|---|
| ACCOUNT_SIGN_OUT_EVENT | src/components/AccountDeviceNotices.tsx:133,
src/components/AccountDeviceNotices.tsx:137,
src/lib/account/service.ts:504 |
| answerOnPc | src/lib/account/noticeAnswer.ts:57 |
| AnswerSocket | src/lib/account/noticeAnswer.ts:16,
src/lib/account/noticeAnswer.ts:48 |
| BlockOutcomes | src/components/AccountDeviceNotices.tsx:104 |
| BlockSend | src/lib/account/fleet-block.ts:60,
src/lib/account/fleet-block.ts:62, src/lib/account/fleet-block.ts:67 |
| canBlockAdmission | src/components/AccountDeviceNotices.tsx:40,
src/lib/account/fleet-block.ts:22 |
| FleetBlock | src/components/AccountDeviceNotices.tsx:39,
src/lib/account/fleet-block.ts:35, src/lib/account/fleet-block.ts:65 |
| indexedAccountService | src/components/AccountDeviceNotices.tsx:47,
src/components/AccountDeviceNotices.tsx:89,
src/components/AccountSection.tsx:192 |
| notMeBlocks | src/components/AccountDeviceNotices.tsx:51 |
| NotMeButton | src/components/AccountDeviceNotices.tsx:105 |
| notMeTransports | src/components/AccountDeviceNotices.tsx:76 |
| OwnKey | src/components/AccountDeviceNotices.tsx:17,
src/lib/account/fleet-block.ts:12, src/lib/account/fleet-block.ts:21 |
| postSafetyRecord | src/components/AccountDeviceNotices.tsx:92 |
| recordsOnPc | src/lib/account/noticeAnswer.ts:64,
src/lib/account/noticeAnswer.ts:65 |
| sendBlocks | src/components/AccountDeviceNotices.tsx:90 |
| useAccountDeviceNotices | src/App.tsx:336 |
| withBlockReceipt | src/lib/account/fleet-block.ts:79 |

None is tests-only. Not me posts the signed block to the account service
(POST /v1/safety-records, ovis-sh/account #44) and to each roster PC;
the roster forward of POST account/records is owner-only
(server/machine-api.ts) and carries x-herdr-machine for the receiver's
origin check. A PC reads blocked only on its own channel's receipt.

##### S2-33

| Export | Production caller |
|---|---|
| holdWaitMs | src/components/JoinWait.tsx:34 |
| JoinWait | src/components/AddPcSheet.tsx:165,
src/components/RelayShellScreens.tsx:272 |

None is tests-only.

##### S2-34

| Export | Production caller |
|---|---|
| declinePendingKey | src/App.tsx:1137 |
| KeyFingerprintWait | src/components/AddPcSheet.tsx:167,
src/components/RelayShellScreens.tsx:267 |
| PendingKeys | src/App.tsx:1137 |
| useRosterEvents | src/App.tsx:319 |

None of Track E's is tests-only. Rows from Track B's S2-13 (#4301:
pairing fingerprint, key proof, pending-key routes, incl.
PAIR_FINGERPRINT_PATTERN which only B's test uses) sit under this branch
as cherry-picks and drop out when S2-13 merges and this branch rebases;
they are listed in #4301.

##### S2-37 line

| Export | Production caller |
|---|---|
| relayOnlyPc | src/components/RelayOnlyWarning.tsx:21,
src/components/SetupGuide.tsx:778, src/components/SetupGuide.tsx:1117 |
| RelayOnlyWarning | src/components/SetupGuide.tsx:75,
src/components/SetupGuide.tsx:841 |

None is tests-only.

---------

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