Skip to content

feat(rust): register Cargo adapter with conservative release boundary - #94

Merged
adityankale190895 merged 19 commits into
DiffCI:mainfrom
FredApps:rust/62-register-adapter
Nov 16, 2026
Merged

adityankale190895 merged 19 commits into
DiffCI:mainfrom
FredApps:rust/62-register-adapter

Conversation

@FredApps

@FredApps FredApps commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Part 4 of #62, stacked after the dependency (#92) and command (#93) milestones. #91 has merged.

This integration milestone is fb6c35c plus the review fixes in 1833649. Earlier milestones stay in the branch until they land.

  • Register Rust. The graph cache schema is bumped to 15. Rust test targets, Cargo feature coverage and documentation readers are added to the profile.

  • The stack is Rust-only. Maven, Python and Go behave exactly as on main:

    • the test matcher adds only Rust targets,
    • goTestPackages keeps its existing routing and only drops Rust contributions,
    • hydrated graphs trust declared test identities only for .rs nodes.

    The cross-adapter fixes from the earlier revision were dropped from this stack, and can follow as a separate PR with their own regression tests.

  • Changes to Rust unit-test roots propagate as production source, including member manifests and modeled includes.

  • Docs-only changes don't force a full run. Documentation paths (README.md, docs/** and similar) follow the shared classification. They still run the full suite when Rust code names a documentation path or a workspace build script exists. include_str!'d docs stay modeled assets of their crate.

  • These still keep full validation:

    • .github/**, which is the evidence for the test invocation,
    • the root manifest and lockfiles,
    • unknown inputs, deleted paths and rename origins.
  • Out-of-workspace manifests (from feat(rust): map Cargo packages and test targets #91's review) block the repository only when metadata shows a member depends on them. Their files stay unmodeled, so changing one still runs the full suite.

  • Plain cargo test invocation evidence accepts ordinary CI:

    • checkout (only safe with keys), toolchain and cache actions,
    • a matrix and output-only env,
    • cargo build/clippy/fmt/doc and rustup steps or jobs.

    Test flags, other runners, wrappers, compiler environment, conditional or relocated test steps and unknown actions keep commands advisory.

  • Rust support is documented as experimental in docs/release-boundary.md and docs/using-diffci.md, along with the boundary from feat(rust): select tests through Cargo crate dependencies #92 and feat(rust): synthesize conservative cargo test commands #93. It hasn't yet narrowed a published project's history, so treat selections as advisory. The README doesn't list Cargo as a supported language.

Known limitations

Validation

Typecheck, build, release-boundary audit, agent packaging and the synthetic benchmark pass, and the full suite passes locally on Linux (1041 tests). New integration tests cover:

  • independent registration without changing other adapters,
  • docs-only changes, and a README read by a Rust test,
  • confined excluded fixture crates,
  • accepted and rejected CI workflows.

Hosted Linux/Windows Node 22/24, CLI packaging, Observer Action smoke and CodeQL checks pass on this head. The public pinned Rust replay and execution report follow in #95.

DCO signed off. Review reply: #94 (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.

Registration is careful: graph cache bump, mixed-language blocker, and a fallback for unmodeled changed paths. Some notes before this merges.

1. Any changed path outside Rust sources or assets forces a full run. That includes README.md, docs/** and .github/**. Docs-only changes are the easiest savings to get. Is the repo-wide fallback intended, or could non-code paths follow the same classification other adapters use?

2. Cross-adapter behavior changes. testFileMatcherForProfile now also includes mavenTestModules and pythonTests, and goTestPackages is now filtered to Go contributions. Before, Maven and Python testPackages leaked into it. The hydrateDependencyGraph matcher change affects every language too. These look like genuine fixes, but they change Maven, Python and Go behavior. Could they be a separate PR with their own regression tests, so the Rust stack stays Rust-only?

3. rustTestInvocation is practically never satisfied. Every workflow in the repo must contain only actions/checkout and a plain cargo test. A toolchain setup action, a cache step, a clippy or fmt job, a matrix or any env disqualifies it. Being conservative here is right. But combined with the dependency and feature blockers in #92, no real repository both narrows and gets runnable commands.

4. Support claim. Given points 1–3 and the #95 replay (all FULL, no qualifying public workspace found), I'd hold the README and release-boundary.md wording that lists Cargo workspaces next to the other supported languages. Either relax the #92 blockers enough that at least one real workspace narrows, or label Rust support experimental or advisory for now.

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]>
Bring in main (including the DiffCI#91 squash merge) through the updated
command milestone. Bump the graph cache schema to 15 after main's 11-14,
and keep release-files.json alphabetical.

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]>
… 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]>
…ixture fallbacks

Review on DiffCI#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 DiffCI#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]>
@FredApps

Copy link
Copy Markdown
Contributor Author

@adityankale190895 thanks. I merged main (15fda34, graph cache schema now 15) and #93 (bd77438), then addressed the points in 1833649.

1. Docs force a full run. Documentation paths (README.md, docs/**, …) now follow the shared classification: no tests and no Rust fallback. The exceptions are Rust code that names a documentation path and a workspace build script, which could read anything. include_str!'d docs stay modeled assets of their crate. I've kept .github/** as a full run on purpose, because the workflows are the evidence for the cargo test invocation, so a change there can change what the baseline is. A new integration test covers a docs-only change and a README read by a Rust test. Spotting doc reads is a heuristic: a string literal ending in .md/.mdx or under doc(s)/, plus any workspace build script.

2. Cross-adapter changes. These are reverted, so the stack is Rust-only:

  • testFileMatcherForProfile adds only Rust targets.
  • goTestPackages keeps main's routing and only drops Rust contributions.
  • hydrateDependencyGraph trusts declared test identities only for .rs nodes.

Maven, Python and Go behave exactly as on main. I can send the Maven/Python/Go fixes as a separate PR with their own regression tests if you'd like them.

3. rustTestInvocation. It now accepts ordinary CI around a plain cargo test:

  • checkout (only safe with keys), toolchain and cache actions,
  • a matrix and output-only env,
  • cargo build/clippy/fmt/doc and rustup steps or jobs.

Test flags, other runners, compiler env (RUSTFLAGS etc.), conditional or relocated test steps and unknown actions still make it advisory. Covered in tests/repo/rust-integration.test.ts.

4. Support claim. docs/release-boundary.md and docs/using-diffci.md now call Rust support experimental and describe the narrower boundary from #92. The README doesn't list Cargo as a supported language.

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 unmodeled, so a change to one still runs the full suite.

Local results: 1041 tests pass, plus typecheck, build, audit, agent check and benchmark. Hosted CI is green.

@FredApps
FredApps marked this pull request as ready for review November 15, 2026 17:22
adityankale190895 and others added 7 commits November 16, 2026 08:41
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
Review on DiffCI#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: adityankale190895 <[email protected]>

# Conflicts:
#	docs/using-diffci.md
#	src/repo/adapters/rust.ts
#	tests/repo/rust-adapter.test.ts
Signed-off-by: adityankale190895 <[email protected]>

# Conflicts:
#	docs/using-diffci.md
@adityankale190895
adityankale190895 merged commit 2164edc 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]>

* 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.

2 participants