-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Context
Event.destination_id stores the publish input — the optional destination the caller explicitly targeted when publishing an event. It does NOT represent which destinations the event was actually routed to. This distinction is already documented in code comments (#676), but the field name doesn't communicate this.
Why it's confusing
When someone reads event.destination_id, the natural interpretation is "the destination this event belongs to" or "the destination this event was delivered to." In reality it means "the destination the publisher requested" — which may not even match (e.g. if the destination is disabled or the topic/filter doesn't match, the event still stores that destination_id but routes to zero destinations).
It also creates an inconsistency at the API level: GET /events?destination_id=... would need to filter by matched destinations, not by Event.destination_id — so there's a query parameter with the same name as a field on the model but with completely different semantics.
If we later add something like matched_destination_ids (#688), having two destination-related fields with very different semantics and no obvious naming distinction makes this worse.
Options
- Rename
destination_id→target_destination_id(orrequested_destination_id) — makes the intent clear, but is a breaking change across model, DB column, API request/response, and OpenAPI spec - Leave as-is — rely on docs to explain the difference
- Drop
destination_idfrom persistence — it's only used transiently duringHandle()routing. After matching, the value has served its purpose. Nothing downstream readsevents.destination_idfrom the DB. This removes the confusion entirely
Question for the team
Which approach do we want to take?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status