Repository navigation
feat(rust): synthesize conservative cargo test commands - #93
Conversation
Signed-off-by: FredApps <[email protected]>
Signed-off-by: FredApps <[email protected]>
Signed-off-by: FredApps <[email protected]>
adityankale190895
left a comment
There was a problem hiding this comment.
Command synthesis looks solid. Target names are literal arguments, doctests survive because crate roots map to -p rather than --lib, and bench and example targets are named explicitly. The refusal paths for missing evidence and old cached profiles are good too.
One semantic gap:
Plain cargo test doesn't always mean every member. In a workspace whose root Cargo.toml is also a [package], plain cargo test tests only the root package. With default-members, it tests only those members. In both cases the planner can emit -p member for crates the full baseline never tests. That's over-execution, not a miss. But the selective run is then no longer a subset of the baseline, and it can fail on crates CI never ran. Could this either refuse or limit selection to the packages the full invocation actually covers?
Resolve the DiffCI#91 squash merge: keep main's symlinked-checkout fix, grouped fallback-reason rows and maintainer line, and reapply this milestone's crate dependency analysis on top. Signed-off-by: FredApps <[email protected]>
Bring in main (including the DiffCI#91 squash merge) through the updated dependency milestone; this milestone's changes are reapplied unchanged. Signed-off-by: FredApps <[email protected]>
Review on DiffCI#92: the checks were so broad that no real crate could select fewer tests. Keep failing closed where a subset can actually differ. - Locked registry/Git dependencies (including build scripts and proc macros) no longer block; Cargo.lock changes keep the full suite. Local path dependencies outside the workspace still block. - A workspace crate with a build script depends on every workspace crate: it and its dependents run for any Rust change, other crates narrow. - Feature requests no longer block. Cargo (`cargo tree`) resolves each tested crate alone and with its dependents; the coverage is recorded for the planner to check each selected set. Missing evidence blocks. - Drop the fs/process/unsafe/extern keyword denylist. Literal paths that reach another crate, and code that runs Cargo/rustc, become crate dependencies instead of blockers. - Check only module trees for symlinks and unlisted sources (no 50k cap; linked LICENSE/README files are fine). - Read parent-directory and $CARGO_HOME Cargo config, block only build-changing keys, and include RUSTDOCFLAGS and CARGO_BUILD_TARGET. Signed-off-by: FredApps <[email protected]>
Signed-off-by: FredApps <[email protected]>
… per command Review on DiffCI#93: plain `cargo test` tests only the root package of a non-virtual workspace, or `default-members`. Register test targets only for `workspace_default_members`, so a selective run stays a subset of the full one; other members remain sources that reach tested dependents. Metadata without default members (Cargo < 1.71) falls back. With DiffCI#92's feature coverage, every synthesized Cargo invocation must contain a unit Cargo resolved with the full run's features for each package a selected crate would otherwise build differently; otherwise the plan is refused. Profiles without coverage are refused. Also keep release-files.json alphabetical. Signed-off-by: FredApps <[email protected]>
|
@adityankale190895 thanks, you're right. Fixed in ee9617b, after merging Plain The same commit uses #92's feature coverage when building each command. Every synthesized Local results: 1036 tests pass, plus typecheck, build and audit. Hosted CI is green. |
Review on DiffCI#92: a test that reads another crate's files only counted as depending on it when the code held a literal path to that crate. Tests that check every crate's files usually build the path instead, through .parent(), .ancestors(), PathBuf::pop or a formatted '..' path, so a change to the other crate skipped them. Treat such code like code that runs Cargo: its crate depends on every workspace crate. It only fires where the file also works with paths, so tree parent() methods and Vec::pop keep narrowing. Crate-local paths built from CARGO_MANIFEST_DIR stay narrow; the literal pass resolves them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]>
Signed-off-by: adityankale190895 <[email protected]> # Conflicts: # docs/using-diffci.md
Signed-off-by: adityankale190895 <[email protected]> # Conflicts: # docs/using-diffci.md # src/repo/adapters/rust.ts # tests/repo/rust-adapter.test.ts
…#94) * feat(rust): map Cargo packages and test targets (#58) Signed-off-by: FredApps <[email protected]> * feat(rust): select workspace tests by crate dependencies (#59) Signed-off-by: FredApps <[email protected]> * feat(rust): synthesize conservative Cargo test commands (#60) Signed-off-by: FredApps <[email protected]> * feat(rust): register conservative Cargo adapter and document boundaries Signed-off-by: FredApps <[email protected]> * fix(rust): narrow dependency, feature and runtime-input blockers Review on #92: the checks were so broad that no real crate could select fewer tests. Keep failing closed where a subset can actually differ. - Locked registry/Git dependencies (including build scripts and proc macros) no longer block; Cargo.lock changes keep the full suite. Local path dependencies outside the workspace still block. - A workspace crate with a build script depends on every workspace crate: it and its dependents run for any Rust change, other crates narrow. - Feature requests no longer block. Cargo (`cargo tree`) resolves each tested crate alone and with its dependents; the coverage is recorded for the planner to check each selected set. Missing evidence blocks. - Drop the fs/process/unsafe/extern keyword denylist. Literal paths that reach another crate, and code that runs Cargo/rustc, become crate dependencies instead of blockers. - Check only module trees for symlinks and unlisted sources (no 50k cap; linked LICENSE/README files are fine). - Read parent-directory and $CARGO_HOME Cargo config, block only build-changing keys, and include RUSTDOCFLAGS and CARGO_BUILD_TARGET. Signed-off-by: FredApps <[email protected]> * fix(rust): select only crates plain cargo test covers; check features per command Review on #93: plain `cargo test` tests only the root package of a non-virtual workspace, or `default-members`. Register test targets only for `workspace_default_members`, so a selective run stays a subset of the full one; other members remain sources that reach tested dependents. Metadata without default members (Cargo < 1.71) falls back. With #92's feature coverage, every synthesized Cargo invocation must contain a unit Cargo resolved with the full run's features for each package a selected crate would otherwise build differently; otherwise the plan is refused. Profiles without coverage are refused. Also keep release-files.json alphabetical. Signed-off-by: FredApps <[email protected]> * fix(rust): keep registration Rust-only; narrow docs, invocation and fixture fallbacks Review on #94: 1. Documentation changes follow the shared classification (no tests, no fallback) unless Rust code names a documentation path or a workspace build script exists; include_str!'d docs stay modelled assets. .github/** keeps the full suite: it is the invocation evidence. 2. Leave Maven, Python and Go behaviour as on main: the test matcher adds only Rust targets, goTestPackages only drops Rust contributions, and hydrated graphs only trust declared test identities for .rs nodes. 3. Accept ordinary CI around a plain `cargo test`: checkout, toolchain and cache actions, a matrix, output-only env, and build/clippy/fmt/doc/ rustup steps or jobs. Test flags, other runners, compiler env, conditional or relocated test steps and unknown actions stay advisory. 4. Label Rust support experimental in the docs. From #91 (point 2): Cargo manifests outside the workspace no longer block the repository when metadata shows no member depends on them; their files stay unmodelled, so changing one keeps the full suite. Also pass Cargo feature coverage and documentation readers to the profile. Signed-off-by: FredApps <[email protected]> * fix(rust): paths that climb out of a crate in code depend on every crate Review on #92: a test that reads another crate's files only counted as depending on it when the code held a literal path to that crate. Tests that check every crate's files usually build the path instead, through .parent(), .ancestors(), PathBuf::pop or a formatted '..' path, so a change to the other crate skipped them. Treat such code like code that runs Cargo: its crate depends on every workspace crate. It only fires where the file also works with paths, so tree parent() methods and Vec::pop keep narrowing. Crate-local paths built from CARGO_MANIFEST_DIR stay narrow; the literal pass resolves them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]> * fix(rust): find documentation reads through relative and walked paths Review on #94: a test that reached docs/ through "../docs", concat!(env!("CARGO_MANIFEST_DIR"), "/../docs") or a directory walk that matched the "md" extension was not recorded as reading documentation, so a docs-only change ran no tests and kept no fallback. Match a documentation directory anywhere in a path, a Markdown name or a bare md/mdx extension, and count code that climbs out of its crate as a documentation reader too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]> --------- Signed-off-by: FredApps <[email protected]> Signed-off-by: adityankale190895 <[email protected]> Co-authored-by: adityankale190895 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
* feat(rust): map Cargo packages and test targets (#58) Signed-off-by: FredApps <[email protected]> * feat(rust): select workspace tests by crate dependencies (#59) Signed-off-by: FredApps <[email protected]> * feat(rust): synthesize conservative Cargo test commands (#60) Signed-off-by: FredApps <[email protected]> * feat(rust): register conservative Cargo adapter and document boundaries Signed-off-by: FredApps <[email protected]> * test(rust): add pinned public glob replay on hosted CI Signed-off-by: FredApps <[email protected]> * docs(rust): publish measured glob replay and fallback limits Signed-off-by: FredApps <[email protected]> * test(rust): execute selections from real Git changes Signed-off-by: FredApps <[email protected]> * docs(rust): publish Linux selective execution evidence Signed-off-by: FredApps <[email protected]> * fix(rust): narrow dependency, feature and runtime-input blockers Review on #92: the checks were so broad that no real crate could select fewer tests. Keep failing closed where a subset can actually differ. - Locked registry/Git dependencies (including build scripts and proc macros) no longer block; Cargo.lock changes keep the full suite. Local path dependencies outside the workspace still block. - A workspace crate with a build script depends on every workspace crate: it and its dependents run for any Rust change, other crates narrow. - Feature requests no longer block. Cargo (`cargo tree`) resolves each tested crate alone and with its dependents; the coverage is recorded for the planner to check each selected set. Missing evidence blocks. - Drop the fs/process/unsafe/extern keyword denylist. Literal paths that reach another crate, and code that runs Cargo/rustc, become crate dependencies instead of blockers. - Check only module trees for symlinks and unlisted sources (no 50k cap; linked LICENSE/README files are fine). - Read parent-directory and $CARGO_HOME Cargo config, block only build-changing keys, and include RUSTDOCFLAGS and CARGO_BUILD_TARGET. Signed-off-by: FredApps <[email protected]> * fix(rust): select only crates plain cargo test covers; check features per command Review on #93: plain `cargo test` tests only the root package of a non-virtual workspace, or `default-members`. Register test targets only for `workspace_default_members`, so a selective run stays a subset of the full one; other members remain sources that reach tested dependents. Metadata without default members (Cargo < 1.71) falls back. With #92's feature coverage, every synthesized Cargo invocation must contain a unit Cargo resolved with the full run's features for each package a selected crate would otherwise build differently; otherwise the plan is refused. Profiles without coverage are refused. Also keep release-files.json alphabetical. Signed-off-by: FredApps <[email protected]> * fix(rust): keep registration Rust-only; narrow docs, invocation and fixture fallbacks Review on #94: 1. Documentation changes follow the shared classification (no tests, no fallback) unless Rust code names a documentation path or a workspace build script exists; include_str!'d docs stay modelled assets. .github/** keeps the full suite: it is the invocation evidence. 2. Leave Maven, Python and Go behaviour as on main: the test matcher adds only Rust targets, goTestPackages only drops Rust contributions, and hydrated graphs only trust declared test identities for .rs nodes. 3. Accept ordinary CI around a plain `cargo test`: checkout, toolchain and cache actions, a matrix, output-only env, and build/clippy/fmt/doc/ rustup steps or jobs. Test flags, other runners, compiler env, conditional or relocated test steps and unknown actions stay advisory. 4. Label Rust support experimental in the docs. From #91 (point 2): Cargo manifests outside the workspace no longer block the repository when metadata shows no member depends on them; their files stay unmodelled, so changing one keeps the full suite. Also pass Cargo feature coverage and documentation readers to the profile. Signed-off-by: FredApps <[email protected]> * ci(rust): run glob replay on demand, execution proof in one Linux job Signed-off-by: FredApps <[email protected]> * fix(rust): paths that climb out of a crate in code depend on every crate Review on #92: a test that reads another crate's files only counted as depending on it when the code held a literal path to that crate. Tests that check every crate's files usually build the path instead, through .parent(), .ancestors(), PathBuf::pop or a formatted '..' path, so a change to the other crate skipped them. Treat such code like code that runs Cargo: its crate depends on every workspace crate. It only fires where the file also works with paths, so tree parent() methods and Vec::pop keep narrowing. Crate-local paths built from CARGO_MANIFEST_DIR stay narrow; the literal pass resolves them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]> * fix(rust): find documentation reads through relative and walked paths Review on #94: a test that reached docs/ through "../docs", concat!(env!("CARGO_MANIFEST_DIR"), "/../docs") or a directory walk that matched the "md" extension was not recorded as reading documentation, so a docs-only change ran no tests and kept no fallback. Match a documentation directory anywhere in a path, a Markdown name or a bare md/mdx extension, and count code that climbs out of its crate as a documentation reader too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]> --------- Signed-off-by: FredApps <[email protected]> Signed-off-by: adityankale190895 <[email protected]> Co-authored-by: adityankale190895 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Fixes #60. Part 3 of #62, stacked after #92 (#91 has merged).
This milestone is af05e2b plus the review fixes in ee9617b. #92 stays in the branch until it lands.
cargo test -p <crate> -p <crate>invocation for selected crate-wide unit suites, keeping their doctests.--test. Bench and example targets are named explicitly.cargo testcovers are test targets. That means Cargo'sworkspace_default_members: the root package of a non-virtual workspace, ordefault-members. Other members stay sources that reach their tested dependents, so a selective run is always a subset of the full one. Metadata withoutworkspace_default_members(Cargo older than 1.71) falls back.-pgroup must include a unit that Cargo resolved (feat(rust): select tests through Cargo crate dependencies #92) with the full run's features for each package that would otherwise build differently. If not, the plan is refused ("Selected Cargo crates would build X with different features than the full cargo test; full validation required"). Profiles without feature coverage are refused too.Validation
Typecheck, build and audit pass, and the full suite passes locally on Linux (1036 tests), including new command and adapter tests for root-package/
default-membersworkspaces, the old-Cargo fallback and per-command feature checks. Hosted Linux/Windows Node 22/24, CLI packaging, Observer Action smoke and CodeQL checks pass on this head. Real profile integration is the next milestone (#94).DCO signed off. Review reply: #93 (comment)