---
id: FAS-PFM-QRY-05
feature: FEAT-PFM-QRY-05
product_area: platform
module: queries
revision: 2
status: proposed
product_intent: proposed
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
  rhythm-v2-docs: f946bdcc118035206f18109fbf69cd8e9e785aaf
capabilities:
  - CAP-PFM-QRY-014
  - CAP-PFM-QRY-015
scenarios:
  - id: FAS-PFM-QRY-05-01
    title: Immediate and scheduled files answer the retained question
    kind: behaviour
    exercises:
      - CAP-PFM-QRY-014
      - CAP-PFM-QRY-015
    relies_on:
      - ATS-PFM-QRY-014-03
      - ATS-PFM-QRY-015-03
      - ATS-PFM-QRY-015-08
    preconditions: A query spans multiple pages and a schedule pins its current definition.
    steps: >-
      Export it immediately, execute its schedule and compare both files with
      the complete ordered query answer.
    expected: >-
      Each file contains the pinned answer once; each scheduled recipient has
      one personal communication request.
    negative: false
    data_needs: >-
      Use an isolated workspace, named fixture records and the caller grants
      described by the prerequisites.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-platform:modules/queries/tests/integration/services/exports/run-query-export.integration.spec.js#writes
        every planted row exactly once, in the query’s sort, with no gap
      - >-
        services-platform:modules/queries/tests/integration/services/schedules/query-schedule-routes.integration.spec.js#flags
        the saved query as changed since the schedule was set up
      - >-
        services-platform:modules/queries/tests/integration/services/schedules/scheduled-delivery.integration.spec.js#asks
        for one e-mail per deliverable recipient, each under the key <run
        id>:<recipient id>
  - id: FAS-PFM-QRY-05-02
    title: A recipient retry reuses the existing file
    kind: interaction
    exercises:
      - CAP-PFM-QRY-014
      - CAP-PFM-QRY-015
    relies_on:
      - ATS-PFM-QRY-014-09
      - ATS-PFM-QRY-015-08
    preconditions: >-
      A completed occurrence has two recipients and its queue message is
      redelivered.
    steps: >-
      Process delivery twice, inspect communication identities and open each
      recipient link.
    expected: >-
      Each recipient keeps one request and a valid personal link; retry does not
      create another copy of the message.
    negative: false
    data_needs: >-
      Use an isolated workspace, named fixture records and the caller grants
      described by the prerequisites.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-platform:modules/queries/tests/integration/services/exports/query-export-routes.integration.spec.js#redirects
        a valid link to the presigned file
      - >-
        services-platform:modules/queries/tests/integration/services/schedules/scheduled-delivery.integration.spec.js#asks
        for one e-mail per deliverable recipient, each under the key <run
        id>:<recipient id>
  - id: FAS-PFM-QRY-05-03
    title: Refreshing a source changes future scheduled output
    kind: lifecycle
    exercises:
      - CAP-PFM-QRY-014
      - CAP-PFM-QRY-015
      - CAP-PFM-QRY-006
    relies_on:
      - ATS-PFM-QRY-015-03
      - ATS-PFM-QRY-014-03
      - ATS-PFM-QRY-006-14
    preconditions: A query schedule pins a definition before the saved question changes.
    steps: >-
      Edit the question, run the schedule, refresh its source, run again and
      remove the schedule.
    expected: >-
      The first run uses the earlier copy and the second uses the refreshed one;
      retained files keep their original output and expiry.
    negative: false
    data_needs: >-
      Use an isolated workspace, named fixture records and the caller grants
      described by the prerequisites.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-platform:modules/queries/tests/integration/services/schedules/query-schedule-routes.integration.spec.js#flags
        the saved query as changed since the schedule was set up
      - >-
        services-platform:modules/queries/tests/integration/services/exports/run-query-export.integration.spec.js#writes
        every planted row exactly once, in the query’s sort, with no gap
      - >-
        services-platform:modules/queries/tests/e2e/reports.e2e.spec.js#refuses
        to delete a saved query a report presents as 409 saved_query_reported
  - id: FAS-PFM-QRY-05-04
    title: Report access loss pauses delivery until an authorized takeover
    kind: permission
    exercises:
      - CAP-PFM-QRY-014
      - CAP-PFM-QRY-015
      - CAP-PFM-QRY-013
    relies_on:
      - ATS-PFM-QRY-015-04
      - ATS-PFM-QRY-015-05
      - ATS-PFM-QRY-013-04
    preconditions: >-
      An author owns an active report schedule with two recipients; an
      administrator can manage the schedule and run its report.
    steps: >-
      After a successful occurrence, make the report private so its owner loses
      report access; inspect the next occurrence, attempt takeover as the owner,
      then take ownership as the administrator and resume.
    expected: >-
      The inaccessible occurrence fails with no export, delivery or recipient
      message and pauses the schedule; the author’s takeover is refused, while
      administrator takeover and resume permit the next occurrence to send to
      both recipients.
    negative: true
    data_needs: >-
      Use an isolated workspace, named fixture records and the caller grants
      described by the prerequisites.
    bound_to:
      - TST-PFM-QRY-140
    provenance: test
    source: >-
      react-console:acceptance/reporting/playwright/journeys/schedules/RPT-ACC-0425.spec.ts#RPT-ACC-0425
  - id: FAS-PFM-QRY-05-05
    title: Deletion separates retained output from future work
    kind: regression
    exercises:
      - CAP-PFM-QRY-014
      - CAP-PFM-QRY-015
      - CAP-PFM-QRY-013
      - CAP-PFM-QRY-011
    relies_on:
      - ATS-PFM-QRY-015-13
      - ATS-PFM-QRY-013-09
      - ATS-PFM-QRY-014-07
    preconditions: A table report has a completed file and a live report schedule.
    steps: >-
      Delete the report, download the retained file, try resuming the schedule
      and then delete the schedule.
    expected: >-
      The file remains downloadable until its deadline; report-deleted
      recurrence cannot restart and schedule deletion removes its run history.
    negative: true
    data_needs: >-
      Use an isolated workspace, named fixture records and the caller grants
      described by the prerequisites.
    bound_to: []
    provenance: proposed
    source:
      - >-
        services-platform:modules/queries/tests/e2e/query-schedules.e2e.spec.js#pauses
        the schedule report_deleted, its report gone
      - >-
        react-console:acceptance/reporting/playwright/journeys/print-and-export/RPT-ACC-0349.spec.ts#RPT-ACC-0349
      - >-
        services-platform:modules/queries/tests/integration/services/exports/query-export-routes.integration.spec.js#answers
        the requester their export
evidence:
  - >-
    rhythm-v2-docs:specs/platform/queries/planning/features/FEAT-PFM-QRY-05-exports-and-scheduled-delivery.md
  - >-
    rhythm-v2-docs:specs/platform/queries/planning/capabilities/CAP-PFM-QRY-014-take-a-query-s-whole-result-away-as-a-csv-or-excel-file.md
  - >-
    rhythm-v2-docs:specs/platform/queries/planning/capabilities/CAP-PFM-QRY-015-send-a-saved-query-or-report-to-chosen-people-on-a-schedule.md
---
# Files and scheduled delivery: Feature Acceptance Suite

## What the Feature Must Do as a Whole

An immediate export and a scheduled delivery must produce usable output under the authority of the person responsible for the work. These scenarios connect complete query results, retained definitions, recipient links and later ownership changes. The suite keeps delivery recovery separate from the existence of an earlier file.

## Interactions Between Capabilities

The access-loss journey withdraws the owner’s report access and checks the next occurrence, its export and its recipient messages. It then attempts takeover without sufficient authority before transferring ownership to an administrator and resuming delivery. The other scenarios connect export retries, source refresh and report removal to their effects on future work and retained output.

## Regression Record

| Revision | Change | Scenario | Why |
|---|---|---|---|
| 1 | initial | all | Establish cumulative coverage from the pinned specifications and test assertions. |
| 2 | continuation examination | delivery permission | Correct the withdrawn-access prerequisite and activate the inspected recovery journey. |
