Architecture Decision Records
The ADRs live in docs/docs/adr/. Each body is immutable once accepted; a
change of mind is a new ADR that supersedes the old one. The status column is
the Status: line of each ADR body.
| ADR | Title | Status |
|---|---|---|
| 0001 | Network Inventory Planning Boundary | Accepted |
| 0002 | Phase-1 local read models, fail-closed planning snapshot and advisory simulation | Accepted (snapshot staleness and direction rules amended by 0018) |
| 0003 | Phase-2 inter-warehouse transfer saga (approval, outbox, allocation replies) | Accepted (per-key ordering amended by 0016) |
| 0004 | CloudEvents type catalogue for network-inventory-planning | Accepted |
| 0005 | Work-demand release and fact-driven saga transitions | Accepted |
| 0006 | Migrations over a direct connection; chart routing | Accepted |
| 0007 | Phase-4 observability — OTel propagation, saga-health analytics, scheduled rebalance runs | Accepted |
| 0008 | Transfer read side and a read-only MCP server | Accepted |
| 0009 | Analytics read side — a projector and read-only reports over a separate analytical database | Accepted |
| 0010 | Console remote nip_mfe (Module Federation) | Accepted |
| 0011 | godog/Gherkin acceptance tests as executable specification | Accepted |
| 0012 | OTLP trace and metric export for the API process | Accepted |
| 0013 | Poison transfer replies and facts are dead-lettered, never retried | Accepted |
| 0014 | Ordering guard on the site_sku_demand read model | Accepted |
| 0015 | Rebalance Policy and Transfer Lane catalogues | Accepted |
| 0016 | Outbox relay attempt cap: OUTBOX_MAX_ATTEMPTS (default 20) excludes a poison row and logs it at ERROR | Accepted |
| 0017 | Case-multiple transfers: round to whole cases (nearest, tie up, at least one, capped by the origin), report the signed remainder, local pack-level copy | Accepted |
| 0018 | A stale fact excludes its site from the planning snapshot (never the whole snapshot); approval is refused only when its origin or destination is excluded; direction-disabled sites still participate | Accepted |
| 0019 | A consumer that stops on its own (not by shutdown) ends the process so the kubelet restarts it, instead of leaving a frozen read model behind a Ready pod | Accepted |
| 0020 | A2A inbound adapter: a read-only Agent2Agent agent (transfer_status, find_stuck_transfers) over the same read use cases as REST and MCP, served by cmd/a2a on :8093 | Accepted |
| 0021 | Adopt the fleet REST API guideline: noun routes, idempotent POSTs (409 idempotency-key-reused, Idempotency-Replayed), keyset {items,nextCursor} lists | Accepted |
| 0022 | Cancel-after-allocation compensation: RELEASING state, TransferAllocationReleaseRequested command, TransferStockAllocationReleased reply, POST /v1/transfers/{id}/cancellation — closes ADR-0003's stranded-reservation gap | Accepted |
| 0023 | A transfer cancelled after allocation holds no reservation: the release settle clears the reservation id, allocations and expiry (amends 0022; matches migration 0009's CHECK) | Accepted |
| 0024 | Every problem type has a replay class (FINAL, OUTCOME, RETRYABLE) declared on its catalogue entry; a RETRYABLE refusal is not stored — the key is released and a retry executes (fleet rule; refines 0021's stored-4xx behaviour) | Accepted |
Where each decision shows up in the code
| ADR | Code |
|---|---|
| 0001 | internal/domain/transfer (advisory planner), no inventory ledger anywhere |
| 0002 | internal/domain/planning, the three read-model consumers, GET /v1/transfer-simulations |
| 0003 | InterWarehouseTransfer, ApproveTransfer, outbox_events and the relay, the transfer-reply consumer (per-key ordering amended by 0016) |
| 0004 | internal/adapters/kafka/cloudevents, internal/architecture/catalogue_fitness_test.go |
| 0005 | WorkDemandReleased, TRANSFER_*_PATH_ID / _CPT_OFFSET, the transfer-fact consumer |
| 0006 | MIGRATIONS_DATABASE_URL, the chart's gatewayApi / ingress values |
| 0007 | trace propagation through Kafka headers, the analytics encoder, NIP_HEALTH_CHECK_INTERVAL, NIP_STUCK_THRESHOLDS, NIP_REBALANCE_SCHEDULE, rebalance_runs |
| 0008 | GET /v1/transfers, GET /v1/transfers/{id}, cmd/mcp |
| 0009 | cmd/nip-projector, cmd/nip-reports, analytics/migrations |
| 0010 | web/ and the chart's frontend component |
| 0011 | features/*.feature, features_*_test.go |
| 0012 | internal/adapters/outbound/telemetry, OTEL_EXPORTER_OTLP_ENDPOINT |
| 0013 | transfer.ErrReplyRefused, usecases.IsRefusedReply, internal/adapters/inbound/kafka/deadletter.go, warehouse.inventory.events.dlq, warehouse.fulfillment.events.dlq |
| 0014 | SiteSkuDemandRepo.Upsert (WHERE EXCLUDED.as_of >= site_sku_demand.as_of), the demand consumer's stale-event INFO line |
| 0015 | transfer.RebalancePolicy / transfer.TransferLane (catalogue.go), Planner.PlanFromSnapshot (scheduled_planner.go), usecases.PutRebalancePolicy / PutTransferLane, RunScheduledRebalance.loadCatalogue, postgres.RebalancePolicyRepo / TransferLaneRepo (migration 0005_rebalance_catalogue), PUT/GET /v1/rebalance-policies and /v1/transfer-lanes |
| 0016 | postgres.WithMaxAttempts / WithRelayLogger / DefaultOutboxMaxAttempts (outbox.go), outboxMaxAttemptsFromEnv (cmd/network-inventory-planning/main.go), OUTBOX_MAX_ATTEMPTS, chart config.outboxMaxAttempts, internal/architecture/outbox_relay_cap_fitness_test.go |
| 0017 | transfer.RoundToCases / CaseRounding (casemultiple.go), PACK_LEVEL_CONSUMER_GROUP, pack-level view (migration 0006), rounding columns (migration 0007) |
| 0018 | planning.BuildSnapshot / PlanningSnapshot.StaleSites (snapshot.go), transfer.ValidateApproval (approval.go), PLANNING_MAX_STALENESS |
| 0019 | startRunners (cmd/network-inventory-planning/main.go) |
| 0020 | internal/adapters/inbound/a2a, cmd/a2a, A2A_AGENT_URL, chart a2a block (templates/a2a-*.yaml), internal/architecture/a2a_fitness_test.go |
| 0024 | problemCatalogue / writeProblem (internal/adapters/inbound/http/problems.go), replayClass (replay_class.go), contract.StoredResponse.Transient, internal/adapters/inbound/http/replay_class_catalogue_test.go, idempotency_replay_classes_integration_test.go |