Skip to content

#1488 gate QC layer - #1555

Merged
caomengxuan666 merged 5 commits into
mainfrom
rust2/gate-qc
Nov 10, 2026
Merged

caomengxuan666 merged 5 commits into
mainfrom
rust2/gate-qc

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

差分门 QC 层(#1488,工具层,不动命令代码)

#1550 打样的教训:false --help 返回 0 的 bug 藏在差分门的 note 类(「只记录不判定」)里一直没被抓到。note 免检、win 只看 rc,都是判定盲区。本 PR 给 gate 加 QC 层,把盲区变成有报表、有复核、有退出码的机制。

机制(全部在 rust2/gate/,脚本层,cargo 无关)

  1. note 抽检 — qc_note_audit.py + note-registry.tsv:note 清单(名字+预期差异描述)→ 每个 note 用例自动跑 GNU/Rust/C++ 三方探针(rc + stdout sha)→ NOTE-QC.md 输出「是否仍成立」:UPGRADE-STRICT(Rust 已与 GNU 字节一致,应升级 strict)/ MASKED-DIVERGENCE(note 掩盖 Rust≠GNU,2.0 机械替换打样: true/false 接线 rust2 staticlib 并删除 C++ 实现 (#1488) #1550 类)。有 masked divergence 时退出码 1(可接 CI)。
  2. win 审计 — qc_win_audit.py → WIN-AUDIT.md:win 类 132 例的 Rust vs C++ stdout 首次被 diff,分类 aligned / wording(品牌、路径分隔、空白归一后相同 → note 候选)/ structural(需人工)。
  3. 覆盖率看板 — gen-cases.py --coverage → COVERAGE.md:每命令 strict/exit/win/note 分布、GNU 直测占比、C++ parity、gate 结果、vacuous 列(双侧 127 空输出的假绿,bracket 家族即此类,本次已修)。
  4. 重复用例检测 — gen-cases.py --dup-check:命令内完全重复(exit 1)+ 设计内共享矩阵家族(≥50% 重叠)+ ≥5 键跨命令 review 清单。
  5. vacuous-green 修复 — run-gate.sh:bracket 家族 26 例数周来双侧 127「假绿」(bracket 不是任何一侧的程序名,Rust 注册的是 [)。加 invocation_name 映射后 26/26 真比较全绿。

首份真实数据(2026-11-10,646+686 用例全量跑,per-lane driver:wave1=main 构建、wave2=wave2 构建,报表内披露)

  • 全量 gate:686/686 GREEN(bracket 修复后为真比较),C++ parity 590/686,GNU 直测 80%。
  • note 升级候选:1 — df/df12-output-subset(Rust 字节级 == GNU,C++ 偏差继承)→ 建议升 strict。
  • note 掩盖的活偏差:1 — df/df13-drive-path(GNU rc=1,Rust rc=0 输出文件系统表;registry 已登记为继承 C++ drive 模型,命令 lane 需修复或再论证)。
  • win 黑洞排出:41 structural,最大簇是 13 个 wave2 命令的 --help/--version Rust 侧输出为空(b2sum/base32/base64/sha224sum/sha384sum/getconf/hostname/id/nproc/printenv/tac/uname/whoami)而 C++ 有完整文本——rc 相同所以 win 门从未发现。
  • 重复用例:3 — test ts25==ts37、whoami wa01==wa20、base64 b64a10==b64a30。
  • 覆盖率最差 5(win-heavy 属预期):pwd 17%、uname 18%、hostname 23%、getconf 23%、whoami 30%。

遗留

Refs #1488, #1550

All 26 bracket.tsv rows passed because BOTH sides were command-not-found:
run-gate.sh invoked the case-table stem 'bracket', but no side has a program
with that name — Rust dispatch registers '[' (winux-cmds lib.rs), the C++
dispatcher and GNU coreutils ship '[' as the program, so the GNU side's
`env bracket ...` failed rc 127 like the driver. strict compared 127==127
and empty==empty: a green that tested nothing, for weeks.

Fix: invocation_name() maps the TSV stem to the program name passed to all
three sides (bracket -> '['); ledger keeps the stem as grouping label.
Re-measured: bash gate/run-gate.sh bracket -> 26/26 with real Rust-vs-GNU
comparisons, all green.

Found by the #1488 QC sweep; systematic detection added to
gen-cases.py --coverage (vacuous column).
Parses gate/cases/<cmd>.tsv with run-gate.sh's exact column contract
(@empty@ empty args, comma-split env, tab-split preserving empty fields)
and runs one case against any side:

  rust/cpp — native spawn in a per-case scratch dir, K=V child env,
             10s timeout, setup snippet via bash
  gnu      — WSL coreutils, native ext4 scratch under
             /tmp/winuxcmd-gate-qc (never touches the gate's own
             /tmp/winuxcmd-gate), artifacts mirrored back like
             run-gate.sh does

Driver provenance: wave1 commands run through RUST_BIN (main build,
carries the truefalse sole-argument fix), wave2 commands through
RUST_BIN_W2 (their implementations are on the wave2 lanes, not main —
the main-built driver exits 127 for them). QC reports disclose the
binaries they used via provenance().

Tooling-only; no command code touched. Refs #1488.
note rows are record-only and never gate; that made them a blind spot.
The `false --help` pilot bug (#1550) lived inside a note row until manual
wiring checks caught it. This tool ends indefinite immunity:

  1. inventory — every note-mode row with its expected-deviation claim
     from gate/note-registry.tsv (undocumented notes are a finding).
  2. GNU re-check — each note case re-run against GNU (WSL), Rust, C++;
     verdicts:
       UPGRADE-STRICT    Rust byte-matches GNU; the row can gate again
                         (C++ divergence stays recorded via r=c:no)
       UPGRADE-EXIT      rc matches GNU, stdout platform-form-bound
       MASKED-DIVERGENCE the note hides a live Rust-vs-GNU divergence
                         — the exact #1550 class
  3. upgrade-candidate list — promotion decisions owned by the command
     lane; this sweep only reports.

First sweep (df wave1, real data):
  - df/df12-output-subset — UPGRADE-STRICT candidate (Rust rc+stdout
    byte-match GNU; C++ deviation inherited-not-fixed)
  - df/df13-drive-path — MASKED-DIVERGENCE: GNU rc=1 (no such file under
    WSL), Rust rc=0 prints a filesystem table (registered deviation:
    Rust follows the C++ drive model). Command lane must fix or
    re-justify; the registry claim documents it, the probe keeps it
    visible.

Exit 1 when masked divergences exist (CI-wireable). Refs #1488, #1550.
….md)

win rows gate only Rust-vs-C++ exit status; stdout is recorded but never
compared anywhere, so 132 of 686 cases (19%) had bytes nobody looks at.
This audit diffs those bytes and classifies:

  aligned     byte-equal
  wording     equal after normalizing brand/path/drive-case/whitespace —
              demote-to-note candidates (command lane decides)
  structural  normalized bodies still differ — human review
  probe-fail  harness error

First sweep (real data, per-lane drivers): 86 aligned / 5 wording / 41
structural / 0 probe-fail.

  - wording (5): all df tables — Rust follows GNU column padding where
    C++ pads differently; same structure, spacing only.
  - structural clusters:
    * wave2 --help/--version (13 commands): the Rust side prints EMPTY
      where the C++ applet prints a full usage/version block (b2sum,
      base32, base64, sha224sum, sha384sum, getconf, hostname, id,
      nproc, printenv, tac, uname, whoami). rc matches, so the win gate
      never saw it — exactly the black hole this audit exists to drain.
    * true/t07 + false/f07 --version: C++ prints a 7-line 1.2.1 banner,
      Rust prints a single brand line ("false (WinuxCmd) 0.1.0").
    * pwd (11 rows): Windows vs POSIX path forms; realpath symlink;
      printenv full-dump ordering; df -h/-H tables.

Tooling-only; no command code touched. Refs #1488.
@caomengxuan666
caomengxuan666 merged commit 1ba1564 into main Nov 10, 2026
10 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 11, 2026
…#1488)

The QC win audit (WIN-AUDIT.md, PR #1555) found a structural black
hole: b2sum base32 base64 sha224sum sha384sum getconf hostname id nproc
printenv tac uname whoami returned rc 0 with EMPTY stdout for
--help/--version. Each now prints the probed WSL-oracle text
byte-for-byte:

- coreutils 9.4 bodies + gnuhelp::footer / gnuhelp::coreutils_version
  (new shared module) for the ten coreutils commands; the first
  --help/--version flag in argv wins, like getopt_long.
- getconf carries the glibc 2.39 help/version verbatim (Ubuntu GLIBC
  2.39-0ubuntu8.9 oracle, incl. its own bug-report footer).
- hostname carries the Debian 3.23 contract: --help/-h print the
  DEBIAN_USAGE block on stdout and exit 255; --version prints
  'hostname 3.23' rc 0 (probed rc 255/0).
- printenv (wired) keeps the dispatcher contract in the product exe and
  prints the oracle bytes on the driver/FFI surface; the --abi path
  shares dispatch, so it gains the text automatically.

Also registers the four wave2 modules that shipped unregistered on
main (getconf/hostname/id/uname) — their 88 gate rows ran rc 127
(GATE-REPORT 'wiring lane scope' gap).

Unit tests per command lock the shape/rc; the strict gate rows added in
the next commit keep the bytes honest against WSL GNU.

Verification: driver --help/--version for all 13 byte-compared against
fresh 'env <cmd> --help|--version' captures (26/26 equal, rc equal);
cargo test green (279 incl. new surface tests).
@caomengxuan666
caomengxuan666 deleted the rust2/gate-qc branch November 18, 2026 05:50
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