---
id: TST-PFM-NOT-042
title: messages
kind: integration
product_area: platform
module: notifications
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
repository: services-platform
files:
  - >-
    modules/communications/tests/integration/services/persistence/messages.integration.spec.js
implements:
  - ATS-PFM-NOT-018-02
  - ATS-PFM-NOT-018-04
  - ATS-PFM-NOT-018-05
  - ATS-PFM-NOT-018-06
  - ATS-PFM-NOT-018-07
  - ATS-PFM-NOT-019-01
  - ATS-PFM-NOT-019-02
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: >-
  Suite-owned records in the prepared integration workspaces; seeded workspace
  identities remain shared fixtures.
assertion_bindings:
  - scenario: ATS-PFM-NOT-018-02
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#answers
        in_flight for a submission that may still be with the provider, so it is
        never sent twice
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#skips
        a message already settled, so a repeated queue item never sends twice
  - scenario: ATS-PFM-NOT-018-04
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#leaves
        a message the provider refused for good alone, so a redrive never sends
        what was refused
  - scenario: ATS-PFM-NOT-018-05
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#expires
        a message whose expiry has passed, without an attempt
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#withholds
        a message whose recipient was suppressed since acceptance, state and
        reason written together
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#withholds
        a draft to a reserved domain, as one accepted before the rule would be,
        under a policy that delivers to everybody
  - scenario: ATS-PFM-NOT-018-06
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#answers
        in_flight for a submission that may still be with the provider, so it is
        never sent twice
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#claims
        it again once the ambiguity window has passed, the unknown attempt
        closed
  - scenario: ATS-PFM-NOT-018-07
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#refuses
        a message that has already been submitted, which cannot be recalled
  - scenario: ATS-PFM-NOT-019-01
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#records
        the event against its message
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#answers
        not_found for a message this tenant does not have
  - scenario: ATS-PFM-NOT-019-02
    suite: TST-PFM-NOT-042
    assertions:
      - >-
        services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js#leaves
        the summary exactly where the first copy put it, so a redelivery counts
        nothing twice
evidence:
  - >-
    services-platform:modules/communications/tests/integration/services/persistence/messages.integration.spec.js
  - The file and referenced assertion titles exist at the pinned commit.
dependency_evidence:
  - >-
    Real: PostgreSQL (the prepared integration database, row-level security on),
    the messages persistence service, and real
  - >-
    acceptance and the real send function for the fixtures that need an attempt
    or an event. Doubled: SES at the transport, the
  - >-
    is the development one. Never doubled: the database, its constraints, or the
    operations under test.
---

# messages

## Verification Boundary

This suite exercises the local services and prepared PostgreSQL database. API lifecycle cases use signed test contexts through the real route handler; they do not invoke the deployed gateway.

## What This Suite Proves

Its cases exercise skip final and temporarily ambiguous submissions; redrive only exhausted sends; apply expiry and recipient checks immediately before send; recover uncertain submission after the wait; allow cancellation only before submission; correlate and deduplicate provider reports.

The registered scenario bindings identify the assertions this executable file contributes. They retain individual test references so that a composite scenario does not become a claim of complete execution by one file.

## What It Does Not Prove

Local outcomes do not prove deployed queues, external provider acceptance, production credentials or complete browser behavior. No fresh execution or conformance result is claimed.

## Real Dependencies and Test Doubles

The communication fixtures use real PostgreSQL and module logic. Shared support records queue and transport calls and stores objects in memory; sender provisioning substitutes a provider identity store. Signed API contexts replace the authorizer key in API suites.

## Must Not Be Doubled

Database constraints, workspace policy, state guards and the service operation under test must remain real. Recording a provider or queue call must not replace the submission, claim or outcome logic being checked.
