From 6b536bcb5bce7e15a90334fde9af8ce07a779065 Mon Sep 17 00:00:00 2001 From: Tyler Beebe Date: Tue, 17 Nov 2026 22:23:28 +0000 Subject: [PATCH] fix(bazel): ignore enum values the BEP protos don't have A JSON build event with an enum value our vendored protos lack, as Bazel 9's NON_CONFIGURABLE was, failed the whole parse and found no tests. pbjson-build 0.9's ignore_unknown_enum_variants reads such a value as the enum's default instead, as the binary parser already does. pbjson 0.9 needs prost 0.14, so bazel-bep moves to prost 0.14 alone, re-exports it for context's binary parser, and drops tonic: nothing enabled its gRPC client or server features. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 673 ++++++++---------- bazel-bep/Cargo.toml | 21 +- bazel-bep/README.md | 2 + bazel-bep/build.rs | 13 +- bazel-bep/src/lib.rs | 13 +- context/src/bazel_bep/binary_parser.rs | 4 +- context/src/bazel_bep/parser.rs | 17 + .../bep_unknown_enum_values.json | 3 + 8 files changed, 334 insertions(+), 412 deletions(-) create mode 100644 context/test_fixtures/bep_unknown_enum_values.json diff --git a/Cargo.lock b/Cargo.lock index 458e5875..d1b25f61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,16 +120,16 @@ name = "api" version = "0.1.0" dependencies = [ "anyhow", - "axum 0.7.9", - "base64 0.22.1", + "axum", + "base64", "bundle", "chrono", "constants", "context", "display", - "http 1.3.1", + "http", "lazy_static", - "prost", + "prost 0.12.6", "proto", "reqwest", "serde", @@ -338,28 +338,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.110", -] - [[package]] name = "async-tar-wasm" version = "0.4.2-wasm.1" @@ -401,34 +379,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core 0.3.4", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "sync_wrapper 0.1.2", - "tower 0.4.13", - "tower-layer", - "tower-service", -] - [[package]] name = "axum" version = "0.7.9" @@ -436,14 +386,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core 0.4.5", + "axum-core", "axum-macros", "bytes", "futures-util", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.8.1", + "hyper", "hyper-util", "itoa", "matchit", @@ -456,31 +406,14 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", - "tower 0.5.2", + "tower", "tower-layer", "tower-service", "tracing", ] -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-core" version = "0.4.5" @@ -490,13 +423,13 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -528,12 +461,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -547,14 +474,12 @@ dependencies = [ "pbjson", "pbjson-build", "pbjson-types", - "prost", - "prost-build", - "prost-types", - "protox", + "prost 0.14.6", + "prost-build 0.14.6", + "prost-types 0.14.6", + "protox 0.9.1", "serde", "serde_json", - "tonic", - "tonic-build", ] [[package]] @@ -675,7 +600,7 @@ dependencies = [ "futures-io", "glob", "js-sys", - "prost", + "prost 0.12.6", "proto", "pyo3", "pyo3-stub-gen", @@ -842,7 +767,7 @@ version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.110", @@ -871,7 +796,7 @@ dependencies = [ "constants", "fancy-regex", "glob", - "indexmap 2.12.0", + "indexmap", "js-sys", "lazy_static", "once_cell", @@ -957,7 +882,7 @@ dependencies = [ "codeowners", "constants", "gix", - "indexmap 2.12.0", + "indexmap", "itertools 0.14.0", "js-sys", "junit-mock", @@ -967,7 +892,7 @@ dependencies = [ "openssl-src", "percent-encoding", "pretty_assertions", - "prost", + "prost 0.12.6", "prost-wkt-types", "proto", "pyo3", @@ -998,7 +923,7 @@ dependencies = [ "context", "futures", "js-sys", - "prost", + "prost 0.12.6", "speedate 0.17.0", "uuid", "wasm-bindgen", @@ -1460,6 +1385,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "foldhash" version = "0.2.0" @@ -2254,25 +2185,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap 2.12.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hash32" version = "0.3.1" @@ -2284,9 +2196,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] [[package]] name = "hashbrown" @@ -2296,7 +2211,7 @@ checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.2.0", ] [[package]] @@ -2309,12 +2224,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -2353,17 +2262,6 @@ dependencies = [ "windows-link 0.1.3", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.3.1" @@ -2375,17 +2273,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -2393,7 +2280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.3.1", + "http", ] [[package]] @@ -2404,8 +2291,8 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "pin-project-lite", ] @@ -2427,30 +2314,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.8.1" @@ -2461,8 +2324,8 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -2479,8 +2342,8 @@ version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "http 1.3.1", - "hyper 1.8.1", + "http", + "hyper", "hyper-util", "rustls", "rustls-native-certs", @@ -2490,18 +2353,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper 0.14.32", - "pin-project-lite", - "tokio", - "tokio-io-timeout", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -2510,7 +2361,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.8.1", + "hyper", "hyper-util", "native-tls", "tokio", @@ -2524,19 +2375,19 @@ version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-core", "futures-util", - "http 1.3.1", - "http-body 1.0.1", - "hyper 1.8.1", + "http", + "http-body", + "hyper", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.5", + "socket2", "tokio", "tower-service", "tracing", @@ -2684,16 +2535,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.12.0" @@ -2744,15 +2585,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -3028,7 +2860,25 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" dependencies = [ - "logos-derive", + "logos-derive 0.14.4", +] + +[[package]] +name = "logos" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" +dependencies = [ + "logos-derive 0.15.1", +] + +[[package]] +name = "logos" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f" +dependencies = [ + "logos-derive 0.16.1", ] [[package]] @@ -3046,13 +2896,61 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "logos-codegen" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" +dependencies = [ + "beef", + "fnv", + "lazy_static", + "proc-macro2", + "quote", + "regex-syntax", + "rustc_version", + "syn 2.0.110", +] + +[[package]] +name = "logos-codegen" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970" +dependencies = [ + "fnv", + "proc-macro2", + "quote", + "regex-automata", + "regex-syntax", + "syn 2.0.110", +] + [[package]] name = "logos-derive" version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" dependencies = [ - "logos-codegen", + "logos-codegen 0.14.4", +] + +[[package]] +name = "logos-derive" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" +dependencies = [ + "logos-codegen 0.15.1", +] + +[[package]] +name = "logos-derive" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31" +dependencies = [ + "logos-codegen 0.16.1", ] [[package]] @@ -3690,38 +3588,38 @@ dependencies = [ [[package]] name = "pbjson" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" +checksum = "e8edd1efdd8ab23ba9cb9ace3d9987a72663d5d7c9f74fa00b51d6213645cf6c" dependencies = [ - "base64 0.21.7", + "base64", "serde", ] [[package]] name = "pbjson-build" -version = "0.6.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" +checksum = "2ed4d5c6ae95e08ac768883c8401cf0e8deb4e6e1d6a4e1fd3d2ec4f0ec63200" dependencies = [ - "heck 0.4.1", - "itertools 0.11.0", - "prost", - "prost-types", + "heck", + "itertools 0.14.0", + "prost 0.14.6", + "prost-types 0.14.6", ] [[package]] name = "pbjson-types" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" +checksum = "a14e2757d877c0f607a82ce1b8560e224370f159d66c5d52eb55ea187ef0350e" dependencies = [ "bytes", "chrono", "pbjson", "pbjson-build", - "prost", - "prost-build", + "prost 0.14.6", + "prost-build 0.14.6", "serde", ] @@ -3738,7 +3636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset 0.4.2", - "indexmap 2.12.0", + "indexmap", ] [[package]] @@ -3748,7 +3646,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset 0.5.7", - "indexmap 2.12.0", + "indexmap", +] + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset 0.5.7", + "hashbrown 0.15.5", + "indexmap", ] [[package]] @@ -3915,6 +3824,16 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "prettyplease" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0" +dependencies = [ + "proc-macro2", + "syn 3.0.4", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -3949,7 +3868,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef0b569d1d907ab3a28596aee62cf1f61dacb0529a4bedcd8e7460e2d5228b4" +dependencies = [ + "bytes", + "prost-derive 0.14.6", ] [[package]] @@ -3959,20 +3888,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck 0.5.0", + "heck", "itertools 0.12.1", "log", "multimap", "once_cell", "petgraph 0.6.5", - "prettyplease", - "prost", - "prost-types", + "prettyplease 0.2.37", + "prost 0.12.6", + "prost-types 0.12.6", "regex", "syn 2.0.110", "tempfile", ] +[[package]] +name = "prost-build" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e4d69d0fa3e7f6f9cf6b53a0e83e4fc99ba3586f65ce166cff30bd13bb4ad2" +dependencies = [ + "heck", + "itertools 0.15.0", + "log", + "multimap", + "petgraph 0.8.3", + "prettyplease 0.3.0", + "prost 0.14.6", + "prost-types 0.14.6", + "regex", + "syn 3.0.4", + "tempfile", +] + [[package]] name = "prost-derive" version = "0.12.6" @@ -3986,17 +3934,42 @@ dependencies = [ "syn 2.0.110", ] +[[package]] +name = "prost-derive" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad9c5423459fa2f729b8d9235fab810aa29628b171467744fc86d21460ad70d" +dependencies = [ + "anyhow", + "itertools 0.15.0", + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "prost-reflect" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" dependencies = [ - "logos", + "logos 0.14.4", "miette", "once_cell", - "prost", - "prost-types", + "prost 0.12.6", + "prost-types 0.12.6", +] + +[[package]] +name = "prost-reflect" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01b80ea363c31af2de2b92e3c07ed1156628f7838c4afb4df75ee78a37fedbd1" +dependencies = [ + "logos 0.16.1", + "miette", + "prost 0.14.6", + "prost-types 0.14.6", ] [[package]] @@ -4005,7 +3978,16 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ - "prost", + "prost 0.12.6", +] + +[[package]] +name = "prost-types" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29a7c4c7a84cef41a53d338a2d10d4f1b043ea5c3dde26db22ee2c9c1b1c75b" +dependencies = [ + "prost 0.14.6", ] [[package]] @@ -4016,7 +3998,7 @@ checksum = "5fb7ec2850c138ebaa7ab682503b5d08c3cb330343e9c94776612928b6ddb53f" dependencies = [ "chrono", "inventory", - "prost", + "prost 0.12.6", "serde", "serde_derive", "serde_json", @@ -4029,10 +4011,10 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "598b7365952c2ed4e32902de0533653aafbe5ae3da436e8e2335c7d375a1cef3" dependencies = [ - "heck 0.5.0", - "prost", - "prost-build", - "prost-types", + "heck", + "prost 0.12.6", + "prost-build 0.12.6", + "prost-types 0.12.6", "quote", ] @@ -4043,12 +4025,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a8eadc2381640a49c1fbfb9f4a857794b4e5bf5a2cbc2d858cfdb74f64dcd22" dependencies = [ "chrono", - "prost", - "prost-build", - "prost-types", + "prost 0.12.6", + "prost-build 0.12.6", + "prost-types 0.12.6", "prost-wkt", "prost-wkt-build", - "protox", + "protox 0.6.1", "regex", "serde", "serde_derive", @@ -4059,10 +4041,10 @@ dependencies = [ name = "proto" version = "0.0.0" dependencies = [ - "prost", - "prost-build", + "prost 0.12.6", + "prost-build 0.12.6", "prost-wkt-types", - "protox", + "protox 0.6.1", "serde", ] @@ -4074,25 +4056,52 @@ checksum = "ac532509cee918d40f38c3e12f8ef9230f215f017d54de7dd975015538a42ce7" dependencies = [ "bytes", "miette", - "prost", - "prost-reflect", - "prost-types", - "protox-parse", + "prost 0.12.6", + "prost-reflect 0.13.1", + "prost-types 0.12.6", + "protox-parse 0.6.1", "thiserror 1.0.69", ] +[[package]] +name = "protox" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f25a07a73c6717f0b9bbbd685918f5df9815f7efba450b83d9c9dea41f0e3a1" +dependencies = [ + "bytes", + "miette", + "prost 0.14.6", + "prost-reflect 0.16.5", + "prost-types 0.14.6", + "protox-parse 0.9.0", + "thiserror 2.0.21", +] + [[package]] name = "protox-parse" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6c33f43516fe397e2f930779d720ca12cd057f7da4cd6326a0ef78d69dee96" dependencies = [ - "logos", + "logos 0.14.4", "miette", - "prost-types", + "prost-types 0.12.6", "thiserror 1.0.69", ] +[[package]] +name = "protox-parse" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" +dependencies = [ + "logos 0.15.1", + "miette", + "prost-types 0.14.6", + "thiserror 2.0.21", +] + [[package]] name = "pyo3" version = "0.26.0" @@ -4148,7 +4157,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "pyo3-build-config", "quote", @@ -4193,7 +4202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ee9342d671fae8d66b3ae9fd7a9714dfd089c04d2a8b1ec0436ef77aee15e5f" dependencies = [ "chrono", - "indexmap 2.12.0", + "indexmap", "newtype-uuid", "quick-xml 0.38.4", "strip-ansi-escapes", @@ -4241,7 +4250,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.5", + "socket2", "thiserror 2.0.21", "tokio", "tracing", @@ -4279,7 +4288,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.5", + "socket2", "tracing", "windows-sys 0.60.2", ] @@ -4506,15 +4515,15 @@ version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-core", "futures-util", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "http-body-util", - "hyper 1.8.1", + "hyper", "hyper-rustls", "hyper-tls", "hyper-util", @@ -4530,12 +4539,12 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-native-tls", "tokio-rustls", "tokio-util", - "tower 0.5.2", + "tower", "tower-http", "tower-service", "url", @@ -5185,16 +5194,6 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" name = "smoke-test" version = "0.1.0" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.5" @@ -5271,7 +5270,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -5284,7 +5283,7 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.110", @@ -5352,12 +5351,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.2" @@ -5458,7 +5451,7 @@ dependencies = [ "anyhow", "api", "assert_matches", - "axum 0.7.9", + "axum", "bundle", "chrono", "codeowners", @@ -5467,7 +5460,7 @@ dependencies = [ "js-sys", "magnus", "more-asserts", - "prost", + "prost 0.12.6", "prost-wkt-types", "proto", "sentry-tracing", @@ -5491,11 +5484,11 @@ version = "0.1.0" dependencies = [ "anyhow", "api", - "axum 0.7.9", + "axum", "context", "flate2", "git2", - "prost", + "prost 0.12.6", "proto", "sentry", "serde", @@ -5632,21 +5625,11 @@ dependencies = [ "mio", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.5", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd86198d9ee903fedd2f9a2e72014287c0d9167e4ae43b5853007205dda1b76" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.7.2" @@ -5750,7 +5733,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.12.0", + "indexmap", "serde", "serde_spanned", "toml_datetime 0.6.11", @@ -5764,7 +5747,7 @@ version = "0.25.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0db3bae107c9522f86d361697dee1d7386a2ddcf659d5aea5159819a21a3c4a7" dependencies = [ - "indexmap 2.12.0", + "indexmap", "toml_datetime 1.1.1+spec-1.1.0", "toml_parser", "winnow 1.0.3", @@ -5785,66 +5768,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" -[[package]] -name = "tonic" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" -dependencies = [ - "async-stream", - "async-trait", - "axum 0.6.20", - "base64 0.21.7", - "bytes", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "tokio", - "tokio-stream", - "tower 0.4.13", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tonic-build" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "quote", - "syn 2.0.110", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower" version = "0.5.2" @@ -5854,7 +5777,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -5870,11 +5793,11 @@ dependencies = [ "bitflags 2.10.0", "bytes", "futures-util", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "iri-string", "pin-project-lite", - "tower 0.5.2", + "tower", "tower-layer", "tower-service", ] @@ -5961,7 +5884,7 @@ dependencies = [ "api", "assert_cmd", "assert_matches", - "axum 0.7.9", + "axum", "bazel-bep", "bundle", "chrono", @@ -5974,7 +5897,7 @@ dependencies = [ "github-actions", "gix", "glob", - "http 1.3.1", + "http", "humantime", "junit-mock", "lazy_static", @@ -5985,7 +5908,7 @@ dependencies = [ "pluralizer", "predicates", "pretty_assertions", - "prost", + "prost 0.12.6", "prost-wkt-types", "proto", "quick-junit", @@ -6092,7 +6015,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bce48219a2f3154aaa2c56cbf027728b24a3c8fe0a47ed6399781de2b3f3eeaf" dependencies = [ - "heck 0.5.0", + "heck", "log", "proc-macro2", "quote", @@ -6195,7 +6118,7 @@ version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" dependencies = [ - "base64 0.22.1", + "base64", "log", "native-tls", "once_cell", @@ -6748,7 +6671,7 @@ dependencies = [ "lsp-types", "petgraph 0.7.1", "pretty_assertions", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quick-junit", "regex", diff --git a/bazel-bep/Cargo.toml b/bazel-bep/Cargo.toml index d510a49b..34c94e8b 100644 --- a/bazel-bep/Cargo.toml +++ b/bazel-bep/Cargo.toml @@ -7,21 +7,14 @@ license = "MIT" repository = "https://github.com/ChristianBelloni/bazel-bep" [dependencies] -prost = "0.12.6" -prost-types = "0.12.6" -pbjson = "0.6" -pbjson-types = "0.6" +prost = "0.14" +prost-types = "0.14" +pbjson = "0.9" +pbjson-types = "0.9" serde = { version = "1.0.215", default-features = false, features = ["derive"] } serde_json = "1.0.133" -tonic = { version = "0.11", optional = true } [build-dependencies] -tonic-build = "0.11.0" -prost-build = "0.12.6" -pbjson-build = "0.6.2" -protox = "0.6.1" - -[features] -default = [] -client = ["tonic/transport"] -server = [] +prost-build = "0.14" +pbjson-build = "0.9" +protox = "0.9" diff --git a/bazel-bep/README.md b/bazel-bep/README.md index f3fbe4d7..1d00778e 100644 --- a/bazel-bep/README.md +++ b/bazel-bep/README.md @@ -6,6 +6,8 @@ Original protos found [here](https://github.com/bazelbuild/bazel/blob/master/src The protos in `proto/` are from **Bazel 9.0.1**. +The JSON parser skips fields and enum values these protos don't have (`ignore_unknown_fields`, `ignore_unknown_enum_variants` in `build.rs`), so a newer Bazel's JSON still parses; an unknown enum value reads as the enum's default. Update the protos when we need what a new Bazel adds. + ## Updating Protos for New Bazel Versions ### Current Situation diff --git a/bazel-bep/build.rs b/bazel-bep/build.rs index 68f3fb38..b96ab8c3 100644 --- a/bazel-bep/build.rs +++ b/bazel-bep/build.rs @@ -16,28 +16,23 @@ fn main() -> io::Result<()> { let descriptor_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin"); - let compiler = tonic_build::configure(); - #[cfg(not(feature = "client"))] - let compiler = compiler.build_client(false); - #[cfg(not(feature = "server"))] - let compiler = compiler.build_server(false); - let file_descriptors = protox::compile(&protos, ["proto/"]).unwrap(); let file_descriptors_bytes = file_descriptors.encode_to_vec(); fs::write(&descriptor_path, &file_descriptors_bytes).unwrap(); - compiler + prost_build::Config::new() .file_descriptor_set_path(&descriptor_path) .skip_protoc_run() - .compile_well_known_types(true) + .compile_well_known_types() // Override prost-types with pbjson-types .extern_path(".google.protobuf", "::pbjson_types") - .compile(&protos, &["proto/"])?; + .compile_protos(&protos, &["proto/"])?; pbjson_build::Builder::new() .register_descriptors(&file_descriptors_bytes)? .ignore_unknown_fields() + .ignore_unknown_enum_variants() .build(&["."])?; Ok(()) diff --git a/bazel-bep/src/lib.rs b/bazel-bep/src/lib.rs index bff7083d..435e5ac9 100644 --- a/bazel-bep/src/lib.rs +++ b/bazel-bep/src/lib.rs @@ -4,20 +4,9 @@ //! //! To learn what does what check out [bazel's docs](https://bazel.build/remote/bep) +pub use prost; pub use prost_types; -#[cfg(feature = "client")] -#[cfg_attr(docsrs, doc(cfg(feature = "client")))] -pub mod client { - pub use super::google::devtools::build::v1::publish_build_event_client::*; -} - -#[cfg(feature = "server")] -#[cfg_attr(docsrs, doc(cfg(feature = "server")))] -pub mod server { - pub use super::google::devtools::build::v1::publish_build_event_server::*; -} - pub mod types { pub mod build_event_stream { pub use crate::build_event_stream::*; diff --git a/context/src/bazel_bep/binary_parser.rs b/context/src/bazel_bep/binary_parser.rs index 8581e027..4d4efbb9 100644 --- a/context/src/bazel_bep/binary_parser.rs +++ b/context/src/bazel_bep/binary_parser.rs @@ -1,9 +1,9 @@ use std::io::Read; use std::path::PathBuf; +use bazel_bep::prost::Message; +use bazel_bep::prost::bytes::Buf; use bazel_bep::types::build_event_stream::BuildEvent; -use prost::Message; -use prost::bytes::Buf; use crate::bazel_bep::common::BepParseResult; diff --git a/context/src/bazel_bep/parser.rs b/context/src/bazel_bep/parser.rs index 3221ab02..40580b5c 100644 --- a/context/src/bazel_bep/parser.rs +++ b/context/src/bazel_bep/parser.rs @@ -51,6 +51,7 @@ mod tests { 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"; + const UNKNOWN_ENUM_VALUES_EXAMPLE: &str = "test_fixtures/bep_unknown_enum_values.json"; #[test] fn test_parse_bep_with_unknown_fields() { @@ -85,6 +86,22 @@ mod tests { assert!(parse_result.errors.is_empty(), "{:?}", parse_result.errors); } + #[test] + fn test_parse_json_bep_with_unknown_enum_values() { + let input_file = get_test_file_path(UNKNOWN_ENUM_VALUES_EXAMPLE); + let mut parser = BazelBepParser::new(input_file); + let parse_result = parser.parse().unwrap(); + + assert_eq!( + parse_result.uncached_xml_files(), + vec![JunitReportFileWithTestRunnerReport { + junit_path: "/tmp/hello_test/test.xml".to_string(), + test_runner_report: None + }] + ); + assert!(parse_result.errors.is_empty(), "{:?}", parse_result.errors); + } + #[test] fn test_parse_simple_bep() { let input_file = get_test_file_path(SIMPLE_EXAMPLE); diff --git a/context/test_fixtures/bep_unknown_enum_values.json b/context/test_fixtures/bep_unknown_enum_values.json new file mode 100644 index 00000000..f66aef22 --- /dev/null +++ b/context/test_fixtures/bep_unknown_enum_values.json @@ -0,0 +1,3 @@ +{"id": {"started": {}}, "children": [{"structuredCommandLine": {"commandLineLabel": "canonical"}}, {"buildFinished": {}}], "started": {"uuid": "test-uuid", "startTimeMillis": "1763416777000", "buildToolVersion": "9.0.1", "command": "test", "workingDirectory": "/repos/trunk", "workspaceDirectory": "/repos/trunk", "serverPid": "4030542"}} +{"id": {"structuredCommandLine": {"commandLineLabel": "canonical"}}, "structuredCommandLine": {"commandLineLabel": "canonical", "sections": [{"sectionLabel": "command options", "optionList": {"option": [{"combinedForm": "--enable_bzlmod", "optionName": "enable_bzlmod", "optionValue": "1", "effectTags": ["AN_EFFECT_FROM_A_LATER_BAZEL"], "metadataTags": ["A_TAG_FROM_A_LATER_BAZEL"]}]}}]}} +{"id": {"testResult": {"label": "//trunk/hello_world/cc:hello_test", "run": 1, "shard": 1, "attempt": 1, "configuration": {"id": "abc123"}}}, "testResult": {"testActionOutput": [{"name": "test.log", "uri": "file:///tmp/hello_test/test.log"}, {"name": "test.xml", "uri": "file:///tmp/hello_test/test.xml"}], "testAttemptDurationMillis": "153", "status": "PASSED"}}