From 7dbee671fa90dfde594c25e401eff96923af579c Mon Sep 17 00:00:00 2001 From: Vasilev Dmitrii Date: Sat, 5 Sep 2026 09:18:22 +0700 Subject: [PATCH] Correct the Zig claim: it does not drop the field, and gen-zig is not a subcommand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wrote that for `bad : 0,` the Zig backend "drops the field entirely, which is worse because nothing downstream can notice". That came from `t27c gen-zig`, which is not a subcommand -- the Zig backend is `gen` -- and the empty output of a misspelled command was read as a dropped field. `t27c` says so on stderr and I was piping only stdout. The real behaviour, measured on two four-line probes: `gen` writes `bad: 0,` and, for the empty type slot, `empty: void`, and BOTH are accepted by `zig build-obj` AND by the deeper `zig test --test-no-exec`. The corrected version is the stronger finding. Rust and C reject both shapes; Zig accepts both at both readings, so the Zig column counts these specs as generating and accepting, and no shape read from Zig output would flag `empty: void` either because `void` is a legitimate Zig type. That is the reason `tri misread` reads Rust and C, and it is now stated as a reason rather than an accident. Blast radius checked rather than assumed. service.rs:1287 invokes ["gen", &sp], so the corpus numbers 581/308/190 were never produced by the misspelling, and the fan-out agent reproduced them independently. `tri misread`'s detectors and its 22/1/0/1 reading are unaffected. Corrected here: skill §566 and the module header of cli/tri/src/misread.rs; issue #3225 carries a correction comment. Refs #3225 Co-Authored-By: Claude Opus 5 --- .claude/skills/ci-gates/SKILL.md | 17 ++++++++--- cli/tri/src/misread.rs | 13 +++++--- ...-drop-the-field-i-ran-a-subcommand-that.md | 30 +++++++++++++++++++ 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 docs/now/2026-09-05-the-zig-backend-does-not-drop-the-field-i-ran-a-subcommand-that.md diff --git a/.claude/skills/ci-gates/SKILL.md b/.claude/skills/ci-gates/SKILL.md index 46b1fbb187..75dd866cad 100644 --- a/.claude/skills/ci-gates/SKILL.md +++ b/.claude/skills/ci-gates/SKILL.md @@ -16178,10 +16178,19 @@ module probe { ``` An integer literal sits in **type position**. `parse` accepts it, `typecheck` -accepts it, the Rust backend writes `pub bad: 0,`, the C backend writes `0 bad;`, -and the Zig backend **drops the field entirely**. Two backends emit something their -language cannot parse; the third silently produces a type that is missing a member, -which is worse because nothing downstream can notice. +accepts it, the Rust backend writes `pub bad: 0,` and the C backend writes `0 bad;`, +both unparseable in their languages. + +The Zig backend is where it disappears. It writes `bad: 0,` and, for the empty type +slot, `empty: void` -- and **`zig build-obj` accepts both, and so does the deeper +`zig test --test-no-exec`**. Nothing in the Zig column can see either shape, so the +corpus counts these specs as generating and accepting. + +(An earlier version of this section said Zig *dropped* the field. That was wrong and +came from running `t27c gen-zig`, which is not a subcommand -- the Zig backend is +`gen`. The empty output of a misspelled command was read as a dropped field. The +corpus itself always used `gen`, so its numbers were never affected; only this +paragraph was. See the note below.) The source of it is a declaration form the parser does not implement — a list-valued key whose items follow on later lines. Because recovery turns those items into fields, diff --git a/cli/tri/src/misread.rs b/cli/tri/src/misread.rs index 9627d863c5..b09deb3b38 100644 --- a/cli/tri/src/misread.rs +++ b/cli/tri/src/misread.rs @@ -16,10 +16,15 @@ //! ``` //! //! An integer literal sits in TYPE position. `parse` accepts it, `typecheck` -//! accepts it, the Rust backend writes `pub bad: 0,`, the C backend writes -//! `0 bad;`, and the Zig backend drops the field entirely. Two emit something -//! their language cannot parse; the third silently produces a type missing a -//! member, which is worse, because nothing downstream can notice. +//! accepts it, the Rust backend writes `pub bad: 0,` and the C backend writes +//! `0 bad;`, both unparseable in their languages. +//! +//! The Zig backend is where it disappears, and not by dropping anything: it +//! writes `bad: 0,` and `empty: void`, and BOTH readings accept them -- +//! `zig build-obj` and the deeper `zig test --test-no-exec` alike. So the Zig +//! column of the corpus counts these specs as generating AND accepting, and no +//! shape read from Zig output would flag the `void` one, since `void` is a +//! legitimate Zig type. That is why the shapes below are read from Rust and C. //! //! ERROR RECOVERY IS WHAT HIDES IT. A list-valued declaration the parser does not //! implement has its items recovered as fields, so the spec comes out the other diff --git a/docs/now/2026-09-05-the-zig-backend-does-not-drop-the-field-i-ran-a-subcommand-that.md b/docs/now/2026-09-05-the-zig-backend-does-not-drop-the-field-i-ran-a-subcommand-that.md new file mode 100644 index 0000000000..465fa3a716 --- /dev/null +++ b/docs/now/2026-09-05-the-zig-backend-does-not-drop-the-field-i-ran-a-subcommand-that.md @@ -0,0 +1,30 @@ +# NOW -- The Zig backend does not drop the field; I ran a subcommand that does not exist (2026-09-05) + +Correcting a claim that reached four merged places today. The measured facts underneath +are unchanged and the corrected version is stronger than the wrong one. + +## What I published and what is true (Refs #3225) + +- I wrote that for `bad : 0,` the Zig backend "drops the field entirely, which is worse because nothing downstream can notice" +- that came from `t27c gen-zig`, which is **not a subcommand**. The Zig backend is `gen`. An empty output from a misspelled command was read as a dropped field +- the real behaviour: `gen` writes `bad: 0,` and, for the empty type slot, `empty: void` +- **both are accepted by `zig build-obj` AND by the deeper `zig test --test-no-exec`** -- measured on two four-line probes + +## Why the corrected version is the stronger finding (Refs #3225) + +- Rust rejects both shapes and C rejects both; Zig accepts both at both readings +- so the Zig column of the corpus counts these specs as generating and accepting, and no shape read from Zig output would flag `empty: void` either, because `void` is a legitimate Zig type +- the defect is not "one backend is careless with the field" but "one backend renders it as something its language genuinely accepts", which is a harder thing to detect and a better reason for `tri misread` to read Rust and C + +## Blast radius, checked rather than assumed (Refs #3225) + +- **the corpus numbers are untouched**: `bootstrap/src/service.rs:1287` invokes `["gen", &sp]`, so 581 generate / 308 accept / 190 analyse were never produced by the misspelling +- the fan-out agent that measured the Zig column reproduced 581/308/190 independently, so its findings stand +- the false sentence appeared in issue #3225, the docs/now entry of #3226, skill §566, and the module header of `cli/tri/src/misread.rs`; §566 and the header are corrected here and the issue carries a correction comment +- `tri misread`'s detectors and its 22/1/0/1 reading are unaffected -- they read Rust and C only + +## The lesson, which I already had written down (Refs #3225) + +- "the instrument answered zero" is in my own notes, and this is the same shape: a command that does not exist prints nothing, and nothing is indistinguishable from a clean result +- `t27c` prints `error: unrecognized subcommand 'gen-zig'` on stderr and I was piping only stdout +- the guard is one line: check the exit code of a probe before believing its silence, and the positive control I built INTO `tri misread` for exactly this reason is what should have been applied to my own shell probes