Skip to content

feat(rust): confine helper scripts and native sources to the crate that owns them - #250

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:rust/131-mixed-language-scope
Nov 18, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:rust/131-mixed-language-scope

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #131 (non-code paths / workspace scope).

A single helper .py script or .c file in a Cargo-only repository used to add the global "Mixed Rust/language" and "Unmodeled languages" blockers, so the whole repository went FULL. This PR confines such files to the crate that owns them instead, only when that is safe:

  • It applies only when Rust is the only adapter contribution, and the Rust sources never run other programs. The adapter now reports runsPrograms: Command::new for anything other than cargo, rustc or CARGO_BIN_EXE_*, or the duct, xshell, subprocess or cmd! crates and macros. If any crate runs programs, the old global blockers stay.
  • It covers only .py, .c, .h, .cc, .cpp and .cxx files that aren't Python test files.
  • The scope is the deepest crate directory containing the file, or the file's top-level directory outside crates. A file owned by a root package maps to the whole repository, so nothing narrows there.
  • Scoped blockers still fire whenever a changed file, or anything it depends on or that depends on it, is in that directory.

New contribution fields: rustCrateDirectories and rustRunsPrograms.

Test: "helper scripts and native sources in a Cargo-only workspace are confined to their crate" (real Cargo, in rust-integration.test.ts), covering the scoped and the still-global cases. One docs sentence is added.

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.

…at owns them

Part of DiffCI#131. In a Cargo-only repository, one Python generator script or C file
used to make every Rust change fall back ("Mixed Rust/language repositories ..."
and "Unmodeled languages alongside an adapter ..."). Both blockers are now scoped
to the owning crate's directory, or the file's top-level directory outside every
crate, through the existing scoped-blocker mechanism.

Still repository-wide: another active adapter, JavaScript/Go/Java/... files,
Python test files, files in a root package, and any workspace whose Rust code
starts an external program (Command::new other than Cargo, rustc or
CARGO_BIN_EXE_*, duct, xshell, cmd!).

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 17, 2026 17:33
FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
…xed list

rustSourceInputs listed the flags it ORs. DiffCI#250 (also in DiffCI#258) adds runsPrograms to rustInputs; merged after this PR, the doctests' value would have been dropped and typecheck would fail, with no textual conflict to warn about. Combining the flags by key keeps both PRs correct in either order.

Signed-off-by: FredApps <[email protected]>
@adityankale190895
adityankale190895 merged commit ddfac62 into DiffCI:main Nov 18, 2026
13 checks passed
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
* fix(rust): scan doctest code in doc comments for inputs

* chore: DCO remediation for 4c0e634

I, FredApps <[email protected]>, hereby add my Signed-off-by to this commit: 4c0e634

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

* refactor(rust): combine every scan flag in rustSourceInputs, not a fixed list

rustSourceInputs listed the flags it ORs. #250 (also in #258) adds runsPrograms to rustInputs; merged after this PR, the doctests' value would have been dropped and typecheck would fail, with no textual conflict to warn about. Combining the flags by key keeps both PRs correct in either order.

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

---------

Signed-off-by: FredApps <[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