Skip to content

feat(rpc): structured value codec and payload accounting for the compact consumer (S03b-1b-I-a, part of #4272) - #4385

Merged
code-yeongyu merged 3 commits into
mainfrom
feat/4272-s03b1b-ia-codec
Oct 27, 2026
Merged

code-yeongyu merged 3 commits into
mainfrom
feat/4272-s03b1b-ia-codec

Conversation

@code-yeongyu

Copy link
Copy Markdown
Owner

Part of #4272. S03b-1b-I-a: structured value codec, typed write error, text-ownership helpers and structural-payload accounting (R3.C6.4 substrate), behind the OFF-by-default compact-updates flag. Stacked on #4378 (S03b-1a).

Rulings: RULING-26/26a, RULING-34 (+ the bugwatch split order: codec first, no production caller yet, guarded; wired by S03b-1b-I-b). Exact resident membership unchanged (RULING-34 option a).

S03b-1b-I-a: bounded structured-value substrate

Part of #4272. Local commit:
889849b243af9b4e0fc5f950c9151b9c92364e25.
Base: ccdc83b013c253a9a01c568ef0bda99e0dc1b7fa.
No push. Author and committer: YeonGyu-Kim code.yeon.gyu@gmail.com.

Scope and ordering

This is the approved codec-first split. CompactValues has no production
caller at this head
. S03b-1b-I-b wires it into the real settled index and removes
4272-structured-value-codec-test-only.test.ts in that same increment.

The guard derives the codec's exported entry-point names and scans production
source for references, including aliases, namespace/module references, and
values stored without a call. A scratch production module importing
CompactValues as DeferredCodec and exporting DeferredCodec made the guard
fail. Removing that scratch module made the exact-head suite pass.

Structured values use bounded field/array descriptors and string chunks, with
shared immutable ownership. Structural payload residency, spilled bytes, and
pinned-only bytes are separate from text payload accounting. Spill scheduling
coalesces current leaf IDs instead of accumulating one job per replacement.
Failed descriptor merges release their temporary owners.

The two #4378 LOWs are included: append roots grow only when a subtree is full;
oversized createLeaf calls throw a write-side CompactWriteError.

Exact resident membership remains unchanged at this head. The real consumer
rejects duplicate settled starts and unknown status/removal operations without
advancing its sequence or changing its storage state. The compact rollout stays
OFF.

RED and GREEN

Test RED evidence GREEN evidence
4272-text-root-height.test.ts Original source: heights 14 and 28 exceeded 11 and 21 at 1,024 and 1,048,576 leaves; exit 1. Both height bounds and final ownership reclamation pass.
4272-bounded-text-roots.test.ts write-error case Original source returned CompactReadError(size_limit) instead of CompactWriteError(size_limit); exit 1. Oversized writes are refused before ownership or accounting changes.
4272-structured-value-codec-test-only.test.ts Scratch production alias/value reference was reported as compact-codec-guard-probe.ts; exit 1. Guard passes with the probe removed at this exact commit.
4272-structured-value-codec.test.ts New substrate preservation tests, not an absent-import RED claim. Nested input ownership, oversized keys, 128/129 array entries, <=64 KiB files, and last-owner reclamation pass.
4272-compact-exact-membership.test.ts Existing membership contract retained, not a new rejection claim. Duplicate start and unknown operations remain exact; legitimate cold status updates still work.

Independent verification

The commit was checked out into a fresh detached worktree with an independent
bun install --ignore-scripts --frozen-lockfile, exit 0. No dependency tree from
the later index worktree was linked into it.

Gate at this commit Exit / result
nice -n 10 bun run build 0; full workspace build.
Focused 4272-, compact-store, and structured-sink suites 0; 15 files / 56 tests.
Standalone no-sync-in-session-path.test.ts 0; 1 file / 6 tests; baseline unchanged.
bun run check 0; oxlint, oxfmt, ratchet, dependencies/imports/entry graphs/locks, both TypeScript projects, and browser smoke.
Real RPC CLI rpc-drive.mjs --self-test 0; 4/4, offline sandbox, real authentication unchanged.
Changelog gate against origin/feat/4272-s03b1-storage-substrate, label no-changelog 1, filename-only: s03b1b-Ia.md must be renamed to <pr-number>.md once assigned.

The configured Husky launcher was absent in the supplied checkout; no hook was
bypassed. The full checks above were run explicitly, including in the independent
checkout. LSP diagnostics intermittently timed out; compiler and static gates
passed.

The detached verification worktree was removed after its receipts were retained.
Read-back confirmed that both the directory and its Git worktree registration
were absent.

Formatted production size

305 added pure production LOC. Counts exclude blank/comment-only lines and
include formatted structural lines.

RPC source file Added pure LOC Whole-file pure LOC
compact-values.ts 206 206
compact-content-store.ts 71 209
compact-text-roots.ts 23 163
compact-spool-storage.ts 4 179
compact-storage-io.ts 1 42

Changed test files: bounded text roots 172, root height 27, codec 65, exact
membership 51, staging guard 20 pure LOC. Every source/test file is <=250.

Contract boundary and next increment

This supplies the value/ownership portion of RULING-26 Q3 and keeps the sequential,
OFF-gated delivery required by RULING-26a and RULING-34. The persistent index,
oversized-row integration, bounded-memory collection proof, peak-resident-page
assertion, and production codec caller belong to S03b-1b-I-b.

Remaining active/settled component migration and RULING-33's live membership,
epoch high-water rejection, and cold-operation path remain S03b-1b-II. Q1/Q2/Q4
remain with the later reducer/lane integration. S07b still owns old-display-reader
parity and replay removal.

No change is claimed for sequential compatibility text reads or retirement
waiting for in-flight reads without a deadline. Resident text/ownership headers
remain counted; this is not a constant-RSS claim.

Base automatically changed from feat/4272-s03b1-storage-substrate to main October 26, 2026 16:08
@code-yeongyu
code-yeongyu merged commit d68816f into main Oct 27, 2026
39 checks passed
@code-yeongyu
code-yeongyu deleted the feat/4272-s03b1b-ia-codec branch October 27, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No changelog required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant