Files
streamline/drizzle/0018_readable_run_round.sql
2026-11-16 17:26:44 -08:00

28 lines
2.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 可读性报告的生成记录是**哪一批执行**的:`readable_report_runs.round`。
--
-- 归档这件事本来就有两半,之前只有一半是按批次组织的:
--
-- - 原始报告(FixReport.md / ImplReport.md)早就按批次存进了
-- `fix_report_versions` / `impl_report_versions`(键是 (target, round))——
-- 节点上只有一份文件、agent 每批就地重写,不抢在下一批开工前拍下来就没了。
-- - 可读性报告(大白话正文)存在 `readable_report_runs` 里,但那张表是按
-- **prompt 版本**组织的:面板上的版本切换器回答的是「这份报告是哪版提示词写
-- 的」,而不是「第 8 批那次实现,当时的报告长什么样」。
--
-- 于是「翻回去看上一批的报告」在库里是拼不出来的:raw markdown 有批次、正文没有。
-- 这一列把正文也接上同一把尺子——生成开工时目标跑到第几批就记第几批,之后按
-- (target, round) 就能把两半对上,前端的批次切换器才有得可选。
--
-- NULL ⇒ 这一列之前的存量 run。同样不回填:run 行没有留下它当时对着的是第几批,
-- 拿目标此刻的 attempts 去补,等于把每一份历史正文都标成「最新那批的」——那正是
-- 这套东西要防的事。存量批次仍然能看:raw markdown 的归档是全的,前端对这种批次
-- 显示原始报告并标明「该批没有大白话版本」。
--
-- 三条 track:security 没有可读性报告流水线,这张表里也就没有它的行。
ALTER TABLE "readable_report_runs" ADD COLUMN IF NOT EXISTS "round" bigint;
-- 批次切换器要按 (目标, 批次) 找那一批的 run,列表页从不按它筛,所以只建这一条
-- 复合索引,且带上 target_type —— 两条 track 的 id 空间是分开的。
CREATE INDEX IF NOT EXISTS "readable_report_runs_target_round_idx"
ON "readable_report_runs" ("target_type", "target_id", "round");