---
id: TST-PFM-SEC-174
title: Users.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/security/tests/integration/services/persistence/users.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/security/tests/integration/services/persistence/users.queries.integration.spec.js#security
      persistence: the console-user list
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the customer’s console users of every live status, by surname then forename
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      a portal member of the customer’s own tenant out of the console list
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      another customer’s console users out, whatever the search asks for
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      every mapped field of a row, as the record the table defines
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#searches
      the forename, the surname and the e-mail address, case-insensitively
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nobody for a term no name or address contains
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the statuses asked for, and to those only
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the people holding one role, excluding somebody with no grant at all
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      one row per person however many grants of the role they hold
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#walks
      the pages by the keyset, answering each person exactly once
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the cursor of the last row of a page, and nothing when the page is the last
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#the
      invitation filter
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      all four people with no invitation filter, the premise of the cases below
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the person whose invitation can still be accepted
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the person whose unaccepted invitation has run out
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the person nobody ever invited
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      any of several states, and never the person whose invitation was accepted
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#combines
      with the status filter: a person must match both
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#userNamesByIds
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the display name where there is one and the two names where there is not, by id
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      out an id it cannot reach and one that names nobody, and answers nothing for no ids
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#still
      names somebody who has been deleted, because it reads platform.current_and_former_users
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#readUserDisplayNames
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the display name where there is one and the two names where there is not, by id
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      out an id it cannot reach and one that names nobody, and answers nothing for no ids or an
      empty one
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#still
      names the owner of a library after they are deleted
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#security
      persistence: the platform.users records
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#createUser
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the console user it wrote whole, every field it was given and no lifecycle column at all
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      out every optional column the input did not name, rather than answering it null
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      a portal member with the tenant of its wall on it, where a console user has no tenant key
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#getUser
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#reads
      the user back by id exactly as the write answered it
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nothing for an id of the right grammar that names nobody
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#findUserByEmailInWall
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the console user of the customer whose address was asked for, whole, whatever case it is
      presented in
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the member of the tenant whose address was asked for, and nothing for the same address in the
      other wall
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nothing for an address nobody in the wall holds, and nothing for another customer's console
      wall
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#listUsers
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      a customer's users of both walls in id order, each whole
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#narrows
      to the members of one tenant, leaving the customer's console users out
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      every user when no scope is named, and never another customer's in a customer scope
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#listUsersOfWall
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the console users of a customer in id order, each whole, and not the members of its tenant
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the members of one tenant's portal, whole, and nobody of another tenant's
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      an empty list for a console wall this suite has nobody in
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#updateUser
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the replaced record whole: the fields it was given, the version bumped, the lifecycle kept
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#deleteUser
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the id it removed, after which the read by that id answers nothing
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#the
      lifecycle transitions
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the invited record with the moment of the first invitation on it
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the activated record with the activation and the e-mail verified at the same moment
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the suspended record with the moment and the administrator who suspended it
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the reinstated record with the suspension gone from it and the first activation kept
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the revoked record with the moment the membership ended
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nothing at all for a transition of somebody who is not there
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#stamps
      a sign-in on the row without moving the status or the version, which no caller holds
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#updateUserDetails
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the record with the five fields it was given changed, the version bumped and nothing else
      moved
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      a field it was not given as it was, and clears the display name it was given null for
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#refuses
      the version the caller did not read, leaving the row as it was
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#refuses
      an edit of somebody who is not there
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#listActiveUsersOfCustomer
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the active user of the customer whole, and leaves out the invited, the suspended and the
      revoked
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      out an active row that carries a revocation instant, which is the clause the status cannot
      speak for
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nobody of this suite's for another customer, and nobody at all for a customer with none
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#security
      persistence: the name and avatar read
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#nameablePeopleOfCustomer
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the customer's console users with the chosen name and the avatar, and the two names where
      neither was given
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the portal users of the customer's tenants, this tenant's and a sibling tenant's alike
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#still
      names somebody who has been deleted, and answers no avatar for them, because former users keep
      no picture
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#names
      a member of Rhythm's staff holding no grant anywhere and one holding an active grant in the
      same way
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#still
      names a member of Rhythm's staff who has been deleted, with no avatar
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#leaves
      out a user of another customer and an id that names nobody, rather than nulling or refusing
      them
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the people of the customer it is asked about, never the ones of the caller’s own customer
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      nothing at all for no ids and for a blank one
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      each person once however often the id is asked for, in id order
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#carries
      exactly the three fields the route may answer, and nothing else about anybody
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#security
      persistence: a service principal's name
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#is
      named "<display name> (service)" by readUserDisplayNames to a caller of any customer
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#is
      named the same by userNamesByIds
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#is
      among the people any tenant's records may be told the names of, with no avatar
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/users.queries.integration.spec.js#answers
      the view's whole row for it: status service, Rhythm's customer, no tenant, the placeholder
      address
dependency_evidence: >-
  The prepared PostgreSQL database supplies the persisted fixtures and constraints exercised here.
  The file declares no substituted collaborators.
evidence:
  - >-
    services-platform:modules/security/tests/integration/services/persistence/users.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/security/tests/integration/services/persistence/users.queries.integration.spec.js
  explicit_no_doubles: true
  identified_double_boundaries: []
---
# Users.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 users.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 file declares no substituted collaborators.

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