-- 归档类别的来源(见 shared/src/archive_reasons.ts::ArchiveCategorySource)。 -- -- 10-06 起归档类别必选。改之前有人只写了一句话、没选类别;这些单的类别由 AI 读那句话 -- 推断,之后任何人都可以在面板上手动改。两种都是**追加**一条记录(带上原来那句话), -- 不改原记录:展示和统计取最新一条,原记录留着可查。source 记这条类别从哪来: -- NULL 归档人当场选的,或事后补填的 -- 'ai' AI 读那句话推断的 -- 'manual' 有人在面板上手动改的 ALTER TABLE "archive_feedback" ADD COLUMN IF NOT EXISTS "source" text; -- 存量回填:2026-10-06 时全平台只写了一句话、没选类别的归档单共 6 条(都是 bug,都在 -- social_relation)。类别是 AI 读那句话推断的,推断依据: -- bba1c22b "Discussed with PM ... this is a won't fix." → not_a_bug -- 9f65574a "more complex than expected ... fix locally" → ai_fix_wrong -- 757cf0fe "The fix is too hacky. I manually fix it ..." → ai_fix_wrong -- fedb7b00 "Still need to confirm with designer on design spec" → not_a_bug(需求未定) -- 982ed6df "This is a feature decision ... owned by profile team" → not_a_bug -- 8c7f4b91 "the feature is not released, thus V5 is not online" → not_a_bug -- 只在这张单最新一条记录仍然没有类别时才写(期间有人手动选过就不覆盖);id 固定,重跑无副作用。 INSERT INTO "archive_feedback" ("id", "kind", "target_id", "status_before", "round", "reason", "note", "by", "at", "source") SELECT 'ai-0048-' || v.target_id, f.kind, f.target_id, f.status_before, f.round, v.reason, f.note, 'system:ai-infer', (EXTRACT(EPOCH FROM now()) * 1000)::bigint, 'ai' FROM (VALUES ('bba1c22b-a2af-4d9b-b198-2d56bd9e33b4', 'not_a_bug'), ('9f65574a-b2d2-4290-a184-b929707c6ed3', 'ai_fix_wrong'), ('757cf0fe-82ca-4bba-bc62-f88615f06e13', 'ai_fix_wrong'), ('fedb7b00-1430-4c7f-b104-67b7d1df5b78', 'not_a_bug'), ('982ed6df-4c21-437f-91f2-0c842cd33eec', 'not_a_bug'), ('8c7f4b91-7897-42a5-82e0-0a947160d38f', 'not_a_bug') ) AS v(target_id, reason) JOIN LATERAL ( SELECT * FROM "archive_feedback" a WHERE a.kind = 'bug' AND a.target_id = v.target_id ORDER BY a.at DESC LIMIT 1 ) f ON f.reason IS NULL ON CONFLICT ("id") DO NOTHING;