Skip to content

feat(rust): select tests through Cargo crate dependencies - #92

Merged
adityankale190895 merged 5 commits into
DiffCI:mainfrom
FredApps:rust/59-crate-dependencies
Nov 16, 2026
Merged

adityankale190895 merged 5 commits into
DiffCI:mainfrom
FredApps:rust/59-crate-dependencies

Conversation

@FredApps

@FredApps FredApps commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #59. Part 2 of #62, after #91 (merged).

#91 has landed and main is merged in, so this PR's diff is only this milestone. The milestone is 580285d plus the review fixes in a2255f6. It stays unregistered until the integration milestone (#94).

Changes

  • Build crate-level source/manifest edges from full offline, locked, all-features Cargo metadata, including optional and dev-dependencies.
  • Keep nested-package containment conservative, and model literal in-crate includes.
  • Locked registry and Git dependencies don't block, including their build scripts and proc macros. They can't change unless Cargo.lock changes, and a Cargo.lock change keeps the full suite. Workspace proc-macro crates are ordinary dependency edges.
  • Workspace build scripts are scoped to their crate. A crate with a build script depends on every workspace member's manifest and sources, so it and its dependents run for any Rust change. Other crates still narrow.
  • Feature declarations don't block. features = [...] and default-features = false are fine. The adapter asks Cargo itself (cargo tree --offline --locked -e normal,build,dev -f "{p}|{f}") how each tested crate resolves on its own and together with its dependents, compared with the full workspace. It records that as feature coverage, and feat(rust): synthesize conservative cargo test commands #93 refuses any command that would build a package with different features than the full run.
  • No keyword denylist. fs, process, unsafe, extern crate, metadata fields and similar are ordinary code, as in the other adapters. Literal paths that reach another crate become crate edges, and so does code that runs cargo/rustc.
  • Inventory checks cover Rust module trees only. There's no repository-wide symlink check and no entry cap.
  • Cargo config is read wherever Cargo reads it: the repository, parent directories and $CARGO_HOME. Only build-changing keys block (build.*, target.*, env, [patch]/[source]/paths and similar), not [profile] or [term]. The compiler environment check includes RUSTDOCFLAGS and CARGO_BUILD_TARGET.
  • A checkout reached through a symlinked directory works, because the workspace root is realpath'd once (from feat(rust): map Cargo packages and test targets #91) and every new path lookup resolves against it.

Remaining full-run fallbacks

  • Local path dependencies outside the workspace, which can change without Cargo.lock changing.
  • Cargo feature resolution unavailable (cargo tree evidence missing or invalid).
  • Computed include!/#[path] arguments, includes outside the crate, and included non-.rs code.
  • Symlinked .rs files or directories inside module trees, unlisted or discovery-excluded Rust sources, and incomplete ownership.
  • Build-changing Cargo config or compiler environment.

The selective boundary is still local workspace crates, not arbitrary Cargo projects. cfg(feature) source alone is not a blocker.

Validation

Typecheck, build, release-boundary audit and agent check pass, and the full suite passes locally on Linux (1011 tests). Each loosened case and each remaining fallback has an adapter test. Real-Cargo tests cover workspaces, optional/dev dependencies, unchanged lockfiles, feature-unified unit tests, and a realistic workspace with a build script, a local derive crate, feature requests and file I/O that now narrows. Hosted Linux/Windows Node 22/24 checks, CLI packaging, Observer Action smoke and CodeQL pass on this head.

DCO signed off. Review replies: #92 (comment)

@adityankale190895 adityankale190895 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the incremental diff on top of #91. I found nothing that could skip a needed test. The concern is the opposite: as written, no real crate can narrow. Your glob replay and the note in #95 ("no verified public workspace meeting all current gates") point the same way.

Blockers that fire on almost every real repo

1. External dependencies block the whole repo. The checks for dependencies outside the workspace, build scripts and procedural macros run over all of metadata.packages, which now includes every resolved registry and Git dependency. serde_derive (proc-macro) or libc (build script) anywhere in the graph is enough. Locked registry and Git dependencies are immutable unless Cargo.lock changes, and #94 already sends any Cargo.lock change to a full run. Could these three blockers apply only to workspace members and local path dependencies?

2. The feature-unification blocker fires on any features = [...] or default-features = false. Almost every crate has one. The risk you describe is narrower: a shared dependency whose requested features differ between the selected -p set and the rest of the workspace. That can be computed from resolve.nodes[].features and each member's dependency declarations. Could the blocker fire only when a subset would actually change unification?

3. The rustInputs denylist is very broad. Any identifier fs, process, unsafe, extern, exists, metadata, is_file and so on blocks the file, and so the repo. Ordinary code like extern crate foo;, std::process::exit(1), a field named metadata or a small unsafe block trips it. The Python adapter doesn't treat open() as a blocker, so the two adapters are inconsistent. Could this target path-taking calls with non-literal paths, or follow the existing adapters' runtime-read policy?

Smaller notes

  1. completeRustInventory blocks on any symlink anywhere in the repo, Rust or not, and on more than 50,000 entries.
  2. The Cargo config check covers the repo's .cargo/config(.toml), but not $CARGO_HOME/config.toml or parent-directory configs. The environment check skips RUSTDOCFLAGS, which affects doctests, and CARGO_BUILD_TARGET. That's a small inconsistency given how strict the rest is.
  3. The symlinked-root path issue from my #91 review applies to all the new repositoryPath and owner calls here.

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]>
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]>
@adityankale190895

Copy link
Copy Markdown
Member

@FredApps thanks for bringing #92–#95 up to date after #91 landed. All four merge cleanly and CI is green on Linux and Windows.

Before we merge, here's where the stack stands. The 11 November review points don't seem to have changed yet, so I've gathered the open items in one place:

Must change before merge

  1. test(rust): replay pinned public glob history on hosted CI #95: rust-replay.yml on every src/** PR. Each run builds glob and runs its suite three times, and today the result is always FULL. CI compute is limited for us, so please make it workflow_dispatch only. If you'd rather keep it automatic, trigger it only on src/repo/adapters/rust*.ts, src/planner/rust-command.ts and scripts/replay-rust.mjs.

Please reply, even if the answer is "follow-up"

  1. feat(rust): select tests through Cargo crate dependencies #92: real repositories can't narrow. These blockers all run over metadata.packages, so external crates count too: non-workspace packages, dependency features or default-features = false, build scripts and proc macros. Any single crates.io dependency therefore makes the whole repo FULL. The runtime-input token list (fs, unsafe, exists, metadata, …) has the same effect at the source level.
  2. feat(rust): register Cargo adapter with conservative release boundary #94: command evidence. rustTestInvocation accepts only actions/checkout plus a literal cargo test. Nearly every Rust workflow has a toolchain setup step and a cache step, so commands stay advisory.
  3. feat(rust): register Cargo adapter with conservative release boundary #94: non-code paths. Any changed path outside Rust sources and includes falls back, including README.md, docs/** and .github/**. Is that intended?
  4. feat(rust): register Cargo adapter with conservative release boundary #94: cross-adapter changes. testFileMatcherForProfile now treats Maven and Python tests as tests, hydrateDependencyGraph trusts declared test nodes, and goTestPackages is now filtered to Go. The last one looks like a needed fix. Please call out all three in the PR description, since they change Maven, Python and Go behaviour as well as Rust.
  5. feat(rust): synthesize conservative cargo test commands #93: workspace scope. In a workspace with default-members or a root [package], plain cargo test runs only some members, and a selected -p member can run tests the baseline never runs.

Items 2–4 and 6 don't have to block this stack. I've opened #131 to track real-repository selectivity, so a short answer here plus a pointer to #131 is fine.

On your #91 proposal (narrow the out-of-workspace Cargo.toml fallback using #92's graph): agreed. Let's do it as a follow-up after this stack merges, so the stack doesn't grow again. It's in #131.

Once item 1 is done and item 5 is in the description, please mark #92 ready and we'll squash-merge #92 → #95 in order. #62 will be closed when they merge, and the remaining work continues in #131.

FredApps added a commit to FredApps/core that referenced this pull request Nov 15, 2026
… 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

Copy link
Copy Markdown
Member

@FredApps thanks for a2255f6 and ee9617b. This is the change that lets real Rust workspaces run fewer tests, and most of it looks right. One part can miss a test that needed to run, so #92 needs a fix before merge.

Blocking: tests that read another crate's files can be missed (a2255f6)

With the fs/process/unsafe word list gone, a test that reads another crate's files only counts as depending on that crate if the code contains a literal path to it. Tests that check every crate's files (license headers, generated code, no todo!) usually build the path in code instead. I ran a probe against ee9617b with two crates: a test in a reads crates/b/src/lib.rs, and I checked whether a is treated as depending on b:

How a's test reaches b/src/lib.rs Depends on b?
Path::new(env!("CARGO_MANIFEST_DIR")).join("../b/src/lib.rs") yes
.parent().unwrap().join("b").join("src").join("lib.rs") no
.parent().unwrap().join("b/src/lib.rs") no
.ancestors().nth(2) followed by walking the directory tree no

In the three failing cases there's no blocker and no dependency, so a change to b skips a's test.

Reproduction (node:test, synthetic metadata, no Cargo needed)
const manifest = (n: string) => `[package]\nname = "${n}"\nversion = "0.1.0"\nedition = "2021"\n`;
const files = {
  "Cargo.toml": '[workspace]\nmembers = ["crates/a", "crates/b"]\nresolver = "2"\n',
  "crates/a/Cargo.toml": manifest("a"), "crates/a/src/lib.rs": "",
  "crates/a/tests/scan.rs": 'use std::path::Path;\n#[test] fn t() { let p = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().join("b").join("src").join("lib.rs"); assert!(std::fs::read_to_string(p).unwrap().contains("fn")); }',
  "crates/b/Cargo.toml": manifest("b"), "crates/b/src/lib.rs": "pub fn f() {}",
};
// a: lib + test target "scan"; b: lib. Both are workspace (default) members with no resolve dependencies.
// Expected: an edge crates/a/Cargo.toml -> crates/b/Cargo.toml, or a blocker.
// Actual: blockers = [] and no edge.

Suggested fix that keeps the narrowing: treat this like the compiles case. A source file that combines file access with CARGO_MANIFEST_DIR, current_dir, .parent() or .ancestors() should depend on every workspace crate. That puts the cost only on the crates that do it, not on the whole repository. Please add the three failing cases as regression tests.

Non-blocking

  1. cargo tree cost. It runs up to twice per tested crate (capped at 400 runs, each with a 60 s timeout) on every analysis. On a workspace with about 100 crates and dependency features, that could take minutes. Can the coverage be cached by Cargo.lock plus the member manifests?
  2. Package key in parseCargoFeatureTree. Packages are identified only by name vX.Y.Z. A path dependency and a registry crate with the same name and version would collide. The {p} output includes the source, which could go into the key.

Looks good

  • Workspace scope (ee9617b). Registering test targets only for workspace_default_members keeps selective runs within what plain cargo test covers, and older Cargo versions get a full run. This resolves the earlier feat(rust): synthesize conservative cargo test commands #93 point.
  • Planner feature check. It's sound: feature unification only adds features, so a unit inside the selection that already matches the full run gives the selected command the full run's features. Missing coverage refuses the plan.
  • Dependencies. Locked registry and Git dependencies no longer block, and a Cargo.lock change still runs everything. Crates with build scripts and code that runs cargo now depend on every crate.
  • Cargo config and symlinks. Only build-changing config keys block, wherever Cargo reads them. Symlinks outside module directories no longer block.

From the earlier comment, #94 and #95 still need the rust-replay.yml trigger change and the description of the changes that affect other adapters. #131 will be trimmed to what's left once the stack merges.

@FredApps

Copy link
Copy Markdown
Contributor Author

@adityankale190895 thanks, agreed that the old checks left nothing real able to narrow. I merged main after #91 landed (966b6bf) and loosened the checks in a2255f6. Point by point:

1. External dependencies. Locked registry and Git packages no longer block, including their build scripts and proc macros. Cargo.lock changes still run the full suite. Two cases still fall back:

  • Local path dependencies outside the workspace still block ("Local Cargo path dependencies outside the workspace require full validation"), because they can change without Cargo.lock changing.
  • A workspace build script makes its crate depend on every workspace member's manifest and sources. That crate and its dependents run for any Rust change, and the other crates still narrow.

Workspace proc-macro crates are ordinary edges now. Tests: registry dependencies narrow; local outside path dependencies … fail closed and workspace build scripts are scoped to their crate; proc macros and feature-gated targets.

2. Feature unification. features = [...] and default-features = false no longer block. Instead of rebuilding unification from resolve.nodes[].features and member declarations, the adapter asks Cargo directly with cargo tree --offline --locked -e normal,build,dev -f "{p}|{f}". It compares two resolutions:

  • each tested crate on its own, and each tested crate together with its dependents,
  • against the full workspace resolution.

That way host and target feature sets aren't merged. The result goes into the profile as feature coverage. #93 refuses any -p set that doesn't include a unit Cargo resolved with the full run's features for each package that would otherwise differ. If the evidence is missing, the result is still "Cargo feature resolution is unavailable; full validation required". Tests: feature requests need Cargo's own feature resolution, not a repository-wide blocker and the real-Cargo Cargo feature-unified unit tests are recorded per crate instead of blocking the repository.

3. rustInputs denylist. It's gone. fs, process, unsafe, extern crate, metadata fields and similar no longer block, which matches the other adapters' runtime-read policy. Literal paths that reach another crate become crate edges, and so does code that runs cargo/rustc. Computed include!/#[path] and includes of non-.rs code outside the crate still fall back. Tests: ordinary Rust code no longer blocks: fs, process, unsafe, extern crate and metadata fields, Rust runtime reads of another crate become dependencies; non-rs included code still falls back, and the end-to-end a realistic Cargo workspace now narrows: build script, local derive crate, feature requests and file I/O.

4. Inventory. The 50,000 cap is gone, and only Rust module trees are checked. Symlinked .rs files or directories in a module tree still block, while a linked LICENSE/README doesn't (symlinks outside module trees and linked non-Rust files do not block).

5. Config and environment. Cargo config is now read from parent directories and $CARGO_HOME too. It blocks only on keys that change the build (build.*, target.*, env, [patch]/[source]/paths and so on), not on [profile]/[term]. RUSTDOCFLAGS and CARGO_BUILD_TARGET are added to the compiler environment check. Test: Cargo configuration blocks only build-changing keys, wherever Cargo reads it.

6. Symlinked root. This is fixed by the #91 change that came in with the main merge. The workspace root is realpath'd once and every repositoryPath/owner call resolves against it, including the new dependency and include code. Cargo maps a checkout reached through a symlinked directory covers it.

Local results: typecheck, build, boundary audit and agent check pass, and the full suite has 1011 passing tests. Hosted Linux/Windows × Node 22/24 is green on this head.

@FredApps
FredApps marked this pull request as ready for review November 15, 2026 17:22
@FredApps

Copy link
Copy Markdown
Contributor Author

@adityankale190895 #92–#95 are updated from main, every point from your Nov 11 reviews has a reply, and hosted CI is green on all four heads, so they're ready for review. Please review them in stack order: #92 → #93 → #94 → #95. The PR descriptions are from before this round, so the reply comments are the current account of the changes.

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]>
@adityankale190895
adityankale190895 merged commit b079713 into DiffCI:main Nov 16, 2026
13 checks passed
adityankale190895 added a commit that referenced this pull request Nov 16, 2026
* 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]>

* 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): 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]>

---------

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]>
adityankale190895 added a commit that referenced this pull request Nov 16, 2026
…#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]>
adityankale190895 added a commit that referenced this pull request Nov 16, 2026
* 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]>
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.

Rust adapter: select tests by crate dependency

2 participants