ci-verify-generated-code
Skill0 starsChanged 3 months agoMITView on GitHub
CI lessons around verifying machine-generated/build outputs in workflows: toolchain pins smuggled inside generated crates, lint gates on generated code, directory args to codegen CLIs, and assert-steps that hide evidence. Use when a CI job builds/verifies transpiled or generated code, or when a green-local/red-CI loop burns runs without visible errors.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- android-share-intentsSkill
- multi-agent-gitSkill
- anti-default-gatesSkill
- flutter-drift-androidSkill
- android-settings-wiringSkill
- rust-boundariesSkill
- windowsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 71
Check: test asserting arg vector equals expected explicit file list.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Verifying Generated Code in CI
Lessons from c2proof (C→Rust via c2rust, GitHub Actions e2e). Each cost ≥1 CI run of blind debugging.
1. Codegen tools smuggle toolchain pins into their output (verified: c2rust 0.20.0)
c2rust transpile --emit-build-files writes rust-toolchain.toml into the
generated crate, pinning the nightly the tool was BUILT on
(nightly-2022-08-08). Host-side cargo clippy then fails with
'cargo-clippy' is not installed for the toolchain 'nightly-...' — and if you
check for a file named rust-toolchain only, your auto-install never fires
(rustup honors both filenames; docs don't mention either).
Fix: detect BOTH rust-toolchain and rust-toolchain.toml, at crate root
and one level down; parse channel (bare line OR [toolchain] channel = "..."),
run rustup toolchain install <ch> --profile minimal --component clippy
(idempotent via rustup toolchain list). Belt-and-braces fallback: on clippy
failure, extract the channel from the error string itself — covers any pin
mechanism you didn't anticipate.
fn stderr_missing_toolchain(stderr: &str) -> Option<String> {
stderr.lines().find_map(|l| {
let i = l.find("not installed for the toolchain '")?;
let rest = &l[i + "not installed for the toolchain '".len()..];
Some(rest[..rest.find('')?].to_string())
})
}Check: unit test parsing both file formats; e2e log line naming the pin path found.
2. Never apply your own lint gate to generated output
Running cargo clippy -- -D warnings on machine-transpiled code fails ~always
— mechanical output warns by design. The gate's job is compile-success;
warnings are EVIDENCE (count them into the report), not failures.
Fix: cargo clippy plain for generated code; -D warnings stays for
first-party source only. Capture warning count + first error lines as report
data.
Check: pipeline test where generated crate compiles-with-warnings is GREEN with warnings > 0 recorded.
3. Codegen CLIs reject intuitive args silently (verified: c2rust 0.20.0)
c2rust transpile <dir> doesn't parse the directory — it emits Could not
parse input file. Skipping /work/src; is it well-formed C? then later Can't
emit build files after incremental transpiler run; skipped. Two soft-failure
messages downstream of one wrong arg; exit code still lets the container
"succeed" partially. Explicit file lists (transpile a.c b.c -o out
--emit-build-files) are required.
Fix: enumerate entry files yourself, pass explicitly, sort for determinism. Unit-test the arg-list builder against a temp dir (headers excluded, dotfiles excluded, flat scan).
Check: test asserting arg vector equals expected explicit file list.
4. Assert-on-artifact steps must print the artifact
A CI step doing grep -q "✅ compiles" "$R" hides WHY when it fails — the
evidence sat inside REPORT.md three runs in a row while we guessed.
Fix:
grep -q "✅ compiles" "$R" || { cat "$R"; exit 1; }Same principle in the program under test: dump failure stderr to the CI log at the moment of detection, don't trust a downstream artifact viewer to exist.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

