---
id: TST-PFM-QRY-234
title: Platform saved queries
kind: api-lifecycle
product_area: platform
module: queries
revision: 1
status: draft
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  rhythm-v2-docs: 99376625d3e7ac26936413cfc31a88fba6562464
repository: services-platform
files:
  - modules/queries/tests/e2e/saved-queries.e2e.spec.js
implements:
  - ATS-PFM-QRY-002-09
  - ATS-PFM-QRY-002-11
  - ATS-PFM-QRY-006-01
  - ATS-PFM-QRY-006-02
  - ATS-PFM-QRY-006-04
  - ATS-PFM-QRY-006-05
  - ATS-PFM-QRY-006-07
  - ATS-PFM-QRY-006-10
  - ATS-PFM-QRY-006-11
  - ATS-PFM-QRY-006-12
  - ATS-PFM-QRY-006-13
  - ATS-PFM-QRY-006-15
  - ATS-PFM-QRY-007-01
  - ATS-PFM-QRY-007-02
  - ATS-PFM-QRY-007-03
  - ATS-PFM-QRY-007-04
environment: local
implementation_state: implemented
latest_result: not-run
latest_run_at: null
latest_run_ref: null
conformance: not-verified
estimated_minutes: 5
isolation: 'The suite’s database fixtures, controlled execution contexts and file-owned external dependency seams.'
evidence:
  - 'services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js'
assertion_bindings:
  - scenario: ATS-PFM-QRY-002-09
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a token sent to the
        validate route, which judges a request on its own
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-002-11
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers 200 and the problems for
        a query it will not run, rather than a refusal
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#names the control the person
        used for a criterion the dataset will not accept
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-01
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#tells a colleague that somebody
        else’s private query does not exist, as 404
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#tells a manager the same thing,
        as 404
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#leaves a colleague’s private
        query out of the list
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-02
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#lets a holder of the selected
        role read the record [E2E-SQ-08]
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers not found for a role the
        caller does not hold, and excludes the record from the list [E2E-SQ-09]
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-04
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses making the query the
        organization’s without the power to share it as 403
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#accepts it from a caller who may
        share
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses the owner taking its
        shared query back to private without the power to share as 403
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-05
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a colleague editing the
        organization’s query as 403
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#lets a manager edit the
        organization’s query
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a colleague deleting the
        organization’s query as 403
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#lets a manager delete the
        organization’s query
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-07
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#creates a role-shared query and
        answers its stored role_ids [E2E-SQ-06]
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#replaces the whole selected-role
        set rather than appending to it [E2E-SQ-07]
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers no role_ids property
        when an update takes a role-shared query to the whole organization [E2E-SQ-12]
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-10
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a body whose definition
        cannot be run as written as 400
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a dataset this caller
        may not query as 403, however the library is reached
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-11
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#leaves a criterion’s value
        exactly as the person typed it, spaces and all
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers the definition it
        stored, and the version of the definition format
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-12
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a create whose name
        normalizes to one the owner already has, naming the trimmed proposed name as 400 [E2E-SQ-01]
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a rename that would
        duplicate another of the owner’s saved queries as 400, leaving the row unrenamed [E2E-SQ-02]
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#lets a different owner save the
        same name, with the created record answered under that owner [E2E-SQ-03]
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-13
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a replacement at a
        version that is no longer in force as 409
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a body that states no
        version at all as 400
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-006-15
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#leaves a colleague’s private
        query out of the numbered page too
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers how many queries each
        view holds
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#answers the record and its
        problems, not a refusal, when the dataset is no longer the caller’s to query
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-007-01
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#runs the organization’s query
        for a colleague who may query the dataset
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses to run it for a caller
        who may not query the dataset as 403, however it was shared
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses the run by the dataset’s
        own query permission, not by the sharing model [E2E-SQ-11]
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-007-02
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#takes the page size the caller
        asks for over the one the definition stored
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#counts every matching row and
        not the page, for a caller that asks for both a total and a smaller page
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a body carrying anything
        but the page as 400
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a page carrying a key
        the query language does not have as 400
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-007-03
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a save whose token is
        not declared as 400 naming the criterion
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a save whose declaration
        does not match its criterion as 400 at definition.parameters[0].dataType
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a save whose parameters
        are not a list as 400
    scope: assertions cited by the scenario
    provenance: test
  - scenario: ATS-PFM-QRY-007-04
    source:
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#runs with the value given,
        answering only the contacts it keeps
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a run without the
        required value as 400 at parameters.updatedBefore
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a value of the wrong
        type as 400 at its key
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#refuses a key the query does not
        ask for as 400 at that key
      - >-
        services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js#keeps a text value exactly as
        sent, never trimmed by the boundary
    scope: assertions cited by the scenario
    provenance: test
fixture_seams:
  - 'services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js:92'
  - 'services-platform:modules/queries/tests/e2e/saved-queries.e2e.spec.js:50'
---

# Platform saved queries

## Verification Boundary

The file dispatches requests through the real route table and signed execution contexts against its local fixtures.

## What This Suite Proves

Its assertions check saved queries. The assertion bindings identify the corresponding acceptance examples and retain their original test-title citations.

## What It Does Not Prove

Local execution does not establish deployed queue scheduling, every external provider response or a passing result at the pinned revision.

## Real Dependencies and Test Doubles

The integration fixture and any imported dependency seams define the environment. Database-oriented checks use PostgreSQL; file-owned transport, clock, provider or worker seams isolate the explicitly controlled boundary.

## Must Not Be Doubled

Keep the dispatcher, route requirements and the handler behavior named by the assertions real. Review any new substitutions before treating the same acceptance bindings as unchanged.
