Skip to content

[PR] fix(storage): persist a schema reader floor + unblock the notice-store migration - #6347

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-11-12_storage-reader-floor
Open

ranxianglei wants to merge 3 commits into
masterfrom
2026-11-12_storage-reader-floor

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Root-cause batch for the [根因] storage aggregation (mirror #6267). One PR, two root causes, both in the storage / notice-persistence layer:

#5761 — notice-store hydration race (cherry-picked from #5768)

src/notice-store.ts: a dismiss landing between process start and cli-boot hydration bailed the whole-process hydration (the cache !== null gate), skipping the one-time legacy JSON→kv migration and hiding sibling lanes' kv rows in-process. The fix unions the hydrate into whatever lazy cache exists instead of bailing, with a distinct hydrated latch and a live-cache snapshot just before publish (publish only on success — a failed hydrate leaves the legacy-file fallback live and retries next call).

Commits (cherry-picked with -x, original authors preserved):

  • 13e7f93d26 ci-check — the fix
  • 6ef363c9fe ework-review — comment alignment

#5788 — schema reader floor

The schema stamp only says "how far a store was migrated" — nothing about whether an OLDER build can still read the result. An older build opening a newer-migrated store would no-op (sqlite) or re-run additive DDL (mysql) and then silently write rows it cannot read back.

The fix persists, per store, the oldest schema version the writing build can still read (STORAGE_MIN_READER_VERSION / MYSQL_MIN_READER_VERSION, both 8 — v8 is the only non-additive migration, the identity backfill):

A missing or malformed floor is UNKNOWN and passes, so existing (pre-feature) stores never false-refuse. The floor and the stamp move atomically (a torn pair would under-report the floor and let a too-old build in).

Behavior change (disclosed): opening a store whose persisted reader floor is above this build's schema version now REFUSES TO START where it previously opened (and silently wrote). This is the intended fix — the previous open-and-write was the data-corruption footgun. Pre-feature stores (no floor row) and additive-bump stores (floor ≤ this build) are unaffected.

Tests: tests/storage-reader-floor.test.ts (sqlite hermetic: invariant, atomic floor write, refuse arm, pass arms; mysql hermetic via a typed driver fake: refuse arm, pass arms, stamp+floor in one txn). tests/notice-unified-store.test.ts carries the #5761 regression cases.

Relationship to PR #5768

#5768 fixes #5761 alone. This batch PR cherry-picks its two commits (authorship preserved) and adds the #5788 reader floor. When this merges, #5768 is superseded — please close whichever loses. If #5768 merges first, I'll rebase this onto it.

@ranxianglei ranxianglei added bug Something isn't working p2 scope/storage labels Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-12_storage-reader-floor (16c0802)

Latest build — install this exact version

npm install -g billion-context@0.0.11119-pr.6347.1a21188

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
16c0802 billion-context@0.0.11119-pr.6347.1a21188 build
ddb159d billion-context@0.0.9417-pr.6347.f09c0f4 build
fba61ee billion-context@0.0.9250-pr.6347.738e7a4 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(storage): persist a schema reader floor + unblock the notice-store migration [PR] fix(storage): persist a schema reader floor + unblock the notice-store migration Nov 12, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — #5768 是本 PR cherry-pick #5761 一半的来源 PR(patch 逐字节一致、作者信息保留),不是并行工作;本 PR 合入后 #5768 被取代,owner 关闭败方。
标签: bug / scope/storage / p2(理由:#5761 是活跃缺陷但有重启绕行 = p2;#5788 的拒绝在发版时休眠——只有未来非加性迁移上线后才会真正触发,属潜在防护而非活跃数据丢失)。

方向关(①): 两个根因都真实存在且定位正确。#5761 根因是 hydrate 重入门用 cache !== null(懒缓存已创建)当「水合完成」信号——两个概念混用;#5788 根因是「读者地板」(还能读此 store 的最老 build)从未持久化,stamp 只记录迁移推进到哪。两个修复都打到根因,不是堵症状。

回归审查(②): 无无意回归。触碰路径既有行为逐项核验:

  • dismissedCache null→file 回退保持;旧代码 cache = merged 在失败路径也执行(用空 map 覆盖懒缓存)——该覆盖本身是潜在 bug,一并修掉;
  • legacy-only 纯文件路径(unifiedReceiptsActive=false)不变;迁移 key 集合不变(file 中已在 kv 的 key 不重复迁移);
  • sqlite no-op 分支只加 floor 门,缺 floor 行 = 通过(存量 store 永不假拒);
  • mysql stamp GREATEST 永不降级语义保持,stamp+floor 现在同一事务——中途失败回滚,下次 open 幂等重迁;
  • shadow 两个新 floor 分支位于 generic refusal 尾部之前——正确,因为 generic 尾部的「移开 index.db」建议会毁掉新 build 的数据;
  • 错误流验证:StorageSchemaFloorError 不匹配 sqliteCorruptionDetail 的损坏标记(SQLITE_CORRUPT/NOTADB),不会被误分类进「无索引启动」损坏路径,正确到达拒绝分支。

代码审查(③): 两后端门等价性成立(sqlite: floor > version → 拒绝;mysql: current > version && floor > version,功能等价);原子性论证成立(floor ≤ 写入 build 的 stamp,故 floor > runningVersion 蕴含 stamp 高于 runningVersion);torn pair 会低报 floor,所以 stamp+floor 必须同事务——已实现。

测试有效性(④): 真测试、有牙,#3617 双向门——sqlite 6 条(不变量 floor≤version;迁移写 floor+stamp;拒绝臂精确错误字段;3 个通过臂:当前版本+已知 floor / 无 floor 行 / 加性未来 bump),mysql 5 条(typed driver fake;拒绝臂;通过臂含「无迁移时不重写 floor」;迁移臂断言 stamp+floor 在同一 begin..commit 窗口),notice-store 2 条回归测试在旧代码上会失败(预水合 dismissal 阻塞迁移;水合中 dismissal 被最终发布覆盖)。

diff 整洁度(⑤): 6 文件 +591/−35,每行都在范围内;无 CHANGELOG 条目——与近期 fix PR(如 #6326)惯例一致,不阻塞。

八问:

  1. 是什么问题: 存储层两个独立根因——① 启动水合完成前落下的 dismissal 会阻塞一次性 notice 收据 file→kv 迁移,并让兄弟车道的 kv 收据在本进程内不可见(通知重复弹出直到重启);② 老 build 打开被新 build 迁移过的 store 时 no-op/重跑加性 DDL,然后静默写入自己读不回的行(共享索引拓扑的滚动升级陷阱)。
  2. 什么原因导致的: ① 重入门把「懒缓存已创建」与「水合完成」混为一谈;② 读者地板与迁移 stamp 是两条信息,只持久化了后者。
  3. 影响范围与严重程度: ① 任何有 legacy 收据文件且预水合 dismissal 落下的统一存储实例——churn + 通知重复弹直到重启,p2(重启绕行);② 共享索引/滚动升级拓扑——潜在数据损坏类,发版时休眠(已发布 build 中 v8 之后无非加性迁移),下一次非加性迁移上线后转为活跃。
  4. 怎么修复的: ① 独立 hydrated 闩 + 并入既有懒缓存 + 仅成功时发布(失败水合保持 file 回退存活);② 每 store 持久化读者地板,与 stamp 同事务原子迁移,open 时 floor > 本 build 版本即 REFUSE TO START(与 CANTOPEN/readonly 同桶,给真实修复建议);缺/坏 floor = 未知 = 通过。
  5. 是否有回归问题: 无无意回归(逐项清单见上)。披露的行为变更:持久化 floor 高于本 build 版本的 store 现在 REFUSE TO START,此前会打开并静默写——这是预期修复,发版时休眠。
  6. 是否破坏缓存: 不影响前缀缓存/重试/去重键。floor 行每次迁移写一次;当前版本的存量 store 不动(no-op 分支,不写 floor)。
  7. 是否改了设计方向: 无架构变更——加性持久化扩展(一行 kv / 一行 meta)+ 启动门。
  8. 是否引入了新的配置: 无(既有 BILI_STORAGE_UNIFIED=legacy 仍是显式退出)。

CI: 12 绿 + 16 跳过,0 失败;2 个 test shard 仍在跑(ubuntu-24 shard 1、ubuntu-22 shard 3)——全部 windows shard、mysql-contract 真驱动车道、static gates 已绿。
判定: 可合(先 rebase 到当前 master——落后 5 个提交(#6326),无文件重叠,预期干净;+ 2 个在途 shard 转绿)。不符合 auto-merge 门(§7.4:持久化格式扩展 + fallback/行为产品决策)→ 人工合并。合入后 #5768 被取代,请关闭。
一句话观察:PR 正文「retries next call」措辞略不准——hydrateNoticeReceipts 全仓唯一调用点在 src/cli.ts:970(每进程一次),准确表述是「file 回退在本进程余下时间存活,下次进程启动重试」。措辞 nit,非代码缺陷。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

本次运行:解决 PR 与 master 的合并冲突并推送。

做了什么

  • 诊断:PR 分支 2026-11-12_storage-reader-floor(原 head fba61eec62)落后 master(259cd87674)90 个提交,merge state = dirty。逐文件核对后,唯一冲突点是 src/storage/mysql.ts 的 import 块:master 侧扩展了 store.js 的 import(新增 rewriteArchiveLog/validateExtKey/serializeExtValue,并从 node:fs 移除 writeFileSync),PR 侧在相邻行新增 import { StorageSchemaFloorError } from "./schema.js"; —— 两边改相邻行,git 无法自动合并。其余 5 个文件(notice-store / schema / shadow / 两个测试)均无冲突。
  • 解决:把 3 个 PR 提交 rebase 到当前 master。前两个 notice-store 提交干净应用;reader-floor 提交仅在 import 行冲突,取并集解决(保留 master 扩展后的 store.js import + PR 的 schema.js import),不丢任何一侧符号。
  • 验证:无残留冲突标记;6 个 import 符号均由源模块导出且在文件内被使用,writeFileSync(master 已移除)无残留引用;解决后 diff vs master 恰好等于 PR 原本的 6 文件贡献(591+/35−),无额外改动;两个 cherry-pick 提交的作者与 -x 溯源标记保留;npm run typecheck 绿(exit 0);PR 自带 18 条定向测试(storage-reader-floor + notice-unified-store)全过。
  • 推送:force-push(lease 钉在原 head fba61eec62,推送前确认无并发改动)到 GitHub PR 分支 → 现 head ddb159d495。master 现为 PR head 的祖先,冲突清除,PR 恢复干净可合。
  • CI:镜像缓存已刷新到新 head,mergeable_state 由 dirty → blocked(= 等 CI 跑完,非冲突);12 项 check 运行中、0 失败。

八问

  1. 是什么问题: PR 分支落后 master 90 提交,与 master 合并冲突(dirty),唯一冲突点是 src/storage/mysql.ts 的 import 块。
  2. 什么原因导致的: master 扩展了 store.js import 并移除 node:fs 的 writeFileSync,PR 在相邻行新增 schema.js import,两边改相邻行触发 content conflict。
  3. 影响范围与严重程度: 仅阻塞本 PR 合并(调度层面),不影响任何已发布行为;解决后 PR 恢复可合。非功能缺陷。
  4. 怎么修复的: rebase 3 个提交到当前 master,import 冲突取并集(两侧符号全保留),不引入任何逻辑改动。
  5. 是否有回归问题: 无。解决后 diff vs master 恰好等于 PR 原贡献;typecheck 绿 + 18 条定向测试全过;master 既有改动(archive/validateExtKey/serializeExtValue)与 PR 的 reader-floor 门都完整保留,无符号丢失/悬空引用。
  6. 是否破坏缓存: 不涉及(纯 import 行合并,不碰缓存/重试/去重键)。
  7. 是否改了设计方向: 不涉及(仅解冲突,未改架构/数据流)。
  8. 是否引入了新的配置: 不涉及(未新增 env/config/默认值)。

判定: 冲突已解决并推送,PR 恢复干净可合;CI 在新 head 上重跑中(0 失败)。本 PR 属持久化格式扩展 + 行为产品决策,不合 auto-merge 门,CI 全绿后需人工合并。

ci-check and others added 3 commits November 21, 2026 03:04
… legacy→kv migration (#5761)

A dismissal landing before the cli-boot hydration lazily created the receipts
cache, which made hydrateNoticeReceipts bail on `cache !== null` — skipping
the one-time legacy JSON→kv migration for that process's lifetime (re-import
churn on every boot) and hiding sibling lanes' kv rows until restart; a
dismissal landing inside the hydrate's await gap was clobbered by the final
cache assignment.

Twin of the host-plugin-notice fix that landed in the #5757 line (commit
4d74613), ported onto master's API surface (unifiedKvActive/getStore; the
kvStore() probe from that line is not merged yet):

- hydrate unions into the existing lazy cache instead of bailing; a new
  hydrated latch (distinct from lazy-init) gates re-entry
- the live-cache snapshot moves to just before the publish with no awaits in
  between, so mid-hydration dismissals survive the final assignment
- publish only on success: a failed listKvAsync now leaves the cache null
  (legacy-file fallback stays live, next call retries) instead of clobbering
  it with an empty/partial map for the process lifetime

Tests: two regression cases mirroring the #5757 shapes — both fail on the
pre-fix code and pass with it; adjacent notice suites green.

(cherry picked from commit cf85588)
…s a store it cannot read (#5788)

An older build opening a store a newer build migrated with a NON-ADDITIVE
change would silently write rows it cannot read back (rolling upgrade /
rollback). Persist, per store, the oldest schema version the writing build
can still read (STORAGE_MIN_READER_VERSION / MYSQL_MIN_READER_VERSION, both
8 — v8 is the only non-additive migration, the identity backfill). The
floor and the stamp move in ONE transaction (a torn pair would under-report
the floor and let a too-old build in). On open, a build below the stored
floor REFUSES TO START (same bucket as CANTOPEN/readonly — the data is
newer, not corrupt; degrading would split-brain, #3923). A missing or
malformed floor is unknown and passes, so existing stores never
false-refuse.

sqlite: kv_store(storage, schema_reader_floor) + user_version in one txn;
gate in the from>=version no-op branch.
mysql: bili_meta schema_reader_floor + schema_version in one txn; gate in
init().
shadow.ts: dedicated refusal branches naming the real remediation (upgrade
bili / restore a pre-upgrade backup) instead of the generic tail, whose
"move index.db aside to force a fresh rebuild" would destroy the newer
build's data.

Tests: tests/storage-reader-floor.test.ts — sqlite hermetic (invariant,
migration writes floor atomically, refuse arm, pass arms: current / missing
row / additive future bump) + mysql hermetic (typed driver fake: refuse arm,
pass arms, migration writes stamp+floor in one txn).
@ranxianglei
ranxianglei force-pushed the 2026-11-12_storage-reader-floor branch from ddb159d to 16c0802 Compare November 20, 2026 19:07
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

本次运行:master 又前进了(259cd87674 → b10c1a0d4ee),PR 重新与 master 冲突,再次 rebase 解冲突并推送。

做了什么

  • 诊断:唤醒时核对 live 状态——我上次推送的 head ddb159d495 仍是 PR 分支 head(无并发改动),但 master 已从 259cd87674 前进到 b10c1a0d4ee。merge-tree 比对发现新冲突只在 src/storage/shadow.ts(mysql.ts / notice-store.ts 这次能自动合并)。
  • 冲突本质:shadow.ts 的 sqlite open catch 块,两边在 const errStr = String(err); 之后同一位置各插了一段——master 侧([Bug][storage] Takeover spawns before reclaim: old and new sidecars simultaneously hold index.db, causing corruption; em | [Bug][storage] 接管时先 spawn 后回收:新旧侧车同时持有 index.db 引发损坏;空 payload_json 又让历史会话静默变 0 #7156)插了损坏处理分支(sqliteCorruptionDetail 分类 → return null 无索引启动)并重写了注释;PR 侧([storage] Persist a schema reader floor so an older build refuses a store it cannot share (rolling upgrades / rollbacks) #5788)插了reader-floor 拒绝分支(instanceof StorageSchemaFloorError → throw 拒绝启动)。两者是互斥的失败分类(floor 错误 = 文件更新、非损坏;损坏 ≠ floor 错误),先后顺序不影响行为。
  • 解决:rebase 3 个提交到当前 master b10c1a0d4ee。前两个 notice-store 提交干净应用;reader-floor 提交在 shadow.ts 冲突,取并集——保留 master 的损坏分支在其已评审位置,PR 的 floor 分支插在其后(仍在通用尾部之前,满足 PR 注释「通用尾部不得适用于 floor」的意图),注释用 master 重写后的版本。import 块 git 已自动并集(三个 import 都在:splitMediaContent / StorageSchemaFloorError / sqliteCorruptionDetail)。
  • 验证:无残留冲突标记;解决后 diff vs 新 master 恰好等于 PR 原本的 6 文件贡献(591+/35−),损坏分支(master 代码)正确地不在 PR diff 里;npm run typecheck 绿(exit 0);PR 自带 18 条定向测试(storage-reader-floor + notice-unified-store)全过。
  • 推送:推送前 fetch 确认 remote head 仍是 ddb159d495(无并发改动),force-push(lease 钉在 ddb159d495)→ 现 head 16c0802f7b5。git 层面确认 master(b10c1a0d4ee)现为 PR head 的祖先,冲突清除。
  • CI:镜像缓存此刻仍显示旧 head(ddb159d495,state=behind)——轮询器 ~60s 刷新,尚未追上本次推送;git 层面已确认冲突清除,镜像会在下个轮询周期收敛到 blocked(等 CI)。

八问

  1. 是什么问题: master 前进(259cd87674→b10c1a0d4ee)后 PR 重新与 master 冲突,唯一冲突点是 src/storage/shadow.ts 的 sqlite open catch 块。
  2. 什么原因导致的: master 侧 [Bug][storage] Takeover spawns before reclaim: old and new sidecars simultaneously hold index.db, causing corruption; em | [Bug][storage] 接管时先 spawn 后回收:新旧侧车同时持有 index.db 引发损坏;空 payload_json 又让历史会话静默变 0 #7156 在 catch 块插了损坏处理分支并改写注释,PR 侧 [storage] Persist a schema reader floor so an older build refuses a store it cannot share (rolling upgrades / rollbacks) #5788 在同一位置插了 reader-floor 拒绝分支,两边改同一区域触发 content conflict。
  3. 影响范围与严重程度: 仅阻塞本 PR 合并(调度层面),不影响任何已发布行为;解决后 PR 恢复可合。非功能缺陷。
  4. 怎么修复的: rebase 3 提交到当前 master,shadow.ts 冲突取并集(master 损坏分支 + PR floor 分支,两者互斥、顺序无关),import 块自动并集,不引入任何逻辑改动。
  5. 是否有回归问题: 无。解决后 diff vs 新 master 恰好等于 PR 原贡献;typecheck 绿 + 18 条定向测试全过;master 的 [Bug][storage] Takeover spawns before reclaim: old and new sidecars simultaneously hold index.db, causing corruption; em | [Bug][storage] 接管时先 spawn 后回收:新旧侧车同时持有 index.db 引发损坏;空 payload_json 又让历史会话静默变 0 #7156 损坏处理与 PR 的 [storage] Persist a schema reader floor so an older build refuses a store it cannot share (rolling upgrades / rollbacks) #5788 floor 门都完整保留,无符号丢失/悬空引用。
  6. 是否破坏缓存: 不涉及(纯冲突合并,不碰缓存/重试/去重键)。
  7. 是否改了设计方向: 不涉及(仅解冲突,未改架构/数据流)。
  8. 是否引入了新的配置: 不涉及(未新增 env/config/默认值)。

判定: 冲突已解决并推送,PR 恢复干净可合;git 层面确认 master 已是 PR head 的祖先。CI 在新 head 上重跑中(镜像缓存稍后收敛)。本 PR 属持久化格式扩展 + 行为产品决策,不合 auto-merge 门,CI 全绿后需人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)

Review verdict: APPROVE — clean, no blocking findings. (Posted as a comment: GitHub rejects a formal APPROVE review on a PR authored by the same account, "can't approve your own pull request" — this comment is the review.

Both fixes are correct, well-tested, and the one behavior change is disclosed.

#5761 (notice-store hydration race): The old cache !== null gate let a single pre-hydration dismissal (lazy cache creation in addDismissedKeyInMemory) block the one-time legacy JSON→kv migration for the whole process lifetime and hide sibling lanes' kv rows until restart. The fix swaps in an independent hydrated latch, UNIONs into whatever lazy cache already exists, and snapshots the live cache with no awaits before the final publish — so a dismissal landing in the hydration gap survives. Publish is success-only (a failed listKvAsync leaves the cache null and retries next call). Verified by tracing all three scenarios (no prior dismissal / pre-hydration dismissal / kv failure). Correct twin of the #5757 host-plugin fix.

#5788 (schema reader floor): Persists per-store the oldest schema version the writing build can still read (STORAGE_MIN_READER_VERSION = 8 / MYSQL_MIN_READER_VERSION = 8), written in the same transaction as the schema stamp, and refuses to start when the floor is above this build's version. I independently verified the load-bearing atomicity claim — PRAGMA user_version IS transactional in SQLite (rollback undoes it), so floor+stamp land or neither does, across all three engines (bun / better-sqlite3 / node:sqlite). A missing (pre-feature) or malformed floor passes rather than false-refusing. The shadow.ts refusal branches correctly name the real remediation (upgrade bili / restore a pre-upgrade backup) instead of the generic "move index.db aside" tail, which would destroy the newer build's data.

Behavior change (disclosed in PR body): opening a store whose persisted reader floor is above this build's schema version now REFUSES TO START where it previously opened (and silently wrote). This is the intended fix — the old open-and-write was the data-corruption footgun. Pre-feature stores (no floor row) and additive-bump stores (floor ≤ this build) are unaffected.

Tests are comprehensive: tests/storage-reader-floor.test.ts covers the invariant, the refuse arm, and the three pass arms (current / nofloor / additive) on both sqlite and mysql, plus the single-transaction write; tests/notice-unified-store.test.ts adds two regression cases that would fail on the pre-fix code (the mid-hydration one gates the KV directions to isolate the loss). No kernel/ changes, no config/env surface changes, no console.error, clean 6-file diff. No small findings to fix on the spot.


八问(中文,供人工 reviewer)

  1. 是什么问题:两个独立缺陷——① 通知回执的 legacy JSON→kv 一次性迁移会被「先 dismiss 后 hydration」的时间窗永久跳过(storage: notice-store (#5548) pre-hydration receipts block the one-time legacy→kv migration #5761);② 旧版 build 打开新版 build 已迁移的存储库时,无法判断自己还能不能读,会静默写入读不回的脏行(滚动升级/回滚的坑,[storage] Persist a schema reader floor so an older build refuses a store it cannot share (rolling upgrades / rollbacks) #5788)。
  2. 什么原因导致的:① hydrate 顶部用 cache !== null 当「已 hydrate」的判据,而 addDismissedKeyInMemory 会惰性建 cache,导致一次提前 dismiss 就 bail 掉迁移;② schema stamp 只记录「迁到了哪一版」,没有任何「旧 build 能否读」的信号,版本门从不拒绝更新的库。
  3. 影响范围与严重程度:① 仅影响统一存储开启、且启动时有提前 dismiss 的进程——迁移被跳过导致每次启动重导文件 + 兄弟车道的 kv 行在本进程内不可见,属体验/效率瑕疵,不丢数据;② 影响共享 index.db 拓扑(A second process was detected writing to the same index.db — another process (pid 435075) is writing to the database in | 检测到第二个进程在写同一个 index.db 另一个进程(pid 435075)正在写入本会话目录的数据库——两个进程写同一个库会损坏数据(#3923/#3959)。请关闭多余实例:一个会话目录只能由一个实例服务。 #5082)下的滚动升级/回滚——旧 build 会静默写脏行,属数据一致性隐患(潜在数据损坏),但需「新版迁移过 + 旧 build 再打开」才触发。
  4. 怎么修复的:① 用独立的 hydrated latch 取代 cache !== null 判据,hydrate 改为并入已有 lazy cache、发布前对 live cache 做无 await 快照、仅在成功时发布(失败则保持 null 下轮重试);② 每库持久化一个「读者地板」(最旧可读 schema 版本),与 schema stamp 在同一事务内写入,开库时地板高于本 build 版本即拒绝启动,缺失/畸形地板放行(不误拒)。
  5. 是否有回归问题:无意外回归。① 既有行为(无提前 dismiss 的正常路径)保持不变,仅修复了被 bail 的异常路径;② 新增「地板高于本 build 版本 → 拒绝启动」是有意行为变更(旧行为是打开并静默写脏行,正是本次要修的坑),已在 PR 正文披露;pre-feature 库(无地板行)与纯加性升级库(地板≤本 build)不受影响。高危模式逐项过:无 fail-fast 变吞错、无阈值/时序/输出格式漂移、无缓存策略静默失效。
  6. 是否破坏缓存:不涉及。① 通知回执缓存的失效策略不变(仍按 key 去重);② schema 地板是每库持久化的一次性元数据,不参与任何缓存/游标/去重键。
  7. 是否改了设计方向:不涉及架构转向。① 仍是同一 notice-store 模块内的竞态修复;② 在既有 storage 层新增一个「读者地板」元数据 + 开库门,属既有边界的补全,未改数据流/边界。
  8. 是否引入了新的配置:不涉及。无新 env、无新 config 字段、无新 CLI flag。STORAGE_MIN_READER_VERSION / MYSQL_MIN_READER_VERSION 是代码常量(非用户配置),随非加性迁移在同一 commit 内提升。

判定:可合并(APPROVE)。 无 kernel/ 改动、无配置面变更、测试充分、行为变更已披露,无阻塞项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Review of PR #6347 (mirror #6348) complete — verdict: APPROVE, no blocking findings.

What I did:

  • Read the PR body, both linked issues (storage: notice-store (#5548) pre-hydration receipts block the one-time legacy→kv migration #5761 notice-store hydration race, [storage] Persist a schema reader floor so an older build refuses a store it cannot share (rolling upgrades / rollbacks) #5788 schema reader floor), and the full 6-file diff (591 insertions, 35 deletions).
  • Verified correctness: independently confirmed the load-bearing atomicity claim — PRAGMA user_version IS transactional in SQLite (rollback undoes it), so the floor+stamp land atomically across all three engines (bun / better-sqlite3 / node:sqlite).
  • Judged tests: comprehensive — tests/storage-reader-floor.test.ts (invariant, refuse arm, 3 pass arms on sqlite+mysql, single-txn write) and tests/notice-unified-store.test.ts (2 regression cases that fail on pre-fix code).
  • Judged risks: one behavior change (refuse-to-start when floor > build version), disclosed in the PR body. No data loss. No kernel/ changes, no config/env surface changes, clean diff.
  • Posted the full review (with the 8-question checklist in Chinese) as a comment on the PR — GitHub rejects a formal APPROVE on a self-authored PR ("can't approve your own pull request").

Outcome: The PR is open and blocked awaiting human merge (merge is human-only per AGENTS.md). No small findings to fix on the spot. The 8-question checklist is in the review comment on the PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant