Skip to main content

Architecture Decision Records

An Architecture Decision Record captures one architecturally significant decision: the forces that produced it, the decision itself, and what it costs. Not a design document, not a spec — a record of a choice, written once, never edited after acceptance.

Why they exist​

Code shows what was built. Git history shows when. Neither reliably shows why, and "why" is what determines whether a future change is safe.

Two examples from this repo where the reasoning is genuinely non-obvious from the code:

  • LaborAssignment is keyed by AssociateId, not by an AssignmentId. Reading the aggregate, that looks like a modelling shortcut. It is the mechanism that makes "exactly one active assignment per associate" structurally impossible to violate. Without ADR 0003, a future refactor to "proper" per-assignment identity would silently downgrade a hard invariant into a hopeful query.
  • There is no taskId anywhere in this service. That reads as incompleteness. It is ADR 0002, and it is the most consequential decision in the codebase.

The template​

These records use Michael Nygard's format, the de facto standard: one Markdown file per decision, numbered 0001-, 0002-, …, with five sections.

# NNNN. Short noun phrase naming the decision

## Status
Proposed | Accepted | Deprecated | Superseded by [ADR-NNNN](./nnnn-....md)

## Context
The forces at play: technical, organisational, domain. Written in
value-neutral language — describe the situation, do not argue for the
outcome yet.

## Decision
"We will ..." — active voice, one clear choice.

## Consequences
What becomes easier, what becomes harder, what is now true that was not
before. Include the costs. An ADR with only benefits is marketing.

Records are immutable once accepted. A decision that no longer holds is not edited — it is marked Superseded by ADR-NNNN, and the new record explains what changed.

Proposing a new one​

  1. Copy the template above into docs/docs/adr/NNNN-short-title.md, taking the next free number.
  2. Write it with status Proposed.
  3. Add it to the Architecture Decision Records category in docs/sidebars.ts.
  4. Open a pull request. The discussion happens on the PR, not in the document.
  5. On merge, flip the status to Accepted.

If a decision turns out to be wrong, write a new ADR that supersedes it. Do not quietly delete the old one — the fact that it was tried is itself information.

The records​

#TitleStatus
0001Hexagonal (ports and adapters) architectureAccepted
0002Stop at the path boundary — no associate-to-task linkAccepted
0003Certification-gated assignment with exactly one active assignment per associateAccepted
0004Kafka for integration events, with a CloudEvents catalog ahead of the wire formatAccepted; envelope superseded by 0026
0005RFC 7807 Problem Details for every error responseAccepted
0006godog acceptance specs driven through the real HTTP surfaceAccepted
0007arch-go fitness tests to make the layering rule executableAccepted
0008Model Context Protocol as an inbound adapter, not a new serviceAccepted; auth/static-bearer sections superseded by 0018
0009Hazmat handling via the existing path-name-equals-certification-name gateAccepted; superseded in part by 0013
0010Per-service analytical data product (report) via a separate analytics topicAccepted; Envelope v1 superseded by 0026
0011Adopt the fleet-wide micro-frontend console architecture (workforce-mfe)Accepted; deferred all-paths endpoint recorded in 0029
0012Close-the-loop measured rate feed from labor-performance into ProposePathPlanAccepted
0013Process-path catalogue validation, mirroring fulfillment-execution's ADR-0017Accepted
0014Live installed-capacity ceiling on CommitShiftPlan, sourced from fulfillment-executionAccepted
0015Standard metrics convention across the fleetAccepted
0016Transactional outbox feeding both Kafka topics from one tableAccepted; relay retry amended by 0036
0017Adopt the fleet REST identity — static bearer keys with read/read-write scopesSuperseded by 0018
0018Remove the fleet REST identity layer (revert ADR-0017)Accepted
0019Replace the synchronous labor-performance MeasuredRateClient with an event-fed local cacheAccepted
0020Consume labor-performance's idle-share signal for staffing surfacing and proposal trimAccepted
0021Optimistic concurrency (version column) on AssociateShift and LaborAssignmentAccepted
0022Per-dependency circuit breakers, read-only retry, Kafka DLQ, and graceful shutdown hardeningAccepted
0023Key the integration Kafka publisher by ShiftPlan aggregate idAccepted
0024Per-workload HorizontalPodAutoscaler and pgxpool MaxConns/statement_timeout tuningAccepted
0025Run golang-migrate against a direct Postgres connection, not PgBouncerAccepted
0026CloudEvents 1.0 as the mandatory event envelopeAccepted
0027Transactional Idempotency-Key middleware on the creation POSTsAccepted
0028Housekeeping sweeper for idempotency keys and published outbox rowsAccepted
0029All-paths staffing-gap list endpoint for a building/shiftAccepted
0030Kafka-sourced process-path catalogue (PATH_CATALOGUE_SOURCE=kafka)Accepted
0031Kafka writer durability: RequireAll acks and a 10ms batch timeoutAccepted
0032Boot-time retry for the first outbound dial (Istio sidecar warm-up)Accepted
0033Corrections from the 2026-10-05 docs audit (idempotent-request atomicity, measured-rate unit, idle-share naming, /readyz)Accepted
0034Site-scoped staffing gap (optional canonical siteCode)Accepted
0035siteCode is the canonical name of the ShiftPlan key; buildingId is a deprecated aliasAccepted
0036The outbox relay stops claiming a row after OUTBOX_MAX_ATTEMPTS failuresAccepted
0037The reports binary's routes are specified in apis/openapi-reports.yamlAccepted
0038Postgres and Kafka are the only runtime (no in-memory, log, file-catalogue or permissive mode)Accepted; supersedes the fallbacks of 0008, 0013, 0016, 0019 and 0030
0039A2A inbound adapter (third driving adapter): two curated skills, staffing_status (read) and assign_labor (write), over the same use cases as REST and MCP; message-only, problems answered in-band, delegation only (facts stay on Kafka via the outbox)Accepted
0040Adopt the fleet REST API guideline: noun routes (shift-starts, shift-ends, break-starts, break-ends, plan-proposals), every POST idempotent (global key, 409 idempotency-key-reused, Idempotency-Replayed), keyset-paged {items,nextCursor} collectionsAccepted
0041Agent authority levels and attributable assignments: every MCP tool and A2A skill declares one level (L1 to L3 here; com.warehouse/authority meta, authority:L<n> tag), the MCP server is stateless (serves the 2026-07-28 revision), and an agent-initiated assign_labor stamps an additive initiated_by on LaborAssigned / LaborReassignedAccepted
0042The IdempotencyKey pattern describes the header as sent (the key, then optional trailing HTTP whitespace that the stack drops); validIdempotencyKey enforces the key exactly (1-128 printable ASCII, visible first and last character)Accepted; amends 0040 and 0027
0043Local copy of warehouse-planning's LabourPlanCommitted; ProposePathPlan without a charge proposes the required heads (rateSource: labour-plan); staffing-gap and committed lines show requiredHeads; the charge-based proposal stays, deprecatedAccepted; extends 0012 and 0029
0044Every problem type has an idempotency replay class (FINAL/OUTCOME/RETRYABLE) declared on its catalogue entry; a RETRYABLE refusal is not stored — the key is released and a retry executes; no OUTCOME entry can exist in this savepoint storeAccepted; amends 0027