Repository navigation
Production code may only name declared dependencies: a seconds-scale guard for the #5452 break (card d4868960) - #5460
Merged
Merged
Conversation
…guard for the #5452 break (card d4868960) PR CI builds each crate as `cargo test --lib --no-run`, the one build that links dev-dependencies, so production code naming a dev-only crate passed and broke every non-test build after merge (#5452 -> #5457). source-hygiene now reads every workspace manifest under core/ and apps/, takes the dev-only crates, and fails on any production line naming one. Test code is read the way cargo gates it: #![cfg(test)] files, any cfg naming test (all(test, ...), any(test, test-fixtures)) at any indent, and whole modules declared behind such a gate. Proven by mutation: dropping core's normal academy dependency (undoing #5457) fails the guard on commands/mod.rs:45 `pub use continuum_academy::hf;` in 2.5 s; restored, source-hygiene 59/59 pass. Zero dependencies kept. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…dex on #5460) `any(test, unix)` compiles in every Unix build, so only a predicate that IMPLIES test (test; all(.., test); any(..) whose every arm implies test; the fixtures feature) gates code out; not(..) never does. A leading `::krate::` is an absolute path to the crate, told from `a::krate::` and `<T as X>::krate`. The attribute's own end is parsed, so an item on the gate's line (`#[cfg(test)] dir: T,`) is read as gated. Regressions for each; source-hygiene 60/60; the #5457 mutation still fails on commands/mod.rs:45. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…d 58b6026f; Codex on #5460) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Contributor
Author
|
Reviewed exact head 820cc89. Both reported false negatives are fixed with regressions: any(test, unix) is treated as production, and leading :: external-crate paths are detected. The final delta documents the parser's limits and the separate compiler-coverage follow-up. All selected exact-head CI checks are now green (skipped jobs are not counted as validation). No remaining blocker from this bounded guard review; this does not replace non-test compilation. |
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.
Serves the build loop (plan line 1, edit-to-checked): a crate cut can no longer break canary's non-test build while its PR's checks pass.
Why
PR CI builds each selected crate as
cargo test --lib --no-run. That is the only build that links[dev-dependencies]. #5452 movedhfinto continuum-academy, and core named it from production code while academy was still only a dev-dependency of core. The PR went green, then every non-test core build failed until #5457. A cold non-testcargo checkper crate would catch this, at minutes per crate. Reading the manifests catches the same class in milliseconds.What
New
source-hygiene::dev_only_deps. For every workspace crate undercore/andapps/, it reads the manifest. Normal dependencies come from[dependencies],[dependencies.x]and[target.'…'.dependencies]; dev dependencies from the same three forms ofdev-dependencies; build dependencies count as neither. It takes the dev-only crates and fails on any production line that names one:krate::,use krate;orextern crate krate. A module path that happens to end in the same word does not count.Test code is recognised the way cargo gates it:
#![cfg(test)];#[cfg(…)]namingtest, at any indent (test,all(test, …),any(test, feature = "test-fixtures")), excludingnot(test);mod x;covers one line; a gated block covers the whole block;#[cfg(test)] mod tests;,#[cfg(all(test, feature = "stress-tests"))] mod load_harness;).gated_item_endbecomespub(crate)so it is reused, not copied. The crate stays std-only with zero dependencies.Measured (IntelMac, base 9cf91c6, 2026-10-26)
continuum-academydependency (undoing Hotfix: core's non-test build resolves continuum_academy (card a581f5d1) #5457). The guard failed withcontinuum-core/src/commands/mod.rs:45 pub use continuum_academy::hf;in 2.53 s. Restored:cargo test -p source-hygiene --libgives 59 passed, 0 failed (14.9 s for the whole suite).load_harness.rs, andtests.rsfiles gated by their parent. Each of those shapes is now pinned in the fixture test.Added 1 file (~300 lines including 4 tests). Removed: nothing.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE