Repository navigation
[PR] fix: corrupted index.db now auto-quarantines and recovers instead of degrading forever (quick_check throw shapes) - #5123
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6947-pr.5123.345ed03This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5123.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。本 PR 是 #4816 的正规修复实现(后到并入先到,#5108 挂 duplicate)。我独立核对:#4816/#5108 描述的症状(throwing-shape corruption 绕过 #4175 隔离 → 永久 legacy-only degrade)与本 PR 修的路径一致;merge-tree 对当前 master 无文本冲突,CI 正跑在同一 sha 方向关(①):正确,且是「疏」不是「堵」。根因定位准——shadow 隔离守卫只认 回归审查(②)——逐项过既有行为:
代码审查(③): 测试有效性(④):新 test 7/7 真断言、双向(classifier 正+负;quarantine-recover + rename-fail-degrade);用真实字节损坏配方(truncate/garbage-header/zero-page-2),非 mock。engproof/banner 重定向自洽——garbage-file corruption 现在自愈,故 banner 场景改用确定性 no-engine 钉 wire 形状,engproof 改钉 quarantine-and-recover 且 leak guard 重定向到 quarantined 文件。本地定向 27/27 绿 + typecheck 绿;全量 = CI(在跑 sha diff 整洁度(⑤/⑤b):11 文件全部与目的相关,无无关 churn、无空白噪声、命名达意、注释讲为什么。 结构化八问
判定:质量达标,可合(待 CI 绿)。两点流程提醒,非阻塞:
|
… tests) - runtime-status shortenError: raw .slice(-78) -> safeSuffix (and head via safePrefix) — the code-unit-safe clamp the #816/#1615 family gate requires - issue4816 rename-fail test: pin BILI_STORAGE_UNIFIED=full around the wire assertion — the CI baseline preload pins legacy for the non-storage corpus (#2815), so requested resolved to legacy and nothing was reportable as degraded (passes locally without the preload, fails on every CI shard) - storage-review-fixes review 3: re-pinned to the NEW intended behavior — the garbage-header corruption shape makes quick_check throw, so the store now quarantines the corrupt file set and recovers a fresh index instead of degrading legacy-only forever (PR behavior change (a)); asserts the forensic copy + fresh index.db exist
Phase 1 keyed the client's degrade decision off the additive parentBlocks count plus a local branchPoint<core.length check. That re-derives server state on the client and silently no-ops when a mixed-version peer lacks the new field. Per review, move the judgment to the server: it computes degraded = (inherited 0 blocks while the parent held some) from its own ledger and sends an additive boolean; the client honors it directly and no longer second-guesses with a truncation gate. Old clients ignore the flag. Adds a test pinning that the client degrades on the flag even for a full local match (no residual truncation gate), and pins degraded:false for a healthy never-compressed parent clone.
(ai: vllm-qwen/qwen3.8-27b) CI 红已修,全绿。 修复 commit 6 条红的 test lane 归并为 3 个独立问题,全部在本 PR 自己的代码/测试里,master 是绿的(非继承性红):
结构化八问
备注:分支仍落后 master 约 10 个提交(此前 review 确认 merge-tree 无文本冲突),CI 在当前 head 全绿。收工判定:可合并。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Outcome: no action possible — PR #5123 upstream is merged & closed (merge commit 38ea945), so there's nothing to rebase/merge or push into an already-merged head branch. The repeated behind/conflict flags are a stale pre-merge snapshot; the merge-guard should stop firing on this closed PR. |
Resolve the fork-identity hash field-set conflict as the union of #5123 serialization-tolerance (drop contentType, JSON-canonicalize tool-call text) and #4266 signed-content carriers (drop thinkingTokens value; add thinkingSignature/googleThoughtSignature/redactedPayloadDigest). Pinned by tests/dsh-fork-adopt.test.ts parity + tests/issue4266-fork-thinking-gate.test.ts drift pins.
master moved past the previous sync (dc041dd) by the web handoff-render (#6260) + anthropic trailing-system (#5432/#5441) + snapshot-write-lifecycle (#6186) landings. None of those commits modify src/plugin.ts or src/agent/fork-adopt.ts (master's version of both == merge-base), so this merge is clean and preserves the #5123/#4266 union resolution untouched.
What & why
A corrupted
index.dbwhose corruption makesPRAGMA quick_checkthrow (truncated file, garbage header, page-content corruption) escaped the #4175 quarantine entirely: the shadow layer only caughtStorageIntegrityError, but every throwing shape re-threw the raw driver error → permanent legacy-only degrade with no auto-heal, while the banner kept pointing users at "delete the file". The non-throwing path (quick_check returns rows) was quarantined correctly — this PR closes the gap so every corruption shape reaches the same quarantine decision.Work consolidated under #4816 (same symptom + mechanism as #5108, which carries the duplicate label). 查重: 与 #4816 同症状同机制(后到并入先到);no in-flight fix PR references #4816 (searched open+closed issues and PRs, 2026-10-29).
Changes (one facet per commit)
src/storage/sqlite-errors.tsnew,store.ts,integrity-check.ts): a small classifier matches exactly the two SQLite corruption shapes —SQLITE_CORRUPT/SQLITE_NOTADBerror codes or the stable errmsg strings ("database disk image is malformed", "file is not a database") — across both engines (node:sqlite builtin, better-sqlite3, including[storage:<engine>]-wrapped messages). Transient shapes (SQLITE_BUSY/IOERR/CANTOPEN/SHORT_READ) deliberately do NOT match: quarantining a merely locked-but-healthy index over a transient AV lock (the Windows Defender class, [bug] 0.1.63 起 Windows persist EPERM 风暴:会话持久化静默丢数据(4.9k 次/117 会话)+ compress no-valid-ranges 拒绝 #362/SQLite unified storage degraded to legacy-only (bili v0.1.202, node v24.21.0, win32-x64) #3823) would destroy a working index.quick_checkcatch: classified throws becomeStorageIntegrityError(quarantine-able) instead of escaping raw.shadow.ts): rename failures are no longer swallowed silently. Missing sidecars are pre-checked (normal), each failure captures its errno, and a failed PRIMARY rename degrades loudly naming the errno and does NOT attempt a doomed fresh reopen; leftover-wal/-shmwarn only (probe-verified: SQLite resets a stale WAL rather than replaying it onto a fresh file).driver.tsgetter,runtime-status.ts):/__bili/statusstorage.enginereports the resolved engine when the open failed AFTER resolution (was null → misdirected triage toward "install sqlite"); the diagnostics blob annotates the engine line accordingly.shortenErrormiddle-truncates >160-char reasons so the errno at the tail survives long Windows paths.launcher.ts, the observability half promised in the SQLite unified storage degraded to legacy-only (bili v0.1.208, node v24.21.0, win32-x64) #4816 thread): bootstrap-failure messages sample the child-log TAIL when output exceeds the 256-byte window (the "head" label is unchanged for ≤256B output).tests/issue4816-integrity-throw-quarantine.test.ts(classifier truth table, both directions per Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617; store/shadow/worker/diagnostics facets incl. rename-failure via chmod and cross-restart FAIL-cache persistence);corrupt-index-child.tsscenarios repurposed — engproof now pins quarantine-and-recover to full mode with the leak guards re-targeted at the quarantined file, and the banner scenario switched to the deterministic no-engine failure (garbage-file corruption now heals itself, which is the point); parents updated accordingly.Behavior changes (old → new)
StorageIntegrityError→ auto-quarantine (index.db.corrupt-<stamp>kept for forensics) + fresh full-mode index; old sessions import lazily from the legacy envelopesstorage.engine=nullwhenever the sidecar didn't openengine: nonemisdirected triage when the real problem was the file (reporter side note)(resolved, but index.db open failed — see degrade reason)annotation...…+ tail 78No config/env surface added. No
kernel/changes.Verification
quick_checkthrow the CORRUPT/NOTADB shapes; zeroing page 2 keepsopen()healthy so the async worker facet is exercised against a real throw.