@chenmk/superflow 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/INSTALL.en.md +32 -5
  2. package/INSTALL.md +58 -17
  3. package/README.md +121 -7
  4. package/README.zh-CN.md +92 -11
  5. package/assets/brand/superflow-banner.svg +80 -0
  6. package/assets/context-templates/business-rules.md +45 -78
  7. package/assets/context-templates/decisions.md +63 -149
  8. package/assets/context-templates/external-systems.md +64 -161
  9. package/assets/context-templates/incidents.md +40 -78
  10. package/assets/context-templates-en/business-rules.md +72 -0
  11. package/assets/context-templates-en/decisions.md +72 -0
  12. package/assets/context-templates-en/external-systems.md +78 -0
  13. package/assets/context-templates-en/incidents.md +52 -0
  14. package/assets/manifest.json +6 -4
  15. package/assets/scripts/claude-auto-backup-hook.sh +11 -6
  16. package/assets/scripts/codex-auto-backup-hook.sh +11 -6
  17. package/assets/skills/superflow-design/SKILL.md +16 -8
  18. package/assets/skills/superflow-docs/SKILL.md +17 -8
  19. package/assets/skills/superflow-pipeline/references/api-design-template.md +99 -63
  20. package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +62 -14
  21. package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +114 -67
  22. package/assets/skills/superflow-pipeline/references/quality-gate.md +104 -102
  23. package/assets/skills/superflow-pipeline/references/superpower-technical-design-template.md +45 -19
  24. package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +35 -0
  25. package/assets/skills-en/api-doc-changelog/SKILL.md +64 -151
  26. package/assets/skills-en/superflow-clarify/SKILL.md +4 -4
  27. package/assets/skills-en/superflow-clarify/agents/openai.yaml +1 -1
  28. package/assets/skills-en/superflow-design/agents/openai.yaml +1 -1
  29. package/assets/skills-en/superflow-docs/SKILL.md +27 -27
  30. package/assets/skills-en/superflow-docs/agents/openai.yaml +1 -1
  31. package/assets/skills-en/superflow-implement/SKILL.md +113 -457
  32. package/assets/skills-en/superflow-implement/agents/openai.yaml +1 -1
  33. package/assets/skills-en/superflow-pipeline/SKILL.md +167 -840
  34. package/assets/skills-en/superflow-pipeline/agents/openai.yaml +1 -1
  35. package/assets/skills-en/superflow-pipeline/references/api-design-template.md +17 -426
  36. package/assets/skills-en/superflow-pipeline/references/architecture-design-template.md +15 -114
  37. package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +36 -524
  38. package/assets/skills-en/superflow-pipeline/references/batch-split-guide.md +19 -133
  39. package/assets/skills-en/superflow-pipeline/references/document-templates.md +50 -123
  40. package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +12 -119
  41. package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +22 -1044
  42. package/assets/skills-en/superflow-pipeline/references/mock-strategy-guide.md +11 -81
  43. package/assets/skills-en/superflow-pipeline/references/openspec-format.md +17 -51
  44. package/assets/skills-en/superflow-pipeline/references/orchestration.md +17 -632
  45. package/assets/skills-en/superflow-pipeline/references/p0-baseline-template.md +10 -169
  46. package/assets/skills-en/superflow-pipeline/references/prompt-usage-template.md +29 -128
  47. package/assets/skills-en/superflow-pipeline/references/quality-gate.md +36 -299
  48. package/assets/skills-en/superflow-pipeline/references/quality-standards.md +12 -186
  49. package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +12 -154
  50. package/assets/skills-en/superflow-pipeline/references/sql-risk-review-checklist.md +19 -316
  51. package/assets/skills-en/superflow-pipeline/references/test-execution-template.md +22 -220
  52. package/assets/skills-en/superflow-pipeline/references/test-guide.md +12 -26
  53. package/assets/skills-en/superflow-pipeline/references/traceability-matrix.md +5 -103
  54. package/assets/skills-en/superflow-pipeline/references/validation-integrity.md +12 -130
  55. package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +23 -23
  56. package/assets/skills-en/superflow-pipeline/scripts/superflow-state.sh +1 -1
  57. package/assets/skills-en/superflow-pipeline/scripts/superflow-status.sh +15 -15
  58. package/assets/skills-en/superflow-table-impact-analysis/SKILL.md +3 -3
  59. package/dist/cli/index.js +61 -54
  60. package/dist/cli/index.js.map +1 -1
  61. package/dist/commands/design.js +25 -3
  62. package/dist/commands/design.js.map +1 -1
  63. package/dist/commands/doctor.js +31 -12
  64. package/dist/commands/doctor.js.map +1 -1
  65. package/dist/commands/init.js +75 -27
  66. package/dist/commands/init.js.map +1 -1
  67. package/dist/commands/scan.js +8 -4
  68. package/dist/commands/scan.js.map +1 -1
  69. package/dist/commands/uninstall.js +3 -3
  70. package/dist/commands/uninstall.js.map +1 -1
  71. package/dist/commands/update.js +8 -3
  72. package/dist/commands/update.js.map +1 -1
  73. package/dist/core/cli-help.js +98 -0
  74. package/dist/core/cli-help.js.map +1 -0
  75. package/dist/core/context.js +40 -17
  76. package/dist/core/context.js.map +1 -1
  77. package/dist/core/detect.js +58 -5
  78. package/dist/core/detect.js.map +1 -1
  79. package/dist/core/i18n.js +10 -8
  80. package/dist/core/i18n.js.map +1 -1
  81. package/dist/core/manifest.js +3 -0
  82. package/dist/core/manifest.js.map +1 -1
  83. package/dist/core/scripts.js +8 -0
  84. package/dist/core/scripts.js.map +1 -1
  85. package/dist/core/skills.js +6 -0
  86. package/dist/core/skills.js.map +1 -1
  87. package/dist/core/state.js +12 -1
  88. package/dist/core/state.js.map +1 -1
  89. package/package.json +4 -3
@@ -1,220 +1,22 @@
1
- # 测试执行与结果记录模板
2
-
3
- 记录测试的执行环境、执行过程和结果,作为交付物的一部分。
4
-
5
- ## 文档结构
6
-
7
- ```markdown
8
- # 测试执行报告
9
-
10
- ## 1. 执行环境
11
-
12
- | 项目 | 信息 |
13
- |------|------|
14
- | 执行时间 | 2026-05-09 14:00 - 15:30 |
15
- | 执行人 | ____ |
16
- | 操作系统 | Linux / macOS / Windows |
17
- | JDK 版本 | 17 |
18
- | 数据库 | MySQL 8.0 / H2 |
19
- | Spring Profile | dev / test / cmk |
20
- | 应用端口 | 9527 |
21
- | 上下文路径 | / |
22
-
23
- ## 2. 测试范围
24
-
25
- | 层次 | 类型 | 用例数 | 自动化 |
26
- |------|------|--------|--------|
27
- | L1 | 单元测试 | __ | [自动化] |
28
- | L2 | 集成测试 | __ | [自动化] |
29
- | L3 | 接口测试 | __ | [自动化 / 需手工] |
30
- | L4 | 验收测试 | __ | [需手工] |
31
-
32
- ## 3. 执行方式
33
-
34
- ### 3.1 自动化测试执行命令
35
-
36
- ```bash
37
- # 全量单元测试 + 集成测试
38
- mvn clean test
39
-
40
- # 仅接口测试(需应用已启动)
41
- mvn test -Dtest=*IntegrationTest
42
-
43
- # 单测试类
44
- mvn test -Dtest=UserServiceTest
45
- ```
46
-
47
- ### 3.2 手工测试执行步骤
48
-
49
- 1. 启动应用:`mvn spring-boot:run -Dspring-boot.run.profiles=dev`
50
- 2. 确认健康检查:`curl http://localhost:9527/actuator/health`
51
- 3. 按 tests.md 逐个执行 curl 命令
52
- 4. 验证数据库状态
53
- 5. 检查日志无 ERROR
54
-
55
- ## 4. 测试结果汇总
56
-
57
- | 测试项 | 状态 | 通过 | 失败 | 跳过 | 备注 |
58
- |--------|------|------|------|------|------|
59
- | 单元测试 | ✅ / ❌ | __ | __ | __ | |
60
- | 集成测试 | ✅ / ❌ | __ | __ | __ | |
61
- | 接口测试 | ✅ / ❌ | __ | __ | __ | |
62
- | 回归测试 | ✅ / ❌ | __ | __ | __ | |
63
-
64
- **总体结果**: [全部通过 / 部分通过 / 未通过]
65
-
66
- ## 4.1 真实测试数据与证据
67
-
68
- | 用例 ID | 真实参数 | 参数来源 | 自动化命令 | 证据等级 | 执行证据 | 结论 |
69
- |---------|----------|----------|------------|----------|----------|------|
70
- | TC-001 | parkCode=____ | 前端请求 / 用户提供 / DB查询 / Mock | curl/Newman/pytest/RestAssured | Mock only / 测试端点 / 真实入口 | 响应 + DB + 日志 | Passed / Blocked / Partial |
71
-
72
- 缺少真实参数、token、站点/运营商归属、外部服务配置或设备环境时,不得填写
73
- `Passed`,必须标记为 `Blocked` 或 `Partial`。
74
-
75
- 涉及第三方、外部集成、支付、设备、回调、客户端或跨系统链路时,测试
76
- Controller、mock endpoint、绕过鉴权端点只能填写 `Mock only` 或 `测试端点`。
77
- 只有真实外部入口的 payload、响应、trace 日志、DB 证据闭环时,才能填写
78
- `Passed`。
79
-
80
- ## 4.2 Red-Green 证据
81
-
82
- 新功能、Bug 修复、CR/Px 联调补项都必须记录。RED 必须发生在生产代码修改前,
83
- 且失败原因必须是预期业务断言,不是环境错误、编译错误、token 缺失或测试代码错误。
84
-
85
- | 用例 ID | RED 命令 | RED 失败摘要 | RED 判定 | GREEN 命令 | GREEN 通过摘要 |
86
- |---------|----------|---------------|----------|------------|----------------|
87
- | TC-001 | curl/test 命令 | 预期业务断言失败 | 正确失败/环境失败/阻塞 | 同一命令 | 响应/DB/日志均通过 |
88
-
89
- ## 4.3 接口自动化证据
90
-
91
- 涉及接口、CRUD、Mapper/XML、数据库字段、配置驱动、MQ、定时任务、设备、支付、
92
- 退款、小程序或第三方链路时必须填写:
93
-
94
- | 用例 ID | Base URL | Token/Cookie 获取 | 请求命令 | 请求数据来源 | 响应断言 | DB SELECT | 日志关键词 | 结论 |
95
- |---------|----------|-------------------|----------|--------------|----------|-----------|------------|------|
96
- | TC-001 | http://localhost:____ | /captcha/image + /login | curl ... | tests.md / DB / 用户提供 | code/data/业务字段 | SELECT ... | traceId/业务日志 | Passed/Blocked/Partial |
97
-
98
- HTTP 200、字段非空、mock-only、DB-only、`BUILD SUCCESS`、`Tests are skipped`
99
- 都不能单独作为接口通过证据。
100
-
101
- ## 5. 详细结果
102
-
103
- ### 5.1 通过的测试
104
-
105
- | 用例 ID | 用例名称 | 执行时间 | 验证方式 |
106
- |---------|----------|----------|----------|
107
- | TC-001 | 用户注册成功 | 2s | 接口返回 + 数据库查询 |
108
-
109
- ### 5.2 失败的测试
110
-
111
- | 用例 ID | 用例名称 | 失败原因 | 处理措施 | 状态 |
112
- |---------|----------|----------|----------|------|
113
- | TC-005 | 并发下单 | 竞态条件导致超卖 | 增加分布式锁 | 已修复 ✅ |
114
-
115
- ### 5.3 阻塞的测试
116
-
117
- | 用例 ID | 用例名称 | 阻塞原因 | 预计解决 |
118
- |---------|----------|----------|----------|
119
- | TC-010 | 设备回调 | 无真实设备 | Mock 验证替代 |
120
-
121
- ## 6. 问题与风险
122
-
123
- | 问题 | 影响 | 应对方案 |
124
- |------|------|----------|
125
- | ____ | ____ | ____ |
126
-
127
- ## 7. 数据库结构核查
128
-
129
- | 表名 | 核查命令 | 预期结构 | 实际结构 | 结论 |
130
- |------|----------|----------|----------|------|
131
- | {table_name} | `SHOW CREATE TABLE {table_name}` | {字段/索引/默认值} | {实际输出摘要} | 一致/不一致 |
132
- | {table_name} | `SELECT COUNT(*) FROM {table_name} WHERE {condition}` | N 条 | 实际 M 条 | 一致/不一致 |
133
-
134
- ## 8. 汇总 SQL 执行记录
135
-
136
- | SQL 文件路径 | 执行的脚本(行号范围或注释标记) | 执行结果 | 复查确认 |
137
- |--------------|--------------------------------|----------|----------|
138
- | `openspec/changes/{change-id}/sql/{文件名}` | 第 XX-XX 行(如 "-- P16 业务字段补齐") | 成功/失败 | SHOW CREATE TABLE 确认 |
139
-
140
- ## 8.1 跨仓数据合同对账
141
-
142
- 多仓共享表、复制 PO/Entity/Mapper、MyBatis-Plus BaseMapper 或字段迁移时必须填写:
143
-
144
- | 表 | 真源结构 | 消费仓 | 实体/Mapper/SQL 字段 | 实际库字段 | 处理结论 | 验证证据 |
145
- |----|----------|--------|----------------------|------------|----------|----------|
146
- | c_xxx | 版本总 SQL + SHOW CREATE TABLE | service-a | field_a, field_b | 一致/缺失 | 通过/阻塞/已修复 | 命令、文件、行号 |
147
-
148
- 如果任一消费仓映射或查询不存在列,结论必须是 `阻塞`,不得通过给测试库补废弃字段绕过。
149
-
150
- ## 9. 结论
151
-
152
- [是否达到交付标准,是否可以进入下一阶段]
153
- ```
154
-
155
- ## 任务完成 Checklist(全部满足才能标记完成)
156
-
157
- 以下 checklist 用于判定一个实现任务是否真正完成。每完成一项勾选一项,**全部勾选后才能标记任务完成**。
158
-
159
- ### 开发阶段(Worker 执行)
160
- - [ ] 已从 tests.md 提取本批次用例 ID、自动化命令和断言
161
- - [ ] 已在生产代码修改前执行 RED 命令
162
- - [ ] RED 失败原因是预期业务断言,非环境/编译/token/测试代码错误
163
- - [ ] RED 失败证据已回填 test-report
164
- - [ ] 代码已修改(git diff 确认修改了正确的文件)
165
- - [ ] 代码自审通过(无 CRITICAL/HIGH 问题,检查空指针/异常/事务/日志)
166
- - [ ] 编译通过(`mvn clean compile -DskipTests` BUILD SUCCESS)
167
- - [ ] 已执行同一命令确认 GREEN,并回填通过证据
168
- - [ ] 旧进程已停止(`pkill` + 端口确认无占用)
169
- - [ ] 应用已重新启动(`mvn spring-boot:run` 或 `./gradlew bootRun`)
170
- - [ ] 进程已验证(PID 存在、启动时间接近当前时间、端口绑定正确)
171
- - [ ] 健康检查通过(`curl /actuator/health` 返回 UP)
172
- - [ ] 日志确认是本次启动(时间戳匹配当前时间)
173
-
174
- ### 接口测试阶段(Worker 逐项执行)
175
- - [ ] Token 已获取(完整的 `/captcha/image` + `/login` 流程,token 非空)
176
- - [ ] L3 接口用例已逐项执行(来自 tests.md 的每个 [自动化] 用例)
177
- - [ ] 每个用例的 curl 命令已记录
178
- - [ ] 每个用例的请求数据来源已记录
179
- - [ ] 每个用例的响应已记录
180
- - [ ] 每个用例的响应断言、DB 断言、日志断言已验证(通过/失败)
181
-
182
- ### 数据库验证阶段(Worker 执行)
183
- - [ ] 已执行 `SHOW CREATE TABLE` 确认表结构
184
- - [ ] 已执行 `SELECT` 查询确认数据状态与预期一致
185
- - [ ] 数据库验证结果已记录
186
-
187
- ### 日志检查阶段(Worker 执行)
188
- - [ ] 已执行 `grep ERROR` 检查应用日志
189
- - [ ] 无 ERROR(除已知无关错误外)
190
- - [ ] 关键日志已出现(如设计要求的特定标记)
191
-
192
- ### 报告阶段(Worker 执行)
193
- - [ ] `embedded-changes/pXX-xxx/test-report.md` 已更新
194
- - [ ] 包含:RED/GREEN 命令和输出、curl 命令、响应摘要、数据库查询结果、日志检查结果
195
- - [ ] 包含:`Tests run:` 真实输出
196
- - [ ] 包含:进程验证证据(PID、启动时间、端口)
197
-
198
- ### 独立验证阶段(Tester 执行)
199
- - [ ] Tester 独立执行全部用例(不参考 Worker 报告)
200
- - [ ] Tester 客观报告通过/失败
201
-
202
- ### Leader 验证阶段(Leader 执行)
203
- - [ ] Leader 抽查至少 30% 关键用例
204
- - [ ] Leader 确认进程是新启动的
205
- - [ ] Leader 确认接口有真实调用证据
206
-
207
- **以上 checklist 全部勾选后,才能标记任务完成。**
208
-
209
- ## 质量红线
210
-
211
- - 不允许不执行测试直接填写"通过"
212
- - 不允许先写生产代码再补 RED;未观察 RED 的用例不得 Passed
213
- - 不允许修改测试断言让失败变为通过
214
- - 不允许隐瞒失败测试,必须记录并说明原因
215
- - 不允许只用 HTTP 200、字段非空、DB-only、BUILD SUCCESS 或 skipped tests 证明业务通过
216
- - 不允许用占位参数或 mock-only 证据证明真实前端/外部系统链路已通过
217
- - 不允许用测试 Controller、mock endpoint、绕过鉴权端点证明真实外部入口已通过
218
- - 不允许把泛化外部失败当作通过,除非需求明确要求该失败结果
219
- - 不允许只检查主仓数据库结构就关闭跨仓共享表任务;必须覆盖全部消费仓实体/Mapper/SQL
220
- - **不允许"编译成功 + 单元测试通过"就标记任务完成,必须完成上述 checklist 全部项**
1
+ # Test Execution Template
2
+
3
+ ## Test Case
4
+
5
+ - ID:
6
+ - Level: L0 unit, L1 component, L2 integration, L3 API, L4 real-entry
7
+ - Preconditions:
8
+ - Command:
9
+ - RED expected failure:
10
+ - GREEN expected pass:
11
+ - Response assertion:
12
+ - DB assertion:
13
+ - Log assertion:
14
+ - Evidence location:
15
+
16
+ ## Report Entry
17
+
18
+ - Environment:
19
+ - Command executed:
20
+ - Result:
21
+ - Evidence:
22
+ - Blocker if not executed:
@@ -1,30 +1,16 @@
1
- # 测试失败修复指南
1
+ # Test Guide
2
2
 
3
- ## 失败类型与修复方向
3
+ ## Levels
4
4
 
5
- | 失败现象 | 可能原因 | 修复方向 |
6
- |---|---|---|
7
- | 应用启动失败 | 配置文件错误 / 端口冲突 / Bean 初始化失败 | 检查 `application.yml`,确认端口未被占用,检查 Bean 依赖注入 |
8
- | 接口返回 404 | URL 路径错误 / 上下文路径未拼接 / 接口未注册 | 核对 Controller 的 `@RequestMapping` 路径,确认 context-path 已拼接 |
9
- | 接口返回 500 | 空指针 / SQL 异常 / 事务回滚 | 查看日志栈追踪,定位具体异常行号,检查入参是否为空 |
10
- | 数据库断言失败 | SQL 未生效 / 事务未提交 / 缓存未更新 | 确认方法上有 `@Transactional`,检查 `updateByPrimaryKeySelective` 返回值 |
11
- | 日志断言失败 | 日志级别过滤 / 异步日志未刷新 | 检查 `logback.xml` 日志级别,确认日志输出时机 |
12
- | 并发测试失败 | 竞态条件 / 锁未生效 / 事务隔离级别 | 检查锁的实现(数据库锁 / 分布式锁),确认事务传播行为 |
13
- | 灯色下发验证失败 | DMS 未连接 / 异步任务未执行 | 确认 DMS 服务可用,检查 `@Async` 线程池配置 |
14
- | Excel 导出验证失败 | 文件格式错误 / 字段映射错误 | 检查 EasyExcel 或 POI 配置,确认字段注解正确 |
5
+ - L0: unit test.
6
+ - L1: component test.
7
+ - L2: integration with real infrastructure such as Testcontainers.
8
+ - L3: API or message contract test with executable command.
9
+ - L4: real external entry such as callback, device, scheduler, client, or
10
+ third-party sandbox.
15
11
 
16
- ## 修复流程
12
+ ## Rule
17
13
 
18
- 1. **复现问题**:根据测试用例的前置条件和执行步骤,手动复现失败场景
19
- 2. **查看日志**:启动应用时添加 `--debug` 或检查 `logs/` 目录下的日志文件
20
- 3. **定位代码**:根据日志中的异常栈追踪,找到具体的源码位置(类名 + 方法名 + 行号)
21
- 4. **分析根因**:对照 design.md 中的设计方案,确认实现是否与设计一致
22
- 5. **修改代码**:修复 bug,确保不引入新的问题(回归测试)
23
- 6. **重新测试**:重新执行失败的测试用例,确认修复成功
24
- 7. **更新文档**:如果修复涉及设计变更,同步更新 design.md 和 tasks.md
25
-
26
- ## 质量红线
27
-
28
- - 不允许跳过失败的测试用例直接提交代码
29
- - 不允许修改测试用例的断言标准来"让测试通过"
30
- - 不允许在没有测试覆盖的情况下修改核心逻辑
14
+ When tests.md requires L3/L4, test-report.md must include real command,
15
+ response, DB/log assertion, and final state evidence. Unit tests alone do not
16
+ close the requirement.
@@ -1,106 +1,8 @@
1
- # 可追溯性矩阵
2
-
3
- ## 目的
4
-
5
- 确保从需求到设计到实现到测试的完整可追溯,避免"设计漂移"和"实现遗漏"。
6
-
7
- ---
8
-
9
- ## 矩阵结构
10
-
11
- ```markdown
12
1
  # Traceability Matrix
13
2
 
14
- ## 需求层(spec.md)
15
-
16
- | Req ID | Requirement | Scenario | 对应 Design | 对应 Task | 对应 Test | 对应 Prompt |
17
- |--------|-------------|----------|-------------|-----------|-----------|-------------|
18
- | R1 | 主数据支持多种业务类型 | S1.1 | design.md ## 主数据 | Task 1.1 | tests.md T1 | P1 |
19
- | R2 | 业务创建时校验用户资格或资源充足 | S2.1 | design.md ## 创建校验 | Task 2.1 | tests.md T2 | P2 |
20
- | ... | ... | ... | ... | ... | ... | ... |
21
-
22
- ## 设计层(design.md)
23
-
24
- | Design 章节 | 涉及文件 | 涉及方法 | 对应 Task | 对应 Prompt |
25
- |-------------|----------|----------|-----------|-------------|
26
- | ## 主数据 | BusinessRecord.java | - | Task 1.1 | P1 |
27
- | ## 开通校验 | OrderService.java | validateBalance() | Task 2.1 | P2 |
28
- | ... | ... | ... | ... | ... |
29
-
30
- ## 任务层(tasks.md)
31
-
32
- | Task ID | 文件 | 方法 | 对应 Design | 对应 Prompt | 状态 |
33
- |---------|------|------|-------------|-------------|------|
34
- | Task 1.1 | BusinessRecordMapper.xml | insert | design.md ## 主数据 | P1 | 待执行 |
35
- | ... | ... | ... | ... | ... | ... |
36
-
37
- ## Prompt 层(prompt/*.md)
38
-
39
- | Prompt | 覆盖 Task | 覆盖 Design | 依赖 Prompt | 状态 |
40
- |--------|-----------|-------------|-------------|------|
41
- | P0 | - | - | 无 | 待执行 |
42
- | P1 | Task 1.1-1.5 | design.md ## 数据模型 | P0 | 待执行 |
43
- | ... | ... | ... | ... | ... |
44
- ```
45
-
46
- ---
47
-
48
- ## 一致性检查规则
49
-
50
- ### 规则 1:设计漂移检查
51
-
52
- **定义**:prompt 中出现了 design.md / api.md / database-contract.md 没有定义的新方案。
53
-
54
- **检查方法**:
55
- 1. 读取每份 prompt 的"精确实现步骤"
56
- 2. 检查每个步骤是否能在 design.md 中找到对应章节
57
- 3. 检查 prompt 中提到的字段、接口、MQ topic 是否在设计文档中有定义
58
-
59
- **标记方式**:
60
- ```
61
- ⚠️ 设计漂移:prompt/p2-charge-order.md 步骤 3 提到"使用乐观锁防止并发下单",
62
- 但 design.md ## 下单流程 中未提及乐观锁策略。
63
- 处理方式:上报 Leader 确认 / 按设计文档原方案实现
64
- ```
65
-
66
- ### 规则 2:实现遗漏检查
67
-
68
- **定义**:design.md 有章节,但没有对应的 prompt 覆盖。
69
-
70
- **检查方法**:
71
- 1. 遍历 design.md 的所有章节
72
- 2. 检查每个章节是否被至少一份 prompt 覆盖
73
- 3. 检查 api.md 中的每个接口是否被至少一份 prompt 覆盖
74
-
75
- **标记方式**:
76
- ```
77
- ⚠️ 实现遗漏风险:design.md ## 订单快照 描述了快照表结构和写入时机,
78
- 但没有 prompt 覆盖该功能(P1-P4 均未提及)。
79
- 处理方式:补充 P2 或新增 Pn 覆盖
80
- ```
81
-
82
- ### 规则 3:测试覆盖检查
83
-
84
- **定义**:tests.md 中的用例与 prompt 的测试要求不一致。
85
-
86
- **检查方法**:
87
- 1. 检查每份 prompt 的"测试要求"是否覆盖了 tests.md 中对应章节的全部用例
88
- 2. 检查 prompt 中"未执行测试及原因"是否合理
89
-
90
- **标记方式**:
91
- ```
92
- ⚠️ 测试覆盖不足:tests.md T3.2(边界:资源刚好等于业务阈值)
93
- 在 prompt/p2-charge-order.md 中未提及。
94
- 处理方式:补充到 P2 测试要求中
95
- ```
96
-
97
- ---
98
-
99
- ## 自动化检查建议
100
-
101
- 在生成所有 prompt 后,执行以下检查:
3
+ | Requirement | Scenario | API/Message | Design Section | Task | Test Case | Prompt | Report Evidence | Status |
4
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- |
5
+ | R-001 | S-001 | api.md#... | design.md#... | tasks.md#... | tests.md#... | prompt/... | test-report.md#... | Pending |
102
6
 
103
- 1. **生成矩阵**:从 spec.md、design.md、tasks.md、tests.md、prompt/*.md 中提取对应关系
104
- 2. **扫描漂移**:对比 prompt 内容与设计文档,标记未定义的方案
105
- 3. **扫描遗漏**:对比设计文档与 prompt 覆盖范围,标记未覆盖的章节
106
- 4. **输出报告**:列出所有漂移和遗漏项,供人工确认
7
+ Every implementation prompt must be traceable back to a requirement and forward
8
+ to report evidence.
@@ -1,134 +1,16 @@
1
- # 验收证据完整性门禁
1
+ # Validation Integrity
2
2
 
3
- Use this reference whenever SDD docs, implementation prompts, or test reports
4
- claim that an API, integration flow, external dependency, dropdown, enum, or
5
- frontend payload has been tested.
3
+ ## Anti-Fake-Delivery Rules
6
4
 
7
- ## Hard Gates
5
+ - Do not write pass when a command was not executed.
6
+ - Do not replace real-entry evidence with mock evidence.
7
+ - Do not hide skipped tests inside a success summary.
8
+ - Do not claim app verification from an old process.
9
+ - Do not claim DB verification without SELECT, SHOW CREATE, or equivalent proof.
10
+ - Do not claim log verification without checking current logs.
8
11
 
9
- - Do not mark L3/L4 tests as passed without real evidence.
10
- - Do not mark any Maven or Gradle test evidence as passed when the output says
11
- `Tests are skipped` / `测试被跳过`. `BUILD SUCCESS` only proves the build
12
- finished; it does not prove tests ran.
13
- - Do not collapse multiple Maven commands into one test count. Each command
14
- must have its own `Tests run` summary. If a wildcard such as
15
- `-Dtest='*P47*'` does not match a needed test class, record and execute a
16
- separate command for that class.
17
- - Do not keep deleted methods, removed classes, or old algorithms in current
18
- evidence tables. Old anchors may be mentioned only as explicitly deleted or
19
- historical context.
20
- - Do not treat a generic fallback error as success unless the requirement
21
- explicitly defines that fallback as the expected business result.
22
- - Do not use placeholder values such as `TEST_PARK_001` to prove frontend or
23
- production-like integration unless the source of that value is documented.
24
- - Do not let mock-only evidence close a case that requires real frontend data,
25
- real database state, real operator/site/park codes, real token, or an external
26
- SDK/service call.
27
- - Do not let a test controller, mock endpoint, bypass-auth endpoint, or direct
28
- service-call endpoint close a case that requires a real external entry.
29
- - Do not treat one repository's schema verification as complete when sibling
30
- services copy the same PO/Mapper or read the same table.
31
- - If required test data is missing, mark the case `Blocked: missing test data`
32
- and ask for or discover the data before claiming completion.
12
+ ## Allowed Outcomes
33
13
 
34
- ## tests.md Requirements
35
-
36
- For every L3/L4 or frontend integration case, include these columns or equivalent
37
- fields:
38
-
39
- | Field | Required content |
40
- |---|---|
41
- | 用例 ID | Stable test id, referenced from spec/tasks/prompt |
42
- | 接口/流程 | Full URL or user workflow |
43
- | 数据来源 | User-provided, frontend captured payload, DB query, seeded fixture, or mock |
44
- | 关键参数 | Real values such as parkCode/operatorId/plotId/templateId; no unexplained placeholders |
45
- | 预期断言 | Response, DB, log, and external-call assertions |
46
- | 证据要求 | curl/request/response/DB/log/external response required in test-report.md |
47
- | 证据等级 | Mock only / Test endpoint / Real external entry |
48
-
49
- For dropdowns, enums, external SDK calls, device callbacks, payment/refund,
50
- invoice, export, import, and cross-system flows, add at least one real-data case
51
- or explicitly mark the case blocked.
52
-
53
- ## test-report.md Requirements
54
-
55
- Every passed L3/L4 case must include:
56
-
57
- - test id and requirement/spec reference
58
- - environment, profile, port, context path, branch, and commit
59
- - exact command or curl
60
- - real request parameters and where they came from
61
- - raw or summarized response
62
- - assertion result
63
- - database evidence when state changes or persistence matters
64
- - relevant logs
65
- - external SDK/service request and response when external dependencies matter
66
- - evidence level: `Mock only`, `Test endpoint`, `Partial real entry`, or
67
- `Real integration passed`
68
- - for cross-repository database contracts: source schema, each consumer
69
- repository, entity/Mapper/SQL fields, real database columns, and conclusion
70
- - exact command-to-result mapping for every automated test command. If the same
71
- command appears with different `Tests run` values, the report is not
72
- acceptable until reconciled.
73
- - for sibling repositories whose build config skips tests by default, record the
74
- direct command result (`Tests are skipped` if applicable), the temporary
75
- change or profile that makes tests run, the real `Tests run` output, and the
76
- clean git status after rollback.
77
-
78
- If any of those are absent, status must be `Not executed`, `Blocked`, or
79
- `Partially verified`, not `Passed`.
80
-
81
- Before delivery, run:
82
-
83
- ```bash
84
- ~/.codex/hooks/superflow-test-report-lint.py <embedded test-report.md>
85
- ```
86
-
87
- For root aggregate reports, run the same script with `--warn-only` and review
88
- all warnings before signing off.
89
-
90
- ## Cross-Repository Schema Rule
91
-
92
- When a table is shared across repositories or a service copies another
93
- service's PO/Entity/Mapper:
94
-
95
- - identify the source-of-truth schema: version SQL, database contract, and
96
- `SHOW CREATE TABLE`
97
- - list every consuming repository and runtime path, including interconnect,
98
- callback, scheduled job, import/export, and test endpoint paths
99
- - compare MyBatis-Plus `@TableName` entity fields, `BaseMapper` default
100
- selection, Mapper XML/resultMap, and handwritten SQL against real database
101
- columns
102
- - fields removed from the final schema must be removed from mapped entities or
103
- marked `@TableField(exist = false)`
104
- - if code still queries a removed column, the fix is code/schema contract
105
- alignment, not adding obsolete columns back to test database
106
-
107
- The case is blocked if any consumer repository maps or queries a non-existent
108
- column.
109
-
110
- ## Red-Green Rule
111
-
112
- For bug fixes and CR/Px follow-ups:
113
-
114
- 1. Record the red evidence first: the exact failing test, curl, or workflow
115
- before the fix, including the error response/log/DB mismatch.
116
- 2. Apply the fix.
117
- 3. Run the same evidence path again and record the green result.
118
-
119
- For new features where no old failing path exists, use a negative control:
120
-
121
- - one invalid or unauthorized case fails with the expected error
122
- - one real happy-path case passes with response and DB/log evidence
123
-
124
- ## External Dependency Rule
125
-
126
- When an external service is unavailable:
127
-
128
- - record the external request parameters, endpoint/config source, exception type,
129
- external code/message if available, and whether the failure is environmental or
130
- code-related
131
- - do not mark the business case passed unless the requirement only promises a
132
- stable error under external failure
133
- - keep the delivery conclusion explicit: `Blocked by external dependency`,
134
- `Code path verified with mock`, or `Real integration passed`
14
+ - Passed: evidence exists and matches tests.md.
15
+ - Partially verified: some evidence exists, and gaps are explicit.
16
+ - Blocked: external dependency or environment prevents execution, with reason.
@@ -244,13 +244,13 @@ require_hash_recorded() {
244
244
 
245
245
  change_has_field_status_risk() {
246
246
  grep -RIEiq \
247
- '字段值|状态|枚举|online|offline|上线|下线|删除|恢复|同步标记|sync marker|payment|refund|支付|退款|第三方状态|running_status|offline_time' \
247
+ 'field value|status|enum|online|offline|delete|restore|sync marker|payment|refund|third-party state|running_status|offline_time' \
248
248
  "$CHANGE_DIR"/*.md "$CHANGE_DIR"/**/*.md 2>/dev/null
249
249
  }
250
250
 
251
251
  change_has_architecture_boundary_risk() {
252
252
  grep -RIEiq \
253
- '跨仓|跨服务|sibling|SDK|MQ|topic|consumer|scheduler|定时|device|设备|callback|回调|third[- ]party|第三方|mini[- ]program|小程序|gateway|网关|adapter|适配|protocol|协议|interconnect|互联互通|调用链|入口|出口' \
253
+ 'cross-repo|cross-service|sibling|SDK|MQ|topic|consumer|scheduler|scheduled|device|callback|third[- ]party|mini[- ]program|gateway|adapter|protocol|interconnect|call chain|entry|exit' \
254
254
  "$CHANGE_DIR"/*.md "$CHANGE_DIR"/**/*.md 2>/dev/null
255
255
  }
256
256
 
@@ -304,12 +304,12 @@ case "$PHASE" in
304
304
  require_handoff_current
305
305
  require_beta_handoff_structure
306
306
  require_hash_recorded
307
- require_grep 'Superpowers Technical Design Handoff|Superpower 技术详设|technical_design|源码级 HOW' design.md "Superpowers technical design handoff"
308
- require_grep 'OpenSpec/SDD|WHAT|合同|API|DB|tests|验收' design.md "OpenSpec/SDD contract boundary"
309
- require_grep '文档完整性|完整文档|proposal.md|api.md|design.md|tasks.md|tests.md' sdd-quality-gate.md "document completeness gate"
310
- require_grep 'RED|红绿|GREEN' tests.md "RED/GREEN test contract"
311
- require_grep 'curl|Postman|Newman|pytest|RestAssured|自动化命令' tests.md "interface automation command"
312
- require_grep 'handoff_hash|sdd-context|上下文包|防漂移' sdd-quality-gate.md "handoff/context-drift gate"
307
+ require_grep 'Superpowers Technical Design Handoff|Superpowers Technical Design|technical_design|source-level HOW' design.md "Superpowers technical design handoff"
308
+ require_grep 'OpenSpec/SDD|WHAT|contract|API|DB|tests|acceptance' design.md "OpenSpec/SDD contract boundary"
309
+ require_grep 'document completeness|complete documents|proposal.md|api.md|design.md|tasks.md|tests.md' sdd-quality-gate.md "document completeness gate"
310
+ require_grep 'RED|red-green|GREEN' tests.md "RED/GREEN test contract"
311
+ require_grep 'curl|Postman|Newman|pytest|RestAssured|automation command' tests.md "interface automation command"
312
+ require_grep 'handoff_hash|sdd-context|context package|anti-drift' sdd-quality-gate.md "handoff/context-drift gate"
313
313
  require_markdown_links_valid
314
314
  transition_event="docs-complete"
315
315
  ;;
@@ -334,18 +334,18 @@ case "$PHASE" in
334
334
  require_optional_state_path technical_design "technical_design"
335
335
  technical_design_rel="$(state_get technical_design)"
336
336
  if [[ -n "${technical_design_rel:-}" && "$technical_design_rel" != "null" ]]; then
337
- require_grep 'Superpowers Technical Design|Superpower 技术详设|Technical Design|源码级 HOW' "$technical_design_rel" "Superpowers technical design"
338
- require_grep 'OpenSpec/SDD|canonical|事实源|不得覆盖|不能覆盖' "$technical_design_rel" "technical design canonical boundary"
337
+ require_grep 'Superpowers Technical Design|Superpowers Technical Design|Technical Design|source-level HOW' "$technical_design_rel" "Superpowers technical design"
338
+ require_grep 'OpenSpec/SDD|canonical|source of truth|must not override|must not override' "$technical_design_rel" "technical design canonical boundary"
339
339
  if change_has_architecture_boundary_risk; then
340
- require_grep 'Architecture Boundary And Call Direction|架构边界与调用方向|模块职责.*调用方向|owner.*入口.*出口|禁止绕路' "$technical_design_rel" "architecture boundary and call direction matrix"
340
+ require_grep 'Architecture Boundary And Call Direction|Architecture Boundary And Call Direction|module responsibility.*call direction|owner.*entry.*exit|no bypass' "$technical_design_rel" "architecture boundary and call direction matrix"
341
341
  fi
342
342
  if change_has_field_status_risk; then
343
- require_grep 'Field And Status Reverse Impact|字段/状态反向影响面|写入点.*读取|读取/过滤点|派生/同步点' "$technical_design_rel" "field/status reverse impact matrix"
343
+ require_grep 'Field And Status Reverse Impact|Field And Status Reverse Impact|write point.*read|read/filter points|derived/sync points' "$technical_design_rel" "field/status reverse impact matrix"
344
344
  fi
345
345
  fi
346
346
  fi
347
- require_grep 'Superpowers Technical Design Handoff|Superpower 技术详设|technical_design|源码级 HOW' design.md "Superpowers technical design handoff"
348
- require_grep 'technical_design|Superpowers 技术详设|源码级 HOW' sdd-quality-gate.md "technical design quality gate"
347
+ require_grep 'Superpowers Technical Design Handoff|Superpowers Technical Design|technical_design|source-level HOW' design.md "Superpowers technical design handoff"
348
+ require_grep 'technical_design|Superpowers Technical Design|source-level HOW' sdd-quality-gate.md "technical design quality gate"
349
349
  require_markdown_links_valid
350
350
  transition_event="design-complete"
351
351
  ;;
@@ -357,18 +357,18 @@ case "$PHASE" in
357
357
  require_hash_recorded
358
358
  require_any_prompt
359
359
  require_prompt_set
360
- require_grep 'OpenSpec/SDD|设计事实源|canonical|事实源' design.md "canonical source boundary"
360
+ require_grep 'OpenSpec/SDD|canonical design source|canonical|source of truth' design.md "canonical source boundary"
361
361
  prompt_rel="$(first_prompt_rel)"
362
362
  if [[ -n "${prompt_rel:-}" ]]; then
363
- require_grep 'Superpower 技术详设继承|Superpower 执行策略继承|technical_design|源码级 HOW' "$prompt_rel" "prompt Superpower strategy inheritance"
363
+ require_grep 'Superpowers Technical Design inheritance|Superpowers execution strategy inheritance|technical_design|source-level HOW' "$prompt_rel" "prompt Superpower strategy inheritance"
364
364
  technical_design_rel="$(state_get technical_design)"
365
365
  if [[ -n "${technical_design_rel:-}" && "$technical_design_rel" != "null" ]]; then
366
- require_grep 'Superpower 技术详设继承|technical_design|源码级 HOW|Technical Design' "$prompt_rel" "prompt Superpowers technical design inheritance"
366
+ require_grep 'Superpowers Technical Design inheritance|technical_design|source-level HOW|Technical Design' "$prompt_rel" "prompt Superpowers technical design inheritance"
367
367
  if change_has_field_status_risk; then
368
- require_grep '字段/状态反向影响面|Field And Status Reverse Impact|读取/过滤点|派生/同步点' "$prompt_rel" "prompt field/status reverse impact inheritance"
368
+ require_grep 'Field And Status Reverse Impact|Field And Status Reverse Impact|read/filter points|derived/sync points' "$prompt_rel" "prompt field/status reverse impact inheritance"
369
369
  fi
370
370
  fi
371
- require_grep '上下文防漂移|handoff_hash|sdd-context' "$prompt_rel" "prompt context drift inheritance"
371
+ require_grep 'context anti-drift|handoff_hash|sdd-context' "$prompt_rel" "prompt context drift inheritance"
372
372
  fi
373
373
  require_state_value build_mode "build_mode"
374
374
  require_state_value isolation "isolation"
@@ -387,10 +387,10 @@ case "$PHASE" in
387
387
  verify)
388
388
  require_state_file
389
389
  require_file test-report.md
390
- require_grep 'RED|失败证据' test-report.md "RED evidence"
391
- require_grep 'GREEN|通过证据' test-report.md "GREEN evidence"
392
- require_grep '接口自动化|curl|Postman|Newman|pytest|RestAssured' test-report.md "interface automation evidence"
393
- require_grep 'DB|数据库|SELECT|SHOW CREATE' test-report.md "DB evidence"
390
+ require_grep 'RED|failure evidence' test-report.md "RED evidence"
391
+ require_grep 'GREEN|pass evidence' test-report.md "GREEN evidence"
392
+ require_grep 'interface automation|curl|Postman|Newman|pytest|RestAssured' test-report.md "interface automation evidence"
393
+ require_grep 'DB|database|SELECT|SHOW CREATE' test-report.md "DB evidence"
394
394
  require_grep 'superflow-verify-integration|superflow-delivery-check|superflow-test-report-lint' test-report.md "SuperBridge Flow hook/script evidence"
395
395
  require_test_report_lint
396
396
  require_markdown_links_valid
@@ -494,7 +494,7 @@ cmd_scale() {
494
494
  changed_files="$(git -C "$CHANGE_DIR" diff --name-only HEAD 2>/dev/null | wc -l | tr -d ' ')"
495
495
  fi
496
496
 
497
- risk_hits="$(grep -REi 'api|接口|curl|SQL|数据库|Mapper|XML|跨仓|状态字段|枚举|真实入口|payment|refund|MQ|定时任务|第三方|SDK' "$CHANGE_DIR"/*.md "$CHANGE_DIR"/**/*.md 2>/dev/null | wc -l | tr -d ' ')"
497
+ risk_hits="$(grep -REi 'api|api|curl|SQL|database|Mapper|XML|cross-repo|status field|enum|real entry|payment|refund|MQ|scheduled job|third party|SDK' "$CHANGE_DIR"/*.md "$CHANGE_DIR"/**/*.md 2>/dev/null | wc -l | tr -d ' ')"
498
498
 
499
499
  mode="light"
500
500
  if [[ "$task_count" -gt 3 || "$capability_count" -gt 1 || "$changed_files" -gt 4 || "$risk_hits" -gt 0 ]]; then