Repository navigation
fix(bazel): parse Bazel 9 JSON build events - #1359
Conversation
Bazel 9 tags options NON_CONFIGURABLE, a value our Bazel 8-era option_filters.proto lacks. The pbjson JSON parser rejects an unknown enum name, so --bazel-bep-path with Bazel 9 JSON found no tests at all. The binary parser was unaffected, since prost keeps unknown enum numbers. Update the vendored protos to Bazel 9.0.1, adding strategy_policy.proto, which invocation_policy.proto now imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
😎 Stack merged successfully - details. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1359 +/- ##
==========================================
+ Coverage 85.61% 85.82% +0.21%
==========================================
Files 85 85
Lines 19174 19186 +12
==========================================
+ Hits 16416 16467 +51
+ Misses 2758 2719 -39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| DIFFERENT_DEPS = 1; | ||
| DIFFERENT_ENVIRONMENT = 2; | ||
| DIFFERENT_FILES = 3; | ||
| DIFFERENT_ACTION_KEY = 0; // currently not used |
There was a problem hiding this comment.
we should copy these verbatim from source imo, without the annotations here
There was a problem hiding this comment.
These are verbatim. The // currently not used comments are Bazel's: src/main/protobuf/action_cache.proto at 9.0.1, lines 36–39. Our copy matches it byte for byte.
I diffed all eight files against Bazel 9.0.1. The only lines that differ are the import paths: import "src/main/protobuf/option_filters.proto" becomes import "option_filters.proto", because every file sits directly in bazel-bep/proto/ and build.rs compiles with proto/ as the only include root. The README's update steps now say so.
| const FLAKY_SUMMARY_EXAMPLE: &str = "test_fixtures/bep_flaky_summary"; | ||
| const RETRIES_EXAMPLE: &str = "test_fixtures/bep_retries"; | ||
| const UNKNOWN_FIELDS_EXAMPLE: &str = "test_fixtures/bep_unknown_fields.json"; | ||
| const BAZEL_9_EXAMPLE: &str = "test_fixtures/bep_bazel_9.json"; |
There was a problem hiding this comment.
yay for historical fixtures so we know we didn't break anything
Problem
--bazel-bep-pathwith a JSON build event file from Bazel 9 finds no tests. The flake farm'sbazel_test (local, json)job on Bazel 9.0.1 shows it, on 0.17.0 and 1.0.0-beta.1 alike:NON_CONFIGURABLEtoOptionMetadataTag, and the JSON parser thatpbjsongenerates rejects an enum name it doesn't know.bazel_test (local, binary)job uploads normally.Change
bazel-bep/proto/to Bazel 9.0.1, with imports flattened as before.strategy_policy.proto, whichinvocation_policy.protonow imports, with its module inbazel-bep/src/lib.rs.src/main/protobuf/).No enum value was removed:
action_cache.proto'sMissReasonvalues only gain "currently not used" comments.build_event_stream.proto(WorkflowConfigured,ChildInvocation*,RunTargetAnalyzed,CoverageActionsFinished,Tree) are field names in JSON, whichignore_unknown_fieldsalready skips. Nothing in the CLI orcontextuses them.Follow-up
pbjson-build0.9 hasignore_unknown_enum_variants, which would stop the next new Bazel enum value from breaking JSON parsing. It means movingprostandtonicup several versions, so it's left for after 1.0.0.Testing
test_parse_bazel_9_json_bep, with abep_bazel_9.jsonfixture carrying"metadataTags": ["NON_CONFIGURABLE"]. It fails with the old protos and passes with these.contextandbazel-bepsuites pass, and so do the CLI's BEP and Bazel tests.cargo check --workspace --all-targetspasses, andtrunk checkis clean.🤖 Generated with Claude Code