---
id: ATS-PFM-LLM-004
scope: CAP-PFM-LLM-004
product_area: platform
module: llm
revision: 2
status: proposed
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
scenarios:
  - id: ATS-PFM-LLM-004-01
    title: Request and response capture have records
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-01
    preconditions: A scripted provider produces a normal result.
    steps: Execute the request and inspect its evidence objects and metadata.
    expected: >-
      Capture records exist for request and response, with request capture preceding dispatch and response
      capture following the loop result.
    negative: false
    data_needs: Fixtures representing a scripted provider produces a normal result.
    bound_to:
      - TST-PFM-LLM-020
    provenance: test
    source: >-
      services-platform:modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js#captured the
      request before it was sent
    category: rule
    test_sources:
      - >-
        services-platform:modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js#captured
        the request before it was sent
      - >-
        services-platform:modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js#captured
        the response
      - >-
        services-platform:modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js#recorded
        where both bodies went on the invocation
  - id: ATS-PFM-LLM-004-02
    title: Redaction preserves ordinary text and replaces credentials
    level: unit
    proves:
      - BR-CAP-PFM-LLM-004-02
    preconditions: >-
      Payload examples contain secret fields and bearer, model-provider, cloud and web keys and connection
      strings.
    steps: Redact every example.
    expected: Recognized credentials disappear while ordinary question text remains.
    negative: false
    data_needs: >-
      Fixtures representing payload examples contain secret fields and bearer, model-provider, cloud and web
      keys and connection strings.
    bound_to:
      - TST-PFM-LLM-072
      - TST-PFM-LLM-020
    provenance: test
    source: >-
      services-platform:modules/llm/tests/unit/services/evidence-redaction.spec.ts#replaces an apiKey whole,
      whatever it holds
    category: validation
    test_sources:
      - >-
        services-platform:modules/llm/tests/unit/services/evidence-redaction.spec.ts#replaces an apiKey whole,
        whatever it holds
      - >-
        services-platform:modules/llm/tests/unit/services/evidence-redaction.spec.ts#replaces an anthropic key
        pasted into a prompt
      - >-
        services-platform:modules/llm/tests/unit/services/evidence-redaction.spec.ts#keeps the prompt’s own
        words
      - >-
        services-platform:modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js#redacts a
        value whose key names a credential
  - id: ATS-PFM-LLM-004-03
    title: Attempt records contain operational fields only
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-03
    preconditions: A conversation creates several attempt records.
    steps: Inspect the retained attempts.
    expected: Their columns contain no prompt or tool input or output bodies.
    negative: false
    data_needs: Fixtures representing a conversation creates several attempt records.
    bound_to:
      - TST-PFM-LLM-034
    provenance: test
    source: >-
      services-platform:modules/llm/tests/integration/services/persistence/invocations.integration.spec.js#records
      no prompt, tool input or tool output on any of them
    category: invariant
    test_sources:
      - >-
        services-platform:modules/llm/tests/integration/services/persistence/invocations.integration.spec.js#records
        no prompt, tool input or tool output on any of them
  - id: ATS-PFM-LLM-004-04
    title: Organization deletion preserves its neighbors
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-05
      - BR-CAP-PFM-LLM-004-06
    preconditions: 'Two organizations hold AI data and evidence, including a similar-prefix neighbor.'
    steps: Delete one organization’s AI resources.
    expected: 'Its records and evidence versions are removed in dependency order, with other organizations unchanged.'
    negative: false
    data_needs: 'Fixtures representing two organizations hold AI data and evidence, including a similar-prefix neighbor.'
    bound_to:
      - TST-PFM-LLM-027
    provenance: test
    source: >-
      services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#leaves
      the tenant nothing at all in any table it declares, or in the evidence bucket
    category: boundary
    test_sources:
      - >-
        services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#leaves
        the tenant nothing at all in any table it declares, or in the evidence bucket
      - >-
        services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#removes
        every version of the tenant’s evidence, leaving the prefix empty
      - >-
        services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#removes
        the evidence only after the last row, so a surviving row never names a deleted body
      - >-
        services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#leaves
        the evidence of another tenant, and of one whose id begins like the purged one, exactly as it was
  - id: ATS-PFM-LLM-004-05
    title: Evidence capture discloses skipped and failed outcomes
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-09
    preconditions: Missing and failing evidence stores and a deployed-memory configuration are available.
    steps: >-
      Capture with no store, fail serialization or storage, and construct a memory store in deployed
      configuration.
    expected: Capture returns skipped or failed as applicable; deployed memory-store construction refuses.
    negative: true
    data_needs: Fault-injection fixtures for the described failure boundary.
    bound_to: []
    provenance: proposed
    source: 'services-platform:modules/llm/services/evidence/evidence-store.ts'
    category: failure
    test_sources: []
  - id: ATS-PFM-LLM-004-06
    title: Capture status controls privileged reads
    category: interaction
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-01
      - BR-CAP-PFM-LLM-016-04
      - INV-DOM-PFM-LLM-001-09
    exercises:
      - CAP-PFM-LLM-004
      - CAP-PFM-LLM-016
    preconditions: A request has one captured redacted body and one skipped body; the reader holds an eligible grant.
    steps: 'Read both body kinds, remove the captured object and read again.'
    expected: >-
      The first body is redacted, skipped avoids storage access, and missing captured content returns purged
      with audited status.
    negative: true
    data_needs: 'An isolated workspace with the records, clock instants and caller authority stated in the preconditions.'
    bound_to: []
    provenance: proposed
    source:
      - 'services-platform:modules/llm/services/execution/run-operation.ts:recordCapture'
      - 'services-platform:modules/llm/services/evidence/evidence-access.ts'
  - id: ATS-PFM-LLM-004-07
    title: Captured content requires a retained reference
    category: invariant
    level: api
    proves:
      - BR-CAP-PFM-LLM-004-04
    preconditions: >-
      The suite owns isolated fixtures representing the valid control and the contrasting case described by
      its steps.
    steps: Write captured request and response states without an evidence reference.
    expected: Both writes are refused by the storage constraint.
    negative: false
    data_needs: 'Suite-owned fixtures, with a fixed clock where dates or grant windows matter.'
    bound_to:
      - TST-PFM-LLM-014
    provenance: test
    source: >-
      services-platform:modules/llm/tests/integration/db/llm-invocations.table.integration.spec.js#refuses a
      captured request with nowhere to find it
    test_sources:
      - >-
        services-platform:modules/llm/tests/integration/db/llm-invocations.table.integration.spec.js#refuses a
        captured request with nowhere to find it
evidence:
  - >-
    services-platform at ad3f6a6582843008ed0f5a17b131878d15829af1: bound or cited
    modules/llm/tests/integration/lifecycle/run-operation.integration.spec.js;
    modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js;
    modules/llm/tests/integration/services/persistence/invocations.integration.spec.js;
    modules/llm/tests/unit/services/evidence-redaction.spec.ts.
coverage:
  rule: 'gap: FND-PFM-LLM-063'
  transition: 'gap: FND-PFM-LLM-063'
  validation: covered
  permission: not-applicable
  edge: 'gap: FND-PFM-LLM-063'
  failure: covered
  boundary: covered
  concurrency: 'gap: FND-PFM-LLM-063'
  invariant: 'gap: FND-PFM-LLM-063'
  interaction: covered
coverage_notes:
  transition: >-
    Existing transition scenarios are retained; the model transition register below records the remaining
    exhaustive mapping obligation.
  permission: >-
    This capability declares no permission key; caller authorization belongs to its consuming operation or a
    related capability.
  interaction: >-
    The related interaction register cites a concrete experiment for every dependency and related capability,
    including cross-capability workflow seams.
  invariant: >-
    The domain-invariant register maps each relevant invariant to a scenario or to the capability coverage
    finding; an example does not establish every invariant.
  rule: >-
    All must-prove rules have scenario references, but the coverage finding retains untested clauses and
    combined outcomes; scenario presence alone is not exhaustive rule proof.
related_interactions:
  - with: CAP-PFM-LLM-001
    scenarios:
      - ATS-PFM-LLM-001-13
    source: 'services-platform:modules/llm/services/catalog/catalog-authority.ts:resolveLlmOperation'
  - with: CAP-PFM-LLM-016
    scenarios:
      - ATS-PFM-LLM-004-06
    source: 'services-platform:modules/llm/services/evidence/evidence-access.ts'
state_models:
  - STATE-PFM-LLM-003
coverage_obligations:
  must_prove:
    - rule: BR-CAP-PFM-LLM-004-01
      scenarios:
        - ATS-PFM-LLM-004-01
        - ATS-PFM-LLM-004-06
      source: 'services-platform:modules/llm/services/execution/run-operation.ts:recordCapture'
      coverage: partial
      gap: FND-PFM-LLM-063
    - rule: BR-CAP-PFM-LLM-004-02
      scenarios:
        - ATS-PFM-LLM-004-02
      source: 'services-platform:modules/llm/services/evidence/evidence-redaction.ts'
      coverage: specified
    - rule: BR-CAP-PFM-LLM-004-03
      scenarios:
        - ATS-PFM-LLM-004-03
      source: 'services-platform:modules/llm/services/persistence/invocations.ts:recordInvocationAttempt'
      coverage: specified
    - rule: BR-CAP-PFM-LLM-004-05
      scenarios:
        - ATS-PFM-LLM-004-04
      source: 'services-platform:modules/llm/services/maintenance/tenant-participant.ts'
      coverage: partial
      gap: FND-PFM-LLM-063
    - rule: BR-CAP-PFM-LLM-004-06
      scenarios:
        - ATS-PFM-LLM-004-04
      source: >-
        services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#removes
        the evidence only after the last row, so a surviving row never names a deleted body
      coverage: partial
      gap: FND-PFM-LLM-063
    - rule: BR-CAP-PFM-LLM-004-09
      scenarios:
        - ATS-PFM-LLM-004-05
      source: 'services-platform:modules/llm/services/evidence/evidence-store.ts'
      coverage: partial
      gap: FND-PFM-LLM-063
  state_transitions:
    - model: STATE-PFM-LLM-003
      transition: 1
      from: pending
      to: captured
      trigger: The runtime writes a request or response body.
      gap: FND-PFM-LLM-063
      provenance: proposed
      source: 'services-platform:modules/llm/services/evidence/evidence-store.ts:captureEvidence'
    - model: STATE-PFM-LLM-003
      transition: 2
      from: pending
      to: skipped
      trigger: Capture runs without an evidence-store configuration.
      gap: FND-PFM-LLM-063
      provenance: proposed
      source: 'services-platform:modules/llm/services/evidence/evidence-store.ts:captureEvidence'
    - model: STATE-PFM-LLM-003
      transition: 3
      from: pending
      to: failed
      trigger: 'Capture encounters redaction, serialization or write failure.'
      gap: FND-PFM-LLM-063
      provenance: proposed
      source: 'services-platform:modules/llm/services/evidence/evidence-store.ts:captureEvidence'
    - model: STATE-PFM-LLM-003
      transition: 4
      from: captured
      to: purged
      trigger: Expiry or workspace removal deletes the stored object.
      gap: FND-PFM-LLM-063
      provenance: proposed
      source: 'services-platform:modules/llm/services/evidence/evidence-access.ts:readInvocationEvidence'
  domain_invariants:
    - invariant: INV-DOM-PFM-LLM-001-08
      scenarios: []
      gap: FND-PFM-LLM-063
      provenance: proposed
      source: 'services-platform:modules/llm/db/llm-invocation-attempts.table.ts:MAX_ATTEMPTS_PER_INVOCATION'
    - invariant: INV-DOM-PFM-LLM-001-09
      scenarios:
        - ATS-PFM-LLM-004-06
      provenance: documented
      source: 'services-platform:db/migrations/0048_llm.sql:llm_invocations_request_payload_key_check'
coverage_limits:
  finding: FND-PFM-LLM-063
  statement: >-
    Capture skip and serialization failures, metadata-write interruption, retention expiry and purge while
    traffic continues still need explicit outcomes. Purge quiescence is an external precondition.
  provenance: proposed
  source:
    - 'services-platform:modules/llm/services/execution/run-operation.ts:recordCapture'
    - 'services-platform:modules/llm/services/evidence/evidence-redaction.ts'
    - 'services-platform:modules/llm/services/persistence/invocations.ts:recordInvocationAttempt'
    - 'services-platform:modules/llm/services/maintenance/tenant-participant.ts'
    - >-
      services-platform:modules/llm/tests/integration/services/maintenance/tenant-participant.integration.spec.js#removes
      the evidence only after the last row, so a surviving row never names a deleted body
    - 'services-platform:modules/llm/services/evidence/evidence-store.ts'
    - 'services-platform:modules/llm/db/llm-invocation-attempts.table.ts:MAX_ATTEMPTS_PER_INVOCATION'
  invariants_without_scenarios:
    - INV-DOM-PFM-LLM-001-08
---

# undefined

## Coverage

The scenarios identify the rules or journey assertions they are intended to prove. A test binding names existing evidence; an unbound proposal remains work to verify.

| Scenario | Title | Level | Provenance |
|---|---|---|---|
| `ATS-PFM-LLM-004-01` | Request and response capture have records | api | test |
| `ATS-PFM-LLM-004-02` | Redaction preserves ordinary text and replaces credentials | unit | test |
| `ATS-PFM-LLM-004-03` | Attempt records contain operational fields only | api | test |
| `ATS-PFM-LLM-004-04` | Organization deletion preserves its neighbors | api | test |
| `ATS-PFM-LLM-004-05` | Evidence capture discloses skipped and failed outcomes | api | proposed |

## Interactions With Related Capabilities

The interaction register links concrete experiments with run ai requests with consistent attribution and accounting; inspect captured ai content with a live access grant. Each experiment checks the outcome at the shared boundary; an unbound experiment remains proposed.

Capture skip and serialization failures, metadata-write interruption, retention expiry and purge while traffic continues still need explicit outcomes. Purge quiescence is an external precondition.
