---
id: TST-PFM-SEC-217
title: Contact match rules unit checks
kind: unit
product_area: platform
module: security
revision: 2
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
repository: services-platform
files:
  - modules/security/tests/unit/services/portal/contact-match-rules.spec.ts
implements:
  - ATS-PFM-SEC-020-01
  - ATS-PFM-SEC-020-02
  - ATS-PFM-SEC-020-03
environment: mock
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 1
isolation: The suite owns its input fixtures and installed doubles.
assertion_evidence:
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#portal
      likely-match: what a member is shown of a contact
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#masks
      an e-mail address to its first letter, its domain’s first letter and its top-level domain
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#keeps
      only the last label of a long domain, so the organization is not spelled out
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#masks
      the canonical address, whatever case and spaces CRM holds it in
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#shows
      nothing for a value that is not an address with a domain
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#shows
      the last four digits of a phone, whatever its punctuation
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#shows
      no digits of a phone with fewer than four
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#portal
      likely-match: a phone number SMS can reach
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#reads
      ten digits as a North American number
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#keeps
      a number already written in international form
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#refuses
      to guess the country of a short local number
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#offers
      SMS only while SMS is enabled, and e-mail only to a contact with an address
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#portal
      likely-match: which contacts are offered
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#links
      without asking the one contact holding the member’s own address, compared case-insensitively
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#asks
      the member when two contacts hold their address, rather than guessing
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#never
      offers a contact a portal member already links, and links nothing through one
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#offers
      at most three, highest score first, each contact once
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#gives
      each candidate its masked hints and nothing else of the contact
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#answers
      none when CRM found nobody likely
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#portal
      likely-match: one attempt at a code
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#verifies
      the right code of a live challenge, changing nothing yet
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#counts
      a wrong code and says how many attempts are left
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#spends
      the challenge on the fifth wrong code, answering it with no attempts left
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#answers
      a spent challenge spent, even with the right code
  - provenance: test
    source: >-
      services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts#spends
      an expired challenge as expired, even with the right code
dependency_evidence: >-
  The production function, schema or declaration runs over literal inputs. The source declares no
  substituted collaborator; this is an in-process decision or mapping check.
evidence:
  - 'services-platform:modules/security/tests/unit/services/portal/contact-match-rules.spec.ts'
  - >-
    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/unit/services/portal/contact-match-rules.spec.ts'
  explicit_no_doubles: true
  identified_double_boundaries: []
---
# Contact match rules unit checks

## Verification Boundary

The file evaluates production helpers with controlled inputs in-process. The assertion references identify the source checks for contact match rules.

## 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 production function, schema or declaration runs over literal inputs. The source declares no substituted collaborator; this is an in-process decision or mapping check.

## Must Not Be Doubled

Keep the production helper, schema, matcher or declaration under examination real. Substituting the decision itself would remove the behavior the assertions exercise.
