Repository navigation
fix(besreceiver): correct PatternExpanded semantics and surface pattern_skipped - #75
Merged
Merged
Conversation
…rn_skipped Three P0 corrections to bazel.patterns from the post-merge review of #71: 1. target_count filters to TargetConfigured children. Previously len(children) counted nested PatternExpanded ids and UnconfiguredLabel failure markers, inflating the reported count of resolved targets. 2. Multi-pattern events even-split target_count across the event's non-empty patterns (floor(M/N)). The proto carries no per-pattern attribution; the prior code stamped the full count to each pattern, summing to N×M across the slice. Single-pattern events — Bazel's dominant case — keep the exact count. Eliminates the inflation that the prior multi-pattern test had cemented as the contract. 3. pattern_skipped events route to a new bazel.patterns_skipped Slice[string] on the root span, instead of being silently dropped. Bazel emits these under --keep_going for parts of a top-level pattern whose expansion was skipped. eventTypeName surfaces them under a distinct event_type label so bes.events.processed counts the two id shapes separately. Test coverage added: NonTargetConfiguredChildren_NotCounted, PatternSkipped_EmitsSkippedAttribute, PatternSkippedOnly_NoPatternsAttribute, PostFlush_Dropped. The existing multi-pattern test is renamed and updated to assert the corrected even-split semantics. docs/attributes.md drops the "1,400 tests" example and documents the new semantics + the new attribute. Refs #62, follow-up to #71. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Three P0 corrections to
bazel.patternsfrom the post-merge review of #71.target_countnow filters toTargetConfiguredchildren. Previouslylen(children)counted nestedPatternExpandedids andUnconfiguredLabelfailure markers, inflating the reported count of resolved targets.target_countacross the event's non-empty patterns (floor(M/N)). The proto carries no per-pattern attribution; the prior code stamped the full count to each pattern, summing toN×Macross the slice. Single-pattern events — Bazel's dominant case — keep the exact count. Eliminates the inflation that the prior multi-pattern test had cemented as the contract.pattern_skippedevents surface as a newbazel.patterns_skippedSlice[string]on the root span instead of being silently dropped. Bazel emits these under--keep_goingfor parts of a top-level pattern whose expansion was skipped.eventTypeNamedistinguishes them sobes.events.processedno longer conflates the two id shapes.docs/attributes.mddrops the misleading "1,400 tests" example and documents the new even-split + filter semantics plus the new attribute.Why this approach
Multi-pattern events are rare (Bazel emits one
PatternExpandedper top-level pattern in practice), and the proto offers no per-pattern attribution within them. Even-split keeps the slice shape stable, makes the per-event sum match the child count, and gives an exact answer for the common case. Reusingcaps.Patternsforbazel.patterns_skippedkeeps operator tuning to one knob.Test plan
make buildmake vetmake test— 360 tests, 4 new + 1 renamed/updatedTestPatternExpanded_NonTargetConfiguredChildren_NotCountedTestPatternExpanded_PatternSkipped_EmitsSkippedAttributeTestPatternExpanded_PatternSkippedOnly_NoPatternsAttributeTestPatternExpanded_PostFlush_DroppedTestPatternExpanded_MultiplePatterns_EvenSplitsTargetCount(renamed, semantics inverted from prior assertion)make lintRefs #62, follow-up to #71.
🤖 Generated with Claude Code