ci: one canonical generated-sources dir for all three mechanisms - #318
ci: one canonical generated-sources dir for all three mechanisms#318thedavidmeister wants to merge 1 commit into
Conversation
The copy-artifacts currency guard, the frozen deploy-pin snapshot check and the soldeer content gate each spelled out `src/generated` by hand. Move the path moves nothing else: every restatement keeps matching nothing and each check goes quietly inert instead of red. `rainix-static generated-dir` is now the one value. The two workflow-side mechanisms ask the binary for it (under `set -e`, so a failed lookup fails the step rather than probing an empty path), and the Rust-side ones — `soldeer-gate`'s content exclusion and `snapshots-append-only`'s default `--root` — read the constant directly. Closes #313
|
Warning Review limit reached
Next review available in: 16 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #313
What
Three rainix mechanisms each spelled out
src/generatedby hand, so moving thecanonical directory moves none of them — every restatement keeps matching
nothing, and the check it guards goes quietly inert instead of red:
rainix-copy-artifacts.yaml's[ -d src/generated ]currency guard — stopshard-failing a repo that commits generated sources without
script/Build.sol;frozen-snapshots-append-only'sls src/generated/*/*.pointers.solprobe —stops policing the frozen deploy-pin snapshots consumers pin constants from;
soldeer-gate's content exclusion (behindrainix-autopublish.yaml) — stopsexcluding generated files, so every regeneration reads as a content change and
the package republishes on runs that changed nothing.
How
rainix-static generated-dirprints the one value, backed by a singleGENERATED_DIRconstant at the crate root. The two workflow-side mechanisms askthe binary for it; the two Rust-side ones (
soldeer-gate's exclusion prefix andsnapshots-append-only's default--root) read the constant directly, so theaction no longer passes
--rootat all.Both shell sites run under
set -euo pipefail, so a failed lookup fails the steprather than probing
""and skipping the guard it exists to enforce — that wouldbe the same silent disable this issue is about.
src/generatednow appears exactly once as a value in rainix. The remainingmentions are prose (the action's
description, workflow comments, README)describing the current path.
QA
test/bats/action/generated-dir.test.bats(
generated-dir prints the one directory…,copy-artifacts hard-fails on generated sources with no script/Build.sol,copy-artifacts does not guard a directory the binary does not name,copy-artifacts fails loudly when the canonical directory cannot be read,frozen-snapshots checks per-tag snapshots under the directory the binary names,frozen-snapshots skips snapshots outside the directory the binary names,frozen-snapshots fails loudly when the canonical directory cannot be read,snapshots-append-only defaults its root to the canonical directory) plussoldeer_gate::tests::norm_hash_excludes_the_canonical_generated_dirand…::norm_hash_excludes_only_that_dir. All 8 bats cases were run against theunfixed tree and all 8 failed (
rainix-static: unknown subcommand "generated-dir"; both YAML mechanisms followed their own literal rather thanthe directory the binary named). The 2 Rust cases fail to compile on base —
crate::GENERATED_DIRdoes not exist there.(1)
rainix-copy-artifacts.yaml[ -d "$GENERATED_DIR" ]->[ -d src/generated ]-> tests 2, 3;(2) that step's
set -euo pipefail-> deleted -> test 4;(3)
frozen-snapshots-append-only/action.ymlls "$GENERATED_DIR"/*/*.pointers.sol->ls src/generated/*/*.pointers.sol-> tests 5, 6;(4) that action's
set -euo pipefail-> deleted -> test 7;(5)
main.rsprintln!("{GENERATED_DIR}")->println!("src/gen")-> tests 1, 8;(6)
main.rs--rootdefaultGENERATED_DIR.to_string()->"src/gen".to_string()-> test 8;(7)
soldeer_gate.rsentries.retain(…)-> deleted ->norm_hash_excludes_the_canonical_generated_dir(108 passed, 1 failed);(8)
soldeer_gate.rsformat!("{}/", GENERATED_DIR)->GENERATED_DIR.to_string()->norm_hash_excludes_only_that_dir(108 passed, 1 failed).mechanism is driven with
gen/out— a directory that is neithersrc/generatednor a prefix or suffix of it — reported by a stubbed binary, and asserted to
follow it AND to ignore a real
src/generatedsitting beside it. A hardcodedliteral fails in both directions, so the test cannot pass by agreeing with the
code it checks. The expected exit statuses come from what the issue says each
mechanism must do (hard-fail, police, exclude), not from reading the scripts.
frozen-snapshots-append-only, and the autopublish soldeer content gate. Allthree covered, plus the fourth restatement the same defect had left in
snapshots-append-only's default--root. The consumer-side half isexplicitly tracked elsewhere (rain.sol.codegen#77) and is not in this diff.
nix develop -c bats test/bats/action/generated-dir.test.bats— 8/8 green. All8 were red before the fix (
rainix-static: unknown subcommand "generated-dir",and both YAML mechanisms following their own literal rather than the directory
the binary named).
nix develop .#rust-shell -c cargo test --manifest-path rainix-static/Cargo.toml— 109 passed, 0 failed, including the two new
soldeer_gatecases.nix develop -c default-shell-test— the full CI bats task fromcheck-shell.yml, with the new file registered in it: every test green exceptthe 3
prettier-bundlecases, which fail identically on unmodifiedorigin/mainin this environment ($prettier_entryresolves empty, so bashruns the fixture name as a command). Verified against a clean
origin/mainworktree, not assumed.
nix develop -c pre-commit run --all-files— nixfmt, no-consumer-prettier,prettier-rainix, shellcheck, statix, taplo and yamlfmt all pass. The
rustfmt-conditionalhook fails, and fails the same way on unmodifiedorigin/main(it runscargo fmtfrom the repo root, which has noCargo.toml); the Rust in this PR is clean undercargo fmt --check --manifest-path rainix-static/Cargo.toml.nix develop …#sol-shell -c rainix-static generated-dirandnix run …#rainix-static -- generated-dirput nothing butsrc/generatedon stdout (devshell and build chatter go to stderr), so the twocommand substitutions capture the value and not shell-hook noise.
[ -d src/generated ]→ tests 2, 3 red.set -euo pipefailremoved → test 4 red (the step exits 0with the guard silently skipped, which is exactly the failure mode).
ls src/generated/*/*.pointers.sol→ tests 5, 6 red.set -euo pipefailremoved → test 7 red.generated-dirprintingsrc/gen→ tests 1, 8 red.snapshots-append-onlydefault--roothardcoded tosrc/gen→ test 8 red.norm_hash's exclusionretaindeleted →soldeer_gate::tests::norm_hash_excludes_the_canonical_generated_dirFAILED(108 passed, 1 failed).
/→soldeer_gate::tests::norm_hash_excludes_only_that_dirFAILED (108 passed,1 failed).
Notes
rainix-copy-artifacts.yaml(its final untracked-file step)and the
default-shell-testlist inflake.nix. This branch changes adifferent step and adds a different line; whichever lands second merges
origin/mainin.rain.sol.codegentest tying itsGENERATED_DIRtothe
fs_permissionsgrant that makes the write work — stays atsrc/generated is a bare string literal replicated across two repos' code, config and CI rain.sol.codegen#77.