fix(ufs): the gate reads Rust and Go, and drift stops being silent - #19
Merged
Conversation
`write_any.sh` has declared `*.rs` and `*.go` for as long as those packs have
existed. `audits/ufs.sh` read neither — its `is_source` listed zig/ts/tsx/js/jsx
only. So the façade fired on a Rust file, printed a green UFS row, and handed
off to a leaf that filtered the file out before reading a line of it. A crate
shipped `pong == "PONG" || pong.contains("PONG")` under that green light.
Two halves, because the missing coverage and the silence are separate bugs.
The leaf now reads `*.rs` and `*.go`. One rule, but each language hides its
literals differently, so each gets a lane rather than a wider glob. Rust:
`#[cfg(test)]` and `#[test]` blocks (unit tests live inside the file they
cover), `#[…]` attribute literals, `static` bindings beside `const`, and the
crate-root `tests/` and `benches/` trees the old `\/tests\/` form needed a
parent directory to see. Go: `const ( … )` members, which carry no keyword of
their own, and backtick struct tags. Every carve-out is for what the LANGUAGE
makes unfixable — an attribute takes a literal token by rule, a struct tag is
read by reflection, and no rename reaches either. Measured on a real crate:
240 hits down to 30, and the 30 are real. On a 2192-file Zig/TS tree the
output is byte-identical to before.
The dispatch-coverage audit gains check (h): every extension a façade fires on
is read by its leaf, or carries a written reason it is not. Reverting the scope
line turns that check red, which is the signal that was missing. `.py` and `.sh`
are named out of scope there with their reasons — Python writes ~14% of its
literals in single quotes this matcher does not read, and a repeated `"$var"` in
shell is interpolation, not a magic string (59% of hits on a real tree). Both
need a lane built before the glob widens; neither gets partial coverage
reported as full.
Four fixtures pin the lanes. Disabling any single carve-out turns the matching
`_ok` fixture red, so the fixture is the drift detector, not the comment.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Checked against the incident that prompted this — agentsfleet's rustd workspace, at the commit before its literals were bound by hand. The new lane catches all 20: `"XADD"` ×3, `"PING"` ×3, `"EVAL"`, `"SET"`, `"HSET"`, `"XREADGROUP"`, `migrate.acquire_lock` — the CMD_XADD / OP_ACQUIRE set, exactly. At the commit after, 1 remains. That check also surfaced a lane gap. Rust marks compiled-in fixture data with `#[cfg(feature = "test-util")]` when a sibling integration test has to call it — 26 files in that workspace do — and the lane only knew `#[cfg(test)]`. Eight of nine residual hits came from one `one_of_each_kind` error-surface enumerator: unfixable by any rename, and precisely the noise that teaches people to stop reading the gate. The seam now joins the carve-out set. Narrowly. The feature name must be `test` as a whole word or a `-`/`_` segment, so `#[cfg(feature = "redis")]` still counts and `"latest"` is not mistaken for a seam. `ufs_feature_gate.rs` pins that from the other side: its only violation sits inside a production feature gate, so widening the pattern turns the fixture green. A carve-out that quietly eats a production block is the same scope hole this PR opened with, wearing better clothes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Touch-it-fix-it on the Triggers line this branch already edited. It named `agentsfleet/src/`, `agentsfleet/test/` and seven `ui/packages/*` prefixes — one repository's directory tree, in a card shipped by the GENERIC universal.authoring pack. Same defect 09bf3a6 fixed for make targets, in path form: every other repository is handed a trigger list it cannot match, and the Pre-edit checks below it told a single-runtime crate to "grep all three runtimes". Both now say what the surface IS — the repository's declared `surfaces.user` prefixes, and every runtime it actually ships — and each repository binds its own. The concrete paths move behind `oracle-packs:start product.agentsfleet`, the mechanism this file already uses twice. A generic Rust repository now renders neither `agentsfleet/` nor `rustd/`; agentsfleet renders both. Two of those prefixes were also simply wrong. `agentsfleet/src/` and `agentsfleet/test/` do not exist in that repository and have not for some time. The same stale prefix sits in `ufs.sh`'s cross-runtime parity scan, where `js_err` globs `agentsfleet/src/*.{js,jsx,ts,tsx}` and matches ZERO files — so the "every JavaScript ERR_* must exist in Zig" half has been vacuously green, with three real codes in `cli/src/` never once compared. That is this branch's own bug class, found by reading the line I was editing. It is left for its own change rather than folded in here: unmuting a check that has been silently passing may surface real drift, and that deserves its own before/after, not a footnote in a scope-hole PR. The Rust root is recorded as `rustd/crates/*/src/`, which is where it is. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
"Everything else counts, including `examples/`, which ships and compiles" was
an argument from the wrong thing. Compiling is not why a rule applies.
What actually repeats in example code is coupling: a cache namespace declared
at the top of a walkthrough and matched ninety lines below it, a fixture id
that is both the fake store's match arm and the key five call sites pass. One
end moves and the example breaks with no error. That is ordinary UFS drift, in
the file a reader copies from — which makes examples/ a worse place to leave it
than src/, not a softer one.
Had the repeats been demonstration-shaped — set("k"), then get("k") to show the
API — holding examples/ out would be right. Checked against a real crate: they
are not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
dispatch/write_any.shhas declared*.rsand*.gofor as long as those packs have existed.audits/ufs.shread neither — itsis_sourcelistedzig/ts/tsx/js/jsxonly.So the façade fired on a Rust file, printed a green UFS row, and handed off to a leaf that filtered the file out before reading a line of it. Not an absent gate — a green light over an unscanned file.
The missing coverage and the silence are separate bugs, so this fixes both.
Checked against the actual incident
agentsfleet'srustdworkspace, at4f6afd6ba~1— the commit before its literals were bound by hand. The new lane catches all 20:That is the
CMD_XADD/OP_ACQUIREset, exactly — the work that had to be found by hand-rolling a script because no gate would do it. At the commit after the cleanup: 1 remains, and it is a fair finding (see below).rustd(74 .rs, pre-cleanup)rustd(77 .rs, post-cleanup)The leaf reads Rust and Go
One rule, but each language hides its literals differently, so each gets a lane rather than a wider glob. Every carve-out is for what the language makes unfixable — not permission.
#[cfg(test)]/#[test]blocks — unit tests live inside the file they cover#[cfg(feature = "test-util")], for a helper that must compile into the crate so a sibling integration test can call it#[…]attribute literals —#[serde(rename = "…")]takes a literal token by language rule; no const is legal therestaticbindings, besideconsttests/andbenches/— the old\/tests\/form needed a parent directory and walked straight past themconst ( … )members — the keyword is stated once, on the opening linejson:"id"is read by reflection; a const cannot appear inside oneThe test-seam carve-out came directly out of checking against
rustd: 26 files there use#[cfg(feature = "test-util")], and 8 of 9 residual hits were oneone_of_each_kinderror-surface enumerator. Unfixable by any rename, and exactly the noise that teaches people to stop reading a gate.It is matched narrowly —
testas a whole word or a-/_segment — so#[cfg(feature = "redis")]still counts and"latest"is not mistaken for a seam.Drift stops being silent
evals/dispatch/coverage.shgains check (h): every extension a façade fires on is read by its leaf, or carries a written reason it is not. Reverting the scope line turns it red — that is the signal that was missing.Check (b)'s fixture extractor was also pinned to
.zig, so a fixture in any other language was invisible to it. Widened..pyand.share named out of scope, with reasonsDeclared, not forgotten, each with the measurement behind it:
.py— ~14% of literals in a real tree are single-quoted, which this matcher does not read. It also needs#stripping,"""docstring tracking, and a module-const model. Partial coverage reported as full is the exact bug this PR exists to fix..sh— a repeated"$var"is interpolation, not a magic string: 59% of hits on a real tree, and shell has noconstto bind to.Both need a lane built before the glob widens.
.mdxis not code.Fixtures pin every lane
Five new fixtures. Each is load-bearing — disabling the matching carve-out flips it:
#[cfg(test)]block skipufs_ok.rs→ red#[cfg(feature = "test-util")]seam skipufs_ok.rs→ red#[attribute]carve-outufs_ok.rs→ redstaticbinding carve-outufs_ok.rs→ redconst ( … )trackingufs_ok.go→ redufs_ok.go→ redufs_feature_gate.rs→ green (caught)That last row is the one that matters most:
ufs_feature_gate.rs's only violation sits inside a production#[cfg(feature = "wire")]block, so a carve-out that quietly eats production code fails it. A scope hole wearing a carve-out costume is still a scope hole.Touch-it-fix-it: the UFS card stopped shipping one repo's layout
The Triggers line this branch edited named
agentsfleet/src/,agentsfleet/test/and sevenui/packages/*prefixes — one repository's directory tree, in a card shipped by the genericuniversal.authoringpack. Same defect 09bf3a6 fixed for make targets, in path form. The Pre-edit checks below it also told a single-runtime crate to "grep all three runtimes".Both now say what the surface is — the repository's declared
surfaces.userprefixes, and every runtime it actually ships. The concrete paths moved behindoracle-packs:start product.agentsfleet, the mechanism this file already uses twice:Rust is recorded as
rustd/crates/*/src/, which is where it is.Found while fixing that: a live parity bug, left for its own PR
agentsfleet/src/andagentsfleet/test/do not exist in that repository. The same stale prefix sits inufs.sh's cross-runtime parity scan:So "every JavaScript
ERR_*must exist in Zig" has been vacuously green, withERR_UNAUTHORIZED,ERR_WORKSPACE_NAME_EXISTSandERR_CLI_CREDENTIAL_EXCHANGE_FAILEDincli/src/never once compared. That is this branch's own bug class.Deliberately not folded in: unmuting a check that has been silently passing may surface real ERR_ drift in agentsfleet, and that deserves its own before/after rather than a footnote in a scope-hole PR.
Verification
make auditgreen (64 PASS, exit 0) · dispatch-evals 17/17 · install-evals 23/23 ·bin/orly verify --allgreen.Downstream note for agentsfleet
After
orly update,rustdreports 3 hits, all fair:afd_crypto/src/secret.rs—concat!($label, "(redacted)")in two macro arms. Removable by havingDisplaydelegate toDebug.1_000numerics in test files — the documented// pin test: literal is the contractannotation applies (numeric-suspect already behaves this way for Zig tests).🤖 Generated with Claude Code