# ISS-0057: TopSQL 数据对部分集群不可用（Delta Lake 路径不存在）

## Background

In O11Y-2489480 (GCP Japan Dedicated cluster), collect_evidence.py A4 failed to retrieve TopSQL
data because the Clinic Delta Lake path does not exist for this cluster:
`gs://o11y-prod-shared-asia-northeast1/deltalake/org=1372813089209272332/cluster=10766841556523235152/type=topsql/component=tidb`

The error is recorded in `evidence_summary.errors`, but the diagnosis output does not explicitly
tell the user that TopSQL is unavailable — it simply proceeds without TopSQL data.

Workspace: ws-1777512849128-e855d536a

## Observed Error

From collect_evidence.py output:
```
A4:topsql_tikv: HTTP 500: {"error":"query failed: create external table failed:
googleapi: Error 400: The parent directory gs://o11y-prod-shared-asia-northeast1/
deltalake/org=1372813089209272332/cluster=10766841556523235152/type=topsql/component=tidb
is not a valid path for a Delta Lake table. Delta log files could not be found in the
subdirectory _delta_log and a checkpoint could not be determined., invalidQuery"}
```

## Root Cause Analysis

The Delta Lake / Parquet TopSQL data pipeline has not been backfilled for this cluster.
This could be a GCP-specific pipeline gap, or the cluster may simply have no TopSQL data
collected (it may be a newer cluster or a cluster outside the TopSQL collection coverage).

## Fix Plan

### Part 1: Improve diagnosis output

In SKILL.md Node C, add guidance: if `evidence_summary.errors` contains `A4:topsql_*`
HTTP 5xx error, add to the diagnosis output:
> "TopSQL 数据因 Clinic 数据管道错误不可用（HTTP 500），分析仅基于 SlowQuery 日志，
>  根因置信度有所降低。"

### Part 2: Update collect_evidence.py

In the A4 section, when HTTP 500 is received for TopSQL:
- Write the failure reason to `evidence_summary["key_findings"]` alongside errors
- Label the finding: `"TopSQL (TiDB): unavailable — Delta Lake path missing (HTTP 500)"`

### Part 3: Update --check script

In replay.sh / check logic, distinguish:
- `topsql_tidb: missing` (not queried at all) — is a gap
- `topsql_tidb: unavailable` (queried but HTTP 5xx from Clinic) — not a gap, log as known limitation

Add logic: if `errors` contains `A4:topsql_*` HTTP 5xx, mark `topsql_tidb` as `unavailable`
and exclude it from `gaps` output.

## Verification

Run collect_evidence.py on the same cluster. Check that:
1. evidence_summary.key_findings includes the TopSQL unavailability note
2. `--check` does not report TopSQL as a gap when Clinic returns HTTP 500

## Related Issues

- ISS-0056: Activity Hub Access Denied for same cluster
- ISS-0036: Loki empty results
