0030. Kafka-sourced process-path catalogue and boot-time dial retry
Status
Accepted. Records a decision that was implemented without an ADR (the
kafkacatalog adapter) and amends ADR-0012,
which described only the file source.
Context
ADR-0012 validates every
path_id against the fleet's process-path catalogue, loaded once from
warehouse-infra's YAML (PATH_CATALOGUE_FILE). process-path-management now
owns the catalogue and publishes ProcessPathCreated, ProcessPathUpdated and
ProcessPathDeactivated on warehouse.process-path-management.events.
Reading a copy of a YAML file means the service can disagree with the owner
until a redeploy.
Decision
- The catalogue is a port, not a concrete type. Callers depend on
ports.PathCatalogue(Lookup(id) (PathDefinition, error)), which*pathcatalog.Cataloguealready satisfies.Handlers.Catalogue, the KafkaConsumerandApplyOrderAllocatedall take the port. (ADR-0012's text that named the concrete*pathcatalog.Cataloguefield is superseded by this.) - Two sources, chosen by
PATH_CATALOGUE_SOURCE(read incmd/wes/main.go'swireCatalogue):file(default) — unchanged ADR-0012 behaviour:filecatalog.LoadreadsPATH_CATALOGUE_FILEonce; a missing/invalid file is fatal.kafka—kafkacatalog.Consumerreplays the topic from the earliest offset into an in-memory catalogue and then follows it live; it requiresKAFKA_BROKERS.
- Per-process consumer group. The replay consumer uses a unique,
process-scoped group id (never a shared name), so a restart always replays
the full history instead of resuming a previous process's offset with an
empty cache; offsets are committed asynchronously only because they are never
resumed (enforced by
TestReplayConsumersSetCommitInterval). - Readiness gate. Startup blocks until the consumer has seen everything
that existed in the topic when it started (
WaitReady, bounded bykafkacatalog.WaitReadyTimeout= 60 s); exceeding it is fatal, mirroring the file loader's "never run against an incomplete catalogue" contract. - Boot-time dial retry (
internal/bootretry). The first outbound dial (Postgres, and the catalogue topic's offset lookup) is wrapped inbootretry.Retry— 5 attempts, exponential backoff from 1 s (~31 s total). Cause: the fleet's Istio native sidecars reset a pod's first outbound TCP connection ~10 s after start; a single attempt turns that into CrashLoopBackOff. Retrying is not a weakening of fail-closed: when the budget is exhausted the process still refuses to boot and reports the real last error. Used bycmd/wes,cmd/wes-projector,cmd/wes-reportsandcmd/mcp.
Consequences
- The catalogue follows the owning service live; a deactivated path stops validating without a redeploy.
- Startup now depends on a replay of the topic (bounded by the 60 s gate) when
kafkais selected.filekeeps zero new boot dependencies. - Each replica runs its own replay (safe by design — read-only, rebuilt on start; see ADR-0025).
- Both sources must keep identical matching semantics: the Kafka consumer builds
a real
pathcatalog.Catalogueper read rather than reimplementing the match.