Repository navigation
test(e2e): pin that a package deleted between revisions is never reported impacted - #591
Merged
tinder-maxwellelliott merged 1 commit intoOct 31, 2026
Conversation
…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
marked this pull request as ready for review
October 31, 2026 01:17
tinder-maxwellelliott
deleted the
claude/bazel-diff-deleted-packages-af24d4
branch
October 31, 2026 01:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reproducer for a report against a precomputed impacted-targets file: its labels named
.../LibraryTestspackages that the consumer's checkout no longer had, so the consumer'sbazel query --query_fileaborted withno such packageand 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
tests/resources/workspaces/deleted_package://keep, a leaf//keep/LibraryTests:keep_testspackage depending on it, and//consumerdepending on it. The tests delete the wholeLibraryTestspackage and editkeep.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-targetswith 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 thatbazel query --query_fileover 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 throughservein 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.bzlregenerated (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:
serveswitches revisions withgit checkout --force, which removes tracked files deleted between revisions but leaves untracked and ignored ones in place. Generated, gitignoredLibraryTestsBUILD files left over from an earlier generator run would stay visible tobazel queryat every revision.Diffing the failing artifact's labels against the generating host's hash file for the "to" commit tells which.
Follow-up: the
serveworking-tree check for the second mechanism is in a separate PR.🤖 Generated with Claude Code