# Clinic Multi-Source Evidence Acquisition

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "clinic-multi-source-evidence-2026-08-06",
  "problems": [
    {
      "problemId": "clinic-auto-oncall-contract-exposes-only-promql-metrics",
      "summary": "Auto-oncall selected Clinic but its deterministic evidence contract admitted only PromQL metrics, so available Slow Query, TopSQL, Loki, topology, and activity evidence could not enter the scenario packet.",
      "status": "optimized_verified",
      "issueKeys": ["ST-2864", "TCID-13001", "ST-2863", "ST-2865"],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/ST-2864#problem:clinic-recipe-queried-tikv-instead-of-tiflash-storage",
        "https://tidb.atlassian.net/browse/TCID-13001#problem:clinic-multi-source-evidence-not-admitted"
      ],
      "signalTextIncludesAny": [
        "clinic recipe queried the wrong component",
        "slow query topsql and loki exist but were not queried",
        "clinic metrics batch only supports promql",
        "available clinic evidence did not enter the scenario packet"
      ],
      "observedThrough": "2026-08-06",
      "effectiveAt": "2026-08-06T06:14:14Z",
      "verifiedAt": "2026-08-06T06:45:28Z",
      "attemptedAction": "Replace the Clinic metrics-only plan with a bounded exact-target multi-source evidence batch that can query topology, metrics, Slow Query, TopSQL, Loki, and activities while preserving historical windows and deterministic compact evidence materialization.",
      "evidenceUrl": "https://pingcap.feishu.cn/docx/SDHAdVVOXoCCfJxpduOcX2hKnAh"
    }
  ]
}
-->

- Optimization ID: `clinic-multi-source-evidence-2026-08-06`
- Owner: auto-oncall-services
- Source references: the frozen `ST-2864` and `TCID-13001` Clinic versus
  Investibook comparison
- Implementation status: deployed to staging in image
  `692e850ea64427827be52bc0425306df5e95c283`
- Effective status: `optimized_verified` for the bounded evidence-admission
  problem

## Bounded problem

Clinic exposed the required data, but auto-oncall constrained the Clinic child
to one metrics-only `query_range_batch` invocation and accepted only
`clinic-metrics-batch-v1`. The source cases therefore either queried the wrong
component or omitted available Slow Query, TopSQL, and Loki evidence.

## Implementation

- Keep the exact Cloud org/cluster target and historical absolute window.
- Execute one bounded deterministic multi-source Clinic plan.
- Materialize source-typed compact reports and a strict child handoff in the
  runner without agent-authored evidence JSON.
- Preserve bounded source failures as gaps rather than negative evidence.

## Verification status

The staging replay cohort produced eight deterministic Clinic batches across
`ST-2864`, `TCID-13001`, `ST-2863`, and `ST-2865`. The batches admitted
topology, metrics, TopSQL, Slow Query, and Loki evidence. In particular,
`TCID-13001` returned TopSQL, Loki, and metric evidence, while `ST-2863`
returned Slow Query and Loki evidence. This passes the bounded criterion that
non-metric Clinic sources can enter a case-specific scenario packet.

All four source cases completed post-change replay and updated their existing
Jira internal comments in place. Comment IDs `23430476`, `23428753`,
`23422952`, and `23432370` were read back as `public=false`.

## Unresolved gaps

- `TCID-13001` Slow Query and two `ST-2863` TopSQL queries returned
  `clinic_http_500`; these remain source failures, not negative evidence.
- The compact series limit omitted the alerting TiKV nodes in `ST-2865`, which
  weakened the final diagnosis even though the acquisition contract worked.
- The publication guard removed admitted facts from `ST-2864` and
  `TCID-13001`. That is a separate finalization problem and is not suppressed
  by this verified acquisition record.
- Three additional affected cases produced no new Clinic batch because their
  provider acquisition was prohibited or no artifact was materialized.

## Next validation action

Validate source-specific retries or bounded fallbacks for Clinic HTTP 500, and
change compact selection so alerting or extreme series cannot be lost merely
because a source returns more than 20 series. Track final fact preservation in
a separate optimization record.
