Add event-bus-dto crate: shared envelope + schema generation#4583
Add event-bus-dto crate: shared envelope + schema generation#4583jmg-duarte wants to merge 4 commits into
Conversation
Introduce a dependency-light crate holding the DTOs for events published on the NATS event bus, the shared `Envelope` wire format (moved out of observe so it has a single source of truth) and an `event-bus-schemas` CLI that emits a JSON schema per subject (the full envelope-wrapped shape downstream consumers receive). Ports the existing `priceEstimate` event into the crate unchanged and wires price-estimation and observe to it. New events are added in follow-up commits.
|
Claude finished @jmg-duarte's task in 3m 23s —— View job PR Review: Add event-bus-dto crateReviewed the new crate, the schema-generation tooling, the CI check, and the migration out of Two non-blocking points posted inline:
Minor observations, not worth blocking on:
Nice work — LGTM. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new event-bus-dto crate to centralize wire-format event types (DTOs) and their JSON schemas, separating them from the event producers. It extracts the Envelope and PriceEstimateEvent structures from the observe and price-estimation crates, and adds a schema generation binary (event-bus-schemas) along with a Justfile command to output the JSON schemas. The observe and price-estimation crates have been updated to use these shared types. No critical issues found.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Constrain the `version` field's generated schema to the current ENVELOPE_VERSION so downstream consumers can validate the wire-format version against the schema instead of just `type: string`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
Extracts the events into a separate crate so we can provide a JSONSchema for downstream usage (like analytics).
Generation style is similar to that of contracts, checks on CI are included.
Context: https://nomevlabs.slack.com/archives/C0B2X0Q7ERK/p1782315064424599
Related to BE-44
Changes
How to test
cargo r -p event-bus-dto