@hunter-harness/workflow-harness 0.2.73 → 0.2.74

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 (154) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
  3. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  4. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  5. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  6. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +1 -1
  7. package/harness/bundles/general/claude-code/harness-pull/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-push/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
  10. package/harness/bundles/general/claude-code/harness-run/SKILL.md +2 -2
  11. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +3 -2
  12. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
  13. package/harness/bundles/general/claude-code/harness-test/SKILL.md +2 -2
  14. package/harness/bundles/general/claude-code/harness-test/checklist.md +2 -0
  15. package/harness/bundles/general/claude-code/scripts/harness_archive.py +82 -1
  16. package/harness/bundles/general/claude-code/scripts/harness_ledger.py +25 -4
  17. package/harness/bundles/general/claude-code/scripts/harness_profile.py +45 -0
  18. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  19. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
  20. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  21. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  22. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  23. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +1 -1
  24. package/harness/bundles/general/codebuddy/harness-pull/SKILL.md +1 -1
  25. package/harness/bundles/general/codebuddy/harness-push/SKILL.md +1 -1
  26. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
  27. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +2 -2
  28. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +3 -2
  29. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
  30. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +2 -2
  31. package/harness/bundles/general/codebuddy/harness-test/checklist.md +2 -0
  32. package/harness/bundles/general/codebuddy/scripts/harness_archive.py +82 -1
  33. package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +25 -4
  34. package/harness/bundles/general/codebuddy/scripts/harness_profile.py +45 -0
  35. package/harness/bundles/general/codex/.harness-build.json +1 -1
  36. package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
  37. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  38. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
  39. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  40. package/harness/bundles/general/codex/harness-plan/SKILL.md +1 -1
  41. package/harness/bundles/general/codex/harness-pull/SKILL.md +1 -1
  42. package/harness/bundles/general/codex/harness-push/SKILL.md +1 -1
  43. package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
  44. package/harness/bundles/general/codex/harness-run/SKILL.md +2 -2
  45. package/harness/bundles/general/codex/harness-submit/SKILL.md +3 -2
  46. package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
  47. package/harness/bundles/general/codex/harness-test/SKILL.md +2 -2
  48. package/harness/bundles/general/codex/harness-test/checklist.md +2 -0
  49. package/harness/bundles/general/codex/scripts/harness_archive.py +82 -1
  50. package/harness/bundles/general/codex/scripts/harness_ledger.py +25 -4
  51. package/harness/bundles/general/codex/scripts/harness_profile.py +45 -0
  52. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  53. package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
  54. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  55. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  56. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  57. package/harness/bundles/general/cursor/harness-plan/SKILL.md +1 -1
  58. package/harness/bundles/general/cursor/harness-pull/SKILL.md +1 -1
  59. package/harness/bundles/general/cursor/harness-push/SKILL.md +1 -1
  60. package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
  61. package/harness/bundles/general/cursor/harness-run/SKILL.md +2 -2
  62. package/harness/bundles/general/cursor/harness-submit/SKILL.md +3 -2
  63. package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
  64. package/harness/bundles/general/cursor/harness-test/SKILL.md +2 -2
  65. package/harness/bundles/general/cursor/harness-test/checklist.md +2 -0
  66. package/harness/bundles/general/cursor/scripts/harness_archive.py +82 -1
  67. package/harness/bundles/general/cursor/scripts/harness_ledger.py +25 -4
  68. package/harness/bundles/general/cursor/scripts/harness_profile.py +45 -0
  69. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  70. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  71. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
  72. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  73. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  74. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  75. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  76. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
  77. package/harness/bundles/java/claude-code/harness-pull/SKILL.md +1 -1
  78. package/harness/bundles/java/claude-code/harness-push/SKILL.md +1 -1
  79. package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
  80. package/harness/bundles/java/claude-code/harness-run/SKILL.md +2 -2
  81. package/harness/bundles/java/claude-code/harness-run/reference.md +348 -348
  82. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +3 -2
  83. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
  84. package/harness/bundles/java/claude-code/harness-test/SKILL.md +2 -2
  85. package/harness/bundles/java/claude-code/scripts/harness_archive.py +82 -1
  86. package/harness/bundles/java/claude-code/scripts/harness_ledger.py +25 -4
  87. package/harness/bundles/java/claude-code/scripts/harness_profile.py +45 -0
  88. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  89. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  90. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
  91. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  92. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  93. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  94. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  95. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
  96. package/harness/bundles/java/codebuddy/harness-pull/SKILL.md +1 -1
  97. package/harness/bundles/java/codebuddy/harness-push/SKILL.md +1 -1
  98. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
  99. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +2 -2
  100. package/harness/bundles/java/codebuddy/harness-run/reference.md +348 -348
  101. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +3 -2
  102. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
  103. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +2 -2
  104. package/harness/bundles/java/codebuddy/scripts/harness_archive.py +82 -1
  105. package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +25 -4
  106. package/harness/bundles/java/codebuddy/scripts/harness_profile.py +45 -0
  107. package/harness/bundles/java/codex/.harness-build.json +1 -1
  108. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  109. package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
  110. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  111. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
  112. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  113. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  114. package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
  115. package/harness/bundles/java/codex/harness-pull/SKILL.md +1 -1
  116. package/harness/bundles/java/codex/harness-push/SKILL.md +1 -1
  117. package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
  118. package/harness/bundles/java/codex/harness-run/SKILL.md +2 -2
  119. package/harness/bundles/java/codex/harness-run/reference.md +348 -348
  120. package/harness/bundles/java/codex/harness-submit/SKILL.md +3 -2
  121. package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
  122. package/harness/bundles/java/codex/harness-test/SKILL.md +2 -2
  123. package/harness/bundles/java/codex/scripts/harness_archive.py +82 -1
  124. package/harness/bundles/java/codex/scripts/harness_ledger.py +25 -4
  125. package/harness/bundles/java/codex/scripts/harness_profile.py +45 -0
  126. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  127. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  128. package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
  129. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  130. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  131. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  132. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  133. package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
  134. package/harness/bundles/java/cursor/harness-pull/SKILL.md +1 -1
  135. package/harness/bundles/java/cursor/harness-push/SKILL.md +1 -1
  136. package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
  137. package/harness/bundles/java/cursor/harness-run/SKILL.md +2 -2
  138. package/harness/bundles/java/cursor/harness-run/reference.md +348 -348
  139. package/harness/bundles/java/cursor/harness-submit/SKILL.md +3 -2
  140. package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
  141. package/harness/bundles/java/cursor/harness-test/SKILL.md +2 -2
  142. package/harness/bundles/java/cursor/scripts/harness_archive.py +82 -1
  143. package/harness/bundles/java/cursor/scripts/harness_ledger.py +25 -4
  144. package/harness/bundles/java/cursor/scripts/harness_profile.py +45 -0
  145. package/harness/manifests/general/claude-code.json +18 -18
  146. package/harness/manifests/general/codebuddy.json +18 -18
  147. package/harness/manifests/general/codex.json +18 -18
  148. package/harness/manifests/general/cursor.json +18 -18
  149. package/harness/manifests/java/claude-code.json +20 -20
  150. package/harness/manifests/java/codebuddy.json +20 -20
  151. package/harness/manifests/java/codex.json +20 -20
  152. package/harness/manifests/java/cursor.json +20 -20
  153. package/hunter-workflow-family.json +3 -3
  154. package/package.json +1 -1
@@ -3,7 +3,7 @@ name: harness-submit
3
3
  description: 最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff 合并回主分支。仅当用户显式调用
4
4
  /harness-submit(或 /harness-merge 重入合并段)时使用;用户口头说'提交/commit/push'时必须先确认,不得自动触发。
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=f856fd80a7929586; overlay=java; agent=cursor; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=6d5c0302ecfb368e; overlay=java; agent=cursor; do not edit -->
7
7
  # harness-submit — 最终提交(含 worktree 合并)
8
8
 
9
9
  ## Purpose
@@ -54,10 +54,11 @@ worktree 合并前必须运行 `harness_change.py integration-lock acquire --run
54
54
 
55
55
  ### 提交流程(步骤 0–7)
56
56
 
57
- 0. **启动准备** — `harness_context.py prepare --phase submit --executor <tool> [--change <id>] --json` 确定唯一变更与 executionRoot;`harness_context.py begin --phase submit --change <id> --executor <tool> --json` 校验 review→submit receipt;**`harness_gate.py begin --phase submit --change <id>`**;读 ledger,以 `harness_ledger.py diff-hash --repo <executionRoot> --base <baseCommit> --change-dir ".harness/changes/<change-name>" --json` 计算 diffHash + post-test 7 类分类(`executionRoot` 必须直接取准备回执;禁止手写 ledger / 手工 phase.end)
57
+ 0. **启动准备** — `harness_context.py prepare --project . --change <id> --phase submit --executor <tool> --json`(`--project` 必填)确定唯一变更与 executionRoot;`harness_context.py begin --project . --change <id> --phase submit --executor <tool> --json` 校验 review→submit receipt;**`harness_gate.py begin --phase submit --change <id>`**;读 ledger,以 `harness_ledger.py diff-hash --repo <executionRoot> --base <baseCommit> --change-dir ".harness/changes/<change-name>" --json` 计算 diffHash + post-test 7 类分类(`executionRoot` 必须直接取准备回执;禁止手写 ledger / 手工 phase.end)
58
58
  1. **合并最新代码** — 主目录与 worktree 均**不在业务工作区 stash/pull**;远端同步由合并段 integration transaction 在隔离 integration worktree 内完成(见「worktree 合并流程」);**正常路径禁止 `git stash` / `stash pop`**
59
59
  2. **最终验证** — ledger 复用优先;提交前只调用 `can-reuse --project . --profile-input unitTestFull --command <profile 规范命令>`。不得传入另一套 `--files`,不得把 runner 包装说明写进 `command`。`reuse=true` 时禁止重跑;只有真实输入、依赖、工具链或环境身份变化时才执行一次同一 profile 验证,并只登记一条结果。不要读取 ledger/archive 实现源码或临时编写散列脚本排查参数。
60
60
  - 无远端 CI 且 gate-policy 未强制 remote provider 时,验证通过/复用后运行 `harness_archive.py certify-local --change-dir ... --project . --json`,从同一 ledger 生成 `local-reproducible` 产品候选收据;该命令不执行测试。
61
+ - **被与本变更无关的预存失败卡住时的正规出路**:用 `harness_preflight.py record-quirk --project . --action skip-not-block --pattern "<具体错误签名,≥8 字符>" --reason "<为什么与本变更无关>"` 把它声明进 build-profile 的 `knownPreexistingErrors`,certify-local 会在**该失败的 ledger 证据里确实出现该签名**时放行,并把 `{validation, pattern, reason}` 写进收据的 `verification.preexistingExemptions` 留痕。**不得**改 gate-policy 的 `candidateVerification.requiredValidations` 来绕过——那是把门禁本身拆掉。声明了但证据对不上、或签名短到能匹配一切,仍然阻断。
61
62
  - gate-policy 要求 `remote-attested` 时不得降级成本地收据,等待远端 attestation。
62
63
  3. **.gitignore + 精确暂存** ⚠️ — 检查 `.harness/` 在 `.gitignore`;**禁止 `git add -A`**。若存在 `evidence/test-tracking.json`,先执行 `python <skills-root>/scripts/harness_test_guard.py stage --project . --change-dir ".harness/changes/<change-name>" --json`;失败即硬停止。无 manifest 时不使用 `-f`。manifest 之外的文件按精确业务路径正常暂存,**禁止全局 force-add**。
63
64
  4. **提交方式** — 主目录:blocking user confirmation 三选项(commit+push / 仅本地 / 取消);**worktree:固定仅本地 commit**
@@ -4,7 +4,7 @@ description: Use when the user asks to synchronize, refresh, or validate Harness
4
4
  metadata, adapters, remote knowledge ownership, instruction entrypoints,
5
5
  config origins, or CodeGraph status.
6
6
  ---
7
- <!-- generated by harness_deploy.py; core=f856fd80a7929586; overlay=java; agent=cursor; do not edit -->
7
+ <!-- generated by harness_deploy.py; core=6d5c0302ecfb368e; overlay=java; agent=cursor; do not edit -->
8
8
  # harness-sync
9
9
 
10
10
  ## Purpose
@@ -3,7 +3,7 @@ name: harness-test
3
3
  description: 测试执行:读取场景表,执行单元测试+API接口测试+数据兼容验证,输出测试报告。仅当用户显式调用 /harness-test
4
4
  时使用;不得在 run 结束后自动接续执行。
5
5
  ---
6
- <!-- generated by harness_deploy.py; core=f856fd80a7929586; overlay=java; agent=cursor; do not edit -->
6
+ <!-- generated by harness_deploy.py; core=6d5c0302ecfb368e; overlay=java; agent=cursor; do not edit -->
7
7
  # harness-test — 测试执行
8
8
 
9
9
  ## Purpose
@@ -85,7 +85,7 @@ Runner 强制同项目单实例、低调度优先级、逐命令超时、正常
85
85
 
86
86
  ### Phase 0:环境准备(主会话执行,需要交互确认)
87
87
 
88
- 先 `harness_context.py prepare --phase test --executor <tool> [--change <id>] --json`,再 `harness_context.py begin --phase test --change <id> --executor <tool> --json` 校验最新 run→test receipt 的 artifact/hash/HEAD;然后 **`harness_gate.py begin --phase test --change <id>`**(禁止手工 phase.start / 手写 ledger)。执行各项强制环境检查 + **命令执行模式 preflight (0.1)**;只有首选执行器不可用时,才执行 fallback 执行器探测。
88
+ 先 `harness_context.py prepare --project . --change <id> --phase test --executor <tool> --json`(`--project` 必填,漏了直接 argparse 报错),再 `harness_context.py begin --project . --change <id> --phase test --executor <tool> --json` 校验最新 run→test receipt 的 artifact/hash/HEAD;然后 **`harness_gate.py begin --phase test --change <id>`**(禁止手工 phase.start / 手写 ledger)。执行各项强制环境检查 + **命令执行模式 preflight (0.1)**;只有首选执行器不可用时,才执行 fallback 执行器探测。
89
89
 
90
90
  验证写入**仅**允许 `harness_ledger.py record` / `can-reuse`;禁止 Write/Edit `verification-ledger.json`。测试跟踪:gate begin → 执行(可选 `harness_test_guard.py mark stale-test-repair`)→ 单次 `harness_gate.py close`。`--to-phase` 取实际阶段计划的后继;Fixback 返回 run,普通流程可直接进入 Review、Submit 或 Archive。Fixback 只失效与改动文件相交的验证目标。
91
91
 
@@ -991,6 +991,62 @@ def migrate_legacy_candidate_evidence(
991
991
  return receipt
992
992
 
993
993
 
994
+ # 声明必须是具体的错误签名,不能是能匹配一切的短串。这个下限不是"安全边界"
995
+ # ——审计线索才是——但它挡住最省事的滥用写法。
996
+ _PREEXISTING_MIN_PATTERN = 8
997
+
998
+
999
+ def _known_preexisting_patterns(
1000
+ project_root: Path,
1001
+ ) -> tuple[list[dict[str, str]], list[dict[str, str]]]:
1002
+ """build-profile 里声明的预存失败签名,按"是否足够具体"分成两组。
1003
+
1004
+ `knownPreexistingErrors` 由 `harness_preflight.py record-quirk --action
1005
+ skip-not-block` 写入,此前没有任何消费方——于是预存失败在 certify-local 处
1006
+ 成为死结:要么去 gate-policy 降门禁,要么顺手改范围外的产品 bug。
1007
+ """
1008
+ path = project_root / ".harness" / "config" / "build-profile.json"
1009
+ if not path.is_file():
1010
+ return [], []
1011
+ try:
1012
+ profile = json.loads(path.read_text(encoding="utf-8-sig"))
1013
+ except (OSError, ValueError):
1014
+ return [], []
1015
+ declared = profile.get("knownPreexistingErrors") if isinstance(profile, dict) else None
1016
+ if not isinstance(declared, list):
1017
+ return [], []
1018
+ usable: list[dict[str, str]] = []
1019
+ vague: list[dict[str, str]] = []
1020
+ for item in declared:
1021
+ if not isinstance(item, dict) or item.get("action") != "skip-not-block":
1022
+ continue
1023
+ pattern = str(item.get("pattern") or "").strip()
1024
+ reason = str(item.get("reason") or "").strip()
1025
+ if not pattern or not reason:
1026
+ continue
1027
+ record = {"pattern": pattern, "reason": reason}
1028
+ (usable if len(pattern) >= _PREEXISTING_MIN_PATTERN else vague).append(record)
1029
+ return usable, vague
1030
+
1031
+
1032
+ def _match_preexisting(
1033
+ entry: dict[str, Any], patterns: list[dict[str, str]]
1034
+ ) -> dict[str, str] | None:
1035
+ """失败证据里是否确实出现了某个已声明签名。
1036
+
1037
+ 只看"声明过"是不够的——那等于声明一次豁免一切。必须是这一条失败的证据里
1038
+ 真的带着该签名,声明与现场才对得上。
1039
+ """
1040
+ evidence = entry.get("evidence")
1041
+ haystack = evidence if isinstance(evidence, str) else json.dumps(
1042
+ evidence, ensure_ascii=False, sort_keys=True
1043
+ )
1044
+ for record in patterns:
1045
+ if record["pattern"] in haystack:
1046
+ return record
1047
+ return None
1048
+
1049
+
994
1050
  def certify_local_candidate(
995
1051
  change_dir: Path,
996
1052
  *,
@@ -1029,14 +1085,28 @@ def certify_local_candidate(
1029
1085
  required = ["unitTestFull"]
1030
1086
  required = [str(item).strip() for item in required if str(item).strip()]
1031
1087
 
1088
+ usable_patterns, vague_patterns = _known_preexisting_patterns(project_root)
1089
+
1032
1090
  selected: list[dict[str, Any]] = []
1091
+ exemptions: list[dict[str, Any]] = []
1033
1092
  for name in required:
1034
1093
  entry = validations.get(name)
1035
1094
  if not isinstance(entry, dict):
1036
1095
  raise ValueError(f"required validation missing: {name}")
1037
1096
  missing: list[str] = []
1097
+ exempted = None
1038
1098
  if str(entry.get("status") or "").upper() != "OK":
1039
- missing.append("status=OK")
1099
+ exempted = _match_preexisting(entry, usable_patterns)
1100
+ if exempted is None:
1101
+ vague = _match_preexisting(entry, vague_patterns)
1102
+ if vague is not None:
1103
+ raise ValueError(
1104
+ f"required validation {name} failed and the declared "
1105
+ f"knownPreexistingErrors pattern {vague['pattern']!r} is too "
1106
+ "generic to identify it; declare the specific error signature "
1107
+ f"(at least {_PREEXISTING_MIN_PATTERN} characters)"
1108
+ )
1109
+ missing.append("status=OK")
1040
1110
  for field in (
1041
1111
  "command",
1042
1112
  "evidence",
@@ -1048,6 +1118,15 @@ def certify_local_candidate(
1048
1118
  raise ValueError(
1049
1119
  f"required validation {name} is incomplete: {', '.join(missing)}"
1050
1120
  )
1121
+ if exempted is not None:
1122
+ exemptions.append(
1123
+ {
1124
+ "validation": name,
1125
+ "status": str(entry.get("status") or "").upper(),
1126
+ "pattern": exempted["pattern"],
1127
+ "reason": exempted["reason"],
1128
+ }
1129
+ )
1051
1130
  selected.append(
1052
1131
  {
1053
1132
  "name": name,
@@ -1160,6 +1239,8 @@ def certify_local_candidate(
1160
1239
  {str(item["inputsHash"]) for item in selected}
1161
1240
  ),
1162
1241
  "logHashes": sorted({str(item["logHash"]) for item in selected}),
1242
+ # 豁免必须随收据一起留痕,否则事后无法把它与干净通过区分开
1243
+ "preexistingExemptions": exemptions,
1163
1244
  },
1164
1245
  }
1165
1246
  if rebound_from_commit is not None:
@@ -304,12 +304,23 @@ def _compact_record_payload(payload: dict[str, Any]) -> dict[str, Any]:
304
304
 
305
305
 
306
306
  def _compact_can_reuse_payload(payload: dict[str, Any]) -> dict[str, Any]:
307
- """C5: can-reuse compact — ok/reuse/code only."""
308
- return {
307
+ """C5: can-reuse compact — ok/reuse/code;拒绝复用时附带可执行的原因。
308
+
309
+ 只回 ok/reuse/code 时,调用方拿到裸 `{"reuse": false}` 无从判断该怎么办,
310
+ 只能再跑一次 `--verbose`——原因(profile 缺 verificationInputs、证据不完整等)
311
+ 是单行短文本,值得留在默认输出里。允许复用时保持原样精简。
312
+ """
313
+ compact = {
309
314
  "ok": payload.get("ok", True),
310
315
  "reuse": payload.get("reuse"),
311
316
  "code": payload.get("code"),
312
317
  }
318
+ if payload.get("reuse") is not True:
319
+ for key in ("reason", "executionNeed", "detail"):
320
+ value = payload.get(key)
321
+ if value not in (None, "", [], {}):
322
+ compact[key] = value
323
+ return compact
313
324
 
314
325
 
315
326
  def emit_compact_or_verbose(
@@ -2581,9 +2592,19 @@ def cmd_record(args: argparse.Namespace) -> int:
2581
2592
  error_code="PROFILE_INPUT_FILES_CONFLICT",
2582
2593
  )
2583
2594
  files = profile_files
2584
- if not files:
2595
+ # NOT_APPLICABLE 的 validation 没有输入文件可言。门禁 close 又要求
2596
+ # requiredValidations 每项都有 entry——两条规则叠加会逼调用方拿无关文件凑数,
2597
+ # ledger 从此声称该 validation 的输入是那些文件,是假证据。
2598
+ not_applicable = str(getattr(args, "applicability", "") or "") == "NOT_APPLICABLE"
2599
+ if not files and not not_applicable:
2600
+ return emit_error(
2601
+ "record requires --files or a non-empty --profile-input file set; "
2602
+ "unless --applicability NOT_APPLICABLE (then --applicability-reason is required)",
2603
+ as_json=as_json,
2604
+ )
2605
+ if not_applicable and not _nonempty_str(getattr(args, "applicability_reason", None)):
2585
2606
  return emit_error(
2586
- "record requires --files or a non-empty --profile-input file set",
2607
+ "NOT_APPLICABLE requires --applicability-reason",
2587
2608
  as_json=as_json,
2588
2609
  )
2589
2610
 
@@ -1101,6 +1101,43 @@ def _derive_verification_graph(profile: dict[str, Any]) -> None:
1101
1101
  }
1102
1102
 
1103
1103
 
1104
+ def manual_profile_template(
1105
+ excluded: tuple[str, ...] | list[str], components: list[str]
1106
+ ) -> dict[str, Any]:
1107
+ """歧义时交给调用方的可填骨架。
1108
+
1109
+ 骨架本身就是 `empty_profile_skeleton`——defaultsFingerprint、excludedRoots
1110
+ 默认集、commands/verificationInputs/verificationGraph 的键都已就位;这里只是
1111
+ 补上 commands 的条目形状与 requiredCoverage 取值,省掉调用方去源码里翻。
1112
+ 占位值用 `<...>` 包裹,便于替换后 grep 自检。
1113
+ """
1114
+ template = empty_profile_skeleton(excluded)
1115
+ template["projectType"] = (
1116
+ f"<从 detectedComponents 选定:{'|'.join(components)}>" if components else "<项目类型>"
1117
+ )
1118
+ template["commands"] = {
1119
+ "unitTest": {
1120
+ "command": "<在项目根可直接执行的增量测试命令>",
1121
+ "scope": "incremental",
1122
+ "inputs": ["<相对项目根的 glob,如 <component>/test/**>"],
1123
+ "coverage": "unitTest",
1124
+ "requiredCoverage": "incremental",
1125
+ "dependsOn": [],
1126
+ "source": "user",
1127
+ },
1128
+ "unitTestFull": {
1129
+ "command": "<在项目根可直接执行的全量测试命令>",
1130
+ "scope": "full",
1131
+ "inputs": ["<相对项目根的 glob,如 <component>/**>"],
1132
+ "coverage": "unitTestFull",
1133
+ "requiredCoverage": "module",
1134
+ "dependsOn": [],
1135
+ "source": "user",
1136
+ },
1137
+ }
1138
+ return template
1139
+
1140
+
1104
1141
  def detect(project: Path) -> dict[str, Any]:
1105
1142
  project = project.resolve()
1106
1143
  existing = load_profile(project)
@@ -1120,6 +1157,14 @@ def detect(project: Path) -> dict[str, Any]:
1120
1157
  "applied": False,
1121
1158
  "detectedComponents": components,
1122
1159
  "message": "multiple or nested project components require an explicit profile",
1160
+ # 拒绝生成可以,但不能连结构都不给:调用方否则只能反读本文件源码去凑
1161
+ # v3 形状。骨架不落盘——一份占位 profile 看起来"已配好"比没有更糟。
1162
+ "profileTemplate": manual_profile_template(excluded, components),
1163
+ "hint": (
1164
+ "手工声明一份 profile:以 profileTemplate 为骨架,按 detectedComponents "
1165
+ "选定产品包,commands 里的 inputs 用相对项目根的 glob(如 "
1166
+ f"'<component>/test/**'),填好后写入 {project / PROFILE_REL}"
1167
+ ),
1123
1168
  }
1124
1169
  if project_type == "unknown" and existing:
1125
1170
  return {
@@ -2,7 +2,7 @@
2
2
  "schema_version": 2,
3
3
  "profile": "general",
4
4
  "adapter": "claude-code",
5
- "bundle_version": "0.2.62",
5
+ "bundle_version": "0.2.63",
6
6
  "requires": {
7
7
  "minimumCliVersion": "0.2.83",
8
8
  "capabilities": [
@@ -25,7 +25,7 @@
25
25
  "files": [
26
26
  {
27
27
  "path": ".harness-build.json",
28
- "sha256": "d9f35544ff9f74b44a07ac9b8ae6dc3ecf9aaf2f366e13002efea6f20f644f0c"
28
+ "sha256": "508071a88969f33e65aeaacb12b44b31549e7ad10961e526f7837adaddf4a680"
29
29
  },
30
30
  {
31
31
  "path": "agents/harness-evaluator.md",
@@ -97,7 +97,7 @@
97
97
  },
98
98
  {
99
99
  "path": "harness-archive/SKILL.md",
100
- "sha256": "99ddcf685d9018eddc846349f79510fa59700e06af332b2df48dbbcb839af002"
100
+ "sha256": "9f8787c11e0f438a5c99b48b43d2d34c1c9b8a0f06b5aae224a79a6d3fa296b2"
101
101
  },
102
102
  {
103
103
  "path": "harness-archive/templates/summary-data-template.json",
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "path": "harness-codebase-map/SKILL.md",
116
- "sha256": "9f73cbb074cc5c54db6a772622a1adc241c1334f7e16c982648186dc37f6c436"
116
+ "sha256": "99f0391decb569498e33828c4641b8b92ccde2ac73b99b8514ab5178b7ed30f4"
117
117
  },
118
118
  {
119
119
  "path": "harness-codebase-map/templates/ARCHITECTURE.md",
@@ -153,11 +153,11 @@
153
153
  },
154
154
  {
155
155
  "path": "harness-knowledge-ingest/SKILL.md",
156
- "sha256": "03182c4ea100bb48a7ffa595dac1dc92106efb71da7d26b6c899b83c6c1d6553"
156
+ "sha256": "6399b98f5a67131e4e00c9545f68bedee451f87c4a636cfbeea4b9acfd47417b"
157
157
  },
158
158
  {
159
159
  "path": "harness-knowledge-query/SKILL.md",
160
- "sha256": "305b8a05b1badf948ffa31d3085604383ff64cc4e215918261a27392f6066cc0"
160
+ "sha256": "17f53253cc1af6792c93ab9fe3f119a5713e32e33e43d33073567ca61875f2a3"
161
161
  },
162
162
  {
163
163
  "path": "harness-plan/checklist.md",
@@ -173,15 +173,15 @@
173
173
  },
174
174
  {
175
175
  "path": "harness-plan/SKILL.md",
176
- "sha256": "1c057efcdd31c03b44c8641067e7115732dfd6f0b8778224515bcbdfa5b3f7e3"
176
+ "sha256": "cea38c85d519d47e836f67ed2baf878c1e9330c3e592df3af48a136f9303eb0a"
177
177
  },
178
178
  {
179
179
  "path": "harness-pull/SKILL.md",
180
- "sha256": "7de117584827afe783f4b1f7920c6cd056b845ff25d22519c1863ac59bc940a1"
180
+ "sha256": "039ce1febbe454a4c6d5a31178bfa9ce6833f2f6cf622a76dcad94af694475e0"
181
181
  },
182
182
  {
183
183
  "path": "harness-push/SKILL.md",
184
- "sha256": "777e071dbf7505c796c7e6d83ea1c3698d9b60b69a44ea4383c61ee25bae8fa7"
184
+ "sha256": "48ea504e400c5836807f6031d46cb0d2d87d3e10e66753d4b0bcb919581d3958"
185
185
  },
186
186
  {
187
187
  "path": "harness-review/checklist.md",
@@ -197,7 +197,7 @@
197
197
  },
198
198
  {
199
199
  "path": "harness-review/SKILL.md",
200
- "sha256": "58f7ac2a668551202c434f62d647030049447d048c78206d4e32aca0901b4d73"
200
+ "sha256": "544d6b2bd611501887479409be632e6bde8cb4a308dcd87e19ff492d92282b7c"
201
201
  },
202
202
  {
203
203
  "path": "harness-run/checklist.md",
@@ -213,7 +213,7 @@
213
213
  },
214
214
  {
215
215
  "path": "harness-run/SKILL.md",
216
- "sha256": "1408e8b112356317efa283c57d393d06a898929c4cfd2072679700bc9715fe37"
216
+ "sha256": "13f883dbc20d001e677c58e091437a2a7994eba7360fe77461b4935c227ae35d"
217
217
  },
218
218
  {
219
219
  "path": "harness-submit/checklist.md",
@@ -225,7 +225,7 @@
225
225
  },
226
226
  {
227
227
  "path": "harness-submit/SKILL.md",
228
- "sha256": "8f8ce128909a19a64e7ca1ab000e31eb5f88191b8ff14de00b1b36ad1c766386"
228
+ "sha256": "8e20be97b57cc9d65b170d5de648e6ccc8052bce72a7f35b6a2ea794fdbf3e22"
229
229
  },
230
230
  {
231
231
  "path": "harness-sync/reference.md",
@@ -233,11 +233,11 @@
233
233
  },
234
234
  {
235
235
  "path": "harness-sync/SKILL.md",
236
- "sha256": "ef000e9678579ea6ef54659e27cc388a395010dcf5cf6828d832eb0b3d6098b8"
236
+ "sha256": "d0ef3c9780b716fec23a80e8a60fc8727d1a7bed72819fbd02ee6bc963233cab"
237
237
  },
238
238
  {
239
239
  "path": "harness-test/checklist.md",
240
- "sha256": "b61055fdb7e22a53160bc66cba91b8d842bee501d50bd2122dae5849f2e9cf71"
240
+ "sha256": "5e10dccc5445ed047187116c3d865c0b12e200f06bc24f1330afdb470a8de03e"
241
241
  },
242
242
  {
243
243
  "path": "harness-test/pitfalls-java.md",
@@ -257,7 +257,7 @@
257
257
  },
258
258
  {
259
259
  "path": "harness-test/SKILL.md",
260
- "sha256": "5b81b3dbaac69c614af08799b020b315da8b20edd80a570646aaa3f571a173e4"
260
+ "sha256": "8782c417c4abc5f39079555e880f0717b71ff7ab4a9df486f24dc787b1bf4c06"
261
261
  },
262
262
  {
263
263
  "path": "protocols/archive-report-protocol.md",
@@ -329,7 +329,7 @@
329
329
  },
330
330
  {
331
331
  "path": "scripts/harness_archive.py",
332
- "sha256": "f029938af890198a737d6fea746a9f5ed885f8c32a462a63cac79dbb0f0b8be0"
332
+ "sha256": "c3d565456f7bc441dbd7d58541e49b698381c594b874ff186e8ff62ac1efc67e"
333
333
  },
334
334
  {
335
335
  "path": "scripts/harness_change.py",
@@ -385,7 +385,7 @@
385
385
  },
386
386
  {
387
387
  "path": "scripts/harness_ledger.py",
388
- "sha256": "5e5787ee891f9e41e815f487422946fc78b2242b78a01e232e0132782f887c6b"
388
+ "sha256": "239d80d9d2c448e5bc8e456df517ad2b2f70281f9de10cf167d53085c6cecaf2"
389
389
  },
390
390
  {
391
391
  "path": "scripts/harness_migration_head.py",
@@ -421,7 +421,7 @@
421
421
  },
422
422
  {
423
423
  "path": "scripts/harness_profile.py",
424
- "sha256": "9a10e62c52a7c84bf373bfb4aff18b2d51bfae6fd0ca75ef5ad7c87d22059e85"
424
+ "sha256": "ca279d53b63c5e589833106b82ce0d3f2b0659e8c218b0fa3bf2d0933d4f9af0"
425
425
  },
426
426
  {
427
427
  "path": "scripts/harness_report_model.py",
@@ -2,7 +2,7 @@
2
2
  "schema_version": 2,
3
3
  "profile": "general",
4
4
  "adapter": "codebuddy",
5
- "bundle_version": "0.2.62",
5
+ "bundle_version": "0.2.63",
6
6
  "requires": {
7
7
  "minimumCliVersion": "0.2.83",
8
8
  "capabilities": [
@@ -25,7 +25,7 @@
25
25
  "files": [
26
26
  {
27
27
  "path": ".harness-build.json",
28
- "sha256": "edef5b656a14982354c320170e73ed12f59fe50545f1d0d486b37fcccc658c61"
28
+ "sha256": "b43d7cca40bde8b1d064df982fa6c6c61c557e4235089f9254d2e48ae3abd9a0"
29
29
  },
30
30
  {
31
31
  "path": "agents/harness-evaluator.md",
@@ -97,7 +97,7 @@
97
97
  },
98
98
  {
99
99
  "path": "harness-archive/SKILL.md",
100
- "sha256": "7fd36b6f3af4f910c60c89befd686ad66bdce572df3c352fa4506b9e0bf5d2c6"
100
+ "sha256": "5c8b4d0406f1c3d7be792905b46eef071ea0e3585125020893afe21cbc9dca22"
101
101
  },
102
102
  {
103
103
  "path": "harness-archive/templates/summary-data-template.json",
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "path": "harness-codebase-map/SKILL.md",
116
- "sha256": "e61e629df793e80331a300f75e7e3c3e88b2139c30594d22fbade9151dc855cd"
116
+ "sha256": "0fb71a136ea578b317c5b1705751c27277ef93b5a5cdb9d3dbf7c9afab82595d"
117
117
  },
118
118
  {
119
119
  "path": "harness-codebase-map/templates/ARCHITECTURE.md",
@@ -153,11 +153,11 @@
153
153
  },
154
154
  {
155
155
  "path": "harness-knowledge-ingest/SKILL.md",
156
- "sha256": "126f7e35d69c61b4b76741d70ad093ad463ed7424d832ae32d8f44836dda57f8"
156
+ "sha256": "33a3c0c41724b73061ef56bed9d151f497b165bac87d2da606863c47b10198a2"
157
157
  },
158
158
  {
159
159
  "path": "harness-knowledge-query/SKILL.md",
160
- "sha256": "2f0164eec1c0d61051f27aaa2f409d554a0d5b27ffc2e004aaa6b662cb02eb69"
160
+ "sha256": "88c80cd1f8eba31ffbd95d08a47e1f94995cf881b6103b79354473526a9e934a"
161
161
  },
162
162
  {
163
163
  "path": "harness-plan/checklist.md",
@@ -173,15 +173,15 @@
173
173
  },
174
174
  {
175
175
  "path": "harness-plan/SKILL.md",
176
- "sha256": "36e59034111d9dc5f851d1968e88c0486d6632fde5dc85aef4eda471c6cfe941"
176
+ "sha256": "1bc47a6b3981893b4082c2466f136211ba84bbf89ce211868d82f1dd6ae69b60"
177
177
  },
178
178
  {
179
179
  "path": "harness-pull/SKILL.md",
180
- "sha256": "4d9b294685d9350cd3a1e661796c7ffc98909829d2f0fc7ea81cd871c1f76994"
180
+ "sha256": "7ae616fbdbb520cfc6b36b9fac6ce66e2fa1deec71f94afbbaba7444ef86c7dd"
181
181
  },
182
182
  {
183
183
  "path": "harness-push/SKILL.md",
184
- "sha256": "c2e6375071ad81b29834a11504b849213041969fe738c10d94acb11cbaef223b"
184
+ "sha256": "aba016e3fa4380ce02fad6bc4ae2be23467e5f2f5903102360f666e67eea80d6"
185
185
  },
186
186
  {
187
187
  "path": "harness-review/checklist.md",
@@ -197,7 +197,7 @@
197
197
  },
198
198
  {
199
199
  "path": "harness-review/SKILL.md",
200
- "sha256": "c462822aefa896765aa7ad37035fd691fdd359679c5f6f8fe171a61c97f1ccde"
200
+ "sha256": "ce8af843e30d03729fbca5b4758190647a30dd0b622c0e5a37749782b8e29c92"
201
201
  },
202
202
  {
203
203
  "path": "harness-run/checklist.md",
@@ -213,7 +213,7 @@
213
213
  },
214
214
  {
215
215
  "path": "harness-run/SKILL.md",
216
- "sha256": "2e8c2f68dec3f9907341508c6fa1c35abcaafa64ac3b9cbfcd1cf21beeca049f"
216
+ "sha256": "bc714ae34ed2a063cf98f636aa69174fad72865b8db7f8597818667867409c94"
217
217
  },
218
218
  {
219
219
  "path": "harness-submit/checklist.md",
@@ -225,7 +225,7 @@
225
225
  },
226
226
  {
227
227
  "path": "harness-submit/SKILL.md",
228
- "sha256": "e1397d38a1fac9513d77fbc6a415ddea802978f93800bd6602366de115003bb8"
228
+ "sha256": "99759111a3a2dd8727610bf773b83824c788462d46fa92dbf3541583f680a6cc"
229
229
  },
230
230
  {
231
231
  "path": "harness-sync/reference.md",
@@ -233,11 +233,11 @@
233
233
  },
234
234
  {
235
235
  "path": "harness-sync/SKILL.md",
236
- "sha256": "439337c90f38513abe1e6167679851e03ed6e08218469019d53e8db2a4d9d8c7"
236
+ "sha256": "2af992431dffd1b0139523c7489e8c6a709436787f6039607c2876ef219a1012"
237
237
  },
238
238
  {
239
239
  "path": "harness-test/checklist.md",
240
- "sha256": "b61055fdb7e22a53160bc66cba91b8d842bee501d50bd2122dae5849f2e9cf71"
240
+ "sha256": "5e10dccc5445ed047187116c3d865c0b12e200f06bc24f1330afdb470a8de03e"
241
241
  },
242
242
  {
243
243
  "path": "harness-test/pitfalls-java.md",
@@ -257,7 +257,7 @@
257
257
  },
258
258
  {
259
259
  "path": "harness-test/SKILL.md",
260
- "sha256": "287b5c75d38d462f428e7086c2d595e04aefbc6a3901c797c66079ec9eda02a5"
260
+ "sha256": "f38520b1f0bd2ec78d291ee3f5c923e926916fe5807e8a724e6b75c1a2221fa4"
261
261
  },
262
262
  {
263
263
  "path": "protocols/archive-report-protocol.md",
@@ -329,7 +329,7 @@
329
329
  },
330
330
  {
331
331
  "path": "scripts/harness_archive.py",
332
- "sha256": "f029938af890198a737d6fea746a9f5ed885f8c32a462a63cac79dbb0f0b8be0"
332
+ "sha256": "c3d565456f7bc441dbd7d58541e49b698381c594b874ff186e8ff62ac1efc67e"
333
333
  },
334
334
  {
335
335
  "path": "scripts/harness_change.py",
@@ -385,7 +385,7 @@
385
385
  },
386
386
  {
387
387
  "path": "scripts/harness_ledger.py",
388
- "sha256": "5e5787ee891f9e41e815f487422946fc78b2242b78a01e232e0132782f887c6b"
388
+ "sha256": "239d80d9d2c448e5bc8e456df517ad2b2f70281f9de10cf167d53085c6cecaf2"
389
389
  },
390
390
  {
391
391
  "path": "scripts/harness_migration_head.py",
@@ -421,7 +421,7 @@
421
421
  },
422
422
  {
423
423
  "path": "scripts/harness_profile.py",
424
- "sha256": "9a10e62c52a7c84bf373bfb4aff18b2d51bfae6fd0ca75ef5ad7c87d22059e85"
424
+ "sha256": "ca279d53b63c5e589833106b82ce0d3f2b0659e8c218b0fa3bf2d0933d4f9af0"
425
425
  },
426
426
  {
427
427
  "path": "scripts/harness_report_model.py",