---
id: WF-MBR-MEM-020
title: Publish and resolve expiring-membership alerts
trigger: 'The daily attention pass runs, or a term write resolves an expiry condition.'
product_area: membership
module: memberships
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
inference: []
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
implements:
  - CAP-MBR-MEM-014
moves:
  - STATE-MBR-MEM-011
crosses:
  - SVC-MBR-MEM-memberships
idempotency: >-
  The membership-based item key refreshes facts rather than creating a duplicate
  open item.
concurrency: >-
  Sweep pages publish in separate transactions. Source resolution shares the
  renewal, closure or deletion transaction.
hops:
  - 'n': 1
    actor_or_service: Attention sweep function
    action: >-
      For each workspace, page principal holdings whose latest uncovered
      committed term ends within the configured horizon.
    anchor: >-
      services-membership:modules/memberships/services/attention/expiring-memberships.ts:sweepExpiringMemberships
    seam: schedule
    on_failure: >-
      Record the workspace pass failure; a later successful pass can refresh its
      items.
    left_inconsistent: Attention can remain stale until a successful later sweep.
    observer: Expiry-sweep execution logs
    provenance: test
    source: >-
      services-membership:modules/memberships/tests/unit/expiring-memberships.spec.ts#starts
      on the tenant’s business date, not the UTC date
  - 'n': 2
    actor_or_service: Memberships service
    action: >-
      Publish keyed attention with most-specific unit scope, renewals
      responsibility and last-day due time.
    anchor: >-
      services-membership:modules/memberships/services/attention/expiring-memberships.ts:expiringItemOf
    seam: sync
    on_failure: >-
      Roll back this publication page; a disabled provider performs no
      publication.
    left_inconsistent: Earlier pages can be committed while this page remains unrefreshed.
    observer: Staff attention list
    provenance: test
    source: >-
      services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#scopes
      the item by the membership’s chapter and its
  - 'n': 3
    actor_or_service: Memberships service
    action: Clear open items not confirmed by the completed pass.
    anchor: >-
      services-membership:modules/memberships/services/attention/expiring-memberships.ts:sweepExpiringMemberships
    seam: sync
    on_failure: Retain the open item for correction by a later pass.
    left_inconsistent: Obsolete attention can remain open until clearing succeeds.
    observer: Staff attention list
    provenance: observed
    source: >-
      services-membership:modules/memberships/services/attention/expiring-memberships.ts
      (header)
  - 'n': 4
    actor_or_service: Term writes
    action: >-
      Resolve attention within renewal, closure or eligible first-purchase
      deletion writes when publishing is enabled.
    anchor: >-
      services-membership:modules/memberships/services/attention/expiring-memberships.ts:resolveExpiringOnCommit
    seam: sync
    on_failure: Enabled resolution refusal aborts the accompanying business transaction.
    left_inconsistent: The database write and enabled resolution share one commit boundary.
    observer: Business operation result
    provenance: documented
    source: >-
      services-membership:docs/attention.md#3. When items are published and
      resolved
branches: []
waits:
  - >-
    Expiry attention is due at the beginning of the final term day and expires
    thirty days afterward.
evidence:
  - >-
    services-membership at 5994c270:
    modules/memberships/services/attention/expiring-memberships.ts;
    aws/membership.attention.ts; aws/lambda/ATTENTION_SWEEP.ts;
    lib/attention.ts; docs/attention.md
controls: [TC-AVL-002, TC-AVL-003, TC-AVL-004, TC-AZ-001, TC-AZ-003, TC-AZ-004, TC-CHG-001, TC-CHG-002, TC-CHG-003, TC-CHG-004, TC-CRY-001, TC-CRY-002, TC-CRY-003, TC-DAT-001, TC-DAT-002, TC-DAT-003, TC-DAT-007, TC-IAM-006, TC-LOG-002, TC-LOG-003, TC-LOG-005, 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, TC-SEC-001, TC-SEC-004, TC-TEN-001, TC-TEN-002, TC-TEN-003]
---

# Publish and resolve expiring-membership alerts

## What It Does

Renewal staff receive attention items for uncovered impending expiry. A sweep publishes the condition; source writes resolve it when renewal or closure removes the need.

## The Flow

```mermaid
flowchart TD
  H1["For each workspace, page principal holdings whose latest uncovered committed term ends within the configured horizon"]
  H2["Publish keyed attention with most-specific unit scope, renewals responsibility and last-day due time"]
  H1 --> H2
  H3["Clear open items not confirmed by the completed pass"]
  H2 --> H3
  H4["Resolve attention within renewal, closure or eligible first-purchase deletion writes when publishing is enabled"]
  H3 --> H4
```

## When Something Fails

Failed pages can leave partial or stale attention until a later sweep. Enabled source resolution failure rolls back its business write. Publishing defaults off, and an existing finding notes the missing automated refusal proof.
