---
id: WF-COM-FUL-004
title: Settle lines that wait on a same-order membership
trigger: A same-order membership outcome needs dependent settlement.
product_area: commerce
module: fulfillment
revision: 1
status: draft
design_intent: confirmed
origin: >-
  COMM-M2 D7 (a), Andrew 2026-10-21:
  services-commerce:docs/milestones/plans/COMM-M2-plan.md#D7
implementation_evidence: observed
inference: []
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
implements:
  - CAP-COM-FUL-003
moves:
  - STATE-COM-FUL-001
crosses:
  - SVC-COM-FUL-fulfillment
idempotency: >-
  Readiness writes retain one satisfaction event, while already recorded
  prerequisite blocks and standing findings are not recreated.
concurrency: >-
  Settlement follows the retained prerequisite outcome and locks each waiting
  same-order dependent independently. Logged errors do not reverse the
  prerequisite.
hops:
  - 'n': 1
    actor_or_service: 'Register (worker, callback, manual completion, resolution or cancellation)'
    action: >-
      Retain the prerequisite delivery outcome, then invoke dependent settlement
      for that order line.
    anchor: >-
      services-commerce:modules/fulfillment/services/register/prerequisite-settlement.ts:settlePrerequisiteDependents
    seam: sync
    on_failure: Log continuation failure while retaining the original outcome.
    left_inconsistent: Dependent records can still show waiting work.
    observer: Continuation logs.
    provenance: observed
    source: >-
      services-commerce:modules/fulfillment/services/register/prerequisite-settlement.ts
  - 'n': 2
    actor_or_service: Prerequisite settlement
    action: >-
      Record readiness on waiting dependents after successful prerequisite
      delivery and evaluate their gates.
    anchor: >-
      services-commerce:modules/fulfillment/services/persistence/obligations.ts:recordPrerequisiteMet
    seam: sync
    on_failure: >-
      Log failure; a pending scan helps only after readiness has actually been
      retained.
    left_inconsistent: A readiness write or its later evaluation can be missing.
    observer: Dependent verdict and order history.
    provenance: test
    source: >-
      services-commerce:modules/fulfillment/tests/integration/services/register/prerequisite-settlement.integration.spec.js#records
      the registration’s prerequisite met, writes it on the history once, and
      opens its gate (authorized, queued); a repeat finds nothing waiting
  - 'n': 3
    actor_or_service: Prerequisite settlement
    action: >-
      Block waiting dependents after permanent prerequisite failure or closure,
      retaining block history and a staff finding.
    anchor: >-
      services-commerce:modules/fulfillment/services/persistence/operational-exceptions.ts
    seam: sync
    on_failure: Log failure; blocked records are outside the pending sweep.
    left_inconsistent: A dependent may remain waiting despite an undeliverable prerequisite.
    observer: Prerequisite findings and logs.
    provenance: test
    source: >-
      services-commerce:modules/fulfillment/tests/integration/services/register/prerequisite-settlement.integration.spec.js#blocks
      the registration prerequisite_failed with the membership named in its
      facts, writes the block on the history once, and raises the exception once
  - 'n': 4
    actor_or_service: 'Staff, later'
    action: >-
      Let staff cancel or reprice dependent work, or re-authorize the membership
      so a later successful delivery settles it.
    anchor: >-
      services-commerce:modules/fulfillment/services/register/obligation-interventions.ts:reauthorizeObligationByStaff
    seam: sync
    on_failure: Apply the owning intervention’s state and authority refusals.
    left_inconsistent: The product choice can remain awaiting staff action.
    observer: Staff interventions and order history.
    provenance: documented
    source: 'services-commerce:docs/milestones/plans/COMM-M2-plan.md#D7'
branches:
  - A retryable failure or an in-progress answer settles nothing.
  - Settlement does not reach another order's lines.
waits:
  - The membership line's terminal outcome.
evidence:
  - >-
    services-commerce at c8b66a98:
    modules/fulfillment/services/register/prerequisite-settlement.ts;
    services/policies/evaluate-gate.ts (prerequisite rules);
    db/obligations.table.ts (prerequisite line);
    docs/milestones/plans/COMM-M2-plan.md#D7.
controls: [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-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]
---

# Settle Lines That Wait on a Same-Order Membership

## What It Does

Member-priced work stays dependent on the membership bought in the same order. Successful membership delivery records readiness and evaluates dependents; permanent failure or closure blocks them for staff to cancel or reprice deliberately.

## The Flow

```mermaid
sequenceDiagram
  participant R as Register outcome
  participant S as Settlement
  participant D as Dependent obligations
  participant X as Exceptions
  R->>R: commit membership outcome
  R->>S: settle the line's dependents
  alt completed
    S->>D: prerequisite met, evaluate now
  else failed, resolved or cancelled
    S->>D: block (prerequisite failed)
    S->>X: raise prerequisite failed
  end
```

## When Something Fails

Settlement errors are logged after the prerequisite outcome stands. The sweep cannot recreate a missing readiness write and excludes blocked dependents. Later prerequisite outcomes or staff action may be needed to recover.
