muse-agent-example/tests/夹具/旧库样本.sql
zizi f76c3cd04a docs(架构): 归档R2历史留痕并清理过程计划与实施分期标签
- 归档并收敛 R2 历史留痕至 docs/实现回顾/R2改造历史留痕.md,删除已退出生命周期的改造计划、旧文件处置及验证过程文档
- 现行测试用例身份收敛至 tests/用例清单.json(1358条扁平登记),适配 conftest、索引维护与测试执行验证
- 清理源码、配置、SQL迁移头、测试夹具及规则文档中的 Wxx 实施分期标签与过时过程描述
- 同步重新打包构建资源清单,通过全量离线测试、模块边界、类型检查与索引双向强核验
2026-09-16 19:09:14 +08:00

85 lines
5.0 KiB
SQL
Raw 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.

-- 新版测试夹具 · 旧库样本
-- 用途:旧知识记录分流 / 迁移行为的合成回归输入。
-- 边界:全部为脱敏合成数据;无真实作品名、无真实正文、无凭据、无生产默认值。
-- 不得被生产配置、生成输入或启用流程反向消费。
-- 形状依据:旧 PG DDL(muse/authority/db/ddl/99-example候选与决策.sql @ sha256:7278928450a26fe2a2dc7edf04b14ac0988146f474c29d6d2c40d585b29389bf、
-- 96-example参考作品授权快照.sql @ sha256:8df6ef2663ca9ad458bf2ac76412729e361c157e873bf04c272ae4246fe6de0d、101-example-raw.sql @ sha256:ff8b9f1c88318d22bcf5c96b5a279c8cf6855ffcece09c58b75ee06db195de52)与
-- 旧 SQLite 账本(data/migrations/0001_init.sql @ sha256:8f25bec720a745840b32187ac758f2d25dfd84fbfd5b4fcbc228c0d6a1d4b8f3)。
-- 说明:本文件只提供「样本行」形状,不重建全部旧 DDL;消费方在隔离库中
-- 自建所需表结构后加载本样本。
-- ============================================================
-- 一、旧 PG:候选与决策(example_candidate / example_user_decision)
-- ============================================================
-- 候选:状态各异,供分流与状态机回归
INSERT INTO example_candidate
(id, work_id, chapter_no, kind, payload_json, status, created_at, updated_at)
VALUES
('cand-syn-0001', 'work-syn-0001', 1, 'chapter_text',
'{"text": "合成正文候选一。", "origin": {"task_id": "task-syn-0001", "role": "writer"}}',
'pending', '2026-01-01T00:00:00Z', '2026-01-01T00:00:00Z'),
('cand-syn-0002', 'work-syn-0001', 1, 'chapter_text',
'{"text": "合成正文候选二。", "origin": {"task_id": "task-syn-0002", "role": "writer"}}',
'adopted', '2026-01-01T01:00:00Z', '2026-01-01T02:00:00Z'),
('cand-syn-0003', 'work-syn-0001', 2, 'fact_delta',
'{"facts": [{"subject": "syn-character-a", "predicate": "located_at", "object": "syn-place-a"}]}',
'rejected', '2026-01-02T00:00:00Z', '2026-01-02T00:00:00Z');
-- 用户决策:adopt / reject 各一,附理由
INSERT INTO example_user_decision
(id, candidate_id, action, reason, decided_at, decision_source)
VALUES
('dec-syn-0001', 'cand-syn-0002', 'adopt', '合成理由:定稿', '2026-01-01T02:00:00Z', 'author_ui'),
('dec-syn-0002', 'cand-syn-0003', 'reject', '合成理由:事实与正文冲突', '2026-01-02T00:00:00Z', 'author_ui');
-- ============================================================
-- 二、旧 PG:参考作品授权快照(指针型记录反例)
-- ============================================================
-- 只有指针、没有完整内容的记录:迁移不得伪装成完整内容(K 分流歧义样例)
INSERT INTO example_reference_snapshot
(id, source_work_label, storage_kind, content_hash, bytes_location, authorized_scope, captured_at)
VALUES
('refs-syn-0001', 'syn-reference-work-a', 'pointer_only',
'sha256:0000000000000000000000000000000000000000000000000000000000000000',
'synthetic://nowhere/placeholder', 'synthetic-scope', '2026-01-03T00:00:00Z');
-- ============================================================
-- 三、旧 PG:raw 运行证据(凭据已脱敏样例)
-- ============================================================
INSERT INTO example_raw
(id, task_id, attempt_id, role, model_id, request_redacted, response_redacted,
usage_json, redaction_note, created_at)
VALUES
('raw-syn-0001', 'task-syn-0001', 'att-syn-0001', 'writer', 'synthetic-model-a',
'{"messages": "[REDACTED:合成请求]", "authorization": "[REDACTED:凭据已脱敏]"}',
'{"output": "合成正文候选一。"}',
'{"input_tokens": 100, "output_tokens": 8, "cost_usd": null}',
'合成样例:演示凭据脱敏后形状', '2026-01-01T00:00:00Z');
-- ============================================================
-- 四、旧 SQLite 运行态账本(runs / events / reviews / revisions)
-- ============================================================
INSERT INTO runs (id, created_at, kind, input_json, output_text, meta_json, skill_set_hash, baseline_hash)
VALUES
('run-syn-0001', '2026-01-01T00:00:00Z', 'write_chapter',
'{"work_id": "work-syn-0001", "chapter_no": 1}', '合成输出',
'{"synthetic": true}', 'sha256:synthetic-skill-set', NULL);
INSERT INTO events (run_id, seq, kind, role, tool_name, payload_json, created_at)
VALUES
('run-syn-0001', 1, 'run_started', NULL, NULL, '{"input_hash": "sha256:synthetic-input"}', '2026-01-01T00:00:00Z'),
('run-syn-0001', 2, 'tool_read', 'writer', 'query_planning', '{"scope": "work-syn-0001"}', '2026-01-01T00:00:01Z'),
('run-syn-0001', 3, 'run_finished', NULL, NULL, '{"candidate_id": "cand-syn-0001"}', '2026-01-01T00:00:02Z');
INSERT INTO reviews (run_id, target, action, reviewer, reason, created_at)
VALUES
('run-syn-0001', 'candidate', 'adopt', 'author-syn', '合成采纳理由', '2026-01-01T02:00:00Z');
INSERT INTO revisions (review_id, kind, before_text, after_text, created_at)
VALUES
(1, 'text', '合成修改前。', '合成修改后。', '2026-01-01T02:30:00Z');