Skip to main content

Ubiquitous language

Synced from returns-processing

This page is a copy of docs/docs/ddd/ubiquitous-language.md on develop, derived from that repository's code. Edit it there, then re-sync.

The terms of the context and the code identifier that implements each one (.claude/rules/domain-model.md is the rule; this page adds the tables and topics).

TermMeaningCode
ReturnAuthorization (RMA)Permission to send one shipped order line back; carries the authorized quantity, the reason and the policy window; one open RMA per order linereturnauthorization.RMA, table return_authorizations
Order ref / lineThe (order, line) a return is authorized against; the shipped fact is the work unit {order_id}-line-{line_no}shared.OrderLineRef, OrderLineRef.WorkUnit()
Requested, Authorized, Rejected, Received, ClosedThe RMA states; REJECTED and CLOSED are terminalreturnauthorization.Status
Rejection codeWhy an RMA was refused: LINE_NOT_MANIFESTED, RETURN_WINDOW_EXPIRED, OPEN_RMA_EXISTS, QUANTITY_EXCEEDS_POLICYreturnauthorization.RejectionCode
Return windowauthorized_at + policy.return_window_days; the goods must arrive inside itRMA.WindowEndsAt
ReturnReceiptThe physical arrival of returned goods, against an RMA or with unexpected lines onlyreturnreceipt.Receipt, tables return_receipts, return_receipt_lines
Return line, MATCHED / UNEXPECTEDEvery received line is MATCHED (carries its rmaId) or explicitly UNEXPECTED — never a silent third statereturnreceipt.LineKind
GradeThe inspection outcome of a line: A, B, C, SCRAP, with reason codes; recorded exactly once, quantity never above the received quantityreturnreceipt.Grade
Reason codesWhy a grade (e.g. CUSTOMER_DAMAGE, OPENED_BOX, MISSING_PARTS)ReturnLineInspected.reason_codes
DispositionThe immutable decision for one inspected line; an override is a NEW disposition with supersedes and a mandatory reasondisposition.Disposition, table dispositions
OutcomeRESTOCK, REFURBISH, LIQUIDATE, DISPOSE, RTV; only RESTOCK touches a siblingdisposition.Outcome
DispositionPolicyThe versioned operator table: grade × product class → outcome, return window days, max units per line, veto outcome; append-onlydisposition.Policy, table disposition_policies
Veto outcomeWhat a guardrail demotes a forbidden RESTOCK to (default DISPOSE)Policy.VetoOutcome
Product class *The per-grade default rule when no exact (grade, class) entry matchesPolicy.Rule
GuardrailsHard-coded safety, not operator tuning: RESTOCK only grade A/B, never a DISPOSE-classified SKU, never a hazmat SKU without a DOT ratingdisposition.Decide
Staged lineA RESTOCK handed to inventory-storage (ReturnLineStaged); the stow stays an RF action theredisposition.Staging, inventory-storage's staged-receipt use case
Unexpected returnA received line with no RMA; opens a problem-solve case downstreamUnexpectedReturnReceived, exception-management
Local copyAn event-fed table this context reads instead of calling a siblingproduct_classes, allocated_lines, manifested_units
ClaimThe (consumer, CloudEvents id) row that makes a consumer effect idempotent, written in the same transaction as the effectprocessed_events, ports.ProcessedEvents
OutboxThe transactional table of already-encoded CloudEvents waiting for the relayoutbox, internal/application/outbox
Idempotency keyThe caller's Idempotency-Key; the first answer is stored and replayedidempotency_keys, inboundhttp.Idempotency
Dead letterA message moved to a .dlq topic: inbound poison rows, or outbox rows the encoder refusesinboundkafka.DLQ, warehouse.returns-processing.events.dlq
VersionOptimistic-concurrency counter on every aggregate write (409 concurrent-modification on a lost update)RMA.Version, Disposition.Version