test: reproducer for #398 (--keep_going silently drops targets on repo-rule failure)#399
Merged
Merged
Conversation
…o-rule failure) `--keep_going` defaults to `true`, so bazel-diff accepts a partial `bazel query` (exit code 3) as success. When a repository rule fails to resolve (e.g. a transient network error fetching a remote dependency), the referencing package silently drops out of the results and bazel-diff emits an incomplete, non-deterministic hash set with no error. Adds an E2E reproducer plus a `keep_going_repo_failure` fixture whose `//bad` package loads from a module-extension repo whose repository rule always fail()s (offline, deterministic). The test pins current behavior: with the default `--keep_going` the run exits 0 and silently omits `//bad`, while `--no-keep_going` fails loudly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Reproduces #398.
What
--keep_goingdefaults totrue, so bazel-diff accepts a partialbazel query(exit code 3) as success. When a repository rule fails to resolve — e.g. a transient network error fetching a remote dependency like:— the package referencing that repo silently drops out of the query results, and
generate-hashesemits an incomplete, non-deterministic hash set with no error. Root cause is theallowedExitCodes.add(3)underkeepGoinginBazelQueryService.runQuery.Reproducer
New
keep_going_repo_failurefixture workspace (bzlmod; works on Bazel 7/8/9)://good— a plain genrule with no external deps (always resolvable)//bad— loads a.bzlfrom@failing_dep, a module-extension repo whose repository rule alwaysfail()s (offline, deterministic — models the fetch failure)New E2E test
testKeepGoingSilentlyDropsTargetsOnRepoRuleFailure_reproducerForIssue398pins the current behavior:--keep_going=true) —generate-hashesexits0, output contains//good:goodbut silently omits//bad.--no-keep_going— exits1, failing loudly instead of writing a truncated hash set.Verified against real Bazel:
--keep_going→ query exit3(accepted),--no-keep_going→ exit7(rejected).Follow-up (not in this PR)
Consider making
--keep_going=falsethe default, or at least warning/failing on exit code 3, so hashes stay deterministic. This PR only lands the reproducer.🤖 Generated with Claude Code