Skip to content

feat(xvm): let self doctor --fix take down an incoherent release - #396

Merged
Sunrisepeak merged 1 commit into
release/0.4.70from
feat/xvm-doctor-repair
Jul 26, 2026
Merged

Sunrisepeak merged 1 commit into
release/0.4.70from
feat/xvm-doctor-repair

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

P1.3 (第一部分) of the 0.4.70 release train。

Problem

#394 让 doctor 能说出哪个 release 的成员互相矛盾,但不能对它做任何事。指出一个自己拒绝处理的问题,只是半个出口。

Change

--fix 现在会停用这样的 release:它的每个成员都退出 active workspace,用户用一条 xlings use 重新选择。

为什么是停用而不是修复

修复意味着要判定哪个成员是"对的",而没有依据做这个判断 —— 用户可能想要任一 release,而静默挑一个正是这个状态最初出错的方式。

未激活的工具链是看得见的问题;不一致的工具链会让 gcc --version 报出正确版本,然后在链接期才炸。

整组下线

不只是那些"不一致"的成员 —— 把一致的那些留在 active 只是把一种不一致换成另一种。

范围刻意收窄

无法解析的、以及元数据损坏的条目,仍然只报告不触碰。修复它们意味着丢弃已存储的元数据,那需要用户的明确同意,而不是一个他为了修 shim 而传的 flag。未分组的包永不波及。

修复路径与其它变更路径一样:取状态锁、重载、再写。

Tests

测试 覆盖
DeactivationTakesDownEveryMemberOfAnIncoherentRelease 整组下线,且计划里带 release 标识
DeactivationLeavesACoherentWorkspaceAlone 不误伤一致状态
DeactivationIgnoresUnresolvableReleases 不静默丢元数据
DeactivationLeavesUngroupedTargetsAlone 无关单包不是附带损伤

剩余部分

元数据损坏条目的修复(--reset-metadata)仍未做,原因见 #394:需要先为未解析的记录保留原始 JSON,否则保存本身就会丢信息。那是独立的一次改动。

Verification

mcpp build   →  Finished release [optimized] in 41.13s
mcpp test    →  test result ok. 11 passed; 0 failed
XvmInspect   →  11 passed

CI 状态为已知上游拉取签名(见 #386),依计划 §3.1.1 合入集成分支。

doctor could name an active release whose members disagree, but not do
anything about it. Naming a problem the tool refuses to touch is only
half an exit.

--fix now deactivates such a release: every member of it leaves the
active workspace, and the user re-selects with one `xlings use`.

Deactivating rather than repairing is the point. Repair would mean
deciding which member was right, and there is no basis for that choice
-- the user may have meant either release, and picking one silently is
exactly how the state went wrong in the first place. An inactive
toolchain is a visible problem; an incoherent one reports the right
version from `gcc --version` and fails at link time.

The whole release comes down, not just the members that disagree.
Leaving the agreeing ones active would swap one incoherent state for
another.

Scope is deliberately narrow. Unresolvable and corrupt entries are still
reported and left alone: repairing those means dropping stored metadata,
which needs explicit consent rather than a flag the user passed to fix
their shims. Ungrouped packages are never touched.

The repair takes the state lock and reloads before writing, like any
other mutating path.

Tests cover the whole-release takedown, a coherent workspace being left
alone, an unresolvable release being left alone, and an unrelated single
package not becoming collateral damage.
@Sunrisepeak
Sunrisepeak merged commit fa50fe1 into release/0.4.70 Jul 26, 2026
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant