---
id: TST-PFM-SEC-169
title: Staff access grants.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/staff-access-grants.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/staff-access-grants.queries.integration.spec.js#staff
      access grants persistence: the standing access reads
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#listActiveStaffGrantTenants
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#maps
      every element of each tenant an active grant reaches, by tenant name, and not the revoked
      grant
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#listLatestStandingGrants
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      one grant per tenant the staff member ever held a standing grant in, and no other kind
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      the latest standing grant of a tenant, not the earlier one that was revoked
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#maps
      every element of the grant it answers
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      a revoked standing grant when it is the latest of its tenant
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      an empty map for a staff member who never held one
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#findStaffAccessGrantByAssignment
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      the grant that materialized the assignment, in any state
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      nothing for an assignment no grant names
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#countActiveStaffAccessGrants
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#counts
      the active emergency grant and none of the standing ones
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#repointStaffAccessGrant
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#points
      an active grant at a new assignment, a version later, and answers the grant as stored
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      nothing for a grant that is no longer active, changing nothing
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#listStaffAccessGrantsOfMember
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      every grant active now and every one that ended inside the window, newest first
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#leaves
      out a request nobody has decided, which no access window answers
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      every grant of the member, newest first, when it is given no filter
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      only the grants of the kind it is given, in every state
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#names
      the tenant of a request, which always has one
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#leaves
      out a grant that ended before the window, which a wider window answers
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#settles
      the grant whose window closed and reports it expired, rather than active
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      a customer-level grant with no tenant and no tenant name, naming its customer
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#maps
      every element of a summary it answers
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      at most the limit it is given, keeping the newest
  - provenance: test
    source: >-
      services-platform:modules/security/tests/integration/services/persistence/staff-access-grants.queries.integration.spec.js#answers
      an empty list for a staff member who holds no grant at all
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/staff-access-grants.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/staff-access-grants.queries.integration.spec.js
  explicit_no_doubles: false
  identified_double_boundaries:
    - the clock
---
# Staff access grants.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 staff access grants.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.
