Skip to content

P5 O11 M5: the Project DO's v2 events - #205

Merged
SSFSKIM merged 8 commits into
masterfrom
p5-o11-m5
Oct 27, 2026
Merged

SSFSKIM merged 8 commits into
masterfrom
p5-o11-m5

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 27, 2026

Copy link
Copy Markdown
Owner

P5 O11 M5: the Project DO's v2 events (docs/doperpowers/plans/2026-10-27-p5-o11-hub-v2.md, M5).

What this lands

  • Three event codings in one store. The log store accepts v1 (mac), dual-coded (mac and sig) and v2-only (sig) events.
    • A v2 hub/<member> event carries its own 16-byte nonce for resend dedupe.
    • The hub still never checks or strips a v1 mac.
    • Duplicates and conflicts are decided on bytes, before verification, and the conflict rule compares the full canonical body, sig included.
  • Verified against the org-state head.
    • Every stored v2 event is verified with apps/org-protocol's verifyEvent against the head that the Project caches from Registry.head().
    • The cache is refreshed on every stateAdvanced announcement, on an unknown key id (at most once a second), and whenever it is older than 60 s.
    • An announced version newer than the cached one makes the cache unusable until the head is re-read.
    • Reads are bounded at 5 s.
    • A batch is judged against one head.
    • The upload re-checks its generation and a DX7 forget after the read.
  • Refusals.
    • A verification failure is refused bad-signature, with the package's code in the message.
    • A head that can't be read, or an unknown signer whose re-read can't complete, is refused state-unavailable.
    • A machine upload gets today's per-event refused frame.
  • Browser humans are queued per member. They are checked for membership when dequeued and again after their signature check, so a removal announced mid-check stores nothing.
  • Interaction with DX2 daemons. A v2-only event reaches DX2 daemons unchanged. sminos refuses it once as bad-code, reports it rejected and goes on; a test pins the hub's side.
  • The O11 document. M5 is ticked, and its decisions and discoveries are folded in.

Validation Evidence

  • Tests: on the branch with M4 merged, desk-hub passes 836/836 (62 files), desk-web 919/919 (97 files) and org-protocol 25/25. Typechecks are clean, and eslint is clean on the touched files.
    • Fixes were test-first; the evidence is in the executor's report.
    • A new pin: a v2-only event signed by the listed machine is stored and pushed as OwnerNotice to the listed owner's device alone.
  • Review: doperpowers:reviewer-medium reviewed M5 over two fix waves.
    • The first review found five P2s and the dispatching session added two items.
    • The re-review found one P2: an unknown signer's failed re-read was answered bad-signature rather than state-unavailable.
    • The second re-review came back correct on 25981bc..90c2d36.
    • M3 and M4 were merged in afterwards, with additive conflicts in test support only.
  • Staging: acceptance 4 is proved in the suites. Its staging run is part of M8's acceptance run.
  • CI: ci-gate GREEN on eb261f28a (static, unit, probes, e2e:desk-web): https://github.com/SSFSKIM/MAWS/actions/runs/40449106023. An earlier run on e01e438c8 (the same code before master's docs commits) failed one desk-web layout test, e2e/stream-scroll.spec.ts:231 on chromium only ("Jump to latest" still shown after a clamp to the end). M5 touches no desk-web code, and the same test passed on webkit in that run and on chromium here, so it is recorded as a flake.

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

The log takes v1, dual-coded and v2-only events. A v2 signature is checked by
the protocol package's verifyEvent against the org-state head the Project
caches from Registry.head(): read again on each stateAdvanced announcement, on
an unknown signer at most once a second, and when older than 60 s at the moment
it is needed. A cache an announcement outran is never used; an unreadable head
refuses the event state-unavailable, so no v2 event is stored unchecked.

- log-store: an event carries a mac, a sig or both; a hub/ event without a mac
  carries a 16-byte nonce, by which its resend is known; legacy/ stays v1-only.
- project: uploads check every storable v2 event before the synchronous store
  step (bad-signature / state-unavailable refusals); a device's signed human is
  positioned as today and verified against its member's devices; humans are
  taken one at a time; the conflict rule still compares the full canonical body,
  sig included.
- protocol: LogEvent gains optional sig and nonce, SignedHumanEvent is added,
  Refusal gains bad-signature and state-unavailable (all additive).
- desk-web: its reader is proved to accept the package's dual-coded vectors.

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

- An unknown signer's re-read follows the announcement rule: a read older
  than the newest announced version is sent again, else the refusal stands.
- An upload's v2 events are judged against one head (SignedEvents.checkAll):
  verdicts from a head older than the newest held or announced are rechecked.
- The post-check fence also refuses a stream DX7 revoked during the read.
- Every dequeued human checks its member against the newest announced state.
- Registry.head() reads are bounded (5 s): a stall fails closed
  state-unavailable and the in-flight read is let go. Humans queue per member,
  so another member's sealed human never waits on a signed one's read.
- A test pins that a v2-only event reaches a DX2 stream without a mac and the
  daemon's rejection is recorded (sminos refuses it bad-code and moves on).

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

When the unknown-signer refresh of the org-state head times out or fails, the
signer is undecided, so the event is refused state-unavailable (its sender
retries) instead of keeping the stale unknown-signer verdict as bad-signature.
A head read that completes and still lacks the signer stays bad-signature.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Conflicts were the test seams only (send-fault.ts, local.ts,
worker-under-test.ts): M5's head-fault and state-cache seams and M3's
as-member and lacks seams, kept side by side. project.ts merged clean (M3
does not touch it); M3's stored, alarm-resent announcements keep
stateAdvanced(version, members?), and M5's refresh rides on it. The package
now anchors retirement on every v2 event's signed `created` and refuses one
without it; M5's events already carry it.

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

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

project.ts merged clean: M4's push now names the uploading machine
(Registry.push(notice, looking, waiting, machine)), and M5's signed upload
feeds the same push loop, since a v2 event reaches it only once stored. The
conflicts were the test seams, where M5's head-fault and state-cache seams sit
beside M4's registry-rpc seam, and the O11 document, where both M4 and M5 are
ticked and M4's Surprises and Decision Log entries come before M5's, each once.
push-owners pins owner-only push for a v2-signed upload too.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
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:31:42.123556Z eb261f2 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 6e4e065 into master Oct 27, 2026
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
… chromium flake

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb261f28a5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +61
if (isHubWriter(e.writer) && (e.nonce !== undefined || mac === undefined) && !isBase64urlOf(e.nonce, 16)) {
return 'a hub/ event without a mac carries nonce, and a nonce is 16 bytes in canonical base64url';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a signed nonce for dual-coded hub events

For a signed hub/ human that omits its top-level nonce, supplying a mac bypasses this nonce requirement. verifyEvent accepts that event because its signing input excludes the entire mac, while takeHuman deduplicates it using mac.nonce. Consequently, replaying the same signed draft with different canonical mac.nonce values stores it repeatedly at new positions without invalidating its signature; the hub never verifies the MAC. I confirmed that both variants pass eventShapeError and verifyEvent while producing different resend nonces. Require the top-level nonce whenever a hub event carries sig, including dual-coded events, so its resend identity is authenticated.

Useful? React with 👍 / 👎.

Comment on lines +90 to +93
if (!verdict.ok && verdict.code === 'unknown-signer' && this.now() - this.lastRead >= UNKNOWN_SIGNER_READ_MS) {
// A re-read that cannot complete leaves the signer undecided, not refused: the sender retries.
const fresher = await this.readAnnounced();
if (!fresher) return { check: STATE_UNAVAILABLE };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve unavailable-state refusals during the refresh cooldown

When a cached head lacks a newly added signer and its refresh fails, the first check correctly returns state-unavailable, but fresh() has already updated lastRead. Another check within one second therefore skips the refresh and falls through to bad-signature against the same outdated cache, even while the Registry remains unreachable. I reproduced this with two consecutive checks of the identical valid event: the first returned state-unavailable and the immediate retry returned bad-signature (unknown-signer) without another read. This can also give different refusal reasons to events from the same signer across writers in one upload. Track unsuccessful refreshes and retain state-unavailable for affected unknown signers during the cooldown instead of treating the failed read as confirmation that their signatures should be refused.

Useful? React with 👍 / 👎.

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