Files
unknownandCursor 21cc721fcc feat(queries): 完成 M04 查询定义与版本激活
交付不可变查询版本、保存即生效与激活(D26),并带控制台列表筛选排序与试跑预览;补 RLS 下 current_version_no 回填迁移。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 18:32:24 +08:00

79 lines
2.1 KiB
Markdown
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.
# Task Context Pack
## Task Goal
M04:受控查询草稿、不可变版本、只读预览与控制台(A-016~A-020;D24)。
## Current Slice Or Group
分析完成;用户已确认计划并要求执行全部切片。下一编码切片:**S1**。
## Requirement Source
`.task/2026-11-18/m04-queries/requirement.md`
## Implementation Source
`.task/2026-11-18/m04-queries/implementation-plan.md`
## Involved Modules Or Knowledge Areas
- 查询定义/版本;只读执行;M03 数据源 usable/熔断
- 控制台查询 UI(S5)
## Loaded Rules
- `AGENTS.md`;sy-standards(API 信封、错误、权限点、前端、红线、注释)
- Marionettist autonomous;原型确认停点;`risk_score>=4` 片际停
## Loaded Docs
- `docs/tasks/INDEX.md` M04;交接稿 A-02;`docs/decisions.md`;`docs/current/frontend-ui.md`
- M03 `assert_usable`/datasources API
## Allowed Modification Scope
按当前切片:见 implementation-plan 各 Slice Allowed Modification Scope。
## Forbidden Modification Scope
- 秘密入库/入日志;映射/报警/企微/场景正式采集;生产破坏性操作
- S4 确认前改 Vue 查询页
## Key Existing Entrypoints
- `services/watchman/src/watchman/services/datasources.py`:`assert_usable`、`list_references`、失败记账
- `services/watchman/src/watchman/api/routes/datasources.py`
- `services/watchman/src/watchman/auth/access.py`
- `web/apps/console/src/datasources/`(UI 模式参考)
- `.task/2026-11-17/m03-datasource/prototype/`(原型模式参考)
## Gate Policy
- selected / effective: autonomous
- finalApprovalRequired: true
## Validation Commands
```
cd services/watchman && uv run pytest
cd services/watchman && uv run alembic upgrade head
cd web/apps/console && pnpm test:unit && pnpm test:e2e && pnpm typecheck
```
## Assumptions
- 权限点 `watchman.query.*` 仅 admin
- 预览不进报警
- 正式采集留给 M08
## Risks
- SQL 注入与任意标识符;熔断绕过;版本可变回归
## Stop Conditions
- S4→S5:原型未确认
- high-risk/boundary-sensitive/risk>=4 片审未过
- 最终验收前不标 DONE_LOCAL(除非用户明确授权)