fix(m161-r1): 崩溃/静默失败不再冒充「启动进程失败」;补三处假绿的守卫
复审 P1-1(用户可见假文案):`LaunchEnd` 在 `failure == None`(跑起来之后崩的)时
临时造了 `Stage::Spawn + format!("exit {:?}")`,于是磁贴写「启动失败 · 启动游戏进程」、
详情页漏出 `exit Some(1)`、静默失败丢掉「exit 0 却没起来」,而同一时刻 Toast 说「崩溃」。
- 新增 `LaunchFailureCause{Stage|Crashed|SilentFailure}`(dto/launch_failure.rs),
`LaunchFailureCause::of(outcome, failure, exit_code)` 是唯一组装点;`InstanceRuntime::Failed{cause}`。
`LaunchFailureStage` 保持「只装装配阶段」(文档那句「崩溃是结局不是阶段」现在成立)。
- 界面:`InstancesFailed`(框架)+ `InstancesCrashed` + `InstancesSilentFailed`;
删掉 `InstancesFailedStage`。退出码按数字出词,不再有 Debug 文本。
- 用例:presenter 断言**枚举变体**(三种形状逐条)、app 断言**具体句子**
(「不许出现 Some(」「进程起来了不许说启动游戏进程」「静默失败要点出没起来」)。
mock 夹具与 launch_state_tests 的期望值同步;launch-error 三张图重拍。
复审 P2-1(`convert::failure_stage` 零覆盖):新增 `convert/stage_tests.rs` 5 条(三档 +
「既没回滚也没宣称干净」+ 非致命无阶段 + `failed_report_with` ⇒ NotStarted)。
变异实测:改成恒 `RolledBack` ⇒ 3 条红。
复审 P2-2(矮窗口用例的算式三个数全错、`body_height` 零测试):用例改成直接调
`frame::body_height`,chrome 从 `Ui::metrics` + `WidthClass::gutter` 现取,并把门槛与真实
chrome 绑死(chrome+MIN ⇒ Split、-1px ⇒ ScrollWhole);新增 `frame` 自己的 `body_height` 用例。
变异实测:`2.0 * gutter` → `gutter` ⇒ 2 条红。
复审 P2-3(源指纹闸门 / `Refused` 零覆盖):新增两条 core 用例——闸门(原地留着 prefs.json
+ 预先写好的同源收据 ⇒ Nothing 且收据未被重写,反证:源变了允许重放)、`Refused`
(`$schema` 1.7.0 ⇒ ReadOnly ⇒ 不动旧文件、不写收据、理由含「不可写」)。
变异实测:删闸门 ⇒ 1 条红;`can_save` 守卫改 `if false` ⇒ 1 条红。
顺手收:
- CLI `pack import` 那句「已整包回滚」也按三档出词(`RollbackStage` + `rollback_line`),
加 2 条单测。CLI 不依赖 presenter,判定暂与 presenter 各一份 → 已 file finding 建议下沉 core。
- 设置页 `status_text()` 抽出 applying 档,用例断言「正在安装…」且非错误色。
金表:新 key 加在 `golden.rs`(81 行),未动 `golden/tail.rs`(211 行),避免与 M162 的拆分冲突。
This commit is contained in:
1 parent
6804b0ad1d
commit
79b796fd58
21 files changed
+894
-168
No files matched your search
@@ -35,7 +35,9 @@ pub(super) const GOLDEN: &[(&str, &str, &str)] = &[
|
||||
("InstancesIsolationIsolated", "Isolated", "独立目录"),
|
||||
("InstancesIsolationShared", "Shared", "共用目录"),
|
||||
("InstancesRunning", "Running · pid {pid}", "运行中 · pid {pid}"),
|
||||
("InstancesFailedStage", "Launch failed · {stage}", "启动失败 · {stage}"),
|
||||
("InstancesFailed", "Launch failed · {reason}", "启动失败 · {reason}"),
|
||||
("InstancesCrashed", "the game crashed (exit {code})", "游戏崩溃(退出码 {code})"),
|
||||
("InstancesSilentFailed", "exit 0, but never started", "退出码 0,没起来"),
|
||||
("InstancesStageDownload", "Downloading", "下载中"),
|
||||
("InstancesStageVerify", "Verifying", "校验中"),
|
||||
("InstancesStageLaunch", "Starting", "启动中"),
|
||||
|
||||
@@ -73,7 +73,13 @@ macro_rules! instances_entries {
|
||||
InstancesIsolationShared => ("Shared", "共用目录"),
|
||||
// ── 运行状态与启动阶段(M120;数字与分隔符不随语言变形)
|
||||
InstancesRunning => ("Running · pid {pid}", "运行中 · pid {pid}"),
|
||||
InstancesFailedStage => ("Launch failed · {stage}", "启动失败 · {stage}"),
|
||||
// 失败状态行的**框架**:`{reason}` 是「哪一步」或「结局」的短句
|
||||
// (M161 复审 P1-1:「起来了又崩」与「没起来」必须能说出不同的话)。
|
||||
InstancesFailed => ("Launch failed · {reason}", "启动失败 · {reason}"),
|
||||
InstancesCrashed => ("the game crashed (exit {code})", "游戏崩溃(退出码 {code})"),
|
||||
// 单行列表行也要放得下(`Launch failed · ` + 这一句 ≤ 行宽),
|
||||
// 「exit 0 却没起来」这一条信息必须留(复审 P1-1 第 ③ 条)。
|
||||
InstancesSilentFailed => ("exit 0, but never started", "退出码 0,没起来"),
|
||||
InstancesStageDownload => ("Downloading", "下载中"),
|
||||
InstancesStageVerify => ("Verifying", "校验中"),
|
||||
InstancesStageLaunch => ("Starting", "启动中"),
|
||||
|
||||
Reference in new issue
Block a user