Skip to content

fix(ufs): the gate reads Rust and Go, and drift stops being silent - #19

Merged
indykish merged 4 commits into
mainfrom
fix/ufs-scope-rust-go
Aug 24, 2026
Merged

fix(ufs): the gate reads Rust and Go, and drift stops being silent#19
indykish merged 4 commits into
mainfrom
fix/ufs-scope-rust-go

Conversation

@indykish

@indykish indykish commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The bug

dispatch/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. 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's rustd workspace, at 4f6afd6ba~1 — the commit before its literals were bound by hand. The new lane catches all 20:

rustd/crates/afd_redis/src/streams.rs   "XADD" 3       → became CMD_XADD
rustd/crates/afd_redis/src/client.rs    "PING" 3       → became CMD_PING
rustd/crates/afd_db/src/migrate/lock.rs "migrate.acquire_lock" 2  → became OP_ACQUIRE
… plus "EVAL" ×2, "SET" ×3, "GET", "HSET", "HLEN", "HRANDFIELD",
        "XACK", "XGROUP", "XREADGROUP", "PUBLISH", "migrate.load_failures" ×4

That is the CMD_XADD / OP_ACQUIRE set, 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).

tree before after
agentsfleet rustd (74 .rs, pre-cleanup) 20 caught
agentsfleet rustd (77 .rs, post-cleanup) 1
agentsfleet zig/ts (2192 files) byte-identical to before
cache-kit.rs (52 files) 240 raw 30, all real
extended-ceph-exporter (11 .go) 17 raw 16, all real

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.

Lane Held out, and why
Rust #[cfg(test)] / #[test] blocks — unit tests live inside the file they cover
Rust feature-gated test seams — #[cfg(feature = "test-util")], for a helper that must compile into the crate so a sibling integration test can call it
Rust #[…] attribute literals — #[serde(rename = "…")] takes a literal token by language rule; no const is legal there
Rust static bindings, beside const
Rust crate-root tests/ and benches/ — the old \/tests\/ form needed a parent directory and walked straight past them
Go const ( … ) members — the keyword is stated once, on the opening line
Go backtick struct tags — json:"id" is read by reflection; a const cannot appear inside one

The 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 one one_of_each_kind error-surface enumerator. Unfixable by any rename, and exactly the noise that teaches people to stop reading a gate.

It is matched narrowlytest as 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.sh 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 it red — that is the signal that was missing.

(h) write_any façade extension → audits/ufs.sh is_source (silent-green scope hole)
    🔴 .rs — write_any.sh fires on it, audits/ufs.sh cannot read it, and no
             UFS_OUT_OF_SCOPE row says why (silent green over an unscanned file)

Check (b)'s fixture extractor was also pinned to .zig, so a fixture in any other language was invisible to it. Widened.

.py and .sh are named out of scope, with reasons

Declared, 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 no const to bind to.

Both need a lane built before the glob widens. .mdx is not code.

Fixtures pin every lane

Five new fixtures. Each is load-bearing — disabling the matching carve-out flips it:

carve-out disabled result
rust #[cfg(test)] block skip ufs_ok.rs → red
rust #[cfg(feature = "test-util")] seam skip ufs_ok.rs → red
rust #[attribute] carve-out ufs_ok.rs → red
static binding carve-out ufs_ok.rs → red
go grouped const ( … ) tracking ufs_ok.go → red
go backtick struct-tag strip ufs_ok.go → red
seam pattern widened to any feature ufs_feature_gate.rsgreen (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 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. 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.user prefixes, and every runtime it actually ships. The concrete paths moved behind oracle-packs:start product.agentsfleet, the mechanism this file already uses twice:

                     generic Rust repo    agentsfleet
  renders rustd/            no                yes
  renders agentsfleet/      no                yes

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/ and agentsfleet/test/ do not exist in that repository. The same stale prefix sits in ufs.sh's cross-runtime parity scan:

  zig_err  src/*.zig                        → 172 codes
  js_err   agentsfleet/src/*.{js,jsx,ts,tsx} →   0 files scanned  ◄──
  ui_err   ui/packages/*/src/*.ts{,x}        → 168 files scanned

So "every JavaScript ERR_* must exist in Zig" has been vacuously green, with ERR_UNAUTHORIZED, ERR_WORKSPACE_NAME_EXISTS and ERR_CLI_CREDENTIAL_EXCHANGE_FAILED in cli/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 audit green (64 PASS, exit 0) · dispatch-evals 17/17 · install-evals 23/23 · bin/orly verify --all green.

Downstream note for agentsfleet

After orly update, rustd reports 3 hits, all fair:

  • afd_crypto/src/secret.rsconcat!($label, "(redacted)") in two macro arms. Removable by having Display delegate to Debug.
  • two 1_000 numerics in test files — the documented // pin test: literal is the contract annotation applies (numeric-suspect already behaves this way for Zig tests).

🤖 Generated with Claude Code

`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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

indykish and others added 3 commits August 24, 2026 09:53
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>
@indykish
indykish merged commit c6653fb into main Aug 24, 2026
4 checks passed
@indykish
indykish deleted the fix/ufs-scope-rust-go branch August 24, 2026 07:06
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.

2 participants