---
id: STATE-MBR-MEM-011
title: Expiring-membership alert
object: DOM-MBR-MEM-002
product_area: membership
module: memberships
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
source_sha:
  services-membership: 5994c270e8a37a30f848e99ba5b5ee6b87c08893
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
states:
  - name: absent
    meaning: Membership has no currently open expiry attention item.
  - name: open
    meaning: Platform retains a keyed renewal attention item for impending expiry.
  - name: resolved
    meaning: >-
      The prior item carries a renewal, closure, clearing or deletion
      resolution.
transitions:
  - from: absent
    to: open
    trigger: The sweep finds impending expiry without later coverage.
    guard: The environment enables publication.
    side_effects:
      - >-
        Publish one keyed item with specific unit scope and renewals
        responsibility.
    who: The attention sweep
    provenance: test
    source: >-
      services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#addresses
      the item to membership.renewals
  - from: open
    to: open
    trigger: A later pass confirms the expiry condition.
    guard: Publication remains enabled.
    side_effects:
      - Refresh facts and due time under the membership key.
    who: The attention sweep
    provenance: test
    source: >-
      services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#refreshes
      the same item’s facts on the next pass
  - from: open
    to: resolved
    trigger: 'Renewal, closure, deletion or sweep clearing removes the condition.'
    guard: Resolution is enabled and Platform accepts it.
    side_effects:
      - Record the relevant resolution in the source transaction or sweep.
    who: Term writes in their own transaction; the attention sweep
    provenance: test
    source: >-
      services-membership:modules/memberships/tests/integration/services/expiring-memberships.integration.spec.ts#resolves
      the item renewed in the staff renewal’s transaction
invalid:
  - from: resolved
    to: open
    why: >-
      Membership resolves the existing item and leaves any subsequent
      publication behaviour to Platform’s item contract.
concurrency: >-
  Item keys are membership-based. Source resolution shares its write
  transaction, while sweep pages have independent transactions and can leave
  attention stale until another pass.
invariants: []
evidence:
  - >-
    services-membership at 5994c270:
    modules/memberships/services/attention/expiring-memberships.ts;
    aws/membership.attention.ts; docs/attention.md
---

# Expiring-membership alert

## The Lifecycle

```mermaid
stateDiagram-v2
  state absent
  state open
  state resolved
  absent --> open
  open --> open
  open --> resolved
```

## Transitions Explained

A sweep identifies the latest uncovered ending period and publishes renewal attention when enabled. Later passes refresh facts, while renewal, closure and eligible deletion resolve attention at source.

## What Cannot Happen

Publishing and resolution are disabled unless the environment opts in. The resolved state describes an earlier item; Platform’s item lifecycle should not be inferred beyond the observed publication calls.

## Concurrency and Timing

Item keys are membership-based. Source resolution shares its write transaction, while sweep pages have independent transactions and can leave attention stale until another pass.
