@abelxiaoxing/cadence 1.5.2 → 1.5.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.
- package/README.md +52 -0
- package/package.json +1 -1
- package/src/contracts.ts +16 -5
- package/src/design-diagnostics.ts +8 -0
package/README.md
CHANGED
|
@@ -150,6 +150,58 @@ Gate 等待和可恢复暂停保持激活以接收直接后续操作。
|
|
|
150
150
|
暂停会保留最小结构化恢复事实;完成或显式 discard 后安全清理。
|
|
151
151
|
不会持久化凭据、环境值、原始 prompt、隐藏推理、完整子会话或原始模型输出。
|
|
152
152
|
|
|
153
|
+
### 公共 UI 的 impactClosure 作者格式
|
|
154
|
+
|
|
155
|
+
`page-state` 与 `public-html` 可以同时声明。
|
|
156
|
+
以下是 **PlanDraft 任务片段**,合并到现有 `tasks[i]`,不是完整计划;其余 Gate A、阶段、产物和验证合同仍按单任务示例填写。
|
|
157
|
+
路径和证据仅用于说明,必须替换为仓库真实调查结果。
|
|
158
|
+
假设 Red 修改 `test/page-state.mjs`,已有 `test/public-html.mjs` 只读保留:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"read": ["test/page-state.mjs", "test/public-html.mjs"],
|
|
163
|
+
"impactClosure": {
|
|
164
|
+
"changedSurfaces": ["page-state", "public-html"],
|
|
165
|
+
"searchEvidence": [
|
|
166
|
+
"检索页面状态的调用点及 test/、tests/ 中的覆盖:test/page-state.mjs 需更新状态切换断言,test/public-html.mjs 覆盖现有公开 HTML。"
|
|
167
|
+
],
|
|
168
|
+
"relatedTests": [
|
|
169
|
+
{
|
|
170
|
+
"path": "test/page-state.mjs",
|
|
171
|
+
"evidence": "本任务 Red 更新页面状态切换回归;由阶段 write 推导为 current-task。"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"path": "test/public-html.mjs",
|
|
175
|
+
"evidence": "保留已有 HTML 断言并执行受影响验证;无任务写入,推导为 unaffected。"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"affectedSuite": ["test/page-state.mjs", "test/public-html.mjs"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
完整规则:
|
|
184
|
+
|
|
185
|
+
- `impactClosure` 恰好包含 `changedSurfaces`、`searchEvidence`、`relatedTests`、`affectedSuite` 四个字段,不接受任意扩展字段。
|
|
186
|
+
- `changedSurfaces` 是非空、无重复的合法枚举数组;`none` 不能与其他值混用。
|
|
187
|
+
不得为了通过校验将公共影响改为 `none`。
|
|
188
|
+
- 存在公共影响时,后三个数组均不得为空;`searchEvidence` 每项为非空字符串,记录实际检索及结论,不是路径对象,也不是可省略的推导字段。
|
|
189
|
+
- `relatedTests` 每项包含 `path` 和非空字符串 `evidence`;路径无重复,必须是 `test/` 或 `tests/` 下的仓库相对文件路径,并位于本任务各阶段合并后的 read/write 范围。
|
|
190
|
+
`src/foo.test.ts` 不满足当前测试路径规则。
|
|
191
|
+
- PlanDraft 可省略 `disposition`:本任务写入则推导为 `current-task`,只有另一任务写入则为 `regression-task` 并推导 `regressionTaskId`,没有任务写入则为 `unaffected`;多个其他写入者时必须消除歧义。
|
|
192
|
+
`unaffected` 表示不修改该测试,不表示不运行该测试。
|
|
193
|
+
- 显式作者格式为 `{ "path": "test/page-state.mjs", "disposition": "current-task", "evidence": "实际证据" }`;只读保留用 `unaffected`。
|
|
194
|
+
跨任务格式为 `{ "path": "test/page-state.mjs", "disposition": "regression-task", "evidence": "实际证据", "regressionTaskId": "ui-regression" }`。
|
|
195
|
+
只有 `regression-task` 携带 `regressionTaskId`;依赖、产物和阶段权限仍需按实际计划声明,不会由闭包新增。
|
|
196
|
+
- `affectedSuite` 是无重复的测试路径数组,每项必须有对应的 `relatedTests` 条目;具备快照的运行时校验还要求其中至少一个是已有普通测试文件,不能全靠未来新增测试充当已有证据。
|
|
197
|
+
- `affectedSuite` 是影响清单,不是验证器。
|
|
198
|
+
显式 `affectedVerification` 应实际运行这些测试,例如 Vitest 的 `testFiles` 列出二者,或使用仓库真实的测试脚本。
|
|
199
|
+
仍需声明验证输入并遵守 Gate A,不能只补清单就宣称测试已运行。
|
|
200
|
+
|
|
201
|
+
`validate-plan-draft` 对三个空数组分别返回字段级 category:`search-evidence-required`、`related-tests-required`、`affected-suite-required`,并提供代码维护的 `hint`。
|
|
202
|
+
测试漏列仍返回 `impactClosure.affectedSuite.<index>` / `related-test-missing` 和具体 `path`。
|
|
203
|
+
空数组不足以确定应选哪些测试,因此不会虚构 `expectedPaths`;按实际证据补齐后,在同一个 Design run 重试预检。
|
|
204
|
+
|
|
153
205
|
## 内部边界与运行验证
|
|
154
206
|
|
|
155
207
|
扩展入口负责宿主生命周期与服务装配,交付加载和验证适配器分别由独立模块负责。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Four explicit Abel workflow prompts with stage-isolated design and diagnosis, durable resumable implementation, and three package-owned professional Agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/contracts.ts
CHANGED
|
@@ -1574,12 +1574,23 @@ function taskFieldDiagnostics(
|
|
|
1574
1574
|
allowedValues: [...IMPACT_SURFACES],
|
|
1575
1575
|
});
|
|
1576
1576
|
}
|
|
1577
|
+
const publicImpact = closure.changedSurfaces.some(
|
|
1578
|
+
(surface) =>
|
|
1579
|
+
surface !== "none" &&
|
|
1580
|
+
(IMPACT_SURFACES as readonly unknown[]).includes(surface),
|
|
1581
|
+
);
|
|
1582
|
+
if (publicImpact) {
|
|
1583
|
+
for (const [field, category] of [
|
|
1584
|
+
["searchEvidence", "search-evidence-required"],
|
|
1585
|
+
["relatedTests", "related-tests-required"],
|
|
1586
|
+
["affectedSuite", "affected-suite-required"],
|
|
1587
|
+
] as const) {
|
|
1588
|
+
if (Array.isArray(closure[field]) && closure[field].length === 0)
|
|
1589
|
+
add({ field: `impactClosure.${field}`, category });
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1577
1592
|
if (
|
|
1578
|
-
|
|
1579
|
-
(surface) =>
|
|
1580
|
-
surface !== "none" &&
|
|
1581
|
-
(IMPACT_SURFACES as readonly unknown[]).includes(surface),
|
|
1582
|
-
) &&
|
|
1593
|
+
publicImpact &&
|
|
1583
1594
|
Array.isArray(closure.affectedSuite) &&
|
|
1584
1595
|
Array.isArray(closure.relatedTests)
|
|
1585
1596
|
) {
|
|
@@ -26,6 +26,14 @@ const HINTS = new Map<string, string>(
|
|
|
26
26
|
"duplicate-path":
|
|
27
27
|
"Remove the repeated path at the indicated index; keep the existing declaration and do not widen phase permissions.",
|
|
28
28
|
enum: "Use one of allowedValues at the indicated field. For public impact, choose the actual changed surface; do not substitute none to bypass closure checks.",
|
|
29
|
+
"public-impact-incomplete":
|
|
30
|
+
"Public impact requires non-empty searchEvidence, relatedTests and affectedSuite; every affectedSuite path must have a relatedTests entry. Keep the actual changedSurfaces; do not substitute none.",
|
|
31
|
+
"search-evidence-required":
|
|
32
|
+
"Add non-empty searchEvidence strings describing actual searches of changed public surfaces, callers and existing tests. Do not invent evidence or substitute none for changedSurfaces.",
|
|
33
|
+
"related-tests-required":
|
|
34
|
+
"Add relatedTests entries with path and non-empty evidence for actual tests under test/ or tests/, within the task's declared read/write scope. In PlanDraft omit disposition to derive ownership from task writes; do not widen writes or substitute none.",
|
|
35
|
+
"affected-suite-required":
|
|
36
|
+
"Add actual affected test paths under test/ or tests/ to affectedSuite and declare each in relatedTests. Bind their execution in affectedVerification; retained snapshot validation requires at least one existing test. Do not invent paths or substitute none.",
|
|
29
37
|
"related-test-missing":
|
|
30
38
|
"Add this affected-suite test to relatedTests with evidence and its actual owner. Do not remove public impact or widen writes to satisfy ownership.",
|
|
31
39
|
"change-contract-acceptance-missing":
|