---
id: TST-PFM-SEC-045
title: Customers.queries 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/customers/tests/integration/services/persistence/customers.queries.integration.spec.js
implements: []
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/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#customers
      queries: the whole mapped customer record
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#createCustomer,
      the record its RETURNING clause answers
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the whole record of a customer that fills every column
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the whole record of a customer that fills only what it must, with no key for a null column
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the canonical address of a customer whose only optional column is its address
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      both external-system ids of a customer that carries only those
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#getCustomer
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#reads
      back the whole record of the customer that fills every column
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#reads
      back the sparse customer with no key for any column the row holds as null
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#reads
      back the address-only customer exactly as it was written
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#reads
      back the external-ids-only customer exactly as it was written
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      exactly what createCustomer answered, so the read and the insert map a row alike
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      undefined for an id no customer has
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the instants of a write on the ordinary clock as ISO 8601 UTC timestamps
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#listCustomers
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      this run's four customers whole, in id order
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      every row of the table once, no row repeated
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#maps
      a row to the very record getCustomer answers for it
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#customers
      queries: updateCustomer, the record its RETURNING clause answers
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the whole replaced record: the new values, the bumped version, the original creation stamps
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      the columns the replacement left out as absent keys, not as nulls
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#persists
      exactly the record it answered, so the update and the read map a row alike
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#customers
      queries: toApiCustomers over listCustomers
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#is
      given the customers in the id order listCustomers answers them in
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#orders
      them by name, the customer without a name last
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#breaks
      a tie between two customers of the same name by id, whatever order they arrived in
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      each customer whole when the query named no fields
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#projects
      each customer to the fields the query named, the id always among them
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#leaves
      out a named field the record does not carry rather than answering it as null
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      an empty list when the list it is given is empty
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#customers
      queries: listCustomersForStaff and getCustomerForStaff, the HQ reads
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      each customer whole, with the number of its tenants
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#counts
      the tenants of every status, a disabled one included
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      a tenant count of 0 for a customer with no tenants
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#orders
      by name, a customer without one first, and breaks a tie of names by id
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#matches
      the customer name whatever its case
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#matches
      the customer id whatever its case
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#takes
      a percent sign in the search literally rather than as a wildcard
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      customers beyond this run when nothing narrows it
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      no more than the limit, and the keyset of the last customer answered, a missing name as the
      empty one
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#resumes
      after the keyset, so the pages together answer every customer once and in order
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      no next keyset on the last page
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      one customer whole, with the number of its tenants
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      a customer without a name or tenants with neither
  - provenance: test
    source: >-
      services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js#answers
      nothing for a customer that does not exist
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/customers/tests/integration/services/persistence/customers.queries.integration.spec.js
  - >-
    Static review at the recorded source revision; executable results remain not-run and conformance
    remains not-verified.
binding_note: >-
  The file has no scenario binding established by this examination. Its executable checks remain
  registered without assigning them broader acceptance coverage.
examiner: codex
examined_at: '2026-10-23'
final_text: OpenAI
dependency_review:
  provenance: test
  source: >-
    services-platform:modules/customers/tests/integration/services/persistence/customers.queries.integration.spec.js
  explicit_no_doubles: false
  identified_double_boundaries:
    - the clock
---
# Customers.queries 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 customers.queries.

## What This Suite Proves

The file supplies executable engineering checks for the named subject. No complete acceptance scenario is inferred from the file’s existence.

## 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.
