Repository navigation
[PR] storage: seq ledger foundations — block interval bounds + ledgerSeq ref stamping (#4316 layer 3, phase 1) - #4346
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.5399-pr.4346.33acf77This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4346.tgz
npm install -g packageInstall instructions are refreshed on each push. |
|
mysql-contract red = pre-existing master breakage, not this PR. Evidence: master's own CI runs have been failing since 2026-10-22T15:30Z — run 39866373994 (head lock-sync (the one failure this PR genuinely owned — kernel/package-lock.json still stamped 0.0.153) is fixed in the follow-up commit. |
8550618 to
1b098b5
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——检索 open+closed 均无其他处理「seq ledger / ledgerSeq stamping / block interval bounds」的 issue 或 PR;本 PR 是 #4316 layer 3 设计(phase 1)的唯一实现切片。 标签: scope/storage + p3(结构地基期,无行为翻转;kernel 侧为纯增量接缝)。非缺陷类,不打 bug;无特定客户端车道。 开始按当前 master 重新审核(分支已 rebase 过一次但仍与 master 冲突:master 内核已到 0.0.160,本 PR 的内核版本号 0.0.154 与 master 上 #4289 用掉的同号冲突)。CI 现状:除 |
1b098b5 to
34112a5
Compare
Review finding on #4346 phase 1: S2's e2e salt-flip scenario already held pre-change (store ids are stable, so the live ref map keeps serving the rendered prefix) — verified by running the suite against pre-change code (S2 green there). S2 therefore pins the user-visible property but cannot catch a regression of the stamp mechanism itself. S3 now covers the discriminating shape directly: empty existing map, stamps arriving out of order — each row must claim its ledger number (order-independent) and the cursor must advance past the highest stamp. Fails without the assignRefs fast path (verified against pre-change kernel).
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 进度更新——冲突已解、分支已推到当前 master,CI 重跑中,测试有效性有一处发现并已顺手修。 1. Rebase 完成(新 head
2. 顺手修了 master 自身的一个漂移:#4292 把 kernel/package.json 提到 0.0.160 时没同步两个 lockfile(都停在 0.0.159)——现在在 master 上跑 3. 本地验证(rebased head):typecheck clean、build OK;定向套件全绿——seq-ledger / snapshot-render×3 / storage-unified / wire-contract(+golden)/ verif-subset-guard 共 69/69,kernel 全套 1460/1460。refs.ts 属 verif Tier-A 守护文件,子语言守卫已过。 4. 测试有效性发现(§④)+ 已修:S2(e2e salt-flip ref 稳定)对 stamp 机制本身没有牙——我把四个源文件+kernel 全部回退到改动前实测:S1、S3 红,S2 仍绿。原因:store 行 id 本身稳定,live ref map 一直能为渲染前缀供号,该场景的稳定性是本来就有的(OP 里「already stable across salt flips」一句也承认了这点)。S2 保留作用户可见属性的钉。真正区分性的形状(空 map 冷重建 + 乱序 stamp 各自认领自己的 ledger 号、cursor 跳过最大值)已作为独立标注提交补进 S3( 5. windows shard 1 失败归因(待 CI):该 lane 当时跑的是旧矩阵(/2 分片),且与 master 自身的 ci.yml 损坏窗口(duplicate concurrency block → 整个 workflow 零 job 失败,#4405/c90e6ea28 已修)重叠,不能排除环境因素。新 head 的 CI 在新矩阵(/3 分片)下全量重跑,windows 三条腿的结果会直接回答 flaky vs 代码问题。CI 绿/红后按八问给最终结论。 |
(ai: vllm-qwen/qwen3.8-27b) 冲突唤醒核实:通知已过期,无需再次 rebase。 唤醒消息(11:43Z 转发)到达时,前一轮会话的 rebase 已经完成并推送(floor 17,head
按纪律不重复 rebase(再跑一次只是对已线性化的分支做无操作改写)。 八问:
收工判定:冲突已消解,分支干净,CI 在新 head 上重跑中;CI 绿即可合并,红了我再来定向排查。 |
(ai: vllm-qwen/qwen3.8-27b) 判定:无需改本 PR,没有可 push 的修复。 mysql-contract 红是 master 上的既有损坏,已在 master 修复,rebase 后的分支原样继承。本地已 A/B 验证。 证据链
八问
收工判定:auto-fix lane 以无 push 关闭——PR 上没有要改的代码。新 run 跑完后 mysql-contract 应转绿;若 windows test shard(另一条单独转发的失败)仍红,走它自己的 lane 处理,不在本次范围。 |
…ef stamping (#4316 layer 3, phase 1) - planIngest fills blocks.start_seq/end_seq with the min/max unified-store seq of the covered messages (-1/-1 when no rows resolve). Coverage bounds become id-independent: byte churn can never invalidate them. - CoreMessage.ledgerSeq sidecar: store-served views (snapshot-render prefix rows) stamp the row's (session, seq); assignRefs issues the ref as the direct display of that number (seq+1, 1-based display space), advancing the cursor past the stamp so counter-allocated refs never collide. - Stakes first (tests/seq-ledger.test.ts): S1 interval bounds, S2 ref-set stability across a full id re-mint under snapshot render, S3 kernel seam.
Review finding on #4346 phase 1: S2's e2e salt-flip scenario already held pre-change (store ids are stable, so the live ref map keeps serving the rendered prefix) — verified by running the suite against pre-change code (S2 green there). S2 therefore pins the user-visible property but cannot catch a regression of the stamp mechanism itself. S3 now covers the discriminating shape directly: empty existing map, stamps arriving out of order — each row must claim its ledger number (order-independent) and the cursor must advance past the highest stamp. Fails without the assignRefs fast path (verified against pre-change kernel).
04d5656 to
a931892
Compare
(ai: vllm-qwen/qwen3.8-27b) 进度更新(中途一次变基,分支已再次 force-push): master 并入了 #4416( 已重新变基到新 master(1491fcf):
新 head(a931892)本地定向验证:typecheck + build 干净;unused-exports gate 干净;LIVE_FILES tripwire 扫描干净(无漏注册的 spawn 测试文件);定向批次(seq-ledger + snapshot-render 族 + storage-unified + web-storage-banner/storage-engine-proofs + wire-contract+golden + verif-subset-guard)= 81 pass / 0 fail(1 skipped)。kernel 套件此前已在同内容上验证 1460/1460。 分支已 force-push(旧 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.794-master.02f544d # this exact build
npm install -g billion-context@master # always the newest merged build
|
First structural slice of the #4316 fix (design: #4316 (comment)). Pure foundations — no behavior flips yet; every consumer stays byte-identical unless the store serves it a stamped view.
kernel-change: refs.ts assignRefs ledgerSeq fast path (new, additive — the counter path is untouched), types.ts CoreMessage.ledgerSeq optional field, kernel 0.0.154.
What lands
CoreMessage.ledgerSeq?(kernel/src/types.ts) — a store-served view may stamp each message with its unified-transcript(session, seq); one allocation, never re-minted.assignRefshonors the stamp (kernel/src/refs.ts) — when a message carries a validledgerSeq(integer within MIN_INDEX..MAX_INDEX, ref slot free), the ref isindexToRef(ledgerSeq)and the cursor advances past it. Collision or missing stamp falls back to the counter path; ids already in the kernel map keep their existing refs (the stamp only rescues cold rebuilds / post-churn views — stability is dual-channel).parseRowsetsmsg.ledgerSeq = seq + 1(store seq is 0-based, display refs are 1-based from MIN_INDEX=1).planIngestfillsstart_seq/end_seqper block from the covered rows' seqs (-1/-1= no row resolved, reads exactly like the old0/0placeholder). Phase 2 (fold bookkeeping keyed by seq intervals instead of h_id sets) builds on these columns.Why phase 1 is safe
assignRefs' new branch; counter-issued refs are unchanged.Tests (tests/seq-ledger.test.ts, 3/3)
-1/-1.ledgerSeq:77→m00077, fresh+counter → next counter, cursor advances.Families: snapshot-render 12/12, storage-unified 14/14, golden 5/5, fold-reconcile 66/66, lane-matrix 58/58, reap 2/2, archive 5/5 (141 green); tsc clean; unused-exports clean.
Next (separate PRs, per the issue)