Skip to content

[PR] fix(#4506): release media refs on historian retire + budget the #3250 custom-cap slack (#4390 follow-ups) - #4511

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-24_fix-4506-master-red
Oct 24, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-24_fix-4506-master-red

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

根因(bisect 铁证)

git bisect f161c518..02f544da → first bad commit = f013414(#4390 row-identity-historian,PR #4395)。两个破口:

破口 1:媒体引用泄漏(media-cas 家族,windows 分片稳定红)

#4390 把权威集清扫从「DELETE+释放引用」改成「retired_at 墓碑」。文本字节保留是评审过的史官语义,但 retired 行的 message_media 映射与媒体 CAS 引用也永远不释放了(默认要等 archive 365 天)——图片重度会话里就是 #3762/#3901 说的「字节永久泄漏」。#4395 验证时漏跑了 media-cas 家族,滑过去了。

修法:retire 时删除该行的媒体映射并释放 CAS 引用(文本字节照旧史官保留);rewind-redo 复活时由重摄取的幂等 upsert 重建映射+引用(INSERT OR IGNORE + release-on-no-change,普通重摄取净零)。sqlite + mysql 双后端同款。

破口 2:#3250 custom-cap 断言的一页余量(#4506 主签名,全平台)

断言 journal_size_limit=1MiB 截断后 WAL ≤ cap+4KiB(一页余量)。#4390 给每行加了 identity 列(64 hex)+ idx_messages_identity 索引项 ≈ +250B WAL 帧/行,~192 行 → 超 12 页(实测 1095952 vs 1048576)。截断不变量本身完好(autocheckpoint 照常截到 cap),坏的是「最后一次截断后到断言之间的新累积帧」超了页级预算。

修法:custom-cap 用例改用 64KiB 的 inter-reset 累积预算(注释引用 #4390 行体积);close-converges 等其余断言维持一页余量不变。

验证

  • media-cas 3/3(含新增 rewind-redo 复活重建映射断言)、issue3250-wal-checkpoint 5/5
  • storage 全家族:storage-unified 14 / storage-review-p2s 6 / archive-gc 5 / full-flip 10 / reap-journal 2 / durability 5 / maintenance-cli 7 / orphan 家族 / state-fields 全绿
  • npm run typecheck 0 错;无新配置/无 schema 变更(kernel-change: none)

Closes #4506

@ranxianglei ranxianglei changed the title fix(#4506): release media refs on historian retire + budget the #3250 custom-cap slack (#4390 follow-ups) [PR] fix(#4506): release media refs on historian retire + budget the #3250 custom-cap slack (#4390 follow-ups) Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-24_fix-4506-master-red (8eb194e)

Latest build — install this exact version

npm install -g billion-context@0.0.5431-pr.4511.3f98c39

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
8eb194e billion-context@0.0.5431-pr.4511.3f98c39 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4511.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit fa81aa2 into master Oct 24, 2026
46 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.796-master.fa81aa2 (rolling master tag).

npm install -g billion-context@0.0.796-master.fa81aa2  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

This was referenced Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant