Skip to content

test(rust): pinned anstyle replay narrows real revisions with the same failures - #258

Merged
adityankale190895 merged 16 commits into
DiffCI:mainfrom
FredApps:rust/131-anstyle-replay
Nov 18, 2026
Merged

adityankale190895 merged 16 commits into
DiffCI:mainfrom
FredApps:rust/131-anstyle-replay

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #131 (this meets its done criterion: a pinned public Rust replay that narrows a historical revision, with the selected tests catching the same failures as the full baseline).

Result (report): on rust-cli/anstyle, a 20-crate workspace pinned at 46bb5c0, three of four historical revisions got a SELECTIVE plan, and two ran a narrower command than the full run:

Head Changed Command crates Tests run (full / selected) Same failures Injected fault
f9639e7 anstyle-progress/src/query.rs 7 of 20 170 / 95 yes caught by both
1c4609a anstyle-svg/src/lib.rs 6 of 20 169 / 92 yes caught by both
4e58408 anstyle-progress/src/progress.rs 18 of 20 (widened for libc features) 168 / 164 yes caught by both
d234fa3 Cargo.lock + svg FULL — — —

All four full baselines passed. No avoided-compute claim: the timings are single runs with a shared build cache.

Self-contained: includes #232, #248, #250 and #254. The replay needs all four, so this branch merges them in, with their conflicts with each other (the Rust paragraph in docs/using-diffci.md, and rust.ts) already resolved. The diff therefore shows them too: #248 (required features), #250 (mixed-language scope), #254 (feature completion), and #232 (the NAME@VERSION package-spec fix). anstyle needs #232 because anstream and anstyle-parse are also published versions in its dev-dependencies, which made cargo tree -p NAME ambiguous. Commit 9e06c4b (#232) was missing its sign-off; both this branch and #232 now carry a signed DCO remediation commit for it.

Merge order: merge this PR instead of #232, #248, #250 and #254 (GitHub then marks those four as merged), or after them; either way needs no conflict resolution from you. #234, #252, #256 and #277 also edit the same Rust paragraph (and #234/#252 touch rust.ts/types.ts), so whichever of those lands after this one needs main merged in; I will do that as each lands.

What this PR itself adds:

  • scripts/replay-rust.mjs: a --target glob|anstyle option with pinned targets. A target uses its committed Cargo.lock as is (cargo fetch --locked), or the harness generates one when the target ignores it (glob). For a SELECTIVE plan it runs the selected commands (from the plan, or from the planner with the harness baseline as evidence), compares every reported test with the full baseline, and injects a failing test into the changed file in a separate git clone --shared scratch copy, which both runs must catch. It reads libtest's failed-test list, so a failure whose output shares its result line is still counted. A full baseline that fails on its own no longer fails the replay, as long as the selected run reports exactly the same failures.
  • Feature completion now accepts NAME@VERSION crate names in Cargo's feature units, with a planner test.
  • .github/workflows/rust-replay.yml: a target input (glob or anstyle) and a 90-minute timeout.
  • The report (.md and the raw .json), listed in release-files.json.

I also tried servo/rust-url: the plan narrowed to 4–7 of 11 test targets, but feature unification widened every command to all six crates, and its custom test harness interleaves output across parallel tests, so I left it out of the pinned targets (details in the report).

Local checks on this head: typecheck, npm test with DIFFCI_REQUIRE_CARGO=1 (1175 pass), build, audit:boundary, agent:check. Glob still passes too.

Hosted replay: run 44208499759 on the fork, workflow_dispatch with target: anstyle on head 41c5343, passed on ubuntu-26.04 (image 20261111.196.1, Node v24.22.2, Cargo/rustc 1.99.1). The report is the rust-public-replay-anstyle artifact. It matches the committed report exactly: f9639e7 ran 7/20 crates (95 of 170 tests), 1c4609a ran 6/20 (92 of 169), 4e58408 ran 18/20 (164 of 168), all with the same failures as the full baseline and the injected fault caught; d234fa3 fell back to FULL (Cargo.lock change). I also ran the same workflow on a Linux box with act (Cargo 1.100.0) and got the same numbers. The later head 954c395 only adds an empty merge of #232's DCO remediation commit; its tree is identical to 41c5343.

…blocking the repository

Part of DiffCI#131. A Cargo target with required-features no longer makes every change
fall back. The adapter records the target's required features, and the planner
keeps that package whole (cargo test -p name, never --test name), so Cargo runs or
skips the target exactly as the full cargo test does. The existing feature check
gives the package the full run's features, so the gate evaluates the same way.

Signed-off-by: FredApps <[email protected]>
…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]>
Signed-off-by: FredApps <[email protected]>

# Conflicts:
#	docs/using-diffci.md
…ld differ

Part of DiffCI#131 (dependency features / default-features = false). A workspace crate
that asks for a sibling with default-features = false (servo/rust-url's url asks
for percent-encoding, idna and form_urlencoded that way) made every selected
command that left out the other crates refuse, so real workspaces stayed advisory.

The package command now adds the tested crates of the smallest unit Cargo
resolved with the full run's features, repeating until every selected crate is
covered. Feature resolution is monotonic in the selected crates, so the larger
command builds those packages exactly as the full run does. Without a covering
unit, the plan is refused as before; integration-only and bench/example commands
are checked as before.

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

Part of DiffCI#131. scripts/replay-rust.mjs takes --target glob|rust-url (glob stays the
default). For a SELECTIVE plan it now runs the selected cargo test commands next
to the full baseline, compares every reported test, and checks that a failing
test injected into the changed file (in a separate local clone) fails both runs.

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

# Conflicts:
#	docs/using-diffci.md
…131-url-replay

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

# Conflicts:
#	docs/using-diffci.md
#	src/repo/adapters/rust.ts
…ing baseline with matching failures

- Add rust-cli/anstyle (20 crates, committed Cargo.lock) as a pinned replay target; the
  harness uses a committed lockfile as is and only generates one for targets that ignore it.
- Read the failed-test list libtest prints before each summary, so a test whose output shares
  the result line is still counted as failed.
- A full baseline that fails on its own no longer fails the replay, as long as it finishes and
  every selected run reports exactly its failures.
- The replay workflow takes a target input and gets a longer timeout.
- Feature completion accepts NAME@VERSION crate names in Cargo's feature units.

Signed-off-by: FredApps <[email protected]>
Its test harness interleaves output across parallel tests, and form_urlencoded does not run its
unit tests, so the replay can't prove a selected run there; anstyle covers selective runs.

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

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

FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

I tried to run the replay on hosted runners from my fork, but GitHub won't start any workflow there. Its Actions settings say enabled, with all actions allowed and every workflow active, yet workflow_dispatch returns HTTP 422 "Actions has been disabled for this repository", and branch pushes haven't created runs since Nov 15. That looks like a block on GitHub's side for the fork, not anything in this PR.

So the replay result here is still the local Linux run in the report (Cargo 1.100.0, anstyle pinned at 46bb5c0). Once this lands, "Rust public repository replay" → Run workflow with target anstyle on main reproduces it on a hosted runner. The target input only exists from this PR on. I'll try the fork again later and add the run link here if it works.

@FredApps

Copy link
Copy Markdown
Contributor Author

Update: Actions are running on the fork again, so the replay now has a hosted run. Run 44208499759 (workflow_dispatch, target: anstyle, head 41c5343) passed on ubuntu-26.04 with Cargo 1.99.1, and the rust-public-replay-anstyle artifact has the same numbers as the committed report. This replaces my earlier note about the fork being blocked. I've added the details to the description. The PR stays a draft until the PRs it's stacked on land.

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

Signed-off-by: FredApps <[email protected]>
@adityankale190895
adityankale190895 merged commit d71d551 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.

Rust adapter: selective runs on real repositories

2 participants