# Wetech metric temporal summary parity

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "wetech-metric-temporal-summary-2026-09-07",
  "problems": [{
    "problemId": "wetech-metric-peak-time-missing",
    "summary": "Wetech metric compaction loses temporal percentiles and the timestamp of the maximum before scenario diagnosis.",
    "status": "candidate",
    "applicability": "Agent9 Wetech metrics_query_range compact results.",
    "issueKeys": ["APID-29470"],
    "sourceRefs": ["https://tidb.atlassian.net/browse/APID-29470#problem:metric-peak-time-missing"],
    "signalTextIncludesAny": ["wetech_metric_peak_time_missing"],
    "observedThrough": "2026-09-07",
    "effectiveAt": null,
    "verifiedAt": null,
    "attemptedAction": "Preserve per-series p50, p95, p99 and maxAt using Clinic-equivalent sample filtering, linear interpolation and first-maximum selection.",
    "evidenceUrl": "https://tidb.atlassian.net/browse/APID-29470"
  }]
}
-->

Owner: Wetech Managed Tool Provider Executor, numericSummary in index.mjs.
Initial base: `91defe086c9d547037e675741b4de976fe29da69`; rebased onto
`958b73bab2ac3732917569fb2557278a188454e2` to preserve the independently merged
identity changes. Wetech v47 source candidate only; not deployed.

APID-29470 v43 run `c235b739-42e1-4962-acce-d800a3b85e86` retained a
59.42 seconds/s query-work maximum but no peak timestamp in its compact metric
facts. Workload-hotspot requested same-instance CPU and execution-rate alignment.
This change preserves the missing temporal facts; it does not itself establish
that the metrics co-moved or that the ticket diagnosis is resolved.

Match Clinic's per-series temporal p50/p95/p99 interpolation, epoch-second
`maxAt` (first maximum in Provider sample order), finite timestamp/value
filtering, last valid sample and sample count. These are time-sample
percentiles, not cross-instance or request-latency percentiles. Wetech's
instance references, Top10 result limit, authentication and query behavior stay
unchanged. No raw series, digest, SQL, plan or identity-policy changes.

Regression compares both production summarizers across single samples, uneven
values, negative values, ties, empty and invalid samples, verifies Top10 and
identity preservation, and checks the real runner materializes these fields
into the Scenario handoff. Deployment and case replay remain pending; the user
requested batching the independent changes before replay.
