Skip to content

P5 O10 M2: the endpoint module — state, enrollment, the org state - #225

Merged
SSFSKIM merged 12 commits into
masterfrom
p5-o10-m2
Oct 27, 2026
Merged

SSFSKIM merged 12 commits into
masterfrom
p5-o10-m2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 27, 2026

Copy link
Copy Markdown
Owner

P5 O10 M2: the endpoint module, src/endpoint/. It has its entry (createEndpoint(), O2's EndpointModule shape), a private state directory (atomic writes; mode, owner and symlink checks; the machine key and grant ledger together or neither), attended enrollment (smns-enroll-v2.) and delegated enrollment (enrollDelegated) against the Registry. It also has the org-state sync: successors, transitions and recovery rewinds verified against the pins, a durable high-water mark, the catch-up window kept in org.json, and the 30-day backstop. And the policy, the CLI (enroll, keys, status, revoke, grant, policy) and a redacted status(). Everything runs against fake services and desk-hub's local runner; mawsd binds it in M10.

Spec: docs/doperpowers/plans/2026-10-27-p5-o10-endpoint.md, M2 (Progress ticked; the Decision Log records M2 as built and the review's consequences).

Validation Evidence

  • The class 1a gate is GREEN on 210dc90 (scripts/ci-gate.sh <wt> --gates static,unit,probes --class1a pool, run 40505278235); the head adds one docs-only commit (the Progress tick). Earlier runs were green too: e053d2b (run 40498759192) and ae1b173 (run 40502906559).
  • test/endpoint/enroll.test.ts spawns desk-hub's local runner (apps/desk-hub/local/run.ts, wrangler dev, local only) in the unit job's node-timing project. It passed on the Linux pool runner: 5 tests in 3.8 s in run 40498759192.
  • Focused suites, one file at a time: org-sync 15, cli 12, state 8, status 3, hub-http 4, enroll 6, src/shared/host/private-path.test.ts 10, org-protocol 140 (advance-head and pinned-chain included); pnpm typecheck and eslint are clean.
  • doperpowers:reviewer-high:
    • Round 1 (verdict incorrect) found 8 Important and 1 Minor:
      • an old recovery transition could replay forward after a rewind;
      • an org label supplied by the hub reset the high-water mark;
      • a revocation dropped a grant's version high-water;
      • grant intake was not serialized;
      • revoked grants were not reconciled at load;
      • a rewind whose base had aged out of the window was unrecoverable;
      • the window and the head were not committed as one generation;
      • hub requests had no deadlines;
      • --wait was not validated.
    • All were fixed (ae1b173). The re-review found that the first aged-out-base fix admitted an attacker-chosen root, so it was reworked (d57e42e): the base must hash to the state this machine adopted at that version.
    • Round 3 (fresh reviewer): correct, no findings.

For the architect

  • Root package: new workspace devDependencies org-protocol and desk-hub (workspace:*), with the matching pnpm-lock.yaml change. electron-vite bundles them; electron-builder never packs them.
  • apps/org-protocol: two changes.
    • verifyPinnedChain anchors a machine's first sync to its enrollment's pins: the chain verifies from its genesis, so acceptedTransitions is complete.
    • advanceHead takes an optional accepted set and holds forward transitions to verifyRewind's replay barrier.
    • Both have unit tests (advance-head.test.ts, pinned-chain.test.ts) and no vectors.
  • A recovery rewind reaches the endpoint only by delivery: mawsd endpoint revoke, or M7's endpoint.state from an admin's channel. It never comes from the hub. A forged head is ahead of anything the hub can page from: the hub accepts transitions only from its own head and serves ?since= after the asker's version, and the handshake's pages start above the receiver's head too. This is recorded in the spec's Decision Log.
  • src/shared/host/private-path.ts is master's (O2's P5 seam: src/shared/host/private-path.ts (O2 and O10) #224), taken as is; M2's own copy was dropped. M2's own socket and state entries keep their own checks (src/endpoint/state/files.ts), and they converge with O2's src/shared/host/private-listen.ts when O2 lands it.

Outside src/endpoint/ and test/endpoint/

  • apps/org-protocol/src/{org-view,org-state}.ts and two tests (above).
  • package.json and pnpm-lock.yaml (above).
  • tsconfig.node.json: the module is typed in the node project beside M9's org-protocol path. desk-hub's protocol and the local-hub harness's deploy and fake-machine files are listed file by file, since the project is composite.
  • eslint.config.js: the module's lint boundary. Nothing outside src/endpoint/ imports src/endpoint/** except index.ts, and there is a block for test/ and e2e/.
  • vitest.config.ts: the Node project takes src/endpoint/** and test/endpoint/**, with enroll.test.ts in node-timing.
  • apps/desk-hub/deploy/proof.ts: an explicit AbortSignal annotation (TS4029 under the composite project). Behaviour is unchanged.
  • The spec's living sections.

Residue

none

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…ts enrollment's pins (P5 O10 M2)

The org's chain from its genesis, verified as one run (verifyGenesis, then advanceHead) and anchored to the pins the
enrollment code named: the genesis names the pinned recovery key, and some state of the run carries a valid signature by
a pinned root key, so a hub can't hand a new machine an org it made up around the owner's public keys. Answers every
transition that authorized a state of the run, verifyRewind's accepted set from the first sync on.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… M2)

src/endpoint/ with its entry (createEndpoint, enrollDelegated) against EndpointServices, O2's DaemonServices field for
field. Its state directory (Interfaces §E) is checked private at start and written atomically; the machine key and the
grant ledger are present together or moved aside. Attended enrollment (the v2 code as the CLI's secret, the pairing MAC,
busy and Access's 401 retried within their budgets, --replace keeping the ref and the grants in force) and delegated
enrollment (the machine's own certificate under its delegation). The org state: the first sync anchored to the pins,
successors adopted serially and only once on disk, forks and rollbacks refused, root transitions and a recovery's rewind,
the 30-day chain window and backstop. The policy, the grant ledger's intake, status() with nothing a remote caller
mustn't read, and mawsd endpoint's enroll, keys, status, revoke, grant, policy and legacy retire.

src/shared/host/private-path.ts to O2's interface (O2 imports it or merges with it). The module's lint boundary, its
typecheck config (tsconfig.endpoint.json) and the root's workspace links to org-protocol and desk-hub.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…suites that drive a child process (P5 O10 M2)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…config.endpoint.json retired (P5 O10 M2)

M9 gave tsconfig.node.json the package's sources, its Node WebCrypto type names and rewriteRelativeImportExtensions,
so the endpoint and its suites are typed there too: the node project lists src/endpoint, desk-hub's protocol module and
the deploy and fake-machine files the local-hub harness imports. proof.ts's Cleanup.signal names its type, which the
composite project's declaration check needs (TS4029).

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ery (M2 fold)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…mit, grant high-water and serialized intake, request deadlines (P5 O10 M2)

advanceHead takes the verifier's accepted transitions and holds forward adoption to
verifyRewind's issued rule, so a rewind can't hand an older transition's root back.
The chain window moves into org.json, one commit with its head. A recovery whose
base aged out of the window takes the delivered base its first state's prev names.
A re-enrollment under the same pins refuses another org from the hub. grants.json
keeps each member's highest version; intake and enrollment's writes run in the org
view's queue; start re-reads the ledger against the head on disk. Every hub request
has a deadline over headers and body; --wait is checked before any side effect.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…grant high-water, forward replay barrier, deadlines)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…rsion (P5 O10 M2 review)

A root transition binds no base, so the first state's prev authenticated nothing:
a delivered base under another recovery key let its own root sign the successor.
org.json now keeps the hash of every adopted state by version, committed with the
head, and a base from a delivery is taken only when it hashes to the recorded one.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… taken as master has them, M2's copy dropped

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… its version (M2 review fold)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit 8534b83 into master Oct 27, 2026
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
…dopted hashes, recovery by delivery only, grants' high-water, org.json's committed hashes

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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