feat(queries): 完成 M04 查询定义与版本激活

交付不可变查询版本、保存即生效与激活(D26),并带控制台列表筛选排序与试跑预览;补 RLS 下 current_version_no 回填迁移。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
unknownandCursor committed 2026-11-18 18:32:24 +08:00
1 parent 8c0335040f
commit 21cc721fcc
97 files changed
+13354 -153

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
# Task Intake Result
## Task Type
feature。Tier L(只读执行、注入防护、迁移、不可变版本、跨前后端)。
## Current Understanding
- M03 DONE_LOCAL。推进 M04:受控查询定义、参数/输出契约、只读执行、预览与配套 UI(A-016~A-020)。
- 用户确认:参数化 SQL 模板(A);不可变查询版本本轮交付(2b);正式定时/场景采集留给 M08。
- 正式 Vue 前须 HTML 原型确认(与 M03/D21 同模式)。
- 执行须经 M03 `assert_usable`/熔断记账,不得绕过。
## Gate Policy
- config/default: balanced
- allowTaskOverride: true
- recommended: balanced
- selected: autonomous
- reason or override reason: 用户在 Marionettist 入口明确选择 autonomous。
- effective: autonomous
- finalApprovalRequired: true
说明:autonomous 不取消分析→编码门禁、最终验收、`gateClass: high-risk|boundary-sensitive`、critic、显式停点、危险命令,以及 `risk_score >= 4`。HTML 原型确认为 S5 前显式停点。用户于 2026-11-18 确认计划并要求执行全部 todos,视为越过分析→编码门禁。
## Blocking Questions
已关闭:
1. 查询正文 = 参数化 SQL 模板。
2. M04 交付不可变查询版本(publish/只读历史);正式采集留给 M08。
## Non-blocking Assumptions
- 权限仅 `watchman-admin`,权限点 `watchman.query.{read,write,publish,preview}`。
- 预览不进报警/通知。
- 定义/版本 references 先空列表;数据源 references 可回填查询引用。
- 标识符白名单用于不可绑定对象名;不靠 SELECT 前缀。
## Recommended Next Step
编码 S1(模型与迁移)。
## Suggested Prompt For Next Step
按 `implementation-plan.md` Slice 1 实现 query_definitions/query_versions 与 RLS/不可变约束测试。