# Clinic Slow Query Batch Materialization

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "clinic-slow-query-materialization-2026-08-06",
  "problems": [
    {
      "problemId": "clinic-slow-query-batch-rejected-by-materializer",
      "summary": "The Clinic helper emitted its canonical slow_query source and kind, but the runner materializer rejected both values and treated the whole multi-source batch as missing.",
      "status": "candidate",
      "issueKeys": ["ST-2863"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/ST-2863#problem:clinic-slow-query-batch-materializer-rejection"
      ],
      "signalTextIncludesAny": [
        "slow_query batch rejected by materializer",
        "valid Clinic batch entered child recovery",
        "helper source slow_query is not admitted"
      ],
      "observedThrough": "2026-08-06",
      "effectiveAt": null,
      "verifiedAt": null,
      "attemptedAction": "Admit the Clinic helper's canonical slow_query source and kind in the runner-owned batch materializer while preserving failed, empty, and complete query status as structured evidence.",
      "evidenceUrl": "https://pingcap.feishu.cn/docx/SDHAdVVOXoCCfJxpduOcX2hKnAh"
    }
  ]
}
-->

- Optimization ID: `clinic-slow-query-materialization-2026-08-06`
- Owner: auto-oncall-services
- Source reference: staging `ST-2863` replay
- Implementation status: implemented locally; staging rollout pending
- Effective status: `candidate`

## Bounded problem

Staging replay `c464d09b-ae65-405a-b200-fc966d99fc8b` produced valid
multi-source Clinic batches. The helper represented Slow Query operations with
`source=slow_query` and `kind=slow_query`, but the materializer omitted those
canonical values from its allowlists. It rejected the whole batch and invoked
missing-child recovery, preventing the parent-requested adaptive round.

## Change

Admit only the existing canonical Slow Query source and operation values. This
does not broaden provider routing, query safety, target, window, or fallback
behavior.

## Verification status

Local regression coverage proves that a failed Slow Query is materialized as a
structured query error instead of invalidating the whole batch. Staging deploy
and replay remain pending.

## Unresolved gaps

The failed provider operation may still need a changed follow-up query. That is
owned by the separate adaptive multi-batch optimization and must be proven by a
round-specific replay artifact.

## Next validation action

Redeploy staging and replay `ST-2863`; verify that the first handoff is
materialized, the same parent receives the Slow Query error, and any requested
round 2 uses an independent artifact path.
