Repository navigation
[PR] fix: egress row addressing changed from msgid to self-dispatched rid (follow-up ruling on #7773) | fix: egress 行寻址从 msgid 改为自派发 rid(#7773 后续裁定) - #7849
Conversation
…follow-up, owner ruling 2026-11-27)
D-row payloads carried msgid endpoints ({"start":"h_...","end":"b6ab..."}):
content-hash ids when the host id was unavailable, potentially-colliding
client ids, and ambiguous after fold re-homing (one msgid can occupy a
slot twice in history). The persistent log must address rows by an id we
issue ourselves: dense per session (MAX(rid)+1), append-only flow never
deletes, so a retired rid can never be re-issued.
- egress_state PK (session_id, msgid) -> (session_id, rid) + msgid index
- egress_flow gains a rid column (I/U rows carry it, D rows NULL);
payload addressing: I {after: rid|null}, D {start: rid, end: rid},
U +rid (the target msgid stays as a cross-check)
- invariant 5 (invariants suite + per-write assert): log addressing is
rid, never msgid; the state<->flow twin check joins on (rid, log_seq)
- the diff (prev<->next view match) still keys on msgid: that is the
kernel identity seam (KDD contract) and only the persistent layer
de-msgid-ifies. New case: a colliding msgid gets a fresh rid and
MAX(rid)+1 stays unambiguous
- frontier/high-water = egressRowHighWater = MAX(rid) over the flow
(U rows carry a rid, D rows NULL). log_seq cannot serve as the row id:
retired-slot re-homing legitimately re-cites an old log_seq
- fork (to-now full copy / point-in-time prefix) copies rid verbatim;
the migrate probe adds the rid-less shape (never shipped: first-open
rebuild, docs/egress-plane.md section 7)
- docs: egress-plane en/zh (tables, invariants, ruling ledger, handover
manual), architecture/storage en/zh/ja, deprecations en/zh register
the change with the rebuild handoff
…d_rid/after_rid) The docs wrote the D/I payload keys as start_rid/end_rid/after_rid, but the actual JSON payload keys are start/end/after (holding rid values). Also clarify that the U row's rid is a column, not a payload key. Drive-by fix from PR #7849 review (mirror 7850).
[bot] 🏷 (ai: zai/glm-5.2) 查重不重复。本 PR 是 owner 2026-11-27 裁定的直接落地(#7773 后续),无其他在途 PR 做同一件事。 审核结论审了什么:完整 diff(23 文件 +402/-258)+ 9 个测试文件 + 4 个文档文件(en/zh)。本地跑了 PR 自己的 egress 测试套件(18/18 绿)。CI 在新 head(1282f83f2f3)上运行中。 核心交付(持久层 rid 寻址)—— 正确:
发现一个缺口(已立 drive-by issue):
diff 的契约「replay 精确复现 next」被违反,无运行时不变量能抓住。旧代码在冲突时 fail-fast(duplicate msgid 硬错),新代码静默分叉——这是碰撞场景下的 fail-fast → silent 回归。 严重度:p2——egress 平面默认关(opt-in,未发布),冲突需宿主铸错(宿主 bug),只在删冲突对一行时触发。但 egress 平面 GA 前应修。 已立 drive-by issue 跟踪:mirror #7851(含复现、根因、修法、决策选项)。 顺手修(已 push 到 PR 分支):
八问
合并判定可合——核心交付(持久层 rid 寻址)正确且测试覆盖充分(含冲突 append 场景)。diff 缺口(冲突 delete)已立 drive-by issue #7851 跟踪,不阻塞本 PR(egress 平面默认关,当前无用户影响)。 标签:mirror 标签端点未实现(ework shim 限制),无法打标签。GitHub PR 侧建议标签: |
… longer ghosts or mismatches (follow-up on #7849) diffEgressView keyed its spine on msgid (first-wins). When the host minted a collision pair (two rows, same msgid, distinct rids) and a fold/delete removed one, the spine Set marked BOTH rows "spine", so the D-run never fired (the deleted row stayed live — a ghost) and the U wrote the survivor's bytes onto the first row's rid (content mismatch). The diff's contract "replay reproduces next exactly" was violated with no runtime invariant to catch it. The spine now matches each next row to a SPECIFIC prev occurrence: prefer the occurrence whose bytes agree (the survivor keeps its own rid — a pure -D), else the first occurrence after the pointer (msgid-only, so a content edit still emits a U). No-collision views have one occurrence per msgid, so the match is identical to the old first-wins key there (no behavior change). Regression tests: the two repro cases (delete-first / delete-second of a collision pair) plus a survivor-content-edit case, each asserting the exact ops and the replay identity.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.12241-pr.7849.7ee4344This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7849.tgz
npm install -g packageInstall instructions are refreshed on each push. |
|
(ai: zai/glm-5.2) CI 全绿:36 success / 12 skipped / 0 failure(含主 CI 全部 test 分片、e2e 全套、Theorem 无关)。可合入;合并后线上实例按 docs/egress-plane.md §7 毁库重建(rid 形状,从未发布过的中间形态)。 |
… + fork = zero id conversion The five numbers across the five egress tables answer five different questions; this section puts them side by side (which one is the write counter, which the kernel citation, which the row identity, which the view offset) and states the fork consequence explicitly: every key is (session_id, rid), so fork copies rows verbatim with NO id conversion — the child keeps its forked rids as lineage identity and continues from its own MAX(rid)+1; the usage stream carries no rids at all, so its fork copy is a plain row copy (whole to-now / at<=W prefix point). en+zh (docs/egress-plane.md §3). Closes the doc gap flagged in the #7849 review thread.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1333-master.4c99c39 # this exact build
npm install -g billion-context@master # always the newest merged build
|
… longer ghosts or mismatches (follow-up on #7849) diffEgressView keyed its spine on msgid (first-wins). When the host minted a collision pair (two rows, same msgid, distinct rids) and a fold/delete removed one, the spine Set marked BOTH rows "spine", so the D-run never fired (the deleted row stayed live — a ghost) and the U wrote the survivor's bytes onto the first row's rid (content mismatch). The diff's contract "replay reproduces next exactly" was violated with no runtime invariant to catch it. The spine now matches each next row to a SPECIFIC prev occurrence: prefer the occurrence whose bytes agree (the survivor keeps its own rid — a pure -D), else the first occurrence after the pointer (msgid-only, so a content edit still emits a U). No-collision views have one occurrence per msgid, so the match is identical to the old first-wins key there (no behavior change). Regression tests: the two repro cases (delete-first / delete-second of a collision pair) plus a survivor-content-edit case, each asserting the exact ops and the replay identity.
…rrence [PR] fix: egress diff occurrence-aware — collision-pair deletion no longer ghosts or mismatches (follow-up on #7849)
(ai: zai/glm-5.2)
PR body draft — egress row addressing moves to self-issued rids (#7773 follow-up)
这是啥
D 行(删除)payload 之前用 msgid 做端点:
{"start":"h_07c9...","end":"b6ab41..."}。owner 实测裁定(2026-11-27,#7773 后续):msgid 不是可靠的持久地址——改为:所有 egress 表的行寻址一律用我们自派发的
rid——稠密(每会话 MAX(rid)+1)、append-only flow 里永不删除、永不重发。改了什么
egress_statePK(session_id, msgid)→(session_id, rid);新增idx_egress_state_msgid (session_id, msgid)保 serving 查找。egress_flow新增rid INTEGER列(I/U 行带目标 rid,D 行 NULL);payload 寻址全部 rid 化:{after: rid|null}(原来 after: msgid|null){start: rid, end: rid}(原来 start/end: msgid)rid(目标行的 msgid 保留为交叉校验)tests/egress-invariants-7773.test.ts+ 每次写入断言):日志寻址是 rid,不是 msgid。MAX(rid)+1永不歧义。egressRowHighWater=SELECT COALESCE(MAX(rid),0) FROM egress_flow(U 行带 rid、D 行 NULL → 全表 MAX 即 I 行 MAX)。log_seq 不能当行 id(retired-slot re-homing 允许旧 log_seq 被再引用)。migrateSchema旧形状判定加「缺rid列」→ 首开 drop 重建(从未发布规则;开发库按 egress-plane.md §7 毁库重建)。边界
egress_block_*的startMsgid/endMsgid)不动——那是折叠时刻的一次性对齐坐标,不是日志寻址。这是啥
D 行(删除)payload 之前用 msgid 做端点:
{"start":"h_07c9...","end":"b6ab41..."}。owner 实测裁定(2026-11-27,#7773 后续):msgid 不是可靠的持久地址——改为:所有 egress 表的行寻址一律用我们自派发的
rid——稠密(每会话 MAX(rid)+1)、append-only flow 里永不删除、永不重发。改了什么
egress_statePK(session_id, msgid)→(session_id, rid);新增idx_egress_state_msgid (session_id, msgid)保 serving 查找。egress_flow新增rid INTEGER列(I/U 行带目标 rid,D 行 NULL);payload 寻址全部 rid 化:{after: rid|null}(原来 after: msgid|null){start: rid, end: rid}(原来 start/end: msgid)rid(目标行的 msgid 保留为交叉校验)tests/egress-invariants-7773.test.ts+ 每次写入断言):日志寻址是 rid,不是 msgid。MAX(rid)+1永不歧义。egressRowHighWater=SELECT COALESCE(MAX(rid),0) FROM egress_flow(U 行带 rid、D 行 NULL → 全表 MAX 即 I 行 MAX)。log_seq 不能当行 id(retired-slot re-homing 允许旧 log_seq 被再引用)。migrateSchema旧形状判定加「缺rid列」→ 首开 drop 重建(从未发布规则;开发库按 egress-plane.md §7 毁库重建)。边界
egress_block_*的startMsgid/endMsgid)不动——那是折叠时刻的一次性对齐坐标,不是日志寻址。