Skip to main content

Architecture Decision Records

An Architecture Decision Record captures one architecturally significant decision: the forces that applied, the choice that was made, and what that choice costs. These records use Michael Nygard's template, the de facto standard: one Markdown file per decision, numbered 0001-, 0002-, …, never renumbered.

Why they exist​

Code shows what was decided. It almost never shows what else was considered or what the decision cost — and those are exactly the things a future reader needs before changing it.

A record is written when the answer to "why is it like this?" would otherwise be lost, or when someone would reasonably assume the current design was an accident. Two of the records here exist precisely because the design looks wrong at first glance: ADR-0006 (two types with the same name that must not be merged) and ADR-0003 (a decision engine with no scheduler).

The records​

#TitleStatus
0001Hexagonal (ports & adapters) architectureAccepted
0002Waveless continuous release over wave-based batchingAccepted
0003Flow balancing as a domain service, not a scheduled batch jobAccepted
0004Kafka integration events with a shared envelope and a CloudEvents type conventionSuperseded by 0027 (envelope)
0005RFC 7807 application/problem+json for every error responseAccepted
0006Project Workforce's ShiftPlanCommitted into a separate read model, not our ShiftPlan aggregateAccepted
0007Executable architecture fitness tests with arch-goAccepted
0008Model Context Protocol as an inbound adapter, not a new serviceAccepted — auth section superseded by 0016; telemetry tools' annotations amended by 0037
0009Propagate inventory-storage's ProductClassification onto WorkReleased via a synchronous read at release timeAccepted — live lookup superseded by 0035
0010Gift wrap as a caller-stated WorkReleased characteristic, not a product attributeAccepted
0011Per-service analytical data product (report) via a separate analytics topicAccepted
0012Process-path catalogue validation, mirroring fulfillment-execution's ADR-0017Accepted — amended by 0030
0013Standard metrics convention across the fleet: Tier 1 OTel baseline + Tier 2 business-metric namingAccepted
0014Transactional outbox feeding both the integration and the analytics topic, with an in-process relayAccepted — per-key ordering amended by 0039; in-memory/log/direct paths removed by 0044
0015REST identity: adopt the fleet's static bearer keys with read/read-write scopes (warehouse-ops-agent ADR 0005)Superseded by 0016
0016Remove the REST + MCP static-bearer auth layer (fleet decision reversed)Accepted
0017Read facility-layout's travel graph once, at shift-plan-commit time, to enrich PathPlanAccepted
0018Publish per-path, per-CPT remaining admission capacity as PathCapacityChanged, correlated by CPT cutoff timestampAccepted
0019Reconcile our committed PathPlan against Workforce's LaborPlanObserved, triggered on either side's commitAccepted; superseded by 0049 on cutover
0020FlowFed paths stay Known=false permanently; an observed-throughput signal is proposed alongside, not insteadAccepted
0021Migrate warehouse.work-planning.events to a CloudEvents 1.0 structured envelope via a dual-read/dual-write bake period; companion to fulfillment-execution's own envelope-migration ADRSuperseded by 0027
0022Transactional Idempotency-Key middleware for POST /paths/{pathId}/work-units, ported from order-management's reference implementationAccepted
0023Per-dependency circuit breakers, read-only retry, Kafka DLQ, and graceful shutdown hardeningAccepted — product-classification breaker and retry retired by 0035
0024Switch every outbound Kafka writer's Balancer from LeastBytes to Hash, so the existing per-aggregate Message.Key actually drives partition placementAccepted
0025Per-workload HorizontalPodAutoscaler (api/projector/reports/frontend, mcp excluded) and pgxpool.MaxConns/statement_timeout tuning, ported from order-management's reference PR #110Accepted
0026Run golang-migrate against a direct Postgres connection (MIGRATIONS_DATABASE_URL), not PgBouncerAccepted
0027CloudEvents 1.0 as the mandatory event envelope on every topic (no flat envelope, no dual mode)Accepted
0028The processed-event mark commits atomically with the handling it guards; TaskCompleted for an unknown work unit is a logged skipAccepted — error enumeration amended by 0043
0029Optimistic concurrency (version column + retry) for the WorkPool aggregate; release heals entries left behind by a lost updateAccepted
0030Kafka-sourced process-path catalogue (PATH_CATALOGUE_SOURCE=kafka) behind ports.PathCatalogue, and boot-time dial retryAccepted
0031Consume OrderAllocated/OrderPartiallyAllocated by choreography, fire-and-forget, with deterministic work unit idsAccepted
0032Retention sweeper for idempotency_keys (24h) and published outbox_events (7d)Accepted
0033Consume NIP WorkDemandReleased into transfer-referenced work units; WorkReleased gains optional transfer fields on the same v1 payloadAccepted
0034ConfigurePool command (PUT /paths/{pathId}/pool) sets a pool's mode and WIP limit; lowering below WIP never evictsAccepted
0035Product classification from a local copy of product-master's ProductClassified events; PRODUCT_CLASSIFICATION_MODE=kafka|permissive, http rejected at bootAccepted — permissive default and in-memory copy removed by 0044
0036WorkUnit stores an optional line_no (nullable column, optional lineNo on the REST enqueue); WorkReleased v1 carries it on both topics (per-line confirm-pick, fleet decision 18)Accepted
0037MCP tools that publish events (get_backlog_telemetry, get_rebalance_recommendation) are annotated readOnlyHint: false, destructiveHint: true, and name the event in their descriptionAccepted
0038The cmd/wes-reports routes get their own OpenAPI contract, apis/openapi-reports.yaml: Spectral-linted, rendered into the docs, contract-tested against the real routerAccepted
0039Outbox relay attempt cap: a row is no longer claimed after OUTBOX_MAX_ATTEMPTS failed sends (default 20, 0 = unlimited), logged at ERROR and kept for re-arming; later same-key rows overtake itAccepted
0040Consume slotting-optimization's SlotPlanApproved into one RELOCATE work unit per move: a move into a slot another move vacates waits for that move's completion, a newer plan cancels older not-yet-released units, WorkReleased v1 gains an optional relocation blockAccepted
0041WorkUnitCreated on the integration stream carries the optional reference (the order id for order work) and line_no, so order-management can confirm a release by matching attributes instead of parsing the work-unit id; additive, v1 stays v1, analytics stream unchangedAccepted
0042Consume pick-face-replenishment's ReplenishmentRequested/ReplenishmentCancelled (opt-in REPLENISHMENT_MODE=kafka) into ONE REPLENISH work unit per request id: URGENT gets the short CPT horizon, a cancellation withdraws only a still-Pending unit, WorkReleased v1 gains an optional replenishment blockAccepted — permissive default removed by 0044
0043A TaskCompleted carrying a NEW event id for a work unit that is already completed is a stale fact: TaskCompletedAlreadyCompleted, an INFO-logged, processed skip — never retried, never dead-lettered; amends 0028's error enumerationAccepted
0044Postgres and Kafka are the only runtime: cmd/wes, cmd/mcp and cmd/wes-projector have no in-memory repositories, no log sink, no direct publisher and no optional relay/consumer; mandatory variables and permissive/off/log are boot errors; real /readyz; NUL and wipLimit bounds are client errors; memory adapters are test doublesAccepted
0045Pack-aware work units: CASE_PICK / EACH_PICK / BREAK_CASE released as the pick / case_break objects fulfillment-execution consumes; local copy of product-master pack-level events (own PACK_VIEW_CONSUMER_GROUP); case-based charge and travel estimatesAccepted
0046Agent2Agent as an inbound adapter: this context as an A2A agent (official a2a-go SDK, JSON-RPC 2.0 over HTTP, Agent Card at the well-known path, curated goal-shaped skills, delegation only — facts still travel as CloudEvents)Accepted
0047Adopt the fleet REST API guideline: noun routes, idempotent POST on a global Idempotency-Key (409 on reuse, Idempotency-Replayed), keyset-paged collections, Spectral-enforcedAccepted
0048WorkReleased publishes top-level site_id for every work kind that has one (order work's site from OrderAllocated/OrderPartiallyAllocated's additive site_id); pick plans gain from_bin derived from the local slot-plan forward-pick faceAccepted
0049ChargeForecast and ShiftPlan/PathPlan move to warehouse-planning (its ADR 0023): the two POST routes answer 410, the use cases, drift reconciliation and travel-distance lookup go, ChargeForecastReceived, plan.ShiftPlanCommitted and PathPlanDriftDetected retire; release, balancing, LaborPlanObserved and PathCapacityChanged stayAccepted; amends 0006 and 0017, supersedes 0019 on cutover
0050Every problem type declares exactly one idempotency replay class on its catalogue entry (FINAL, OUTCOME, RETRYABLE); a RETRYABLE refusal (concurrent-modification, wip-limit-reached, work-pool-empty, the not-founds, a not-yet-known CASE pack level, any 5xx) rolls the request transaction back, key row included, so the same key executes againAccepted; amends 0022 and 0047

The template​

# ADR-NNNN — Short present-tense title

## Status
Proposed | Accepted | Deprecated | Superseded by ADR-NNNN

## Context
The forces at play: technical, business, domain. Written so a reader who was
not in the room can see why a decision was needed at all. Facts, not
justification.

## Decision
The choice, stated in the active voice: "We will …".

## Consequences
What becomes easier, what becomes harder, and what is now hard to reverse.
Both the good and the bad — a record that lists only benefits is marketing,
not a decision record.

Status lifecycle​

StatusMeaning
ProposedOpen for discussion; not yet acted on.
AcceptedIn force. The code reflects it.
DeprecatedNo longer applied, with no direct replacement.
Superseded by ADR-NNNNReplaced by a later record.

An accepted record is never edited to reflect a change of mind and never deleted. Superseding it with a new record preserves the reasoning that applied at the time, which is the only reason the archive is worth keeping.

Proposing a new one​

  1. Copy the template into docs/docs/adr/NNNN-short-title.md, taking the next free number.
  2. Set Status: Proposed.
  3. Add it to the table above and to the adr/ section of docs/sidebars.ts.
  4. Open a pull request. The discussion happens on the PR; merging with Status: Accepted is the act of accepting it.

Scope​

These records cover the Work Planning & Release bounded context only. Each sibling service keeps its own. Where a decision is genuinely platform-wide — the integration envelope, for instance — the record states so explicitly and notes that the same decision is recorded in the other repositories.