P36b+P36c: WAL checkpoints + bucket-backed sc serve — P36 complete - #127
Merged
Conversation
…ve over a bucket (P36c)
… one bucket (P36c)
…e .sc/tmp, fold dedup + docs (P36b+c)
tonibergholm-codento
approved these changes
Aug 27, 2026
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.
Summary
Completes P36 (spec:
docs/superpowers/specs/2026-08-26-wal-bucket-backend-design.md; ADR-0046 As-built extended).P36b — checkpoints + log-tail cold start. New
walfmt::Checkpointrecord (magicSCWC: folded branch tips + cumulative pack list, strict fail-closed decode).BucketTransport::refresh()now stops its parent-chain walk atmanifest.checkpoint_seq, seeding refs and pack index from the checkpoint — a reader never needs the folded log entries (proven by a test that deletes them). Absent, seq-lying, or chain-bypassed checkpoints each fail closed with a typed error. After a successful commit CAS,update_refopportunistically folds a checkpoint once the tail exceedsCHECKPOINT_INTERVAL = 64— coordinator-free, best-effort by contract: a fold failure or lost CAS never fails the push (fault-injection tested), and a fold that would exceed the codec'sMAX_LISTcap is skipped rather than writing a checkpoint no reader could decode.P36c — bucket-backed
sc serve. The wire serve loop is generalized behind aServeTransportseam (local keeps its tempfile fast paths verbatim; bucket uses theTransporttrait with RAII spill dirs under the serve home's.sc/tmp/).sc serve --stdio|--http <addr> --store sc+wal://…|sc+s3://… <serve-home>serves a bucket with tokens, TLS, read-only floors, and limits working unchanged; the serve home must be an initialized.sc/(fail-closed on both paths). Instances are disposable: two instances over one bucket show strict consistency with zero propagation delay (library test), and the CLI test kills instance one and clones the pushed content through a freshly spawned instance two. Wire protocol unchanged (PROTOCOL_VERSION4).Docs: ADR-0046, CLAUDE.md (P36 row complete + serve-home boundary), ROADMAP (built entries removed; serve-side pack cache follow-on added; compaction entry notes it relieves the checkpoint cap), THREAT-MODEL (serve-home split).
Review process notes
Seven task-gated reviews plus a whole-branch final review (which caught a real cross-task Critical: the unbounded cumulative fold vs the decoder's
MAX_LISTcap — fixed with a skip-fold guard + regression tests; and relocated bucket-serve spills from the system temp dir into the serve home per the spec's own posture).Test plan
cargo test --workspace: 772 passed, 0 failedcargo clippy --workspace --all-targets -- -D warnings: cleancargo fmt --all -- --check: cleansc demo --agents 4: zero residue confirmed