Skip to main content

Subdomain classification

returns-processing is a Supporting bounded context in the warehouse-management (wms) tier: every event type it publishes starts com.warehouse.wms.returns-processing.. The verdict is the one fixed by ADR 0001 (Strategic classification: Supporting subdomain), listed in the portfolio scorecard and in the aggregator's Subdomain classification (docs/strategic-design/subdomain-classification.md on origin/main): business model value recovery / compliance (accurate return record and disposition audit), evolution custom-built (genesis). The neighbour rows below are copied from that table, not recalled. The pages were read on 2026-11-01; if the aggregator has moved since, it wins.

Why Supporting​

  • Not Core. Value recovery is material (returns run 20-30 % of e-commerce volume), but the differentiator is the ledger it feeds, not the returns logic itself. A RESTOCK reuses inventory-storage's staged-receipt and stow seam unchanged: this context only raises ReturnLineStaged and asks that sibling to do the work. Four of the five outcomes (REFURBISH, LIQUIDATE, DISPOSE, RTV) are recorded for audit and touch no stock. The decision itself is a pure function of the inspection grade (A, B, C, SCRAP), the SKU's classification and a policy version, and the policy is a replaceable policy object: a versioned operator table, data and not code. A bad table is rolled back by declaring a new version, never by redeploying (ADR 0002).
  • Not Generic. The rules are the fleet's own and not bought unchanged: a return is authorizable only against a shipped line (a manifested work unit {order_id}-line-{line_no}) inside the policy window, one open RMA per order line, a receipt line references an RMA line or is explicitly unexpected, a line is inspected once, and a disposition is immutable (an override creates a superseding one with a reason). The grade-by-product-class table, the hazmat guardrail and the RESTOCK handover depend on the fleet's classification tags and its inventory seam, so an off-the-shelf returns product would need an anti-corruption layer on both sides.
  • Every input is a sibling's fact. The allocated lines, the manifested work units and the classifications are replicated into local copies from order-management, fulfillment-execution and product-master (ADR 0003), see Integration. Delete the RMA, receipt and disposition rows and the forward flow keeps working, because the facts keep arriving and the record rebuilds.

Model complexity is low to moderate: three small aggregates (RMA, Receipt, Disposition) plus the versioned DispositionPolicy, a pure decision function, read models fed by events, and no algorithm that ranks or optimises. See the Core domain chart and the Aggregate design canvas.

Inside the context​

The context-level verdict is the one that drives fleet decisions. Reading the code, the spread of design investment inside it is uneven:

SliceWhereReading
Authorization rules and the disposition decisioninternal/domain/{returnauthorization,returnreceipt,disposition}Supporting: the part that is specific to this fleet and deserves the tests; kept small and fixed.
Local copies and CloudEvents consumersinternal/adapters/inbound/kafka, internal/application/usecases/consume_*.goSupporting plumbing that follows the fleet pattern of ADR 0003.
Outbox, relay, CloudEvents envelope, idempotency keysinternal/adapters/outbound/{postgres,kafka}, internal/adapters/kafka/cloudeventsGeneric: the envelope package is generated from the fleet's harness template and the rest repeats the fleet's outbox pattern.
Analytics read sidecmd/returns-projector, cmd/returns-reports, internal/analyticsGeneric reporting over the event stream (ADR 0007).

Source: the table is a reading of the code layout, not a verdict recorded in an ADR or in the aggregator.

What would move it​

ADR 0001 declares no condition that flips the verdict and none is claimed here. The two roadmap items complete the current shape instead of reclassifying it: order-management adding quantity to its allocated lines (which turns the shipped-quantity check from a policy cap into a real check), and this service consuming ItemStowed, which inventory-storage already publishes on its integration topic (which would close the restock loop this context leaves open). Until then: invest for Supporting, keep it simple, fixed and well tested, and do not gold-plate.

Neighbours (from the aggregator's table)​

Bounded contextClassificationCloudEvents subdomainRelation to this context
product-masterSupportingwmsupstream (ProductClassified, conformist local copy)
order-managementGeneric/Supportingwesupstream (OrderAllocated, OrderPartiallyAllocated)
fulfillment-executionCorewesupstream (PackageManifested)
inventory-storageCorewmsdownstream (consumes ReturnLineStaged)
exception-managementSupporting (candidate Core)wesdownstream (consumes UnexpectedReturnReceived)

Source: the classification and subdomain columns come from the aggregator's table; the relation column comes from internal/adapters/inbound/kafka/{product_classes,allocated_lines,manifests}.go and internal/adapters/outbound/kafka/encoder.go, verified on Integration.

Tier is not classification​

The wms segment groups contexts by tier, not by Core, Supporting or Generic: returns-processing and product-master share the tier and the Supporting class, while inventory-storage is wms and Core, and fulfillment-execution is wes and Core. The tier decides the type prefix; the class decides how much design investment the context deserves.