@xulthekl/team-flow 0.30.0 → 0.32.1

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 (101) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +3 -3
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +2 -2
  5. package/.cursor-plugin/marketplace.json +2 -2
  6. package/.cursor-plugin/plugin.json +2 -2
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +5 -4
  9. package/CHANGELOG.md +85 -0
  10. package/GEMINI.md +1 -1
  11. package/HANDOFF.md +1 -1
  12. package/INSTALL.md +1 -1
  13. package/README.md +3 -3
  14. package/agents/build-executor.md +1 -0
  15. package/agents/contract-builder.md +6 -1
  16. package/docs/README_en.md +1 -1
  17. package/docs/solutions/INDEX.md +2 -0
  18. package/docs/solutions/cross-phase/2026-08-01-no-summary.md +17 -0
  19. package/docs/solutions/cross-phase/2026-08-03-no-summary.md +17 -0
  20. package/gemini-extension.json +2 -2
  21. package/hooks/session-start +2 -2
  22. package/llms.txt +1 -1
  23. package/package.json +6 -2
  24. package/plugin.json +2 -2
  25. package/scripts/guard/checks/test-gate-exemptions.mjs +53 -0
  26. package/scripts/guard/checks/test-matrix-complete.mjs +91 -0
  27. package/scripts/guard/checks/test-matrix-ready.mjs +60 -0
  28. package/scripts/guard/checks/tests-passing.mjs +112 -24
  29. package/scripts/guard/guard.mjs +10 -2
  30. package/scripts/lib/cmd-doctor.mjs +43 -1
  31. package/scripts/lib/cmd-execution.mjs +24 -1
  32. package/scripts/lib/cmd-state.mjs +33 -5
  33. package/scripts/lib/cmd-validate.mjs +42 -0
  34. package/scripts/lib/execution-plan.mjs +23 -0
  35. package/scripts/lib/hash.mjs +11 -0
  36. package/scripts/lib/state-loader.mjs +26 -1
  37. package/scripts/lib/test-matrix-export.mjs +231 -0
  38. package/scripts/lib/test-merge.mjs +540 -0
  39. package/scripts/lib/test-record.mjs +212 -0
  40. package/scripts/team-flow.mjs +9 -0
  41. package/skills/build-executor/implementer-prompt.md +38 -3
  42. package/skills/code-reviewer/SKILL.md +28 -1
  43. package/skills/code-reviewer/code-reviewer-prompt.md +10 -0
  44. package/skills/contract-builder/SKILL.md +75 -0
  45. package/skills/release-archivist/SKILL.md +50 -10
  46. package/skills/session-handoff/SKILL.md +1 -0
  47. package/skills/spec-writer/SKILL.md +3 -1
  48. package/skills/test-strategy/SKILL.md +70 -0
  49. package/skills/test-strategy/references/adversarial-patterns.md +0 -0
  50. package/skills/test-strategy/references/complexity-grading.md +137 -0
  51. package/skills/test-strategy/references/design-methods-detail.md +183 -0
  52. package/skills/workflow-orchestrator/references/s1-path-router.md +4 -0
  53. package/skills/workflow-start/SKILL.md +5 -3
  54. package/skills/workflow-start/references/routing-rules.md +21 -0
  55. package/tests/e2e.test.mjs +0 -266
  56. package/tests/lib/cmd-audit.test.mjs +0 -202
  57. package/tests/lib/cmd-checkpoint.test.mjs +0 -98
  58. package/tests/lib/cmd-config.test.mjs +0 -101
  59. package/tests/lib/cmd-doctor.test.mjs +0 -450
  60. package/tests/lib/cmd-execution.test.mjs +0 -647
  61. package/tests/lib/cmd-handoff.test.mjs +0 -137
  62. package/tests/lib/cmd-inject.test.mjs +0 -218
  63. package/tests/lib/cmd-install-workbuddy.test.mjs +0 -113
  64. package/tests/lib/cmd-install-zcode.test.mjs +0 -42
  65. package/tests/lib/cmd-isolate.test.mjs +0 -68
  66. package/tests/lib/cmd-list.test.mjs +0 -127
  67. package/tests/lib/cmd-runtime.test.mjs +0 -83
  68. package/tests/lib/cmd-state-missing.test.mjs +0 -65
  69. package/tests/lib/cmd-state.test.mjs +0 -365
  70. package/tests/lib/cmd-sync-paths.test.mjs +0 -84
  71. package/tests/lib/cmd-validate-paths.test.mjs +0 -90
  72. package/tests/lib/config-loader.test.mjs +0 -175
  73. package/tests/lib/ensure-branch.test.mjs +0 -110
  74. package/tests/lib/execution-control-plane.test.mjs +0 -168
  75. package/tests/lib/execution-plan.test.mjs +0 -474
  76. package/tests/lib/guard-compound-captured.test.mjs +0 -92
  77. package/tests/lib/guard-specs-merged.test.mjs +0 -110
  78. package/tests/lib/guard-tests-passing.test.mjs +0 -114
  79. package/tests/lib/guard-transitions.test.mjs +0 -262
  80. package/tests/lib/guard.test.mjs +0 -613
  81. package/tests/lib/hash.test.mjs +0 -138
  82. package/tests/lib/infer-workflow.test.mjs +0 -161
  83. package/tests/lib/install-git-hooks.test.mjs +0 -20
  84. package/tests/lib/marketplace-release-docs.test.mjs +0 -31
  85. package/tests/lib/minimality-discipline.test.mjs +0 -37
  86. package/tests/lib/model-profiles-docs.test.mjs +0 -33
  87. package/tests/lib/node20-compatibility.test.mjs +0 -73
  88. package/tests/lib/node20-test-entry.test.mjs +0 -17
  89. package/tests/lib/platform-runtime-distribution.test.mjs +0 -157
  90. package/tests/lib/raw-mode-smoke.test.mjs +0 -42
  91. package/tests/lib/sdd-overlay.test.mjs +0 -118
  92. package/tests/lib/solutions-capture.test.mjs +0 -108
  93. package/tests/lib/solutions-index-gen.test.mjs +0 -147
  94. package/tests/lib/solutions-inject.test.mjs +0 -115
  95. package/tests/lib/solutions-promote.test.mjs +0 -200
  96. package/tests/lib/spec-paths.test.mjs +0 -80
  97. package/tests/lib/state-loader.test.mjs +0 -251
  98. package/tests/lib/token-baseline.test.mjs +0 -72
  99. package/tests/lib/token-rules.test.mjs +0 -94
  100. package/tests/lib/verify-marketplace-release.test.mjs +0 -128
  101. package/tests/tsconfig.json +0 -12
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: test-strategy
3
+ description: 测试设计方法论 skill——design_method 选择、分层策略、对抗验证、复杂度分级。build-executor 通过 skills: 预加载。
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Test Strategy
8
+
9
+ 测试设计方法论的硬规则。build-executor 通过 `skills: [test-strategy]` 预加载。
10
+ 详细说明见 `references/design-methods-detail.md`、`references/complexity-grading.md`、`references/adversarial-patterns.md`。
11
+
12
+ ## 1. Design Method 选择规则(三级分层)
13
+
14
+ ### 基础级(必选——每个被测目标必须覆盖)
15
+ - **equivalence**: 输入域有有效/无效分类
16
+ - **boundary**: 数字/长度/日期/金额/分页存在边界(6 值法:min-1/min/min+1/max-1/max/max+1)
17
+ - **error**: 业务异常、空值、外部依赖失败
18
+
19
+ ### 扩展级(条件触发)
20
+ - **path**: 方法存在多分支(圈复杂度 M = 判定节点+1,用例数 ≥ M)
21
+ - **state**: 对象状态改变或业务规则依赖状态迁移
22
+ - **exception**: 显式覆盖异常类型/消息/框架异常映射
23
+ - **reject**: 业务拒绝、准入失败、权限拒绝
24
+
25
+ ### 高级(场景触发)
26
+ - **permission**: API 权限、租户、用户上下文
27
+ - **idempotency**: 重复调用、重复消息、补偿逻辑
28
+ - **concurrency**: 锁、事务、异步消息、并发更新
29
+ - **contract**: 跨模块/跨服务接口契约(Feign、MQ 消息格式、领域事件字段)
30
+
31
+ ## 2. 复杂度分级用例数
32
+
33
+ | 复杂度 | 判据 | 最少用例 |
34
+ |--------|------|---------|
35
+ | trivial | is_trivial=true(enum/constant/POJO) | ≥3(仅 equivalence + error,boundary 可省) |
36
+ | medium | 默认(无判据命中) | ≥5 |
37
+ | complex | public_methods>15 或 lines>800 或 圈复杂度>10 或 param_count>6 | ≥7 |
38
+
39
+ 保守默认:事实是估算非实测 → 强制 medium 档(≥5)。
40
+
41
+ ## 3. 分层策略(测试金字塔比例)
42
+
43
+ - unit(test_tier=unit):70-80% 的 case
44
+ - integration(test_tier=integration):≤30% 的 case
45
+ - e2e:由 e2e skill 独立覆盖,不计入本矩阵
46
+
47
+ ## 4. 对抗验证三招(矩阵生成后必检)
48
+
49
+ 1. **恶意输入**:至少 1 个 case 覆盖 null/空串/超大值/特殊字符
50
+ 2. **并发场景**:涉及锁/事务/异步 → 至少 1 个 concurrency case
51
+ 3. **依赖失败**:涉及外部依赖 → 至少 1 个 dependency_failure case(超时/熔断/返回空)
52
+
53
+ ## 5. 自检门口诀
54
+
55
+ 每个方法至少:**1 正常 + 1 边界 + 1 异常 + 1 null/空**
56
+
57
+ ## 6. Schema 强制覆盖(test-matrix.md 校验)
58
+
59
+ 1. cases 必须包含至少 1 个 `design_method ∈ {boundary, equivalence}` 的 case
60
+ 2. cases 必须包含至少 1 个 `design_method ∈ {error, exception, reject}` 的 case
61
+ 3. `complexity_tier=trivial` 时降级:允许只覆盖 equivalence + error
62
+ 4. 对抗验证段必须存在(恶意输入/并发/依赖失败三类之一,视目标而定)
63
+
64
+ ## 7. work_mode 三种模式
65
+
66
+ | work_mode | 适用场景 | TDD 节奏 |
67
+ |---|---|---|
68
+ | **TDD** | 新功能/新行为 | RED→GREEN→REFACTOR |
69
+ | **CHARACTERIZATION** | 遗留代码行为捕获 | 只写不改(不改生产代码) |
70
+ | **REGRESSION** | 缺陷复现+修复 | 先复现再修 |
@@ -0,0 +1,137 @@
1
+ # Complexity Grading
2
+
3
+ 复杂度分级的详细规则。SKILL.md §2 的扩展参考。
4
+
5
+ ---
6
+
7
+ ## 1. 分级标准
8
+
9
+ ### trivial(简单)
10
+
11
+ **判据**(命中任一):
12
+ - 纯常量/枚举类(无方法体)
13
+ - POJO/DTO(仅 getter/setter,无业务逻辑)
14
+ - 工具方法的简单委托(`return delegate.doSomething(x)`)
15
+ - 配置文件读取(无校验逻辑)
16
+
17
+ **最少用例数**:≥3
18
+ - equivalence: 1 个正常输入
19
+ - error: 1 个 null/空值
20
+ - boundary: **可省**(trivial 降级特权)
21
+
22
+ **示例**:
23
+ ```java
24
+ // ErrorCode.java — 纯枚举
25
+ // OrderDTO.java — 仅 getter/setter
26
+ // StringUtils.isBlank() — 简单委托
27
+ ```
28
+
29
+ ### medium(中等)— 默认
30
+
31
+ **判据**:无 trivial 或 complex 判据命中时,强制 medium。
32
+
33
+ **最少用例数**:≥5
34
+ - equivalence: ≥1 正常 + ≥1 无效
35
+ - boundary: ≥2(至少 1 个下边界 + 1 个上边界)
36
+ - error: ≥1
37
+
38
+ ### complex(复杂)
39
+
40
+ **判据**(命中任一):
41
+ - public_methods > 15
42
+ - lines > 800(含注释和空行)
43
+ - 圈复杂度 > 10
44
+ - param_count > 6(单个方法参数超过 6 个)
45
+ - 涉及 ≥3 个外部依赖交互
46
+ - 包含状态机(≥4 个状态)
47
+
48
+ **最少用例数**:≥7
49
+ - equivalence: ≥2 正常 + ≥2 无效
50
+ - boundary: ≥3(至少含 1 个 6 值法完整覆盖)
51
+ - error: ≥1
52
+ - path: ≥1(如果有分支)
53
+
54
+ ---
55
+
56
+ ## 2. 圈复杂度计算方法
57
+
58
+ ### 手动计算
59
+
60
+ 从 1 开始(方法本身的 1 条直线执行路径),每遇到以下结构 +1:
61
+
62
+ | 结构 | 增量 |
63
+ |---|---|
64
+ | `if` / `else if` | +1 |
65
+ | `switch` 每个 `case`(含 `default`) | +1 per case |
66
+ | `for` / `while` / `do-while` | +1 |
67
+ | `&&` / `||` 短路运算 | +1 per operator |
68
+ | `catch` | +1 |
69
+ | `?:`(三元表达式) | +1 |
70
+
71
+ **示例**:
72
+ ```java
73
+ public void process(Order order) { // 1
74
+ if (order == null) { ... } // +1 = 2
75
+ if (order.getStatus() == PAID // +1 = 3
76
+ && order.getAmount() > 1000) { ... } // +1 = 4
77
+ for (Item item : order.getItems()) { // +1 = 5
78
+ if (item.isDiscounted()) { ... } // +1 = 6
79
+ switch (item.getType()) {
80
+ case PHYSICAL: ... break; // +1 = 7
81
+ case DIGITAL: ... break; // +1 = 8
82
+ default: ... // +1 = 9
83
+ }
84
+ }
85
+ }
86
+ // 圈复杂度 = 9 → medium 档(未超 10)
87
+ ```
88
+
89
+ ### 工具辅助
90
+
91
+ | 语言 | 工具 | 命令 |
92
+ |---|---|---|
93
+ | Java | Checkstyle / PMD | `mvn checkstyle:check` / `pmd check` |
94
+ | Java | SonarQube | 自动扫描 |
95
+ | TypeScript | complexity-report | `npx complexity-report src/` |
96
+ | Python | radon | `radon cc src/` |
97
+
98
+ ---
99
+
100
+ ## 3. 校准规则
101
+
102
+ ### 保守默认
103
+
104
+ - 事实是估算非实测 → 不确定时强制 medium 档(≥5)
105
+ - 宁可多做不可漏做 → 边界 case 优先于 happy path
106
+
107
+ ### 方法拆分时的处理
108
+
109
+ 如果一个方法被拆分为多个小方法:
110
+ - 拆分前:complex(圈复杂度 12)
111
+ - 拆分后:每个子方法 medium(圈复杂度 4-6)
112
+ - **但**:拆分前的 complex 级用例数仍需保留(不因拆分而降级)
113
+
114
+ ### 组合方法的计算
115
+
116
+ 如果类有多个 public 方法:
117
+ - 每个方法独立计算复杂度
118
+ - 类的总复杂度 = 各方法圈复杂度之和
119
+ - 类的用例数 = 各方法用例数之和(去重共享的 setup/teardown case)
120
+
121
+ ---
122
+
123
+ ## 4. 与 test-matrix.md 的关联
124
+
125
+ 在 test-matrix.md 的 `## Summary` 段中标注每个模块的复杂度分级:
126
+
127
+ ```markdown
128
+ ## Summary
129
+ - Total cases: 35
130
+ - Modules covered: 4
131
+ - OrderService: complex (圈复杂度 14, ≥7 cases)
132
+ - PaymentValidator: medium (圈复杂度 6, ≥5 cases)
133
+ - ErrorCode: trivial (纯枚举, ≥3 cases)
134
+ - OrderConverter: trivial (POJO 映射, ≥3 cases)
135
+ ```
136
+
137
+ contract-builder 在生成矩阵时,必须为每个模块标注复杂度分级,作为用例数下限的判据。
@@ -0,0 +1,183 @@
1
+ # Design Methods Detail
2
+
3
+ 10+1 种测试设计方法的详细说明。SKILL.md §1 的扩展参考。
4
+
5
+ ---
6
+
7
+ ## 基础级(必选)
8
+
9
+ ### equivalence(等价类划分)
10
+
11
+ **触发条件**:输入域有有效/无效分类。
12
+
13
+ **方法**:
14
+ 1. 识别输入参数的有效等价类和无效等价类
15
+ 2. 每个等价类取 1 个代表值
16
+ 3. 有效类 → 验证正常行为;无效类 → 验证拒绝/异常
17
+
18
+ **示例(Java)**:
19
+ ```java
20
+ // 有效等价类:validOrderId (正整数)
21
+ // 无效等价类:null, 0, -1, 超过 MAX_LONG
22
+ @Test void shouldFindOrder_whenValidId() { ... }
23
+ @Test void shouldThrow_whenNullId() { ... }
24
+ @Test void shouldThrow_whenNegativeId() { ... }
25
+ ```
26
+
27
+ ### boundary(边界值分析)
28
+
29
+ **触发条件**:数字/长度/日期/金额/分页存在边界。
30
+
31
+ **6 值法**:对每个边界取 min-1 / min / min+1 / max-1 / max / max+1
32
+
33
+ | 边界类型 | 示例(金额 0.01 ~ 999999.99) |
34
+ |---|---|
35
+ | min-1 | 0.00 → 拒绝 |
36
+ | min | 0.01 → 接受(最小合法) |
37
+ | min+1 | 0.02 → 接受 |
38
+ | max-1 | 999999.98 → 接受 |
39
+ | max | 999999.99 → 接受(最大合法) |
40
+ | max+1 | 1000000.00 → 拒绝 |
41
+
42
+ **日期边界特殊处理**:
43
+ - 闰年:2024-02-29 / 2025-02-28
44
+ - 月末/月初:1月31日 → 2月1日
45
+ - 时区切换:UTC+8 的 23:59 vs UTC 的 15:59
46
+
47
+ ### error(错误/异常路径)
48
+
49
+ **触发条件**:业务异常、空值、外部依赖失败。
50
+
51
+ **必须覆盖的三类**:
52
+ 1. **参数校验错误**:null、空串、格式错误
53
+ 2. **业务规则违反**:库存不足、余额不够、重复操作
54
+ 3. **外部依赖失败**:DB 连接超时、HTTP 5xx、MQ 消费失败
55
+
56
+ **示例**:
57
+ ```java
58
+ @Test void shouldThrowBizException_whenInsufficientStock() { ... }
59
+ @Test void shouldReturnEmpty_whenDbReturnsNull() { ... }
60
+ @Test void shouldRetry_whenExternalApiTimeout() { ... }
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 扩展级(条件触发)
66
+
67
+ ### path(路径覆盖)
68
+
69
+ **触发条件**:方法存在多分支。
70
+
71
+ **圈复杂度计算**:M = 判定节点数 + 1
72
+ - `if` → +1
73
+ - `else if` → +1
74
+ - `switch` 每个 `case` → +1
75
+ - `for` / `while` → +1
76
+ - `&&` / `||` 短路运算 → +1
77
+
78
+ **用例数 ≥ M**。示例:M=4(1 个 if + 1 个 switch 3-case)→ ≥4 个 case。
79
+
80
+ ### state(状态迁移)
81
+
82
+ **触发条件**:对象状态改变或业务规则依赖状态迁移。
83
+
84
+ **方法**:
85
+ 1. 画出状态迁移图(初始态 → 中间态 → 终态)
86
+ 2. 每条迁移边至少 1 个 case
87
+ 3. 非法迁移(如 CLOSED → PROCESSING)→ 1 个 reject case
88
+
89
+ **示例(订单状态机)**:
90
+ ```
91
+ CREATED → PAID → SHIPPED → DELIVERED → CLOSED
92
+ ↓ ↑
93
+ CANCELLED ←──────────────┘ (仅 PAID 前可取消)
94
+ ```
95
+
96
+ ### exception(异常覆盖)
97
+
98
+ **触发条件**:显式覆盖异常类型/消息/框架异常映射。
99
+
100
+ **必须验证**:
101
+ 1. 异常类型是否正确(BusinessException vs SystemException)
102
+ 2. 异常消息是否包含上下文(errorCode + 参数值)
103
+ 3. 框架异常映射(Spring 的 `@ResponseStatus` → HTTP 状态码)
104
+
105
+ ### reject(业务拒绝)
106
+
107
+ **触发条件**:业务拒绝、准入失败、权限拒绝。
108
+
109
+ **与 error 的区别**:error 是"系统出了问题",reject 是"系统正确地拒绝了"。
110
+
111
+ **示例**:
112
+ ```java
113
+ @Test void shouldReject_whenOrderAlreadyClosed() { ... }
114
+ @Test void shouldReject_whenUserNotInWhitelist() { ... }
115
+ @Test void shouldReject_whenDuplicateRequest() { ... }
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 高级(场景触发)
121
+
122
+ ### permission(权限控制)
123
+
124
+ **触发条件**:API 权限、租户、用户上下文。
125
+
126
+ **覆盖维度**:
127
+ 1. 角色权限:ADMIN / USER / GUEST / ANONYMOUS
128
+ 2. 租户隔离:租户 A 不能访问租户 B 的数据
129
+ 3. 数据权限:只能操作自己创建的资源
130
+
131
+ ### idempotency(幂等性)
132
+
133
+ **触发条件**:重复调用、重复消息、补偿逻辑。
134
+
135
+ **验证模式**:
136
+ 1. 调用 N 次 → 效果等同于调用 1 次
137
+ 2. MQ 重复消费 → 不重复处理
138
+ 3. 补偿操作 → 正向 + 逆向 = 无净效果
139
+
140
+ **示例**:
141
+ ```java
142
+ @Test void shouldNotDuplicateOrder_whenRetryCreate() {
143
+ var first = orderService.create(request);
144
+ var second = orderService.create(request);
145
+ assertThat(second.getId()).isEqualTo(first.getId());
146
+ }
147
+ ```
148
+
149
+ ### concurrency(并发安全)
150
+
151
+ **触发条件**:锁、事务、异步消息、并发更新。
152
+
153
+ **验证模式**:
154
+ 1. 乐观锁冲突 → 重试或拒绝
155
+ 2. 分布式锁 → 同一时刻只有一个执行者
156
+ 3. 事务隔离 → 读未提交 / 读已提交 / 可重复读
157
+ 4. 异步消息 → 最终一致性
158
+
159
+ ### contract(接口契约)
160
+
161
+ **触发条件**:跨模块/跨服务接口契约。
162
+
163
+ **覆盖维度**:
164
+ 1. Feign 客户端:请求/响应格式与 provider 一致
165
+ 2. MQ 消息:字段名/类型/必填项
166
+ 3. 领域事件:事件名/载荷/版本
167
+
168
+ ---
169
+
170
+ ## 派生字段:test_tier
171
+
172
+ 从 `test_kind` 派生 `test_tier`(语言无关的粗粒度分类):
173
+
174
+ | test_kind 值 | test_tier |
175
+ |---|---|
176
+ | pure_unit, mockito_unit, spring_assisted_unit | unit |
177
+ | vitest_unit, vue_test_utils_mount | unit |
178
+ | api_mockmvc_standalone, api_mockmvc_slice, api_mockmvc_boot | integration |
179
+ | service_social, repository_h2 | integration |
180
+ | rabbitmq_social, redis_social | integration |
181
+ | external_api_stub, test_infrastructure | integration |
182
+
183
+ **用途**:test_tier 用于统计和 CI 分级;test_kind 用于路由到正确的编写模板。
@@ -48,6 +48,10 @@ S1 只做编排动作(需求选择、存在性检查、路径判断、阻塞
48
48
 
49
49
  工作流模式复利(L2):S1 路由时额外注入历史 `workflow_pattern` top-3(confidence ≥ 0.5)。详见 state-model.md「工作流模式复利 L2」。
50
50
 
51
+ ## 测试台账注入(v0.12 §43.5,advisory 级)
52
+
53
+ 读取 `docs/test-ledger/INDEX.md`(如存在),注入 `coverage_status=partial` 的模块列表。新 change 涉及这些模块时,提示「有未解决的 deferred 测试项,本次可考虑解决」。读取失败时静默跳过,不阻断。
54
+
51
55
  ## 路由结果显式呈现(强制,B3)
52
56
 
53
57
  路由判断后**必须**向用户确认,路由是建议而非决定:
@@ -54,12 +54,14 @@ Validate mode against artifact content. If hotfix/tweak criteria not met → upg
54
54
 
55
55
  ## Routing Rules
56
56
 
57
+ > **⚠️ 路由优先级(硬规则)**:路由按文档顺序从前到后评估,**第一个匹配的路由必须执行**。关键门控:`arch_design_decision` 为 `null` 时 MUST 路由到 `architecture-design`,即使后续路由(spec-writer / contract-builder / build-executor)的其他条件也满足——架构判定是 exploring→specifying 的硬前置,不可跳过。hotfix/tweak 走快速转换,guard 不挂 `arch-design` 维度(`exploring:bridging`/`exploring:approved-for-build` 为空维度),但 **SOP 层仍须过 architecture-design 判断门,不豁免**(v0.9 §26,见 Fast-Path Routing;hotfix 可能正是架构缺陷导致)——判断结果由 architecture-design 子代理写入 `arch_design_decision`,无"自动写 skipped"行为。
58
+
57
59
  ### Sub-agent Dispatch Protocol (v0.30.0)
58
60
 
59
61
  产出型路由(spec-writer / contract-builder / build-executor / release-archivist)通过 `Agent(subagent_type: "team-flow:<name>")` **dispatch 子代理**执行——agent 定义经 `skills:` 预加载对应 SKILL.md,主代理**不得**凭记忆手写产物格式 prompt。need-explorer 为交互式澄清,**主进程执行**(需与用户对话;其 agent 定义 `team-flow:need-explorer` 仅作可 dispatch 后备)。
60
62
 
61
63
  - **记录 agentId**:dispatch 后立即记录子代理 ID;修复一律 SendMessage 恢复原子代理(禁启动新子代理,见 v0.29.0 §37)
62
- - **返回即验证(validation gate)**:子代理返回产物后**立即** `tf validate <change-dir>`;FAIL → SendMessage 回**原**子代理修复,通过后才能继续/转换。把格式失败拦截在返回时,而非状态转换时(避免浪费整次执行后再失败)
64
+ - **返回即验证(validation gate)**:子代理返回产物后**立即** `tf validate <change-dir>`;FAIL → SendMessage 回**原**子代理修复,通过后才能继续/转换。把格式失败拦截在返回时,而非状态转换时(避免浪费整次执行后再失败)。**build-executor 附加验证(v0.13 §52 B3,SDD/full 模式)**:返回的 diff 中必须包含测试文件(src/test/ 或项目测试目录);零测试文件的实现返回一律 BLOCK,SendMessage 回原子代理按 test-matrix.md / TDD Iron Law 补齐——不得以"手动验证"替代(C1-domain-policy 事件教训)。例外:已显式记录 `test_matrix_skipped=true` + 理由的 change(纯文档/配置类)不要求测试文件
63
65
  - **结果协议**:子代理终态须标注 `FINAL VERDICT: <DONE|BLOCKED|FAIL>`(审查类用 PASS/PASS_WITH_WARNINGS/FAIL);**SendMessage 报告为权威结果**,task-notification.result 仅内部元数据
64
66
  - **子代理状态边界**:子代理 MUST NOT 修改 `.team-flow.yaml` 的 `state`/`workflow` 核心字段(状态转换是主代理专有职责,经 `tf state transition` 执行),只写自己的 `dp_N_*` 决策字段
65
67
 
@@ -84,10 +86,10 @@ Full protocol in `references/routing-rules.md`「Route to architecture-design」
84
86
  Guard: `tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK. **arch_design_decision must not be null** → fail = BLOCK (v0.9 §26). User knows what they want, artifacts missing/incomplete.
85
87
 
86
88
  ### Route to contract-builder (dispatch sub-agent)
87
- Guard: `... check <dir> specifying bridging --json` → fail = BLOCK. Artifacts exist, implementation requested, contract missing/stale. Include `DP-3: 契约批准`.
89
+ Guard: `... check <dir> specifying bridging --json` → fail = BLOCK. Artifacts exist, implementation requested, contract missing/stale. Include `DP-3: 契约批准`. **full workflow 必产 test-matrix.md(v0.13 §52 B1)**:契约 `## Test Matrix` 段 + 非空矩阵文件 + `tf state rebuild` 捕获 hash;确无测试需求只能显式 skip + 理由(`test_matrix_skipped=true` + `test_matrix_skip_reason`)。GLAF4 Java 项目矩阵生成的工具选择见 `references/routing-rules.md`「Route to glaf4-tests」。
88
90
 
89
91
  ### Route to build-executor (dispatch sub-agent)
90
- Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `tf execution recommend <change-dir> [--wave ...]`, show the user every available mode plus evidence and the recommendation, then obtain a clear selection. The command saves a current receipt; before the first implementation edit, `build-executor` must run `tf execution plan <change-dir> --mode <selected> --confirm ...` (and `--acknowledge-recommendation` when the selected mode differs from the recommendation) using matching artifacts, contract, and waves, then `tf execution show <change-dir> --json`; report the saved revision, selected mode, recommendation alignment, ordered waves, and actual concurrent-dispatch capability. A revision must repeat recommend and confirmation. Do not transition to `executing` until `show` reports `current: true`; then run `... check <dir> approved-for-build executing --json` → fail = BLOCK.
92
+ Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `tf execution recommend <change-dir> [--wave ...]`, show the user every available mode plus evidence and the recommendation, then obtain a clear selection. The command saves a current receipt; before the first implementation edit, `build-executor` must run `tf execution plan <change-dir> --mode <selected> --confirm ...` (and `--acknowledge-recommendation` when the selected mode differs from the recommendation) using matching artifacts, contract, and waves, then `tf execution show <change-dir> --json`; report the saved revision, selected mode, recommendation alignment, ordered waves, and actual concurrent-dispatch capability. A revision must repeat recommend and confirmation. Do not transition to `executing` until `show` reports `current: true`; then run `... check <dir> approved-for-build executing --json` → fail = BLOCK. **v0.13 §49 门禁前移**:该 guard 含 `test-matrix-ready` 维度——full 模式非存量 change 必须"带着矩阵开工"(矩阵存在非空 OR 显式 skip 附理由);FAIL 时回 bridging 让 contract-builder 补矩阵,或按指引显式 skip,禁止绕过。
91
93
 
92
94
  ### Route to bug-investigator
93
95
  Execution hit blockage: test failure, unexpected behavior, build error, task cannot proceed. After debugging, route back to build-executor.
@@ -307,3 +307,24 @@ Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **twe
307
307
 
308
308
  ## Post-transition
309
309
  💡 `tf inject <change-dir>` to update phase-guard artifacts.
310
+
311
+ ## Route to glaf4-tests (v0.12 §46, v0.31.0, v0.13 §52 B3 归位)
312
+
313
+ **归位说明(v0.13)**:本段的触发主体是 **bridging 阶段的 contract-builder 子代理**(矩阵生成者),workflow-start 主路由表不包含 glaf4-tests 条目——放在本文件仅作 bridging 期参考。
314
+
315
+ **强制性澄清(v0.13 §52 B1)**:full workflow 生成 test-matrix.md 本身是**必选动作**(`test-matrix-ready`/`test-matrix-complete` 门禁强制);**可选的是工具选择**——GLAF4 Java 项目可选用 glaf4-tests 流水线做精细矩阵设计,非 GLAF4 项目用内置 test-strategy skill。两条路都必须产出非空 `test-matrix.md` + contract `## Test Matrix` 段 + `tf state rebuild`。
316
+
317
+ **触发条件**:`project_type == glaf4-java`(Spring Boot / JUnit 5 / Mockito)。
318
+
319
+ **协议**:
320
+ 1. contract-builder 检测项目技术栈(读取 `pom.xml` / `build.gradle` 判断是否 GLAF4 Java)
321
+ 2. GLAF4 项目 → 提示用户:「检测到 GLAF4 Java 项目,是否调用 `glaf4-test:glaf4-tests` 做精细测试矩阵设计?」
322
+ 3. 用户同意 → 调用 `glaf4-test:glaf4-tests-design` 生成 `test-matrix.json`
323
+ 4. `glaf4-tests-validate` 校验矩阵完整性
324
+ 5. `tf test-matrix-export <test-matrix.json> <change-dir>/test-matrix.md` 转换为 team-flow 格式
325
+ 6. 用户确认(轻量版 DP-A)
326
+ 7. contract 中添加 `## Test Matrix` 段引用 + `tf state rebuild` 捕获 test_matrix_hash
327
+
328
+ **非 GLAF4 项目**:contract-builder 使用预加载的 test-strategy skill 直接生成 `test-matrix.md`(同等强制)。
329
+
330
+ **用户拒绝 glaf4-tests 时**:回退内置 test-strategy 生成(不是跳过矩阵)。确无测试需求的特例走显式 skip + 理由。