Skip to content

CAP-COM-FUL-018Allocate stock and explain what buyers can obtain

Markdown

CAP-COM-FUL-018

Allocate stock and explain what buyers can obtain

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

KindCapabilityProduct areaCommerceModuleFulfillment, Shipping and InventoryRevision1

Read atservices-commerce c8b66a98

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Product policy controls whether shortage can become backorder.Shared availability logic supplies storefront and staff views.
Surfaces
apijob

Controls

21 controls apply, from the corpus control catalogue.

TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-006 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-CRY-001 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-DAT-004 TC-LOG-004 TC-LOG-005 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-005 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
commerce.inventory.readapitenant

Business Rules

10 rules, 8 to be proved before approval. A rule's product intent is derived from its origin: 0 confirmed by a product decision, the rest inheriting this capability's proposed.

IdRuleKindEnforced atProvenance
01must prove
Proposed
Placement commits one allocation per ordered unit in sellable-location order with order and line references, and repeating the line claim creates no duplicate units.
no proof recorded yet
calculationservice, databasetest
services-commerce:modules/inventory/tests/integration/services/stock/merchandise-claims.integration.spec.js#writes one committed unit per unit on the first location in allocation order, unit 0 and 1, each stamped with the order and the line
02must prove
Proposed
A short claim either rejects insufficient stock or commits available units and backorders the remainder according to product policy, creating a first-location item when needed and excluding backorders from available-stock consumption.
no proof recorded yet
policyservice, databasetest
services-commerce:modules/inventory/tests/integration/services/stock/merchandise-claims.integration.spec.js#commits what exists and backorders the rest when the product allows it (A12), the shortfall counting as backordered, never against available
03must prove
Proposed
Concurrent placements for the final stock permit one winner and reject the others as insufficient-stock claim conflicts without placing their orders.
origin: D-P8I-21 (build decision, not a product ruling): services-commerce:docs/migrations/inventory/README.md#D-P8I-21
no proof recorded yet
invariantdatabasetest
services-commerce:modules/inventory/tests/e2e/merchandise-placement.e2e.spec.js#lets exactly one placement win and refuses the nine others 409 claim_conflict naming the item, the SKU and insufficient_stock
04must prove
Proposed
Limited stock can be held for checkout until expiry, extended only within the product window, committed at placement and released on order void.
no proof recorded yet
lifecycleservice, databasetest
services-commerce:modules/inventory/tests/e2e/merchandise-placement.e2e.spec.js#extends the hold within the window and refuses one past it, 409 hold_not_extendable
05must prove
Proposed
Held units consume held balance and committed or picked units consume allocated balance; each row represents one unit, requires its state-specific references and cannot change item or duplicate a live checkout-unit hold.
no proof recorded yet
invariantdatabasetest
services-commerce:modules/inventory/tests/integration/db/inventory-tables.table.integration.spec.js#counts a held row against held, a committed one against allocated and a released one against nothing, through the trigger
06must prove
Proposed
One availability rule supplies storefront states and console counts, reporting untracked products available without stock numbers.
no proof recorded yet
calculationservicetest
services-commerce:modules/inventory/tests/e2e/inventory.e2e.spec.js#answers the availability in the storefront’s words: limited with what is left, unavailable for more than the shelf has, backorder for the shirt, available for a product it does not track
07must prove
Proposed
Authorized delivery picks committed units, void and delivered cancellation release units with reasons, and partial cancellation releases only its selected units.
no proof recorded yet
lifecycleservicetest
services-commerce:modules/inventory/tests/integration/services/stock/merchandise-claims.integration.spec.js#releases a line’s committed units on a void, giving the stock back; a release naming nothing live answers released: []
08must prove
Proposed
A shipment and claim contending for the same item cannot consume the same unit.
no proof recorded yet
invariantdatabasetest
services-commerce:modules/inventory/tests/integration/services/stock/merchandise-claims.integration.spec.js#answers the claim, once it gets the row, insufficient_stock: the unit the shipment took is not claimed twice
09
Proposed
Once checkout becomes an order, its checkout-item holds are released.
lifecycleservicetest
services-commerce:modules/inventory/tests/integration/services/stock/merchandise-claims.integration.spec.js#releases a checkout item’s held units when the checkout stands as the order (D-P2-03)
10
Proposed
Inventory-read authority permits allocation inspection by order, line, item, checkout item and state.
permissionapiobserved

Scenarios

IdGivenWhenThenProvenance
01Ten carts compete for a single remaining cap.Place all carts concurrently.One order succeeds, nine conflict and no stock remains available.test
services-commerce:modules/inventory/tests/e2e/merchandise-placement.e2e.spec.js#placed nothing for the losers (their checkouts open, the refusal on their trail) and left the shelf with the winner’s unit allocated and nothing available

Edge Cases

IdGivenWhenThenProvenance
02Backorders are allowed and one unit is available.Place a two-unit purchase.One unit is committed and another backordered, with backorder availability for the next buyer.test
services-commerce:modules/inventory/tests/e2e/merchandise-placement.e2e.spec.js#advised the two as a backorder of one, and placed them: one unit committed, one backordered, the SKU showing backorder to the next buyer

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.