docs: register baseline_diagnosis and split_manifest schemas with baseline metrics

This commit is contained in:
2026-07-15 11:42:38 -04:00
parent cfa510a7e5
commit 745b600b5d
8 changed files with 236 additions and 3 deletions
@@ -0,0 +1,44 @@
---
type: schema
node_id: schema:baseline-diagnosis
title: "表结构: baseline_diagnosis(逐题诊断信号)"
date: 2026-07-15
---
# 表结构: baseline_diagnosis(逐题诊断信号)
> 载体:`harness.db``workspaces/<ws>/harness.db`)。用途:把已有 baseline run(如 `infer_adhoc`)的每道错题诊断结果落成信号行,供视频级切分选择器消费。**逐题 upsert,可断点续跑。**
> 实现:`schema:results-driven-video-split` 计划 Task 3(端口 `DiagnosisSignalStore``core/evolution/protocols.py`+ 适配 `adapters/baseline_diagnosis_store.py`),遵循 `app/harness/log.py::HarnessLog` 既有约定(`create_table` + `insert(mode="replace")` 实现 upsert)。
## 列定义
| 列 | 类型 | 可空 | 说明 |
|----|------|:---:|------|
| question_id | TEXT | 否 | 题唯一标识(canonical 取行 = 每 qid 第一行 `ORDER BY rowid` |
| video_id | TEXT | 否 | 视频标识 |
| baseline_run_id | TEXT | 否 | 溯源 run(如 `infer_adhoc` |
| diag_fingerprint | TEXT | 否 | `hash(诊断prompt版本 + model + 诊断代码git短SHA)``--force` 用新值不覆盖旧 |
| task_type | TEXT | 否 | 12 类之一 |
| error_type | TEXT | **是** | extraction/search/reasoning/mixed**T0(INFRA)/uncertain 行为 NULL** |
| cause_category | TEXT | 是 | defect/lapse;正确题/INFRA/未判为 NULL |
| tier | TEXT | 否 | T0 / T1 / T2 / uncertain |
| evolution_target | TEXT | **是** | 由 error_type 派生 tool/skill/systemerror_type 为 NULL 时亦 NULL |
| degraded | INTEGER | 否 | judge 解析失败降级 0/1 |
| infra | INTEGER | 否 | INFRAstop_reason∈{error,parse_error})排除 0/1 |
| session_id | TEXT | 是 | 遥测关联 ID |
**主键**`(question_id, baseline_run_id, diag_fingerprint)` —— 保证 upsert 幂等、不同 fingerprint 隔离、断点续跑按已完成集跳过。
**tier 写规则**INFRA 题 `infra=1, tier=T0, error_type/cause_category/evolution_target=NULL`degraded/诊断失败题 `degraded=1, tier=uncertain, error_type` 可 NULL`cause_category='defect'``tier=T2``='lapse'``tier=T1`。仅 T2 进 48 格覆盖。
## 埋点位置
| 位置 | 动作 |
|------|------|
| `app/harness/baseline_diagnosis.py::run_baseline_diagnosis`(计划 Task 4 | 投影 `run_diagnosis``error_attributions` + `infra_question_ids` + `degraded_question_ids` → 逐行 `store.upsert(DiagnosisSignalRow)` |
| `adapters/baseline_diagnosis_store.py::SqliteDiagnosisSignalStore.upsert`(计划 Task 3 | `INSERT OR REPLACE`(单事务原子) |
| 读回 | `.done_question_ids(run,fp)`(续跑跳过)/ `.load(run,fp)`(选择器输入) |
## 关联
- 实现设计:`design:results-driven-video-split`
- 被度量:`metric:split-signal-tier-distribution``metric:split-cell-coverage`
+30
View File
@@ -0,0 +1,30 @@
---
type: schema
node_id: schema:split-manifest
title: "表结构: split_manifest(切分冻结溯源)"
date: 2026-07-15
---
# 表结构: split_manifest(切分冻结溯源)
> 载体:JSON sidecar,随冻结的 `pools.json` 同目录(非 DB 表)。用途:记录切分产物的复现三元组与验收报告,任何人可据此校验/复现该次切分。
> 实现:`app/harness/split_manifest.py::write_manifest`(计划 Task 10/11)。
## 字段定义
| 键 | 类型 | 说明 |
|----|------|------|
| baseline_run_id | str | 溯源 run`infer_adhoc` |
| diag_fingerprint | str | 诊断指纹(与 `baseline_diagnosis` 一致,不匹配则 build 时 fail loud |
| seed | int | 选择器随机种子 |
| config | object | 旋钮快照:n_trainval / floor_k / epsilon / report_floor / val_wrong_min |
| pools_sha256 | str | 冻结 `pools.json` 内容 SHA256(自洽校验) |
| coverage_report | object | 48格覆盖数、floor 达标情况、test 代表性偏差、各 tier 占比、默认lapse/degraded 计数 |
| generated_at | str | 生成时间(由脚本传入,非代码内 `Date.now` |
**幂等/原子**manifest 与 pools.json 均经 `_atomic_write_json`tmp + os.replace)落盘;重建时 `diag_fingerprint`/`pools_sha256` 不匹配即 fail loud。
## 关联
- 实现设计:`design:results-driven-video-split`
- 承载指标:`metric:split-floor-and-representativeness``metric:split-cell-coverage`