Skip to content

test(e2e): pin that a package deleted between revisions is never reported impacted - #591

Merged
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/bazel-diff-deleted-packages-af24d4
Oct 31, 2026
Merged

tinder-maxwellelliott merged 1 commit into
masterfrom
claude/bazel-diff-deleted-packages-af24d4

Conversation

@tinder-maxwellelliott

@tinder-maxwellelliott tinder-maxwellelliott commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reproducer for a report against a precomputed impacted-targets file: its labels named .../LibraryTests packages that the consumer's checkout no longer had, so the consumer's bazel query --query_file aborted with no such package and discarded all ~33k labels. The suspected mechanism was that bazel-diff counts a target present only in the "from" hashes as impacted.

The reproducer does not reproduce the bug. Every path walks the "to" hashes only, so a from-only label cannot come out of the diff itself. The new cases pin that, which narrows the report down to the hashes the diff was handed: the "to" hash file must already have contained the deleted packages, i.e. the generating checkout still had them on disk.

What changed

  • New fixture tests/resources/workspaces/deleted_package: //keep, a leaf //keep/LibraryTests:keep_tests package depending on it, and //consumer depending on it. The tests delete the whole LibraryTests package and edit keep.sh, so the diff is non-empty and the deleted package would have been impacted had it survived.
  • regressions::deleted_package_labels_are_not_impacted: get-impacted-targets with and without --depEdgesFile. Asserts the from-hashes contain the deleted target and the to-hashes do not, that the impacted set is exactly //keep:keep, //keep:keep.sh, //consumer:consumer, and that bazel query --query_file over that set succeeds at the "to" checkout, the way a CI consumer uses the file.
  • regressions::serve_deleted_package_labels_are_not_impacted: the same through serve in the default mode and with --partialGraph, where the deletion must force a full generation (fallback reason names the deleted path) rather than a derivation from a base that still contains the package.
  • tools/e2e/rust_e2e_cases.bzl regenerated (make regen-e2e).

Both cases pass locally under Bazel 8.8.2 (~25s each).

For the reporter

Two mechanisms on the generating side fit the symptom and are worth checking before anything changes here:

  • The precompute generated "to" at a different tree than the consumer's commit (merge commit, stale base).
  • The generating working tree kept files git does not track. serve switches revisions with git checkout --force, which removes tracked files deleted between revisions but leaves untracked and ignored ones in place. Generated, gitignored LibraryTests BUILD files left over from an earlier generator run would stay visible to bazel query at every revision.

Diffing the failing artifact's labels against the generating host's hash file for the "to" commit tells which.

Follow-up: the serve working-tree check for the second mechanism is in a separate PR.

🤖 Generated with Claude Code

…rted impacted

A report against a precomputed impacted-targets file: its labels named
`.../LibraryTests` packages the consumer's checkout no longer had, so the
consumer's `bazel query --query_file` aborted with `no such package` and
discarded all 33k labels. The suspected mechanism was that bazel-diff counts
a target present only in the "from" hashes as impacted.

New fixture `deleted_package` (`//keep`, a `//keep/LibraryTests` leaf test
package, `//consumer`) and two e2e cases that delete the package and edit
the source both dependents share, then assert the impacted set is exactly
`//keep:keep`, `//keep:keep.sh`, `//consumer:consumer` and that `bazel query`
over it succeeds at the "to" revision:

- `deleted_package_labels_are_not_impacted`: `get-impacted-targets` with
  and without `--depEdgesFile`.
- `serve_deleted_package_labels_are_not_impacted`: `serve` in the default
  mode and with `--partialGraph`, where the deletion must force a full
  generation rather than a derivation from the base that still has the
  package.

Both pass: every path walks the "to" hashes only, so a from-only label
cannot be produced by the diff itself. The cases pin that so the stale
labels in the report have to come from the hashes handed to the diff.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tinder-maxwellelliott
tinder-maxwellelliott marked this pull request as ready for review October 31, 2026 01:17
@tinder-maxwellelliott
tinder-maxwellelliott merged commit c52cc66 into master Oct 31, 2026
19 checks passed
@tinder-maxwellelliott
tinder-maxwellelliott deleted the claude/bazel-diff-deleted-packages-af24d4 branch October 31, 2026 01:17
@tinder-maxwellelliott tinder-maxwellelliott changed the title test(e2e): pin that a package deleted between revisions is never reported impacted serve: refuse to cache a revision whose query loaded packages its tree does not track Oct 31, 2026
@tinder-maxwellelliott tinder-maxwellelliott changed the title serve: refuse to cache a revision whose query loaded packages its tree does not track test(e2e): pin that a package deleted between revisions is never reported impacted Oct 31, 2026
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.

1 participant