Skip to main content

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.

ADRTitleStatus
0001Network Inventory Planning BoundaryAccepted
0002Phase-1 local read models, fail-closed planning snapshot and advisory simulationAccepted (snapshot staleness and direction rules amended by 0018)
0003Phase-2 inter-warehouse transfer saga (approval, outbox, allocation replies)Accepted (per-key ordering amended by 0016)
0004CloudEvents type catalogue for network-inventory-planningAccepted
0005Work-demand release and fact-driven saga transitionsAccepted
0006Migrations over a direct connection; chart routingAccepted
0007Phase-4 observability — OTel propagation, saga-health analytics, scheduled rebalance runsAccepted
0008Transfer read side and a read-only MCP serverAccepted
0009Analytics read side — a projector and read-only reports over a separate analytical databaseAccepted
0010Console remote nip_mfe (Module Federation)Accepted
0011godog/Gherkin acceptance tests as executable specificationAccepted
0012OTLP trace and metric export for the API processAccepted
0013Poison transfer replies and facts are dead-lettered, never retriedAccepted
0014Ordering guard on the site_sku_demand read modelAccepted
0015Rebalance Policy and Transfer Lane cataloguesAccepted
0016Outbox relay attempt cap: OUTBOX_MAX_ATTEMPTS (default 20) excludes a poison row and logs it at ERRORAccepted
0017Case-multiple transfers: round to whole cases (nearest, tie up, at least one, capped by the origin), report the signed remainder, local pack-level copyAccepted
0018A 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 participateAccepted
0019A 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 podAccepted
0020A2A 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 :8093Accepted
0021Adopt the fleet REST API guideline: noun routes, idempotent POSTs (409 idempotency-key-reused, Idempotency-Replayed), keyset {items,nextCursor} listsAccepted
0022Cancel-after-allocation compensation: RELEASING state, TransferAllocationReleaseRequested command, TransferStockAllocationReleased reply, POST /v1/transfers/{id}/cancellation — closes ADR-0003's stranded-reservation gapAccepted
0023A 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
0024Every 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​

ADRCode
0001internal/domain/transfer (advisory planner), no inventory ledger anywhere
0002internal/domain/planning, the three read-model consumers, GET /v1/transfer-simulations
0003InterWarehouseTransfer, ApproveTransfer, outbox_events and the relay, the transfer-reply consumer (per-key ordering amended by 0016)
0004internal/adapters/kafka/cloudevents, internal/architecture/catalogue_fitness_test.go
0005WorkDemandReleased, TRANSFER_*_PATH_ID / _CPT_OFFSET, the transfer-fact consumer
0006MIGRATIONS_DATABASE_URL, the chart's gatewayApi / ingress values
0007trace propagation through Kafka headers, the analytics encoder, NIP_HEALTH_CHECK_INTERVAL, NIP_STUCK_THRESHOLDS, NIP_REBALANCE_SCHEDULE, rebalance_runs
0008GET /v1/transfers, GET /v1/transfers/{id}, cmd/mcp
0009cmd/nip-projector, cmd/nip-reports, analytics/migrations
0010web/ and the chart's frontend component
0011features/*.feature, features_*_test.go
0012internal/adapters/outbound/telemetry, OTEL_EXPORTER_OTLP_ENDPOINT
0013transfer.ErrReplyRefused, usecases.IsRefusedReply, internal/adapters/inbound/kafka/deadletter.go, warehouse.inventory.events.dlq, warehouse.fulfillment.events.dlq
0014SiteSkuDemandRepo.Upsert (WHERE EXCLUDED.as_of >= site_sku_demand.as_of), the demand consumer's stale-event INFO line
0015transfer.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
0016postgres.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
0017transfer.RoundToCases / CaseRounding (casemultiple.go), PACK_LEVEL_CONSUMER_GROUP, pack-level view (migration 0006), rounding columns (migration 0007)
0018planning.BuildSnapshot / PlanningSnapshot.StaleSites (snapshot.go), transfer.ValidateApproval (approval.go), PLANNING_MAX_STALENESS
0019startRunners (cmd/network-inventory-planning/main.go)
0020internal/adapters/inbound/a2a, cmd/a2a, A2A_AGENT_URL, chart a2a block (templates/a2a-*.yaml), internal/architecture/a2a_fitness_test.go
0024problemCatalogue / 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