Repository navigation
fix(test): key the Vcs render budget to the in-process bare-spawn ratio (#423) - #436
Conversation
…io (#423) The flat 45ms p50 budget false-armed master twice on the 2-core shared CI runner (ce5f225: p50 47.7ms; 76f148b: p50 49.4ms against max 73.2ms) - the bare `git status` spawn alone costs that much there, so a unit-level absolute p50 has no verdict on shared hardware. Three-door composite, #604's ratio shape with #337's hard/soft spirit: - primary: segment p50 <= 1.5x the p50 of the bare spawn it wraps, interleaved sample-for-sample in-process. A uniform runner slowdown moves both numbers and the ratio holds; a real regression does not - a second spawn doubles the ratio, a fixed quantum (drain thread, hidden console) shows up as ratio on any machine. - backstop: p50 > 135ms (3x the old budget) fails regardless of ratio, so a hang or an unbounded sweep cannot hide behind a slow baseline. - the old 45ms budget is demoted to a soft warn, printed not gated. Teeth proven by mutation: +20ms sleep in the render path -> red (p50 42.3ms vs budget 29.9ms; the old flat gate would have passed this locally); budget multiplier shrunk to 1.02 -> red; a second spawn injected into read_status -> red (ratio 2.1). 10/10 consecutive green runs locally, worst healthy ratio 1.27 (under background load that pushed one sample to 353ms - the old gate's exact failure mode).
CR 结论:APPROVE-WITH-NITS(无 BLOCKER)独立复核(自建 worktree @ dde0174,merge-preview 对 origin/master 1. 门设计审计(核心)
2. 有牙复验(本机自跑)+20ms sleep 注入渲染路径 → 红:p50 43.73ms vs 比值预算 30.64ms(比值 2.14),prompt_segments.rs:1124 的相对门 assert 触发、135ms 上限正确保持沉默。附带证实:43.7 < 45,旧平面门本会放行这一突变——PR 表述属实。突变已还原,worktree 树干净( 3. 防假红复验本机 10/10 连跑绿(比值 1.04-1.13)。更有说服力的是本 PR 自己的 CI run(打红 master 的那类 2 核共享 runner): 4. 回归门禁(本机复跑)
5. 夹带扫描单文件单提交(dde01742),+116/-14 全在 6. #423 票面关闭引用评论已挂,ce5f225e 与 76f148b 两实录均给出新门下的比值复盘(≈1.05-1.10 → 绿),与我的 CI 实测(1.01)一致。 NIT(不阻塞,择机处理)
不合并。复核用 worktree 已删除。 |
Closes #423.
Problem
vcs_segment_render_p50_within_the_render_budgetfalse-armed master twice in two days on the 2-core shared CI runner:The segment is one
git status --porcelain=v2 --branchspawn and nothing else; on that runner the bare spawn alone costs 45-50ms, so a unit-level absolute p50 has no verdict on shared hardware.Fix (ticket option 2 primary, option 1 as backstop — #604's ratio shape over #337's hard/soft spirit)
Three-door composite in the same test:
git_prompt::read_statusand measured in this process, interleaved sample-for-sample (21 pairs). A uniform runner slowdown moves both numbers and the ratio holds; a real regression does not — a second spawn doubles the ratio (~2x), a fixed quantum (drain thread ~15ms, the CREATE_NO_WINDOW console ~28ms) shows up as ratio on any machine. A 20ms floor guards the degenerate-zero baseline.Teeth (mutation-verified)
+20ms sleepin the render pathgit statusspawn injected intoread_statusFalse-red immunity
10/10 consecutive green runs locally (worst healthy ratio 1.05-1.27). The 1.27 run is the money shot: background load pushed one sample to 353ms and p50 to 37.6ms while the interleaved baseline rose to 29.5ms in lockstep — the exact CI failure mode that armed the old gate — and the ratio gate stayed green.
Gates
cargo test -p niubash-runtime --lib -- --test-threads=1: 554 passed / 0 failedcargo fmt --check --all: cleanRUSTFLAGS="-D warnings"on lib + test profiles: clean (clippy is not a CI gate here; the only clippy hits in the touched file are pre-existing at line 394, outside this diff)