ADR 0022: Stage E removes the backfill command, the legacy encoders and Replay
Status
Accepted (2026-11-10). Amends ADR 0019
(point 5 and Rollout step 4, the first half of stage E) and the
dockappointment rows of ADR 0004,
which are now marked retired. Does not edit their bodies beyond a one-line
pointer each. Companion of dock-scheduling's ADR 0011, which removes the
importer this command fed.
Context
ADR 0019 moved the DockAppointment to dock-scheduling by a strangler. Stage A
was dock-scheduling's legacy importer, stage B this context's one-shot
api republish-appointments backfill, which re-announced every stored
appointment as the four legacy dockappointment events
(DockAppointmentBooked, CheckedIn, Cancelled, Completed) so the
importer could rebuild them. ADR 0019 kept, "for this command only", the legacy
Encoder / AnalyticsEncoder mappings of those types and the domain Replay
that rebuilds a row's event sequence, and said they go at stage E.
Verified on the live cluster on 2026-11-10:
- this context's appointment copy is empty (
GET /appointmentsreturns{"items":[]}): there is no legacy row to re-announce; - dock-scheduling's
DOCK_LEGACY_IMPORT_CONSUMER_GROUPis unset, so its importer never ran; - the topic
warehouse.inbound-receiving.eventsholds zero messages.
Nothing legacy exists to preserve, and the command's only purpose, feeding the importer, is gone with it (dock-scheduling ADR 0011).
Consumers of the four types were checked on each repository's origin/develop
(2026-11-10): dock-scheduling (its importer, removed by its ADR 0011),
warehouse-planning, yard-management, exception-management, e2e-tests,
network-fulfillment and warehouse-ops-agent. warehouse-planning and
yard-management mention the types only in comments and in tests that assert the
type is ignored; the others have no reference. No non-test code reads them.
Decision
- Remove the backfill. The
republish-appointmentssubcommand and its dispatch (cmd/api/republish.go, therunCommandhook inmain), theRepublishAppointmentsuse case, theports.AppointmentHistoryport andAppointmentRepo.ListRecordswithrepository.AppointmentRecord, which only it used../api <anything>now serves like./api: the binary has no subcommand. - Remove the legacy encoders.
Encoder.EncodeAppointment,AnalyticsEncoder.EncodeAppointment,appointmentRow, the four payload structs and thedockappointmententity constant of the outbound Kafka adapter, andports.LegacyAppointmentEncoder. The running service'sFanoutEncodernever had them. - Remove
Replay. The domain'sTimeline,Replayand the four legacy domain events with theirEventinterface andHeader(internal/domain/appointment/events.go). The aggregate keeps the state the copy needs (door, window, ASN coverage, version, state). - Retire the four types from the contract.
apis/asyncapi.yamlno longer declaresDockAppointmentBooked,DockAppointmentCheckedIn,DockAppointmentCancelledandDockAppointmentCompletedwith the prefixcom.warehouse.wms.inbound-receiving.dockappointmenton either channel (integration and analytics: messages, payload schemas, channel references). dock-scheduling'sBooked,Cancelled,RescheduledandDoorReassigneddeclared as consumed are a different prefix and stay. ADR 0004's catalogue rows for the four types are marked retired, not deleted, so the history of what the topics once carried stays readable. - No legacy event can be produced any more. Nothing in this service builds
one; the integration topic carries
asn.*andreceipt.*types only.
Kept on purpose, each by its own reason:
- The analytics projector still folds the historical
dockappointmenttypes. They stay onwarehouse.inbound-receiving.analytics(a stream is append-only and a rebuild from the topic reads them again) and theappointmentsblock of the receiving-performance report stays frozen, as ADR 0019 said. The fold, the reportKindconstants and the consumer's handling are untouched; their tests build the historical messages from literals instead of through the removed encoders. - The deprecated
GET /appointmentsandGET /appointments/{appointmentId}(and the MCP toolsget_appointmentandlist_appointments), the three 410appointment-movedwrite routes, the appointment copy tables and theDockAppointmentConsumer, and theweb/console. This context's own console remote still calls/appointments, and dock-scheduling has no UI; removing the GETs is a business and UX decision not taken yet. ADR 0019 point 4's "go at stage E" is therefore pending, not done.
Consequences
- ADR 0019's Rollout step 4 is half done: the backfill command and the legacy
encoders and
Replayare gone; the deprecated GETs and the 410 routes remain until a decision names a date. - The published contract shrinks by four types per channel. A consumer that still declared one of them would now be reading a type nobody produces; none was found.
- The
appointmentscopy tables, theappointmentaggregate and theDockAppointmentConsumerare unchanged; no migration. - Retiring the types from
apis/asyncapi.yamlis a contract change in the breaking direction for a reader that ignored ADR 0019's "legacy" label; the cluster shows no message of these types on the topic and no consumer reads them, which is why it is safe now.