Skip to content

P5 O11 M3: the Registry's org-state chain, members and devices - #203

Merged
SSFSKIM merged 12 commits into
masterfrom
p5-o11-m3
Oct 27, 2026
Merged

SSFSKIM merged 12 commits into
masterfrom
p5-o11-m3

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 27, 2026

Copy link
Copy Markdown
Owner

P5 O11 M3: the Registry's org-state chain, members and devices (docs/doperpowers/plans/2026-10-27-p5-o11-hub-v2.md, M3).

What this lands

  • The chain. src/objects/org-chain.ts stores RL5's signed chain, root transitions and certificates over the Registry's storage, verified with apps/org-protocol.
    • Genesis is accepted once, and only from ORG_ADMIN_EMAIL, keeping the bootstrap member id.
    • Successors are accepted only on the head: 409 not-head or 409 rollback, and nothing is stored on a refusal.
    • Routes: GET/POST /api/org/state, POST /api/org/transitions, and GET /machine/org/state for machines, which pages ?since=.
  • Projections. members and devices are rebuilt from each accepted state in the same transaction, and today's bootstrap admission is kept until a state exists.
    • A removed member's Project and Registry sockets close 4403 removed, hibernated ones included, and a late upgrade is refused.
    • stateAdvanced announcements are stored with the state and re-sent by alarm until each Project answers.
    • Every Registry mutation re-reads the member and role after its last wait.
  • The pairing exchange. POST/GET /api/devices/pending: entries expire after 10 minutes, are capped at 8 per member, and the hub never checks their MAC.
  • deployment access-sync. It reconciles staging's people policy to the head's emails, and owns the policy's include list from now on. The deploy tool only creates the policy, with the owner alone, and never rewrites it.
    • It reads the head through /machine/org/state with an enrolled machine's service token, so a sole member's email change can't lock everyone out.
    • It verifies the chain against the deployment's pinned orgGenesis.
    • It keeps a checkpoint in ~/.local/state/desk-hub/<worker>.json, written before the first Access call, which every run must extend.
    • It holds a run lock that is never taken over.
    • It checks the host–Worker pair before any Access call.
  • Compatibility. pushSubscriptions keeps its pre-M3 contract, beside a new memberPushSubscriptions with a fallback. M3's new RPCs answer 503 hub-updating against an older Registry.
  • The O11 document. M3 is ticked, with its decisions and the live run's discoveries.

Validation Evidence

  • Tests: desk-hub 757/757 (57 files). The desk-hub, org-protocol and desk-web typechecks are clean, and eslint is clean on the touched files. Each finding was fixed test-first (/tmp/dsk-scripts/p5-o11/task-3-report.md).
  • Review: doperpowers:reviewer-high and reviewer-medium, four fix waves. The last re-review came back correct on 298d52a..f97b48d.
  • Live on desk-hub-staging (acceptance 2's chain, member and device parts), deployed at e3694c0ba:
    • genesis keeping the bootstrap member id;
    • 409 not-head (a real race) and 409 rollback;
    • [email protected] added, re-roled and removed by signed successors;
    • a second device refused without an endorsement (endorsement-missing) and with only its member's signatures (not-root-signed), then accepted with an endorsement plus the admin's signature;
    • access-sync read back from the Access API listing exactly the head's emails at each step, and staging's policy ends as found, with the owner alone;
    • zero overlap simulated live: the policy was set to an address no head lists, and access-sync restored the owner from the head with no member identity.
  • Where the live proof stops: the sole member's real email change is proved offline, in apps/desk-hub/test/org-access-sync.test.ts › "brings the policy to the head after the only member's email changes, though no email overlaps, and checkpoints it".
  • Production unchanged: X-Desk-Build: hub@3486527c before and after, and production's Access apps, policies and names file are identical before and after.
  • CI: ci-gate GREEN on f5195d228 (static, unit, probes, e2e:desk-web): https://github.com/SSFSKIM/MAWS/actions/runs/40446910404

For O8

  • No hub route carries a non-admin member's endorsed new device to an admin for countersigning. It can't arise in a one-person org, and it's O8's call.

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

The Registry keeps RL5's signed chain (OrgChain, src/objects/org-chain.ts, in
its own storage): a genesis accepted once, from ORG_ADMIN_EMAIL's identity and
keeping the bootstrap member's id (409 genesis-member otherwise); successors
only on the head, verified by the protocol package against the stored head and
the root transitions held, refused 409 <verdict code> and kept nowhere, a race
loser refused not-head. After each accepted state, in the same transaction,
members (Access admission, with the role), devices (member, class, a kept
Access client id) and machines by ref are rebuilt from the head. A member the
state drops is refused at once; their grid sockets and, through
Project.stateAdvanced (retried as retry.ts says, a project on older code taken
as told), their project sockets close 4403 removed.

Routes: GET/POST /api/org/state (?since=<v> pages the chain), POST
/api/org/transitions, GET /machine/org/state for endpoints, and the device
pairing exchange at /api/devices/pending (entries expire after ten minutes,
dropped when a successor lists the device). Registry.head() serves M5.

The deploy tool gains access-sync, which makes the people policy exactly the
head's member emails (the owner alone before a state) and reads it back; a
deploy creates that policy when absent and never rewrites its list.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…into p5-o11-m3

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…s late socket

M1's waves 4 and 5 merged: the suites' states carry RL5's `revoked`, a device
leaving with its member has its keys revoked in that step, and Certificates
is {certs, retirements}.

Project.stateAdvanced now carries the head's member ids, keeps the newest
version announced, closes every socket of a member it does not hold (4403
removed; hibernated sockets too, by their attachments) and refuses at accept
an upgrade the Worker admitted before the removal (403 removed). The
Registry's grid refuses one the same way, from its members table.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…e closed) and the countersign gap

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…cements, access-sync as a machine

- Every Registry method that changes something for a member (and their own
  lists) reads the member again in the synchronous step of the change, after
  its last await: a successor accepted after the Worker resolved them refuses
  a removed member 403 not-a-member and a demoted admin 403 not-admin. A state
  or transition is committed only while its poster is still a member.
- State announcements are stored in the step that accepts the state, one per
  project (a newer replacing an older), and deleted only when the project
  answers; the alarm sends again what failed, so a Registry reset loses none.
- access-sync reads the org state through /machine/org/state with an enrolled
  machine's service token, so an email change of the only member cannot leave
  no one able to read the head; the chain is read from its genesis and verified
  with the package. It checks the host-Worker pair before any Access call.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…contract

- access-sync trusts the hub's chain only as far as two anchors the operator
  holds: the org's genesis hash pinned in the deployment's config
  (`orgGenesis`), and a checkpoint of the last head it accepted, kept per
  Worker in ~/.local/state/desk-hub (DESK_HUB_STATE_DIR moves it), which each
  run's chain must extend. A made-up chain under the org id, an older prefix
  served as the head, and "no state" once the org is set up write nothing.
- Registry.pushSubscriptions keeps its pre-M3 result; the checked list is a
  new memberPushSubscriptions, which the Worker calls with a fallback to the
  old one for a Registry on older code. Any other method an older object lacks
  answers 503 hub-updating instead of 500.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…run lock (O11 M3 review fixes 3)

The checkpoint, the oldest head a later run accepts, is now written as soon as
the chain verifies and before the first Access call; a run that cannot write
it touches no Access. An Access write whose answer or read-back is lost can no
longer leave the checkpoint behind a list Access already holds.

The whole read, verify, checkpoint and update sequence holds a lock file
beside the checkpoint (deploy/run-lock.ts): a whole copy hard-linked into
place, naming its pid and host. A second run, in this process or another, is
refused before it reads anything; a lock whose process is gone from this host
is taken over. Under the lock the checkpoint is read again before it is
written, so a lock removed by hand under a slow run still cannot regress it.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…ixes 4)

Two processes that each judged the same lock stale could each remove it, the
second removing the first's fresh lock, and both runs entered; no reread makes
the removal conditional. Any lock already there now refuses the run before it
reads anything, naming the file and its recorded pid, host and start time; the
operator removes a dead run's lock after checking nothing runs. The checkpoint
still moves before Access, and is still reread under the lock before it does.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…re-applied on the landed document

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
staging-ssfskim's genesis, posted by the live run's test admin device, hashes to
IYk7xTsTWsrPWYrfBSH6s5A5Fh4t11NtcuMnmrKreLc, the hash that device holds; access-sync
on staging verifies the chain the hub serves from it.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…evice parts live on staging)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T04:07:09.230230Z — PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit 5082abf into master Oct 27, 2026
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
…rsign route is O8's to settle)

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