Repository navigation
feat(dsh-lane): converge all three ledgers on in-place self-heal + bili doctor --fix (#3496) - #3509
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4224-pr.3509.b154279This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3509.tgz
npm install -g packageInstall instructions are refreshed on each push. |
fdfe800 to
df9df2c
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 是 #3496 的唯一实现 PR(正文 Closes #3496),与在途的 #3231(provenance 检测半边)互补不重叠——检测归 #3231、修复/收敛归本 PR;近期 open/closed issue 与 PR 中无同签名(manifest+lockfile+副本三账收敛 / 开始独立审阅(PR Review 规范全套:方向关→回归关→代码关→测试关→diff 整洁度)。已注意分支 base |
a74a7e5 to
9e8e331
Compare
(ai: vllm-qwen/qwen3.8-27b) Review 结论(独立重审:原分支落后 master 19 个提交,已 rebase 到当前 master 八问:
Review 中发现的 3 个问题已直接在分支上修掉(独立 commit
验证证据:本地 typecheck+build 绿;定向套件 105/105(修复前,9 个文件)+ 62/62(修复后,4 个文件);远程 CI 在 合并判定:代码就绪,但按仓库规则还有两道人工闸门:
后续项(不扩本 PR 范围):本 PR 与 #3231 都合入后,把 provenance.ts 与 dsh-ledger.ts 之间重复的 lockfile reader 收敛为一份,届时单独立项跟踪(PR 正文已记)。 @ranxianglei 等你拍板发版顺序(no-op release 先行 → 再合本 PR)。 |
|
ai: zhipuai-lb/glm-5.3 Live end-to-end verification (real proxy driving the desktop-lane in-place update cycle against a local static registry, three pnpm major versions, plus Matrix (all with the PR build as both the old and new copy):
Assessment of the pnpm ≥12 edge: dsh's own runtimes embed pnpm 9/11 (op logs: Suggested follow-up (not blocking): converge could also inject the Reproduction artifacts kept locally ( Verdict: verified, recommend merge — the #3160/#3496 failure mode (update leaves ledgers diverged; next install silently reverts or, worst case, breaks) is closed on every pnpm version dsh actually drives. |
…li doctor --fix (#3496) The dsh desktop lane is the one copy bili overwrites in place (#1575/#2894). Its self-heal previously synced only the manifest spec and deliberately left the lockfile record naming the old version — manufacturing exactly the wedge class #3224 detects and #3160 bit users on (stale lock record / unresolvable manifest spec -> next pnpm install 404s or reverts the update). - src/dsh-ledger.ts (new): ledger readers (pnpm nested v6+/v9, flat <=5.4, v6-v8 top-level; npm package-lock.json fallback), #3231's three-rung findings semantics ported verbatim, and convergeDshLedger() — plan everything then write atomically (tmp+fsync+rename), healthy profiles get zero writes. - src/update.ts: the installViaTarball success hook (desktop-gated) now calls convergeDshLedger instead of bare manifest sync — all three ledgers move in one transaction, local pins respected, failure logs but never fails install. - src/dsh-channel.ts: syncDshProfileManifestSpec split into a pure planner + atomic writer; the wrapper keeps byte-identical behavior/reasons. - bili doctor --fix: explicit repair pass over every dsh profile (desktop included — detection excludes it by design, repair must reach it), converges to the on-disk copy version, prints every before->after change, re-audits for residuals, non-zero exit when anything remains. - AGENTS.md: Install-Lane contract item 6 — an in-place writer keeps all three ledgers in step. Tests: tests/issue3496-dsh-ledger-convergence.test.ts (23, fixture matrix incl. the #3160 ^1.2.9 shape, healthy zero-writes, refusal cases) + one integration test in tests/update-desktop-inplace.test.ts.
… pin zero-writes by mtime; cover doctor --fix flag parse
d1248ad to
bc1b3c8
Compare
(ai: vllm-qwen/qwen3.8-27b) 收到实机端到端验证矩阵——和我这边的独立审核结论互相印证(#3160/#3496 失败模式在 dsh 实际驱动的所有 pnpm 版本上已闭环),同意「verified, recommend merge」的判定。两件事已处理: 1. pnpm ≥12 边缘已单独立项跟踪:#3570 2. 分支又往前挪了一步:我审核期间 master 合入了 v0.1.198 release(#3534)等 15 个提交,与本 PR 零文件重叠,已再次 rebase 到当前 master。新 head: 等你拍板的一件事 — no-op 验证 release(§5 流程闸门):本 PR 改了 关于这个 release 提议本身:
你回复「批准发布 v0.1.199」我就切分支开 release PR;它合并发布后,本 PR 即可合并(§7.4 人工合并)。 |
(ai: vllm-qwen/qwen3.8-27b) CI 确认(rebased head 清单里唯一的一个红是 状态不变:等你拍板 no-op 验证 release v0.1.199(§5,updater 改动的前置闸门)。你回复「批准发布 v0.1.199」我就切 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.539-master.5bea7ee # this exact build
npm install -g billion-context@master # always the newest merged build
|
…ions and keep it when rewriting
pnpm appends a peer-resolution suffix to an importer's resolved version
when the package or one of its dependencies has a satisfied peer:
`version: 0.1.213(@types/node@16.9.1)`. The ledger code took the whole
scalar for the version. A healthy profile was reported as copy-vs-lock,
and convergence (`bili doctor --fix`, the pass after an in-place update)
rewrote the line to the bare version: a write where nothing had drifted,
leaving the importer without the suffix its snapshots key carries.
- splitPeerSuffix(): split the scalar at the first "(".
- readPnpmLockResolution returns the version without the suffix, so the
state and the findings carry a plain version.
- patchNestedEntries compares the version part only; when the version
really moves it swaps that part and keeps the suffix and the quoting
the line already had.
- tests/issue3496-dsh-ledger-convergence.test.ts: v9 fixture with a peer
suffix; healthy triple gives no finding and zero writes; real drift
changes only the two importer lines and keeps the suffix; multi-peer,
quoted and v6-v8 nested shapes.
packages:/snapshots: stay untouched as before (ranxianglei#3509, ranxianglei#3570).
(cherry picked from commit 9ae09b3)
(ai: vllm-qwen/qwen3.8-27b)
Closes #3496
What this does
The dsh desktop lane is the one copy bili overwrites in place (self-heal swaps
node_modules/billion-contextfrom a verified registry tarball, #1575/#2894). Until now that writer moved only ONE of the three ledgers — the manifest spec (#2894) — while deliberately leaving the lockfile record naming the OLD version. That manufactured exactly the wedge class #3224 detects and #3160 bit users on: after an auto-update, the profile's pnpm bookkeeping still names the old version, so dsh's in-app plugin manager can revert the copy on the next "install" click, or a hand-edited manifest (^1.2.9phantom) makes the nextpnpm install404.This PR closes the loop per the issue's three requirements:
src/dsh-ledger.ts:convergeDshLedger(profileDir, targetVersion)plans every change first (all-or-nothing), then writes atomically (tmp+fsync+rename, the [dsh] #2894/#2891 dsh lane 状态同步与检测:四个子缺陷(清单原子写 / lockfile 一致性 / Windows 大小写 / doctor 告警收敛窗口) #2972-M1/[bug] 会话状态写入缺 fsync:内核崩溃后留下 size 正常但 VDL=0 的全零状态文件,loadSync 永久抛错 → 502 acp-proxy failure 且不自愈(含 7 处 tmp+rename 写路径盘点) #3157 discipline) — manifest spec (via split-outplanDshProfileManifestSpec, byte-identical rules) + pnpm-lock.yaml record (nested v6+/v9 importers, flat ≤5.4specifiers:/dependencies:, v6–v8 top-level sections) + package-lock.json fallback (npm-materialized profiles). TheinstallViaTarballsuccess hook (src/update.ts) now calls it instead of bare manifest sync — desktop-gated, so the global self-update and advisory call sites are untouched.bili doctor --fix. Walks every dsh profile (desktop included — detection excludes it by design, but repair must reach the very profile where Profile 副本自愈可被本地高版本号永久卡死,且 out-of-band 副本无来源校验(#1196 变体) #3160 happened), converges drifted profiles to their on-disk copy version, prints every before→after change, re-audits for residuals, exits non-zero when anything remains. Healthy profiles get ZERO writes (byte-identical, tested).config surface
New CLI flag:
bili doctor --fix(no env vars, no config-file fields;--jsonoutput gains an optionalledgerFixesarray). Shape proposed by the owner in the issue body ("如bili doctor --fix形态") — recorded here as the sign-off per AGENTS.md Configuration Surface Discipline. Justification: the existing surface cannot express "repair" at all — doctor was read-only by contract, and a finding's remediation text pointing at re-running install through the host channel does not work for the DESKTOP profile (the CLI refuses--profile desktop, #1575) and would not touch the lockfile record anyway.§5 declaration — src/update.ts touched
The change touches
src/update.ts(theinstallViaTarballsuccess hook, inside the existing desktop-only gate). Per §5 this requires a NO-OP validation release FIRST to prove the existing upgrade path is healthy end-to-end before this ships. That release needs your go — approve in-thread and I'll cut it (or fold it into the release that carries this PR).Behavior changes (old → new)
info ... manifest spec now declares Xinfolists each before→after when something changed;warn+bili doctor --fixhint when convergence failedintegrityhash is DROPPED alongside the version/resolved rewritenpm ci; dropping it lets npm re-fetch and verifybili doctor--fixis the sole write path — explicit trigger, prints every change, re-verifiesAcceptance mapping (issue #3496)
^1.2.9shape —tests/issue3496-dsh-ledger-convergence.test.ts: post-self-heal wedge, raw Profile 副本自愈可被本地高版本号永久卡死,且 out-of-band 副本无来源校验(#1196 变体) #3160 phantom shape (spec admits copy → manifest kept, lock converged), full three-rung wedge, flat ≤5.4 pnpm lock, v6–v8, npm package-lock, local pin respected, dist-taglatest, range spec, tilde refusal, exact-style preservation, no-lockfile wedge, corrupt manifest abort, moving-target guard, desktop gating, multi-profile walk, fail-soft absent DSH_HOME. After converge all three ledgers name one version, so apnpm install --lockfile-onlydry run resolves instead of 404ing.syncDshProfileManifestSpecbehavior); tests/doctor.test.ts 11/11; plus update-tarball / update-proxy / update-host-guard / issue2082-desktop-boot-smoke / update-owner-lane-backoff / cli-parseargs / cli-export = 39/39. Full-suite verdict = CI on this head. feat: detect manifest/lockfile/copy three-way disagreement in dsh profiles (#3224) #3231's detection tests live on its own unmerged branch — untouched here; its findings semantics were ported verbatim, so both stay consistent.