---
id: ADR-PFM-QRY-015
title: The application validates model-proposed queries
product_area: platform
module: queries
revision: 1
status: proposed
design_intent: confirmed
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
decision: >-
  The model proposes query outcomes over permitted metadata, while the application validates and
  compiles queries, controls bounded test execution and stores explanatory model content as part of
  the outcome.
constrains:
  - IOP-PFM-QRY-001
  - WF-PFM-QRY-004
  - DOM-PFM-QRY-002
  - SCR-PFM-QRY-003
origin: >-
  docs/llm/llm-foundation-and-generate-query.md (approved 2026-10-10, accepted 2026-10-12);
  docs/compliance/control-coverage.md TC-AI-001
alternatives:
  - option: Execute the submitted query without application validation
    why_not: The draft could violate the language contract or the person’s dataset access.
  - option: Include sample records in model context
    why_not: >-
      Personal record values would reach the provider; configured test summaries provide a narrower
      interface.
consequences:
  - The LLM foundation meters and records each invocation.
  - >-
    An invalid final query is rejected; clarification and unsupported outcomes can still settle
    successfully.
supersedes: []
evidence:
  - 'services-platform at ad3f6a6: modules/queries/services/generate/**'
---

# The application validates model-proposed queries

## Context

Plain-language authoring needs model judgment without handing authorization or persistence control to the model.

## Decision

The model proposes query outcomes over permitted metadata, while the application validates and compiles queries, controls bounded test execution and stores explanatory model content as part of the outcome.

## Alternatives Considered

Execute the submitted query without application validation: The draft could violate the language contract or the person’s dataset access.

Include sample records in model context: Personal record values would reach the provider; configured test summaries provide a narrower interface.

## Consequences

The LLM foundation meters and records each invocation. An invalid final query is rejected; clarification and unsupported outcomes can still settle successfully.
