Repository navigation
Conversation
…ccount fallback after revocation
…eckpoint-join source in the reference gateway
…lback; trim lab comments
zxch3n
marked this pull request as ready for review
December 5, 2026 11:06
- P0 lab: truncate control-stream reads at the revoked device's first invalidating record on the gateway side (stream-read.ts) - P0 lab: require workspace-bound credential (genesis !== null) on snapshot routes - P1 client: raise personal refresh and admission page-size caps from 64 to 129 - P1 core: rebuild checkpoint-origin feeds from the checkpoint anchor offset instead of genesis (-1), and preserve verified admission suffix in CheckpointFeedOrigin - P1 core: verify anchorState head/stateDigest/parentPosition before downloading snapshot - P1 client-e2ee: reuse SnapshotDownload across retries so consumed budget is never refunded - P1 core: propagate email first-use suffix limit (128 records / 8 MiB) into LedgerFeed and enforce it before copying/verifying records - P1 client-e2ee: retain nextCursor on feed catch-up and send cursor alone on continuations - P1 core: allow retained-state v7 CBOR codec to scale to the authenticated snapshot budget above 64 MiB (aligned with formats-v1 §8.1 unbounded ledger CBOR subset) Model: Gemini 4 Neon
…light revocation Model: Gemini 4 Neon
…nd paging Address Astra's round-2 review findings on #3891: - Verify and truncate prior control stream responses against the verified readable prefix on mid-flight revocation; stream chunk-by-chunk up to cutoff without buffering > 16 MiB - Enforce feed/state byte and record budgets before allocating or copying in CBOR, state-v7, and LedgerFeed; replace MAX_SAFE_INTEGER export cap - Align LedgerFeed, SQLite, and IndexedDB origin caps to persist and reopen > 64 MiB snapshots across restart - Align personal client ingestLedgerRecords paging to 129 records/page and drop legacy 16384 checkpoint length cap - Preserve caller checkpoint anchor on corrupt-suffix rebuild and preserve verified genesis admission suffix in joinFromAnchor - Coalesce concurrent snapshot downloads per digest and free buffered chunks on budget exhaustion - Tighten network readAfter limit by remaining maxRecords, stream join-source windows without retaining full history, and preserve continuation cursor on retry Model: Gemini 4 Neon
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 5B: checkpoint joins in core, the client network and the lab reference gateway (checkpoint joins, formats-v1 §4.7, §6–8). Entry paths are untouched (5C).
snapshot/v1andhead-attest/v1stay until 5C/4G (retirement list below).Interface for 5C
Anchors (
@lody/e2ee-core/protocol,JoinAnchor) — each entry path builds one from what it authenticated out of band:{ kind: 'checkpoint', genesis, position: 129·k, checkpointHash }(position 0 joins from genesis){ kind: 'admission', genesis, admissionRecordHash }+admissionPositionHint(untrusted locator){ kind: 'first-use', genesis }(server's latest checkpoint, 32 MiB budget; suffix feed ≤ 128 records / 8 MiB){ kind: 'genesis', genesis }(replays from genesis through the paged feed)Workflows (
@lody/e2ee-core):joinFromAnchor(anchor, { admissionPositionHint? })returns{ origin, view }and requires theLedgerJoinSourceport.originis aLedgerFeedOrigin(genesisor the newcheckpointkind) to keep and pass toLedgerFeed.layer({ origin })on every open; it is re-verified each time. The feed then catches up fromorigin.checkpoint.offsetin pages.viewis at the anchor; foradmissionit is at the admission record. 5C still checks that this record admits its own key bundle.rejoinFromAnchor(genesis, joinAnchorOf(view))rebuilds a checkpoint origin from the retained join anchor after a local storage format change, instead of replaying from genesis.Pure protocol (
@lody/e2ee-core/protocol):verifyCheckpointJoin(input)authenticates the checkpoint record by any one of: an out-of-bandcheckpointHash, a retainedanchorState, or nothing (first use). It then decodes the v7 snapshot under the budget with the checkpoint'sstateDigest, restores the state atp − 1, and verifies the checkpoint record forward: signature, parent and recomputed digest.authenticateBackwardChainauthenticates positions before an anchor.verifyCheckpointJoin's optionalpreAnchorretains them, including hashes and epoch publications.resolveAdmissionAnchorwalks from an admission record back to the nearest checkpoint.joinAnchorOf(view)returns the anchor a view joined from, ornullfor a full-history view.Ports and adapters:
LedgerJoinSource(@lody/e2ee-core/services):readRecords(fromIndex, limit ≤ 129)→{ records, tip, nextOffset }readSnapshot(stateDigest, budget)→ bytesnetwork.ledger(credential).join(@lody/client-e2ee/network). ItsreadSnapshotneeds the newsnapshotRoutes: { origin, sessionToken, fetch? }option onmakePersonalCloudNetwork. 5C must wire it (deployment HTTP origin + session-token getter); without itreadSnapshotfails closed.labJoinSource.Changes
checkpoint-join.ts: join verification, backward chains, admission resolution and join anchors.join.ts:joinFromAnchor/rejoinFromAnchorover theLedgerJoinSourceport.LedgerFeedgains acheckpointorigin, verified withverifyCheckpointJoinon every open.snapshotDownloadBudget((p + 1) · 4,096 B) andEMAIL_FIRST_USE_SNAPSHOT_BUDGET_BYTES.policy,replay,state-v7orsnapshot-codec(feat(e2ee): cloud-machine registry in the v1 base ledger (tags 14–16) #3859); the join view is built from their existing exports (restore +extendLedger).network.ts):e2ee_device_revokedis removed: a credential read fails with that refusal and is never re-read under the account login (AGENTS.md updated).limit, thenfromIndexorafteron the first page, and onlycursor+limiton continuations (nocheckpoint). Pages carry ≤ 129 records, and the 64-record and 16,384-length caps are lifted. The whole-history helper keeps its 32 MiB in-memory bound.LedgerJoinSourceimplementation reads snapshots through W0's streamingsnapshot-reader.buildSnapshotArchive(SQLite, keyed by genesis and stateDigest) before accepting a tag 13 append; a failure refuses the append.Content-Length, CORS{ code }refusalslabJoinSourceand aLedgerFeedcheckpoint origin inledger-client.@lody/cloud-apiis now a lab runtime dependency (lockfile updated for that entry only).Retirement list (5C per entry path; 4G removes the core APIs)
src/ledger.ts(verifyLedgerSnapshot,snapshotTrustFromView, snapshot feed origin)src/pairing.tsandsrc/session.ts(signLedgerSnapshot, head signatures in invitations)pairing,host,owned-host,ledger-control, browserhost-fixturee2ee-personal-pairing.mts(signLedgerSnapshot, head signature) ande2ee-runtime-part-2.test.mjs.invitation-wire.ts,snapshot-cache.ts,workspace-session.tsand the snapshot feed origin inledger-client.tsfull-session,ledger-client,recovery-vault,snapshot-cache-reopene2ee-ledger-verification.test.ts, mobilemobile-host.test.ts, client-e2eeopen-content-perf.test.ts.snapshot/v1/head-attest/v1APIs:signLedgerSnapshot,verifyLedgerSnapshot,prepareLedgerSnapshot,snapshotTrustFromView,authenticateLedgerSnapshotEvidence,SnapshotTrust/SnapshotFeedOriginand thesnapshotfeed origininternal/workspace/invitation.tsTests
test/ledger/checkpoint-join.test.ts, 11), against the independent ledger v2 vector:LedgerFeedcheckpoint origin open/reopenjoinFromAnchorfor every anchor kind with its budgets, andrejoinFromAnchortest/checkpoint-join.test.ts:e2ee_device_revoked, a tampered chunk is refused, and an absent snapshot is 404run-tests.mjs668/0acp-extensionmodule errors are the temp worktree's missing submodule builds.🤖 Generated with Claude Code