Skip to content

feat(rust): model local path packages inside the repository instead of blocking it - #256

Merged
adityankale190895 merged 3 commits into
DiffCI:mainfrom
FredApps:rust/131-local-path-deps
Nov 18, 2026
Merged

adityankale190895 merged 3 commits into
DiffCI:mainfrom
FredApps:rust/131-local-path-deps

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #131 (external dependency inputs and out-of-workspace Cargo.toml).

Path dependencies on packages that live inside the repository but aren't workspace members (for example vendor/bridge) used to add the repo-wide "Local Cargo path dependencies outside the workspace" blocker. This PR models them instead:

  • An in-repo, non-member path package is treated as an unmodeled boundary of the members that use it. Dependency edges are followed through it, so a → vendor/bridge → b makes a depend on b.
  • If that package is opaque — it has a build script, or its code compiles, runs or navigates to other paths, reads docs, has any path literal, or includes files outside its own directory — every member that uses it depends on every crate. That's wide, but it's safe.
  • A change to a file in that package isn't a modeled source, so it still keeps the full suite.
  • Path packages outside the repository keep the repo-wide blockers, as before.

Tests: the excluded nested-crate adapter test and the integration fixture are updated. A new adapter test covers the a → vendor/bridge → b chain and the opaque cases (build script, path literal, climbing out of the directory, running Cargo). The docs reason table is updated.

Local checks on this head: typecheck, npm test with DIFFCI_REQUIRE_CARGO=1 (1168 pass), build, audit:boundary. Hosted CI passed on this head.

Merge order (#131 series: #232, #234, #248, #250, #252, #254, #256, #277, #258). These all edit the one-line Rust paragraph in docs/using-diffci.md, and some also touch rust.ts/types.ts, so they conflict textually with each other. #258 already includes #232, #248, #250 and #254 with those conflicts resolved. The simplest path: merge #258 (GitHub marks those four as merged), then #234, #252, #256 and #277. After each one lands I merge main into the next and resolve the docs line. Merging them one at a time in number order works too, with the same main merge after each.

…t a repository-wide fallback

Part of DiffCI#131 (external dependency inputs, out-of-workspace Cargo.toml). As agreed
in DiffCI#91: a local path package that is not a workspace member but lives inside the
repository (an excluded or vendored crate, or a [patch] target) no longer blocks
every change. Its files stay unmodelled, so changing one keeps the full suite.

Dependency edges now follow non-member packages until they reach members, so
a -> vendor/bridge -> b still selects a when b changes. When such a package has
a build script, or code that could read other crates' files (path literals,
includes outside it, climbing out of its directory, running Cargo), the members
that reach it depend on every workspace crate.

Path packages outside the repository keep the repository-wide fallback, because
they can change without the diff showing it.

Signed-off-by: FredApps <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

#258 is merged (it brought in #232, #248, #250 and #254), along with #228-#231 and #233, so this branch now conflicts with main in docs/using-diffci.md, as you expected in #258.

Could you merge main into it? Once it's green I'll check it alongside the other Rust PRs and merge it. Thanks for keeping the Rust series moving.

@adityankale190895

Copy link
Copy Markdown
Member

Thanks! Following dependency edges through non-member packages is a real improvement, and it also fixes a miss through [patch]ed crates. One problem before this can merge: these repos used to be blocked entirely, but the bridge package's own code is now scanned only to decide whether it's "opaque". The reads it makes are never recorded, so a change those reads depend on can select no tests:

  1. Documentation and build scripts. A bridge that reads docs, or has a build script, is never added to rustDocumentationReaders, even though members' build scripts are. A local probe with a bridge doing read_to_string("docs/guide.md") gave rustDocumentationReaders: [] and no blockers, so a docs-only change selects nothing even when member tests call that bridge code.
  2. Programs it runs. The bridge's runsPrograms is ignored. Bridge code that runs sh or python doesn't turn off feat(rust): confine helper scripts and native sources to the crate that owns them #250's crate scoping (the probe gave rustRunsPrograms: false).

Suggested fix: in opaqueLocal, also push bridge build scripts and documentation readers into rustDocumentationReaders, and set rustRunsPrograms from the bridge's scanned.runsPrograms. Ideally do this for every in-repo non-member package, not only the ones the lazy check reaches.

Small thing: the bridge scan resolves input.path from dirname(file) and ignores the #[path] module base from #234 (now on main). The PR also needs main merged in; the only conflict is the Rust paragraph in docs/using-diffci.md.

…-deps

Signed-off-by: FredApps <[email protected]>

# Conflicts:
#	docs/using-diffci.md
A local path package inside the repository that is not a workspace
member was scanned only to decide whether it was opaque. Its build
scripts and documentation readers were never added to
rustDocumentationReaders, and its program runs never set
rustRunsPrograms, so a docs-only change could select no tests even
when member tests call bridge code that reads the docs.

Every such package is now scanned up front, reached or not. Unreadable
or unscannable files count as readers and program runs. #[path]
inputs resolve from the inline module base, as for members.

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Thanks, this was a real hole. I merged main in (55503ac; the only conflict was the Rust paragraph in docs/using-diffci.md) and fixed it in 6e6e5a2:

  • Every in-repository local package that isn't a workspace member is now scanned up front, whether or not a member reaches it, instead of only in the lazy opaque check.
  • A file that can't be read or scanned counts as all of these, and makes the package opaque.
  • The bridge's #[path] inputs now use the inline-module base from feat(rust): accept literal #[path] modules inside their own crate #234. An inline-module #[path] outside a crate root or mod.rs makes the bridge opaque, as it does for members. In practice any bridge with a #[path] was already opaque, because the path literal counts as a path, so this one doesn't change the result. It just stops relying on that.
  • The docs paragraph now says this.

New tests in tests/repo/rust-adapter.test.ts:

  • "local path packages inside the repository record their readers and program runs, reached or not": your read_to_string("docs/guide.md") case, a bridge build script, a bridge running sh, and the same reads and runs in a local package that no member reaches. It fails without the fix.
  • "a bridge with #[path] modules is opaque, wherever its module base resolves": keeps that behaviour in place.

Locally, typecheck, npm test with DIFFCI_REQUIRE_CARGO=1 (1361 pass, 0 skipped), build, audit:boundary, agent:check and the CLI package tests all pass. Hosted CI is green on 6e6e5a2.

There's one interaction with #277. Bridge files aren't counted as tool-metadata readers here, because rustMetadataReaders only exists on #277. Whichever of the two lands second, I'll merge main in and add bridge files to that list in the same way.

@adityankale190895
adityankale190895 merged commit d23a582 into DiffCI:main Nov 18, 2026
13 checks passed
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