Skip to content

feat(message)!: mark the wire-protocol enums #[non_exhaustive] - #3151

Merged
trunk-io[bot] merged 1 commit into
mainfrom
protocol-non-exhaustive
Aug 13, 2026
Merged

feat(message)!: mark the wire-protocol enums #[non_exhaustive]#3151
trunk-io[bot] merged 1 commit into
mainfrom
protocol-non-exhaustive

Conversation

@phil-opp

Copy link
Copy Markdown
Collaborator

DaemonRequest, DaemonReply, InterDaemonEvent, CoordinatorRequest and DaemonEvent are the bincode-serialized wire protocol, and they are public on the published dora-message crate. Without #[non_exhaustive] a downstream crate can match them exhaustively, so every future variant addition is a semver-major change.

Adding the attribute is itself breaking, so it has to land before 1.0.0 — otherwise the wire protocol is frozen for the whole 1.x line and any new variant forces a 2.0.0. NodeEvent in this same module already carries it; this brings the other five in line.

Blocks #3121 (the 1.0.0 version bump).

In-tree fallbacks

The catch-all arms are deliberately per-site rather than uniform, because the right behaviour differs by role:

Site Behaviour Why
coordinator — CoordinatorRequest, DaemonEvent warn, keep going a newer daemon must not be able to tear down its own connection by sending a message this coordinator predates
daemon — DaemonRequest reply with an explicit error a newer node fails loudly instead of hanging on a reply that never arrives
daemon, replay-node — InterDaemonEvent skip the replay node counts it as skipped, so the existing "decoded none of N candidates" guard still reports it
CLI — record, topic echo|hz|info skip read-only observability views should not break on an unknown event

Validation

  • cargo check --all (Python crates excluded) — clean
  • cargo fmt --all -- --check — clean
  • cargo clippy --all -- -D warnings (Python crates excluded) — clean
  • cargo test -p dora-message -p dora-daemon -p dora-coordinator -p dora-node-api — 690 passed, 0 failed

Follow-up worth considering

dora-memory-pool is also published, and its five public structs (MemoryPoolId, MemoryPoolMetadata, MemoryPoolEntry, CleanupSummary, MemoryPoolManager) are exhaustively constructible today — so adding a field to any of them after 1.0.0 is likewise semver-major. Same decision, different crate; worth settling before the bump rather than discovering it later.

`DaemonRequest`, `DaemonReply`, `InterDaemonEvent`, `CoordinatorRequest`
and `DaemonEvent` are the bincode-serialized wire protocol, and they are
public on the published `dora-message` crate. Without `#[non_exhaustive]`
a downstream crate can match them exhaustively, so *every* future variant
addition is a semver-major change.

Adding the attribute is itself breaking, so it has to land before 1.0.0 or
the protocol is frozen for the whole 1.x line. `NodeEvent` in this same
module already carries it; this brings the other five in line.

The in-tree fallbacks are deliberately per-site rather than uniform:

- coordinator `CoordinatorRequest` / `DaemonEvent`: warn and continue. A
  newer daemon must not be able to tear down its connection by sending a
  message this coordinator predates.
- daemon `DaemonRequest`: reply with an explicit error, so a newer node
  fails loudly instead of hanging on a reply that never arrives.
- daemon / replay-node `InterDaemonEvent`: skip. The replay node counts
  the event as skipped so the existing "decoded none of N" guard still
  reports it.
- CLI observability (`record`, `topic echo|hz|info`): skip — these are
  read-only views and should not break on an unknown event.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@phil-opp phil-opp added this to the 1.0 milestone Aug 13, 2026
@trunk-io

trunk-io Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

😎 Merged successfully - details.

@trunk-io
trunk-io Bot merged commit 793e4d9 into main Aug 13, 2026
16 checks passed
@trunk-io
trunk-io Bot deleted the protocol-non-exhaustive branch August 13, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant