From 07d6731e041f82ae53df73226ef2bc2f40260997 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 8 Aug 2026 08:47:01 +0800 Subject: [PATCH 1/2] Bump deps --- Cargo.lock | 230 +++++++------------------------- Cargo.toml | 18 +-- libs/otlp-mock/tests/metrics.rs | 1 + 3 files changed, 56 insertions(+), 193 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c56bcfd..b34320f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -284,16 +284,18 @@ dependencies = [ [[package]] name = "actix-ws" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12d4f2fbee3ef7a22fa6cb0e416b962237a167ed0419f22d4e451da2d7f082f8" +checksum = "decf53c3cdd63dd6f289980b430238f9a2f6d19f8bce8e418272e08d3da43f0f" dependencies = [ "actix-codec", "actix-http", "actix-web", "bytestring", "futures-core", + "futures-sink", "tokio", + "tokio-util", ] [[package]] @@ -3328,12 +3330,12 @@ dependencies = [ "hyper-util", "log", "once_cell", - "opentelemetry 0.32.0", - "opentelemetry-http 0.32.0", - "opentelemetry-otlp 0.32.0", - "opentelemetry-proto 0.32.0", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-otlp", + "opentelemetry-proto", "opentelemetry-semantic-conventions", - "opentelemetry_sdk 0.32.1", + "opentelemetry_sdk", "pin-project", "prost", "serde", @@ -4211,7 +4213,7 @@ dependencies = [ "progenitor", "quote", "regex", - "reqwest 0.13.4", + "reqwest", "schemars 1.2.2", "semver", "serde", @@ -4260,10 +4262,10 @@ dependencies = [ "edge-toolkit", "hostname", "log", - "opentelemetry 0.31.0", + "opentelemetry", "opentelemetry-appender-tracing", - "opentelemetry-otlp 0.31.1", - "opentelemetry_sdk 0.31.0", + "opentelemetry-otlp", + "opentelemetry_sdk", "tracing", "tracing-log", "tracing-opentelemetry", @@ -4284,10 +4286,10 @@ version = "0.1.0" dependencies = [ "bytes", "futures-core", - "opentelemetry 0.31.0", - "opentelemetry-http 0.31.0", + "opentelemetry", + "opentelemetry-http", "progenitor-client", - "reqwest 0.13.4", + "reqwest", "retry-policies", "serde", "serde_urlencoded", @@ -4593,7 +4595,7 @@ dependencies = [ "et-test-helpers", "futures-util", "humantime-serde", - "reqwest 0.13.4", + "reqwest", "retry-policies", "serde", "serde-env", @@ -4677,7 +4679,7 @@ dependencies = [ "et-test-helpers", "fs-err", "futures-util", - "opentelemetry 0.31.0", + "opentelemetry", "serde", "serde-env", "serde-inline-default", @@ -4790,11 +4792,11 @@ dependencies = [ "int-otlp-emit", "int-otlp-mock", "libc", - "opentelemetry 0.31.0", - "opentelemetry-http 0.31.0", + "opentelemetry", + "opentelemetry-http", "ort", "pollster", - "reqwest 0.13.4", + "reqwest", "retry", "rstest", "secrecy", @@ -4849,7 +4851,7 @@ dependencies = [ "et-ws-test-server", "fs-err", "futures-util", - "reqwest 0.13.4", + "reqwest", "rstest", "serde", "serde-env", @@ -6241,9 +6243,9 @@ dependencies = [ name = "int-otlp-emit" version = "0.1.0" dependencies = [ - "opentelemetry 0.31.0", - "opentelemetry-otlp 0.31.1", - "opentelemetry_sdk 0.31.0", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry_sdk", ] [[package]] @@ -6253,9 +6255,9 @@ dependencies = [ "actix-rt", "actix-web", "et-test-helpers", - "opentelemetry-proto 0.31.0", + "opentelemetry-proto", "prost", - "reqwest 0.13.4", + "reqwest", "serde_json", "tokio", ] @@ -7485,7 +7487,7 @@ dependencies = [ "percent-encoding", "quick-xml", "rand 0.10.2", - "reqwest 0.13.4", + "reqwest", "rustls-pki-types", "serde", "serde_json", @@ -7592,20 +7594,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" -[[package]] -name = "opentelemetry" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84bcd6ae87133e903af7ef497404dda70c60d0ea14895fc8a5e6722754fc2a0" -dependencies = [ - "futures-core", - "futures-sink", - "js-sys", - "pin-project-lite", - "thiserror 2.0.19", - "tracing", -] - [[package]] name = "opentelemetry" version = "0.32.0" @@ -7622,29 +7610,16 @@ dependencies = [ [[package]] name = "opentelemetry-appender-tracing" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef6a1ac5ca3accf562b8c306fa8483c85f4390f768185ab775f242f7fe8fdcc2" +checksum = "2c0080f0dc1d7c786f467cd85a4e395fcab11ee852004f39a29a18ab7c25d837" dependencies = [ - "opentelemetry 0.31.0", + "opentelemetry", "tracing", "tracing-core", "tracing-subscriber", ] -[[package]] -name = "opentelemetry-http" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a6d09a73194e6b66df7c8f1b680f156d916a1a942abf2de06823dd02b7855d" -dependencies = [ - "async-trait", - "bytes", - "http 1.5.0", - "opentelemetry 0.31.0", - "reqwest 0.12.28", -] - [[package]] name = "opentelemetry-http" version = "0.32.0" @@ -7654,24 +7629,8 @@ dependencies = [ "async-trait", "bytes", "http 1.5.0", - "opentelemetry 0.32.0", -] - -[[package]] -name = "opentelemetry-otlp" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f69cd6acbb9af919df949cd1ec9e5e7fdc2ef15d234b6b795aaa525cc02f71f" -dependencies = [ - "http 1.5.0", - "opentelemetry 0.31.0", - "opentelemetry-http 0.31.0", - "opentelemetry-proto 0.31.0", - "opentelemetry_sdk 0.31.0", - "prost", - "reqwest 0.12.28", - "serde_json", - "thiserror 2.0.19", + "opentelemetry", + "reqwest", ] [[package]] @@ -7681,32 +7640,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9966929966d17620d7c316c643ba62631826e10021409357772d5eea84f62c35" dependencies = [ "http 1.5.0", - "opentelemetry 0.32.0", - "opentelemetry-http 0.32.0", - "opentelemetry-proto 0.32.0", - "opentelemetry_sdk 0.32.1", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-proto", + "opentelemetry_sdk", "prost", + "reqwest", "serde_json", "thiserror 2.0.19", ] -[[package]] -name = "opentelemetry-proto" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7175df06de5eaee9909d4805a3d07e28bb752c34cab57fa9cff549da596b30f" -dependencies = [ - "base64 0.22.1", - "const-hex", - "opentelemetry 0.31.0", - "opentelemetry_sdk 0.31.0", - "prost", - "serde", - "serde_json", - "tonic", - "tonic-prost", -] - [[package]] name = "opentelemetry-proto" version = "0.32.0" @@ -7715,8 +7658,8 @@ checksum = "56d658ba1faf63f7b9c492cfbe6e0ec365440a16132d3270c1065f7b33f1b638" dependencies = [ "base64 0.22.1", "const-hex", - "opentelemetry 0.32.0", - "opentelemetry_sdk 0.32.1", + "opentelemetry", + "opentelemetry_sdk", "prost", "serde", ] @@ -7727,21 +7670,6 @@ version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c913ac17a6c451661ee255f4625d143e51647ae78ebd969b75e41c4442f4fe47" -[[package]] -name = "opentelemetry_sdk" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ae4f5991976fd48df6d843de219ca6d31b01daaab2dad5af2badeded372bd" -dependencies = [ - "futures-channel", - "futures-executor", - "futures-util", - "opentelemetry 0.31.0", - "percent-encoding", - "rand 0.9.5", - "thiserror 2.0.19", -] - [[package]] name = "opentelemetry_sdk" version = "0.32.1" @@ -7751,7 +7679,7 @@ dependencies = [ "futures-channel", "futures-executor", "futures-util", - "opentelemetry 0.32.0", + "opentelemetry", "percent-encoding", "portable-atomic", "rand 0.9.5", @@ -8365,7 +8293,7 @@ dependencies = [ "bytes", "futures-core", "percent-encoding", - "reqwest 0.13.4", + "reqwest", "serde", "serde_json", "serde_urlencoded", @@ -9008,40 +8936,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" -[[package]] -name = "reqwest" -version = "0.12.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http 1.5.0", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "reqwest" version = "0.13.4" @@ -11308,38 +11202,6 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" -[[package]] -name = "tonic" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef" -dependencies = [ - "async-trait", - "base64 0.22.1", - "bytes", - "http 1.5.0", - "http-body", - "http-body-util", - "percent-encoding", - "pin-project", - "sync_wrapper", - "tokio-stream", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tonic-prost" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0" -dependencies = [ - "bytes", - "prost", - "tonic", -] - [[package]] name = "tower" version = "0.5.3" @@ -11405,7 +11267,7 @@ checksum = "36bb7a33ce7f0807d44124b5119ea3581fd59028db56477a7aa01741c869ca6a" dependencies = [ "actix-web", "mutually_exclusive_features", - "opentelemetry 0.31.0", + "opentelemetry", "pin-project", "tracing", "tracing-opentelemetry", @@ -11446,12 +11308,12 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.32.1" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac28f2d093c6c477eaa76b23525478f38de514fa9aeb1285738d4b97a9552fc" +checksum = "adbc64cba7137545b8044cb1fe9814f7aacf3c6b5f9b45be8bb5db538befdb26" dependencies = [ "js-sys", - "opentelemetry 0.31.0", + "opentelemetry", "smallvec 1.15.2", "tracing", "tracing-core", diff --git a/Cargo.toml b/Cargo.toml index 821fed6..0958b29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ actix-files = "0.6" actix-rt = "2" actix-web = { version = "4", features = ["rustls-0_23"] } actix-web-thiserror = "0.2" -actix-ws = "0.3" +actix-ws = "0.4" async-trait = "0.1" asyncapi-rust = "0.2" backon = { version = "1.6", default-features = false } @@ -114,10 +114,10 @@ onnx-extractor = "0.3" # ever needs them, and each drags its own SDK surface, so they stay off until asked for. object_store = { version = "0.14", default-features = false, features = ["aws", "fs"] } openapiv3 = "2" -opentelemetry = "0.31" -opentelemetry-appender-tracing = "0.31" -opentelemetry-http = "0.31" -opentelemetry-otlp = { version = "0.31", default-features = false, features = [ +opentelemetry = "0.32" +opentelemetry-appender-tracing = "0.32" +opentelemetry-http = "0.32" +opentelemetry-otlp = { version = "0.32", default-features = false, features = [ "http-json", "http-proto", "logs", @@ -125,13 +125,13 @@ opentelemetry-otlp = { version = "0.31", default-features = false, features = [ "reqwest-blocking-client", "trace", ] } -opentelemetry-proto = { version = "0.31", default-features = false, features = [ +opentelemetry-proto = { version = "0.32", default-features = false, features = [ "gen-tonic-messages", "metrics", "trace", "with-serde", ] } -opentelemetry_sdk = "0.31" +opentelemetry_sdk = "0.32" ort = { version = "=2.0.0-rc.10", default-features = false, features = ["copy-dylibs"] } pollster = "0.4" port_check = "0.2" @@ -180,11 +180,11 @@ toml = "0.8" tracing = "0.1" tracing-actix-web = { version = "0.7", default-features = false, features = [ "emit_event_on_error", - "opentelemetry_0_31", + "opentelemetry_0_32", "uuid_v7", ] } tracing-log = "0.2" -tracing-opentelemetry = "0.32" +tracing-opentelemetry = "0.33" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-wasm = "0.2" tree-sitter = "0.25" diff --git a/libs/otlp-mock/tests/metrics.rs b/libs/otlp-mock/tests/metrics.rs index bb26c8b..48e3908 100644 --- a/libs/otlp-mock/tests/metrics.rs +++ b/libs/otlp-mock/tests/metrics.rs @@ -43,6 +43,7 @@ fn sample_request() -> ExportMetricsServiceRequest { value: Some(AnyValue { value: Some(any_value::Value::IntValue(7)), }), + ..Default::default() }], ..Default::default() }; From 49e02ee9ecc95c64b8d2dd95826d198bd84eecc9 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 8 Aug 2026 09:34:43 +0800 Subject: [PATCH 2/2] Bump asyncapi --- .mise/config.toml | 1 + CLAUDE.md | 13 + Cargo.lock | 89 +- Cargo.toml | 16 +- .../rules/doc-summary-ends-with-period.yaml | 1 + generated/specs/ws.yaml | 1028 +++-------------- libs/edge-toolkit/src/ws.rs | 2 +- utilities/int-gen/src/asyncapi.rs | 116 +- utilities/int-gen/src/error.rs | 2 - utilities/onnx/src/main.rs | 5 +- 10 files changed, 226 insertions(+), 1047 deletions(-) diff --git a/.mise/config.toml b/.mise/config.toml index 91bb5c2..731eead 100644 --- a/.mise/config.toml +++ b/.mise/config.toml @@ -1510,6 +1510,7 @@ depends = [ ] [tasks.cargo-test] +alias = "cargo-nextest" description = "Run every Rust test via nextest (web-runner excluded on gnullvm)" run = "cargo nextest run --workspace {{ vars.cargo_ws_excludes }} --config-file config/nextest.toml" diff --git a/CLAUDE.md b/CLAUDE.md index 2e228ca..fa70672 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -207,6 +207,19 @@ When you find yourself about to explain something that is already explained else is the right home (so say nothing here), or this is the better home (so move it here and remove the original). One canonical location, never two. +## Don't narrate dependency version changes in comments + +A comment describes what the code does now, not how it got there. When you bump a dependency and update code to its +new API, do **not** add a comment explaining the change -- no "0.4 renamed `Foo` to `Bar`", no "replaces the old +`x()`/`y()` calls", no "the 0.3 API used to ...". The renamed symbol and the new call are already visible in the code, +and git history records what changed, so the note is pure duplication that goes stale the moment the next version +lands. Comment the current code as if the old version never existed. + +The narrow exception is a version fact that is load-bearing -- it explains something that would otherwise read as +arbitrary or wrong and that a reader needs in order not to break things: a pin deliberately held back for +compatibility, or a workaround for a specific upstream bug. "The implementation changed but the behaviour did not" +never qualifies. When in doubt, leave it out. + ## Common Commands All tasks run through `mise run `. The aggregates below act on Rust + the universal checks diff --git a/Cargo.lock b/Cargo.lock index b34320f..1244345 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -703,12 +703,13 @@ dependencies = [ [[package]] name = "asyncapi-rust" -version = "0.2.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ca4d85b1ab04475b03e84a38385786632200879127fd4cbc7da83c8fa7fe72" +checksum = "b78e4b1b517a0ed363afe4ce5f3c654f9dad71ae219b493326edd0fba90931e8" dependencies = [ "asyncapi-rust-codegen", "asyncapi-rust-models", + "indexmap", "schemars 1.2.2", "serde", "serde_json", @@ -716,9 +717,9 @@ dependencies = [ [[package]] name = "asyncapi-rust-codegen" -version = "0.2.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc20d497b19e9f06ba3fad2938f6bf696184a72d44d8e9d44208303409e3a0af" +checksum = "4cfe26564ef0eb43900f482d827f5a2d6360bd0361de4fd1c77d87e0f7517e2c" dependencies = [ "proc-macro2", "quote", @@ -730,10 +731,11 @@ dependencies = [ [[package]] name = "asyncapi-rust-models" -version = "0.2.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076c77e2a619f709f613e50ea1bcb58211539cbf2f1eaa9fad140e93a15f8950" +checksum = "0ff7f79a0864d5c8f1fbd83f9c7eb5c07d623cf50196ea54213e6592ae4ec341" dependencies = [ + "indexmap", "serde", "serde_json", ] @@ -826,6 +828,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + [[package]] name = "base64-simd" version = "0.8.0" @@ -871,7 +879,7 @@ dependencies = [ "clang-sys", "itertools 0.13.0", "log", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quote", "regex", @@ -891,7 +899,7 @@ dependencies = [ "clang-sys", "itertools 0.13.0", "log", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quote", "regex", @@ -3031,8 +3039,8 @@ dependencies = [ "proc-macro2", "quote", "stringcase", - "strum", - "strum_macros", + "strum 0.27.2", + "strum_macros 0.27.2", "syn 2.0.119", "syn-match", "thiserror 2.0.19", @@ -4034,7 +4042,7 @@ name = "edge-toolkit" version = "0.1.0" dependencies = [ "asyncapi-rust", - "base64 0.22.1", + "base64 0.23.1", "command-error", "et-path", "et-test-helpers", @@ -4051,7 +4059,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_yaml", - "strum", + "strum 0.28.0", "tempfile", "testing_logger", "thiserror 2.0.19", @@ -4209,7 +4217,7 @@ dependencies = [ "kdl 6.7.1", "openapiv3", "pretty_yaml", - "prettyplease", + "prettyplease 0.3.0", "progenitor", "quote", "regex", @@ -4219,7 +4227,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "syn 2.0.119", + "syn 3.0.3", "thiserror 2.0.19", "tree-sitter", "tree-sitter-zig", @@ -4566,7 +4574,7 @@ name = "et-ws-pyo3-runner" version = "0.1.0" dependencies = [ "backon", - "base64 0.22.1", + "base64 0.23.1", "command-error", "edge-toolkit", "et-rest-client", @@ -7550,9 +7558,9 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "onnx-extractor" -version = "0.3.10" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8a7b1752ce77203505f0939b9861ec10905100d017720bc66400502ce1e531" +checksum = "531e693927327eef6b84c2051e1d0453d2ea5b2f658f1ab3463100716d8ed6d6" dependencies = [ "memmap2", "prost", @@ -8134,9 +8142,9 @@ dependencies = [ [[package]] name = "port_check" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2110609fb863cdb367d4e69d6c43c81ba6a8c7d18e80082fe9f3ef16b23afeed" +checksum = "4c2749dcd0984ec1be3c01001bb1d83623a58c3c0049a99b9afec61464fa98e7" [[package]] name = "portable-atomic" @@ -8228,6 +8236,16 @@ dependencies = [ "syn 2.0.119", ] +[[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.3", +] + [[package]] name = "primeorder" version = "0.13.6" @@ -8375,7 +8393,7 @@ dependencies = [ "log", "multimap", "petgraph 0.8.3", - "prettyplease", + "prettyplease 0.2.37", "prost", "prost-types", "regex", @@ -10198,7 +10216,16 @@ version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ - "strum_macros", + "strum_macros 0.27.2", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros 0.28.0", ] [[package]] @@ -10213,6 +10240,18 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "subtle" version = "2.6.1" @@ -11353,9 +11392,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.25.10" +version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f873475d258561b06f1c595d93308a7ed124d9977cb26b148c2084a4a3cc87" +checksum = "af1c71c1c4cc0920b20d6b0f6572e7682cd07a6a2faec71067a31fa394c586df" dependencies = [ "cc", "regex", @@ -13143,7 +13182,7 @@ dependencies = [ "anyhow", "heck", "indexmap", - "prettyplease", + "prettyplease 0.2.37", "syn 2.0.119", "wasm-metadata", "wit-bindgen-core", @@ -13158,7 +13197,7 @@ checksum = "af9237d678e3513ad24e96fe98beacdc0db6405284ba2a2400418cf0d42caa89" dependencies = [ "anyhow", "macro-string", - "prettyplease", + "prettyplease 0.2.37", "proc-macro2", "quote", "syn 2.0.119", diff --git a/Cargo.toml b/Cargo.toml index 0958b29..693fc4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,9 +56,9 @@ actix-web = { version = "4", features = ["rustls-0_23"] } actix-web-thiserror = "0.2" actix-ws = "0.4" async-trait = "0.1" -asyncapi-rust = "0.2" +asyncapi-rust = "0.5" backon = { version = "1.6", default-features = false } -base64 = "0.22.1" +base64 = "0.23" bytemuck = { version = "1.16", features = ["derive"] } bytes = "1" bytesize = { version = "2", features = ["serde"] } @@ -107,7 +107,7 @@ libc = "0.2" local-ip-address = "0.6" log = "0.4" minicov = "0.3" -onnx-extractor = "0.3" +onnx-extractor = "0.4" # Storage backend abstraction: local disk by default, any object_store backend via a URL. # `aws` pulls the S3 client (which also covers S3-compatible servers such as the rustfs mise tool the backend # test runs against). Only `aws` is enabled -- adding `gcp`/`azure`/`http` is a one-word change if a consumer @@ -134,9 +134,9 @@ opentelemetry-proto = { version = "0.32", default-features = false, features = [ opentelemetry_sdk = "0.32" ort = { version = "=2.0.0-rc.10", default-features = false, features = ["copy-dylibs"] } pollster = "0.4" -port_check = "0.2" +port_check = "0.3" pretty_yaml = "0.6" -prettyplease = "0.2" +prettyplease = "0.3" progenitor = "0.14" progenitor-client = "0.14" prost = "0.14" @@ -166,8 +166,8 @@ serde_json = "1" serde_path_to_error = "0.1" serde_urlencoded = "0.7" serde_yaml = "0.9" -strum = { version = "0.27", features = ["derive"] } -syn = "2" +strum = { version = "0.28", features = ["derive"] } +syn = "3" sys_traits = { version = "0.1.28", features = ["libc", "real"] } temp-env = "0.3" tempfile = "3" @@ -187,7 +187,7 @@ tracing-log = "0.2" tracing-opentelemetry = "0.33" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-wasm = "0.2" -tree-sitter = "0.25" +tree-sitter = "0.26" tree-sitter-zig = "1" # Already resolved transitively (object_store, reqwest, ...), so this adds no new crate or license to review. # object_store's parse_url_opts takes a `&Url` and does not re-export the type, so a backend-URL config needs it. diff --git a/config/ast-grep/rules/doc-summary-ends-with-period.yaml b/config/ast-grep/rules/doc-summary-ends-with-period.yaml index 3e5379a..a5a6ddc 100644 --- a/config/ast-grep/rules/doc-summary-ends-with-period.yaml +++ b/config/ast-grep/rules/doc-summary-ends-with-period.yaml @@ -71,4 +71,5 @@ files: - utilities/int-gen/src/lib.rs - utilities/int-gen/src/zig.rs - utilities/int-gen/tests/generate_zig.rs + - utilities/onnx/src/main.rs - utilities/wasm-cov-wrapper/src/main.rs diff --git a/generated/specs/ws.yaml b/generated/specs/ws.yaml index 5a1a185..151b3df 100644 --- a/generated/specs/ws.yaml +++ b/generated/specs/ws.yaml @@ -4,9 +4,9 @@ channels: address: /ws components: messages: - et-agent-message: + AgentMessage: contentType: application/json - name: et-agent-message + name: AgentMessage payload: properties: from_agent_id: @@ -31,518 +31,81 @@ components: - message title: WsAgentMessage type: object - title: et-agent-message - et-alive: + title: AgentMessage + Alive: contentType: application/json - name: et-alive + name: Alive payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-alive - et-broadcast-message: + properties: + timestamp: + type: string + type: + const: et-alive + type: string + required: + - type + - timestamp + title: WsAlive + type: object + title: Alive + BroadcastMessage: contentType: application/json - name: et-broadcast-message + name: BroadcastMessage payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-broadcast-message - et-client-event: + properties: + message: + description: Arbitrary JSON value (opaque to the protocol) + type: + const: et-broadcast-message + type: string + required: + - type + - message + title: WsBroadcastMessage + type: object + title: BroadcastMessage + ClientEvent: contentType: application/json - name: et-client-event + name: ClientEvent payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-client-event - et-connect: + properties: + action: + type: string + capability: + type: string + details: + description: Arbitrary JSON value (opaque to the protocol) + type: + const: et-client-event + type: string + required: + - type + - capability + - action + - details + title: WsClientEvent + type: object + title: ClientEvent + Connect: contentType: application/json - name: et-connect + name: Connect payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-connect - et-connect-ack: + properties: + agent_id: + type: + - string + - "null" + type: + const: et-connect + type: string + required: + - type + title: WsConnect + type: object + title: Connect + ConnectAck: contentType: application/json - name: et-connect-ack + name: ConnectAck payload: properties: agent_id: @@ -558,10 +121,10 @@ components: - status title: WsConnectAck type: object - title: et-connect-ack - et-invalid: + title: ConnectAck + Invalid: contentType: application/json - name: et-invalid + name: Invalid payload: properties: detail: @@ -578,137 +141,23 @@ components: - detail title: WsInvalid type: object - title: et-invalid - et-list-agents: + title: Invalid + ListAgents: contentType: application/json - name: et-list-agents + name: ListAgents payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-list-agents - et-list-agents-response: + properties: + type: + const: et-list-agents + type: string + required: + - type + title: WsListAgents + type: object + title: ListAgents + ListAgentsResponse: contentType: application/json - name: et-list-agents-response + name: ListAgentsResponse payload: properties: agents: @@ -723,137 +172,26 @@ components: - agents title: WsListAgentsResponse type: object - title: et-list-agents-response - et-message-ack: + title: ListAgentsResponse + MessageAck: contentType: application/json - name: et-message-ack + name: MessageAck payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-message-ack - et-message-status: + properties: + message_id: + type: string + type: + const: et-message-ack + type: string + required: + - type + - message_id + title: WsMessageAck + type: object + title: MessageAck + MessageStatus: contentType: application/json - name: et-message-status + name: MessageStatus payload: properties: detail: @@ -873,10 +211,10 @@ components: - detail title: WsMessageStatus type: object - title: et-message-status - et-relay-binary: + title: MessageStatus + RelayBinary: contentType: application/json - name: et-relay-binary + name: RelayBinary payload: properties: content: @@ -895,10 +233,10 @@ components: - content title: WsServerRelayBinary type: object - title: et-relay-binary - et-relay-text: + title: RelayBinary + RelayText: contentType: application/json - name: et-relay-text + name: RelayText payload: properties: content: @@ -911,10 +249,10 @@ components: - content title: WsServerRelayText type: object - title: et-relay-text - et-response: + title: RelayText + Response: contentType: application/json - name: et-response + name: Response payload: properties: message: @@ -927,134 +265,26 @@ components: - message title: WsResponse type: object - title: et-response - et-send-agent-message: + title: Response + SendAgentMessage: contentType: application/json - name: et-send-agent-message + name: SendAgentMessage payload: - $schema: https://json-schema.org/draft/2020-12/schema - description: |- - Messages a client is allowed to SEND to the server. - - Split from [`ServerMessage`] so the type system rejects client code - constructing a `ConnectAck`, and so the server's inbound match arms - can be exhaustive without an "unexpected server-originated message" - trap. - oneOf: - - properties: - agent_id: - type: - - string - - "null" - type: - const: et-connect - type: string - required: - - type - title: WsConnect - type: object - - properties: - timestamp: - type: string - type: - const: et-alive - type: string - required: - - type - - timestamp - title: WsAlive - type: object - - properties: - type: - const: et-list-agents - type: string - required: - - type - title: WsListAgents - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - to_agent_id: - type: string - type: - const: et-send-agent-message - type: string - required: - - type - - to_agent_id - - message - title: WsSendAgentMessage - type: object - - properties: - message: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-broadcast-message - type: string - required: - - type - - message - title: WsBroadcastMessage - type: object - - properties: - message_id: - type: string - type: - const: et-message-ack - type: string - required: - - type - - message_id - title: WsMessageAck - type: object - - properties: - action: - type: string - capability: - type: string - details: - description: Arbitrary JSON value (opaque to the protocol) - type: - const: et-client-event - type: string - required: - - type - - capability - - action - - details - title: WsClientEvent - type: object - - properties: - content: - type: string - type: - const: et-relay-text - type: string - required: - - type - - content - title: WsClientRelayText - type: object - - properties: - content: - description: Byte array (uint8) - items: - format: uint8 - maximum: 255 - minimum: 0 - type: integer - type: array - type: - const: et-relay-binary - type: string - required: - - type - - content - title: WsClientRelayBinary - type: object - title: ClientMessage - title: et-send-agent-message + properties: + message: + description: Arbitrary JSON value (opaque to the protocol) + to_agent_id: + type: string + type: + const: et-send-agent-message + type: string + required: + - type + - to_agent_id + - message + title: WsSendAgentMessage + type: object + title: SendAgentMessage schemas: AgentConnectionState: enum: diff --git a/libs/edge-toolkit/src/ws.rs b/libs/edge-toolkit/src/ws.rs index 6cebc99..9196b6e 100644 --- a/libs/edge-toolkit/src/ws.rs +++ b/libs/edge-toolkit/src/ws.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; /// Schema for `serde_json::Value`-typed fields. schemars 1.x renders bare /// `Value` as the boolean schema `true`, which the `AsyncAPI` Schema model in -/// `asyncapi-rust` 0.2 doesn't accept. Emit an explicit object schema so the +/// `asyncapi-rust` doesn't accept. Emit an explicit object schema so the /// payload is described as "arbitrary JSON" without tripping the parser. #[cfg(feature = "schema-export")] #[expect( diff --git a/utilities/int-gen/src/asyncapi.rs b/utilities/int-gen/src/asyncapi.rs index dcea574..1ed473d 100644 --- a/utilities/int-gen/src/asyncapi.rs +++ b/utilities/int-gen/src/asyncapi.rs @@ -68,24 +68,25 @@ struct WsApiClient; #[asyncapi_messages(ServerMessage)] struct WsApiServer; -/// Build the merged, slimmed `AsyncAPI` spec as a `serde_json::Value`. +/// Build the merged `AsyncAPI` spec as a `serde_json::Value`. /// /// Steps: /// 1. Derive the two halves via `WsApiClient` / `WsApiServer`. /// 2. Merge the server-side channels / operations / messages into the /// client-side document (`merge_asyncapi`). -/// 3. Slim each `components.messages..payload` to just its -/// tagged variant and hoist shared `$defs` into -/// `components.schemas` (`slim_component_messages`). -/// 4. Assert that `info.version` matches [`WS_VERSION`] so any drift +/// 3. Assert that `info.version` matches [`WS_VERSION`] so any drift /// between the derive literal and the const is caught loudly. +/// +/// `asyncapi-rust` 0.5 already emits each message's payload as its own object +/// schema (no `oneOf` fan-out), with shared definitions hoisted into +/// `components.schemas` and canonical `#/components/schemas/...` refs, so no +/// payload-slimming post-processing is needed -- unlike 0.2, which required it. pub fn build_spec() -> Result { let client_spec = WsApiClient::asyncapi_spec(); let server_spec = WsApiServer::asyncapi_spec(); let mut spec_value = serde_json::to_value(&client_spec)?; let server_value = serde_json::to_value(&server_spec)?; merge_asyncapi(&mut spec_value, &server_value); - slim_component_messages(&mut spec_value)?; let info_version = spec_value .get("info") .and_then(|info| info.get("version")) @@ -157,106 +158,3 @@ fn merge_asyncapi(target: &mut serde_json::Value, source: &serde_json::Value) { merge_nested(target, source, "components", "messages"); merge_nested(target, source, "components", "schemas"); } - -/// Replace each component message's payload with just its variant schema and -/// hoist the shared `$defs` into `components.schemas`. Mutates `spec` in place. -#[expect( - clippy::single_call_fn, - reason = "named helper called once by build_spec(); the slim-down is one logical step" -)] -fn slim_component_messages(spec: &mut serde_json::Value) -> Result<(), Error> { - use serde_json::Value; - - // Pluck one variant payload off any message -- they're all identical, so - // we use the first to harvest the `oneOf` array and `$defs`. - let components = spec - .get_mut("components") - .and_then(Value::as_object_mut) - .ok_or(Error::SpecNodeMissing("components"))?; - - let messages = components - .get_mut("messages") - .and_then(Value::as_object_mut) - .ok_or(Error::SpecNodeMissing("components.messages"))?; - - let any_payload = messages - .values() - .find_map(|msg| msg.get("payload").cloned()) - .ok_or(Error::SpecNodeMissing("any message payload"))?; - let one_of = any_payload - .get("oneOf") - .and_then(Value::as_array) - .ok_or(Error::SpecNodeMissing("payload.oneOf"))? - .clone(); - let defs = any_payload - .get("$defs") - .and_then(Value::as_object) - .cloned() - .unwrap_or_default(); - - // Index variants by their `type.const` discriminator so we can match each - // component message name (`et-connect`, ...) to its slim schema. - let mut variants_by_tag: std::collections::HashMap = std::collections::HashMap::new(); - for variant in one_of { - let tag = variant - .get("properties") - .and_then(|props| props.get("type")) - .and_then(|kind| kind.get("const")) - .and_then(Value::as_str) - .map(str::to_string); - let Some(tag) = tag else { - continue; - }; - // Rewrite `$ref: "#/$defs/Foo"` -> `"#/components/schemas/Foo"` so the - // hoisted defs land in the AsyncAPI-canonical location. - let mut variant = variant; - rewrite_refs(&mut variant); - let _previous: Option = variants_by_tag.insert(tag, variant); - } - - for (name, message) in messages.iter_mut() { - if let Some(variant) = variants_by_tag.get(name) - && let Some(obj) = message.as_object_mut() - { - let _previous: Option = obj.insert("payload".to_string(), variant.clone()); - } - } - - // Hoist `$defs` to `components.schemas`. Rewrite refs inside each def too. - let mut hoisted = serde_json::Map::new(); - for (name, mut value) in defs { - rewrite_refs(&mut value); - let _previous: Option = hoisted.insert(name, value); - } - if !hoisted.is_empty() { - let _previous: Option = components.insert("schemas".to_string(), Value::Object(hoisted)); - } - Ok(()) -} - -/// Recursively replace `$ref: "#/$defs/Foo"` with `"#/components/schemas/Foo"`. -fn rewrite_refs(value: &mut serde_json::Value) { - match value { - serde_json::Value::Object(map) => { - if let Some(reference) = map.get_mut("$ref") - && let Some(raw) = reference.as_str() - && let Some(rest) = raw.strip_prefix("#/$defs/") - { - *reference = serde_json::Value::String(format!("#/components/schemas/{rest}")); - } - for inner in map.values_mut() { - rewrite_refs(inner); - } - } - serde_json::Value::Array(items) => { - for inner in items { - rewrite_refs(inner); - } - } - // primitives have no refs to rewrite. - serde_json::Value::Null - | serde_json::Value::Bool(_) - | serde_json::Value::Number(_) - | serde_json::Value::String(_) => {} - } -} diff --git a/utilities/int-gen/src/error.rs b/utilities/int-gen/src/error.rs index 513db26..9af41a8 100644 --- a/utilities/int-gen/src/error.rs +++ b/utilities/int-gen/src/error.rs @@ -30,8 +30,6 @@ pub enum Error { #[error(transparent)] Regex(#[from] regex::Error), - #[error("AsyncAPI spec missing required node: {0}")] - SpecNodeMissing(&'static str), #[error("WS message JSON Schema malformed: {0}")] SchemaMalformed(&'static str), #[error("unsupported JSON Schema `type`: `{0}`")] diff --git a/utilities/onnx/src/main.rs b/utilities/onnx/src/main.rs index 1a7cec3..c11a737 100644 --- a/utilities/onnx/src/main.rs +++ b/utilities/onnx/src/main.rs @@ -28,9 +28,8 @@ fn main() -> Result<(), Box> { return Err("--filename is required".into()); }; - let model = onnx_extractor::OnnxModel::load_from_file(&filename.to_string_lossy())?; + let model = onnx_extractor::Model::load_from_file(filename)?; - model.print_summary(); - model.print_model_info(); + println!("{model}"); Ok(()) }