Skip to content

CAP-COM-FUL-004Carry authorized work to its delivering application

Markdown

CAP-COM-FUL-004

Carry authorized work to its delivering application

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
Applications fulfill their own sold outcomes without staff copying the sale.Failed or unanswered delivery remains available for investigation.
Surfaces
jobapi

Controls

35 controls apply, from the corpus control catalogue.

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

Permissions

KeyChecked atScope
commerce.obligations.callbackapiglobal

Business Rules

13 rules, 11 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
The dispatcher runs every minute and is nudged when work is queued, publishes workspace, obligation and authorization pointers, and removes only entries accepted by the queue.
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/register/obligation-dispatcher.integration.spec.js#claims the three rows of both tenants, publishes a pointer for each, and reports the refused one
02must prove
Proposed
A failed or rejected publication leaves the dispatch entries available for a later run.
invariantservicetest
03must prove
Proposed
The worker invokes the owning application with the operation envelope only for the current authorization, acknowledges obsolete or repeated pointers and records the stale attempt without changing delivery state.
invariantservicetest
services-commerce:modules/fulfillment/tests/integration/services/register/obligation-worker.integration.spec.js#acknowledges a redelivery of the same item as stale, writing one stale attempt and nothing else (A17)
04must prove
Proposed
A completed response stores the delivered record; a partial response retains progress and completed units until the remainder arrives, rejecting completion beyond the owed quantity.
origin: D-P4-12 (build decision, not a product ruling): services-commerce:docs/migrations/obligation-register/README.md#D-P4-12
calculationservice, databasetest
services-commerce:modules/fulfillment/tests/integration/services/persistence/obligation-register.integration.spec.js#records partial completion as in progress with the units, then completes when the rest arrive
05must prove
Proposed
Permanent refusal fails delivery and raises an exception, while retryable refusal or an unreachable application leaves delivery in flight for another attempt.
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/register/obligation-worker.integration.spec.js#fails the obligation with the participant’s code, raises obligation_failed, and acknowledges the item
06must prove
Proposed
The fifth queue delivery fails the obligation for exhausted attempts and raises its exception before the message is dead-lettered.
origin: D-P4-07 (build decision, not a product ruling): services-commerce:docs/migrations/obligation-register/README.md#D-P4-07
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/register/obligation-worker.integration.spec.js#fails it attempts_exhausted on the fifth receive, raises the exception, and still reports the item failed so the queue dead-letters it
07must prove
Proposed
An application can report delivery in progress and later complete, fail or report readiness through callbacks using its current authorization; repetition returns the stored result and obsolete authorization is rejected.
origin: D-P4-09 (build decision, not a product ruling): services-commerce:docs/migrations/obligation-register/README.md#D-P4-09
lifecycleapi, servicetest
services-commerce:modules/fulfillment/tests/e2e/obligation-register.e2e.spec.js#refuses a callback under an authorization that is not the current one, 409 authorization_not_current
08must prove
Proposed
Callback access is restricted to application service identities, rejects console and portal callers, and validates the request contract.
permissionapiobserved
09must prove
Proposed
An expired acknowledgement deadline causes one redispatch with an extended deadline, followed by acknowledgement-lost failure and an exception at the next expiry; the default deadline is one hour.
origin: D-P4-08 (build decision, not a product ruling): services-commerce:docs/migrations/obligation-register/README.md#D-P4-08
lifecycleservicetest
services-commerce:modules/fulfillment/tests/integration/services/register/register-sweeper.integration.spec.js#fails it ack_lost on the next deadline, with the exception raised and the history line written
10must prove
Proposed
Database lifecycle guards reject invalid transitions, permit completed obligations only to be superseded, retain cancellation and resolution as terminal states, and require authorization for delivery in flight.
invariantdatabasetest
services-commerce:modules/fulfillment/tests/integration/db/register-tables.table.integration.spec.js#refuses pending to authorized, authorized to pending, failed to completed and completed to anything but superseded (RHC02)
11must prove
Proposed
A sold line can have only one obligation for each operation and unit, preventing duplicate obligations on retried placement.
invariantdatabasetest
services-commerce:modules/fulfillment/tests/integration/db/obligations.table.integration.spec.js#refuses a second obligation for the same subject, operation and unit, by obligations_subject_uq
12
Proposed
The application role can append delivery attempts but cannot alter or remove the attempt history.
invariantdatabasetest
services-commerce:modules/fulfillment/tests/integration/db/register-tables.table.integration.spec.js#names a real authorization (…_authorization_fk), counts from one (…_attempt_check) and is never changed or removed by the application (42501)
13
Proposed
The worker logs a warning and acknowledges terminate and allocation-release operations without delivering them while no document produces them.
policyserviceobserved

Scenarios

IdGivenWhenThenProvenance
01Three applications respectively complete, defer and refuse authorized work.Deliver the queued instructions.The register records completed, in-progress and failed outcomes and acknowledges each message.test
services-commerce:modules/fulfillment/tests/e2e/obligation-register.e2e.spec.js#completes the plain one, leaves the long one in progress and fails the failing one, acknowledging all three

Edge Cases

IdGivenWhenThenProvenance
02An application repeatedly returns a retryable failure.Deliver the message for the fifth time.The obligation reaches exhausted-attempt failure and an exception is recorded.test
services-commerce:modules/fulfillment/tests/integration/services/register/obligation-worker.integration.spec.js#fails it attempts_exhausted on the fifth receive, raises the exception, and still reports the item failed so the queue dead-letters it

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.