---
id: TST-PFM-SEC-160
title: Portal contact challenges database and service checks
kind: integration
product_area: platform
module: security
revision: 2
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
repository: services-platform
files:
  - >-
    modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js
implements:
  - ATS-PFM-SEC-020-05
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 3
isolation: Use the prepared test database and suite-owned fixture rows; retain shared seed records.
assertion_evidence:
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#security
      persistence: portal_contact_challenges
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#startPortalContactChallenge
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#records
      the member, the contact, the channel and a ten-minute expiry, with the digest of the code and
      never the code
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#supersedes
      the member’s live challenge, so an old code can never be entered after a new one was sent
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#refuses
      a sixth start within an hour
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#starts
      again once the hour has passed
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#keeps
      the member’s newest twenty challenges and drops the oldest, never refusing the start
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#refuses
      an unknown channel by its check constraint
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#attemptPortalContactChallenge
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#counts
      a wrong code and answers the attempts left
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#spends
      the challenge exhausted on the fifth wrong code
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#answers
      spent for the right code after the challenge was exhausted
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#answers
      the right code verified and leaves the challenge live for the caller to spend
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#spends
      an expired challenge as expired, even with the right code
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#answers
      nothing for another member’s challenge
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#answers
      nothing for a challenge of another tenant, which the tenant policy hides
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#spending
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#spends
      a live challenge with the outcome given
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#never
      spends a challenge twice
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#supersedes
      every live challenge of the member and none that was spent
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js#refuses
      a spent stamp without its outcome by the spent check
dependency_evidence: >-
  The prepared PostgreSQL database supplies the persisted fixtures and constraints exercised here.
  The suite controls the clock at the declared seams; those collaborators remain outside its live
  proof.
evidence:
  - >-
    services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js
  - >-
    Static review at the recorded source revision; executable results remain not-run and conformance
    remains not-verified.
binding_note: >-
  Each binding names the scenario to which this file contributes assertions. A binding is not a
  recorded pass and does not extend the file’s dependency boundary.
examiner: codex
examined_at: '2026-10-23'
final_text: OpenAI
dependency_review:
  provenance: test
  source: >-
    services-platform:modules/security/tests/integration/services/persistence/portal-contact-challenges.integration.spec.js
  explicit_no_doubles: false
  identified_double_boundaries:
    - the clock
---
# Portal contact challenges database and service checks

## Verification Boundary

The file exercises database or service behavior through the local integration harness. The assertion references identify the source checks for portal contact challenges.

## What This Suite Proves

The source assertions support the observations named in the bound scenarios. A scenario spanning multiple files must retain the other files’ contributions.

## What It Does Not Prove

This examination does not run the suite. Passing behavior, deployed conformance and the behavior of substituted dependencies require separate execution evidence.

## Real Dependencies and Test Doubles

The prepared PostgreSQL database supplies the persisted fixtures and constraints exercised here. The suite controls the clock at the declared seams; those collaborators remain outside its live proof.

## Must Not Be Doubled

Keep the queried database, applicable constraints and transaction boundaries real. Provider substitutes cannot establish delivery, cloud execution or cross-service recovery.
