ADR 0007: inbound limits on the operational profile
Status
Accepted (2026-10-24).
Context
Sellers will ship cartons to the network's nodes (the seller-inbound context).
Before a carton is labelled and shipped, someone must check it against what the
destination node can physically receive: its weight, its size, whether pallets
are taken and whether every carton must carry an SSCC. Node Topology already
owns what a node declares about itself in the versioned OperationalProfile
(ADR 0002, ADR 0003 decision 5), so the limits belong there. The consumer must
not call this service (ADR 0003: no sync calls between network contexts), so
the limits have to travel on the existing profile event.
Decision
- A value object on the profile.
OperationalProfilegains an optionalinboundof typeInboundLimits:maxCartonWeightG(grams),maxCartonDimsMm{l, w, h}(millimetres),acceptsPalletsandrequiresSscc. Quantities are integers, never decimals. It is part of the immutable profile revision: a new revision restates the limits or declares none. - Invariants (all in the domain,
ErrValidation/ 422validation-failed). Every number that is set is a positive integer, at most 2147483647 (zero and negatives refused). The three edges ofmaxCartonDimsMmare all-or-none: a missing edge is refused, never defaulted. Aninboundthat declares nothing (all four fields absent) is refused: omit it instead. - Absent means unchecked. Every field is optional on its own. A field that
is absent was not declared, and so is not a limit:
acceptsPalletsabsent is not "no pallets", it is "unchecked". A profile withoutinbounddeclares no limits at all. The limits are declared here and only here. - Declared here, consumed as a local view.
seller-inboundkeeps its own copy of the limits, fed byNodeOperationalProfileDeclared, and validates cartons against that copy. It keeps the highestprofileRevision(the rule every consumer of this event already follows). A node whose latest revision has noinboundtherefore has no limits. - REST.
PUT /nodes/{nodeId}/operational-profileacceptsinbound, and every read that returns a profile (GET /nodes,GET /nodes/{nodeId}, thePUTresponse) echoes it. Additive: a client that never sends it keeps the same contract. Optional means omitted, nevernullon the wire we write; an explicitnullin a request is read as absent. Unknown keys insideinboundstay a 400 like everywhere else (the strict decoder). - Event.
NodeOperationalProfileDeclaredcarriesinbound(camelCase, same shape, only the declared fields) when the revision set it, and omits the key otherwise. The event staysv1: the change is additive and old consumers ignore the key.apis/asyncapi.yamldocuments it with an example. - Storage. Migration
0003_profile_inbound_limitsadds a nullableinboundJSONB column tonode_profile_revisions(an object holding only the declared limits; SQL NULL = none). A JSONB document, like the cutoffs and operating hours beside it, because the limits are always read and written with their revision and never queried by field. Existing rows keep NULL; the append-only trigger is untouched (it guards rows, not the table shape). The adapter owns its own document struct, as for the other JSONB columns.
Consequences
- No new endpoint, topic, event, consumer or environment variable; the chart is unchanged.
- A node that never declared limits keeps accepting everything, so rolling this
out changes no behaviour until a profile sets
inbound. - Limits are per profile revision, so history is kept: earlier revisions still show what the node declared then.
- Open for
seller-inbound: what it does with cartons of a node whose limits it has not yet received (unchecked, per decision 3).