@hunter-harness/workflow-harness 0.2.23 → 0.2.25

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 (198) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/README.md +2 -2
  3. package/harness/bundles/general/claude-code/agents/harness-evaluator.md +4 -4
  4. package/harness/bundles/general/claude-code/agents/harness-explorer.md +2 -2
  5. package/harness/bundles/general/claude-code/agents/harness-reviewer.md +2 -2
  6. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
  7. package/harness/bundles/general/claude-code/harness-archive/templates/render-summary.mjs +6 -4
  8. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  10. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  11. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +7 -4
  12. package/harness/bundles/general/claude-code/harness-plan/checklist.md +12 -17
  13. package/harness/bundles/general/claude-code/harness-plan/reference.md +7 -19
  14. package/harness/bundles/general/claude-code/harness-review/SKILL.md +3 -3
  15. package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
  16. package/harness/bundles/general/claude-code/harness-run/protocols.md +3 -3
  17. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
  18. package/harness/bundles/general/claude-code/harness-submit/checklist.md +8 -2
  19. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
  20. package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
  21. package/harness/bundles/general/claude-code/scripts/harness_archive.py +124 -17
  22. package/harness/bundles/general/claude-code/scripts/harness_deploy.py +22 -3
  23. package/harness/bundles/general/claude-code/scripts/harness_integration.py +77 -2
  24. package/harness/bundles/general/claude-code/scripts/harness_preflight.py +50 -29
  25. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  26. package/harness/bundles/general/codebuddy/README.md +2 -2
  27. package/harness/bundles/general/codebuddy/agents/harness-evaluator.md +5 -6
  28. package/harness/bundles/general/codebuddy/agents/harness-explorer.md +3 -3
  29. package/harness/bundles/general/codebuddy/agents/harness-reviewer.md +3 -5
  30. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
  31. package/harness/bundles/general/codebuddy/harness-archive/templates/render-summary.mjs +6 -4
  32. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  33. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  34. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  35. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +7 -4
  36. package/harness/bundles/general/codebuddy/harness-plan/checklist.md +12 -17
  37. package/harness/bundles/general/codebuddy/harness-plan/reference.md +7 -19
  38. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +3 -3
  39. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
  40. package/harness/bundles/general/codebuddy/harness-run/protocols.md +3 -3
  41. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
  42. package/harness/bundles/general/codebuddy/harness-submit/checklist.md +8 -2
  43. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
  44. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
  45. package/harness/bundles/general/codebuddy/scripts/harness_archive.py +124 -17
  46. package/harness/bundles/general/codebuddy/scripts/harness_deploy.py +22 -3
  47. package/harness/bundles/general/codebuddy/scripts/harness_integration.py +77 -2
  48. package/harness/bundles/general/codebuddy/scripts/harness_preflight.py +50 -29
  49. package/harness/bundles/general/codex/.harness-build.json +1 -1
  50. package/harness/bundles/general/codex/README.md +2 -2
  51. package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
  52. package/harness/bundles/general/codex/harness-archive/templates/render-summary.mjs +6 -4
  53. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  54. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
  55. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  56. package/harness/bundles/general/codex/harness-plan/SKILL.md +7 -5
  57. package/harness/bundles/general/codex/harness-plan/checklist.md +12 -17
  58. package/harness/bundles/general/codex/harness-plan/reference.md +7 -19
  59. package/harness/bundles/general/codex/harness-review/SKILL.md +2 -2
  60. package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
  61. package/harness/bundles/general/codex/harness-run/protocols.md +3 -3
  62. package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
  63. package/harness/bundles/general/codex/harness-submit/checklist.md +8 -2
  64. package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
  65. package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
  66. package/harness/bundles/general/codex/scripts/harness_archive.py +124 -17
  67. package/harness/bundles/general/codex/scripts/harness_deploy.py +22 -3
  68. package/harness/bundles/general/codex/scripts/harness_integration.py +77 -2
  69. package/harness/bundles/general/codex/scripts/harness_preflight.py +50 -29
  70. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  71. package/harness/bundles/general/cursor/README.md +2 -2
  72. package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
  73. package/harness/bundles/general/cursor/harness-archive/templates/render-summary.mjs +6 -4
  74. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  75. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  76. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  77. package/harness/bundles/general/cursor/harness-plan/SKILL.md +7 -5
  78. package/harness/bundles/general/cursor/harness-plan/checklist.md +12 -17
  79. package/harness/bundles/general/cursor/harness-plan/reference.md +7 -19
  80. package/harness/bundles/general/cursor/harness-review/SKILL.md +2 -2
  81. package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
  82. package/harness/bundles/general/cursor/harness-run/protocols.md +3 -3
  83. package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
  84. package/harness/bundles/general/cursor/harness-submit/checklist.md +8 -2
  85. package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
  86. package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
  87. package/harness/bundles/general/cursor/scripts/harness_archive.py +124 -17
  88. package/harness/bundles/general/cursor/scripts/harness_deploy.py +22 -3
  89. package/harness/bundles/general/cursor/scripts/harness_integration.py +77 -2
  90. package/harness/bundles/general/cursor/scripts/harness_preflight.py +50 -29
  91. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  92. package/harness/bundles/java/claude-code/README.md +2 -2
  93. package/harness/bundles/java/claude-code/agents/harness-evaluator.md +4 -4
  94. package/harness/bundles/java/claude-code/agents/harness-explorer.md +2 -2
  95. package/harness/bundles/java/claude-code/agents/harness-reviewer.md +2 -2
  96. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  97. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
  98. package/harness/bundles/java/claude-code/harness-archive/templates/render-summary.mjs +6 -4
  99. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  100. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  101. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  102. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  103. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +7 -4
  104. package/harness/bundles/java/claude-code/harness-plan/checklist.md +12 -17
  105. package/harness/bundles/java/claude-code/harness-plan/reference.md +7 -19
  106. package/harness/bundles/java/claude-code/harness-review/SKILL.md +3 -3
  107. package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
  108. package/harness/bundles/java/claude-code/harness-run/protocols.md +3 -3
  109. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
  110. package/harness/bundles/java/claude-code/harness-submit/checklist.md +8 -2
  111. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
  112. package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
  113. package/harness/bundles/java/claude-code/scripts/harness_archive.py +124 -17
  114. package/harness/bundles/java/claude-code/scripts/harness_deploy.py +22 -3
  115. package/harness/bundles/java/claude-code/scripts/harness_integration.py +77 -2
  116. package/harness/bundles/java/claude-code/scripts/harness_preflight.py +50 -29
  117. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  118. package/harness/bundles/java/codebuddy/README.md +2 -2
  119. package/harness/bundles/java/codebuddy/agents/harness-evaluator.md +5 -6
  120. package/harness/bundles/java/codebuddy/agents/harness-explorer.md +3 -3
  121. package/harness/bundles/java/codebuddy/agents/harness-reviewer.md +3 -5
  122. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  123. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
  124. package/harness/bundles/java/codebuddy/harness-archive/templates/render-summary.mjs +6 -4
  125. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  126. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  127. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  128. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  129. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +7 -4
  130. package/harness/bundles/java/codebuddy/harness-plan/checklist.md +12 -17
  131. package/harness/bundles/java/codebuddy/harness-plan/reference.md +7 -19
  132. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +3 -3
  133. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
  134. package/harness/bundles/java/codebuddy/harness-run/protocols.md +3 -3
  135. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
  136. package/harness/bundles/java/codebuddy/harness-submit/checklist.md +8 -2
  137. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
  138. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
  139. package/harness/bundles/java/codebuddy/scripts/harness_archive.py +124 -17
  140. package/harness/bundles/java/codebuddy/scripts/harness_deploy.py +22 -3
  141. package/harness/bundles/java/codebuddy/scripts/harness_integration.py +77 -2
  142. package/harness/bundles/java/codebuddy/scripts/harness_preflight.py +50 -29
  143. package/harness/bundles/java/codex/.harness-build.json +1 -1
  144. package/harness/bundles/java/codex/README.md +2 -2
  145. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  146. package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
  147. package/harness/bundles/java/codex/harness-archive/templates/render-summary.mjs +6 -4
  148. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  149. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
  150. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  151. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  152. package/harness/bundles/java/codex/harness-plan/SKILL.md +7 -5
  153. package/harness/bundles/java/codex/harness-plan/checklist.md +12 -17
  154. package/harness/bundles/java/codex/harness-plan/reference.md +7 -19
  155. package/harness/bundles/java/codex/harness-review/SKILL.md +2 -2
  156. package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
  157. package/harness/bundles/java/codex/harness-run/protocols.md +3 -3
  158. package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
  159. package/harness/bundles/java/codex/harness-submit/checklist.md +8 -2
  160. package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
  161. package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
  162. package/harness/bundles/java/codex/scripts/harness_archive.py +124 -17
  163. package/harness/bundles/java/codex/scripts/harness_deploy.py +22 -3
  164. package/harness/bundles/java/codex/scripts/harness_integration.py +77 -2
  165. package/harness/bundles/java/codex/scripts/harness_preflight.py +50 -29
  166. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  167. package/harness/bundles/java/cursor/README.md +2 -2
  168. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  169. package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
  170. package/harness/bundles/java/cursor/harness-archive/templates/render-summary.mjs +6 -4
  171. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  172. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  173. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  174. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  175. package/harness/bundles/java/cursor/harness-plan/SKILL.md +7 -5
  176. package/harness/bundles/java/cursor/harness-plan/checklist.md +12 -17
  177. package/harness/bundles/java/cursor/harness-plan/reference.md +7 -19
  178. package/harness/bundles/java/cursor/harness-review/SKILL.md +2 -2
  179. package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
  180. package/harness/bundles/java/cursor/harness-run/protocols.md +3 -3
  181. package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
  182. package/harness/bundles/java/cursor/harness-submit/checklist.md +8 -2
  183. package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
  184. package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
  185. package/harness/bundles/java/cursor/scripts/harness_archive.py +124 -17
  186. package/harness/bundles/java/cursor/scripts/harness_deploy.py +22 -3
  187. package/harness/bundles/java/cursor/scripts/harness_integration.py +77 -2
  188. package/harness/bundles/java/cursor/scripts/harness_preflight.py +50 -29
  189. package/harness/manifests/general/claude-code.json +25 -25
  190. package/harness/manifests/general/codebuddy.json +25 -25
  191. package/harness/manifests/general/codex.json +22 -22
  192. package/harness/manifests/general/cursor.json +22 -22
  193. package/harness/manifests/java/claude-code.json +27 -27
  194. package/harness/manifests/java/codebuddy.json +27 -27
  195. package/harness/manifests/java/codex.json +24 -24
  196. package/harness/manifests/java/cursor.json +24 -24
  197. package/hunter-workflow-family.json +2 -2
  198. package/package.json +1 -1
@@ -367,7 +367,13 @@ python harness/scripts/harness_integration.py verify --change <change-name> --ru
367
367
 
368
368
  任一命令非零退出 → step FAILED,不进入 push。
369
369
 
370
- **写 check-ok marker**(npm run check exit 0 后强制):
370
+ **产品候选证据门槛**:
371
+
372
+ - 项目存在远端 CI:本地 push 只运行有界静态门槛,push 后必须取得当前候选 commit 的 CI 绿灯,才能归档或发布。
373
+ - 项目没有远端 CI:在候选 commit 对应的同一棵 tree 上完整执行 resolved check;成功后写本地候选收据。收据必须同时匹配时间、命令和 tree hash,不接受口头声明或旧提交结果。
374
+ - 不得在 pre-push 中无条件重复全量测试;失败后不自动重跑,先报告失败阶段与残留进程。
375
+
376
+ **写 check-ok marker**(`npm run check` exit 0 后强制;无 CI 项目以此作为产品候选绿灯证据):
371
377
 
372
378
  ```powershell
373
379
  node scripts/check-gate.mjs --write
@@ -375,7 +381,7 @@ node scripts/check-gate.mjs --write
375
381
 
376
382
  ### 步骤 M5:push
377
383
 
378
- **硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` `npm run check` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
384
+ **硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` 跑有界 `check:push` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
379
385
 
380
386
  ```powershell
381
387
  python harness/scripts/harness_integration.py push --change <change-name> --run-id <run-id> --feature-branch harness/<change-name> --target-branch <主分支> --temp-root <task-temp>
@@ -2,7 +2,7 @@
2
2
  name: harness-sync
3
3
  description: 检查并更新项目AI元数据(CodeGraph索引、harness-codebase-map分析、CLAUDE.md、AGENTS.md、.harness/完整性),确保Claude对代码库的理解与最新代码一致。当用户说'同步/更新索引/刷新元数据/检查一致性'时使用
4
4
  ---
5
- <!-- generated by harness_deploy.py; core=15bd13873bb3fb8f; overlay=none; agent=cursor; do not edit -->
5
+ <!-- generated by harness_deploy.py; core=170e634f2d9f865c; overlay=none; agent=cursor; do not edit -->
6
6
  # harness-sync — 元数据同步
7
7
 
8
8
  ## Purpose
@@ -2,7 +2,7 @@
2
2
  name: harness-test
3
3
  description: 测试执行:读取场景表,执行单元测试+API接口测试+数据兼容验证,输出测试报告。当用户说'跑测试/验证/跑用例/接口测试/单元测试'时使用
4
4
  ---
5
- <!-- generated by harness_deploy.py; core=15bd13873bb3fb8f; overlay=none; agent=cursor; do not edit -->
5
+ <!-- generated by harness_deploy.py; core=170e634f2d9f865c; overlay=none; agent=cursor; do not edit -->
6
6
  # harness-test — 测试执行
7
7
 
8
8
  ## Purpose
@@ -900,10 +900,22 @@ def resolve_product_archive_identity(
900
900
  or ledger.get("finalCommit")
901
901
  or ""
902
902
  )
903
+ feature_merge = str(
904
+ ledger.get("featureMergeHash")
905
+ or ledger.get("mergeFinalHash")
906
+ or product
907
+ ).strip()
908
+ code, current_head, _ = git_run(project_root, "rev-parse", "HEAD")
909
+ release_tip = str(
910
+ ledger.get("releaseTipHash")
911
+ or (current_head if code == 0 else "")
912
+ or ledger.get("archiveCommit")
913
+ or product
914
+ ).strip()
903
915
  archive = (
904
916
  archive_commit
905
917
  or ledger.get("archiveCommit")
906
- or ledger.get("finalCommit")
918
+ or release_tip
907
919
  or product
908
920
  )
909
921
  tree = str(ledger.get("productTreeHash") or "")
@@ -930,6 +942,8 @@ def resolve_product_archive_identity(
930
942
  tree = hashlib.sha256(b"fixture-no-product-tree").hexdigest()
931
943
  identity = {
932
944
  "productCommit": str(product),
945
+ "featureMergeHash": feature_merge,
946
+ "releaseTipHash": release_tip,
933
947
  "productTreeHash": str(tree),
934
948
  "archiveCommit": str(archive),
935
949
  "productTreeHashTruncated": bool(tree_meta.get("truncated")),
@@ -1659,6 +1673,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1659
1673
 
1660
1674
  run = failures = errors = skipped = 0
1661
1675
  passed_count: int | None = None
1676
+ deselected = 0
1662
1677
  pass_rate: Any = None
1663
1678
  source = "committed"
1664
1679
  counted = False
@@ -1675,6 +1690,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1675
1690
  "failures",
1676
1691
  "errors",
1677
1692
  "skipped",
1693
+ "deselected",
1678
1694
  )
1679
1695
  ):
1680
1696
  if "total" in metrics:
@@ -1690,6 +1706,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1690
1706
  failures = int(metrics.get("failed", metrics.get("failures", 0)) or 0)
1691
1707
  errors = int(metrics.get("errors", 0) or 0)
1692
1708
  skipped = int(metrics.get("skipped", 0) or 0)
1709
+ deselected = int(metrics.get("deselected", 0) or 0)
1693
1710
  if "passed" in metrics:
1694
1711
  passed_count = int(metrics.get("passed", 0) or 0)
1695
1712
  pass_rate = metrics.get("passRate")
@@ -1708,6 +1725,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1708
1725
  failures = int(evidence.get("failures", unit.get("failures", 0)) or 0)
1709
1726
  errors = int(evidence.get("errors", unit.get("errors", 0)) or 0)
1710
1727
  skipped = int(evidence.get("skipped", unit.get("skipped", 0)) or 0)
1728
+ deselected = int(evidence.get("deselected", unit.get("deselected", 0)) or 0)
1711
1729
  pass_rate = evidence.get("passRate") or unit.get("passRate")
1712
1730
  source = "committed"
1713
1731
  counted = run > 0 or failures > 0 or errors > 0 or skipped > 0
@@ -1729,6 +1747,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1729
1747
  failures = int(unit.get("failures", 0) or 0)
1730
1748
  errors = int(unit.get("errors", 0) or 0)
1731
1749
  skipped = int(unit.get("skipped", 0) or 0)
1750
+ deselected = int(unit.get("deselected", 0) or 0)
1732
1751
  pass_rate = unit.get("passRate")
1733
1752
  source = "committed"
1734
1753
 
@@ -1755,6 +1774,7 @@ def _ledger_unit_tests(ledger: dict[str, Any] | None) -> dict[str, Any]:
1755
1774
  "failures": int(failures or 0),
1756
1775
  "errors": int(errors or 0),
1757
1776
  "skipped": int(skipped or 0),
1777
+ "deselected": int(deselected or 0),
1758
1778
  "passRate": pass_rate if pass_rate is not None else NOT_AVAILABLE,
1759
1779
  "source": source,
1760
1780
  }
@@ -1771,10 +1791,12 @@ def _ledger_api_tests(
1771
1791
  empty = {
1772
1792
  "status": "NOT_RUN",
1773
1793
  "total": 0,
1794
+ "executed": 0,
1774
1795
  "passed": 0,
1775
1796
  "failed": 0,
1776
1797
  "blocked": 0,
1777
1798
  "passRate": NOT_AVAILABLE,
1799
+ "executionRate": NOT_AVAILABLE,
1778
1800
  "source": "not-run",
1779
1801
  }
1780
1802
  if not ledger:
@@ -1853,18 +1875,19 @@ def _ledger_api_tests(
1853
1875
  pass_rate = api.get("passRate")
1854
1876
  source = "committed"
1855
1877
 
1856
- if pass_rate is None and total > 0:
1857
- pass_rate = f"{passed / total:.0%}"
1858
- elif pass_rate is None:
1859
- pass_rate = NOT_AVAILABLE
1878
+ executed = passed + failed
1879
+ pass_rate = f"{passed / executed:.0%}" if executed > 0 else NOT_AVAILABLE
1880
+ execution_rate = f"{executed / total:.0%}" if total > 0 else NOT_AVAILABLE
1860
1881
 
1861
1882
  return {
1862
1883
  "status": status,
1863
1884
  "total": int(total or 0),
1885
+ "executed": int(executed or 0),
1864
1886
  "passed": int(passed or 0),
1865
1887
  "failed": int(failed or 0),
1866
1888
  "blocked": int(blocked or 0),
1867
- "passRate": pass_rate if pass_rate is not None else NOT_AVAILABLE,
1889
+ "passRate": pass_rate,
1890
+ "executionRate": execution_rate,
1868
1891
  "source": source,
1869
1892
  }
1870
1893
 
@@ -1937,13 +1960,16 @@ def _typed_test_metrics(entry: dict[str, Any], *, total_key: str) -> dict[str, A
1937
1960
  total = int(metrics.get(total_key, 0) or 0)
1938
1961
  passed = int(metrics.get("passed", 0) or 0)
1939
1962
  failed = int(metrics.get("failed", 0) or 0)
1963
+ executed = passed + failed
1940
1964
  status = str(entry.get("status") or "").upper() or "NOT_RUN"
1941
1965
  out: dict[str, Any] = {
1942
1966
  "status": status,
1943
1967
  "total": total,
1968
+ "executed": executed,
1944
1969
  "passed": passed,
1945
1970
  "failed": failed,
1946
- "passRate": f"{passed / total:.0%}" if total > 0 else NOT_AVAILABLE,
1971
+ "passRate": f"{passed / executed:.0%}" if executed > 0 else NOT_AVAILABLE,
1972
+ "executionRate": f"{executed / total:.0%}" if total > 0 else NOT_AVAILABLE,
1947
1973
  "source": "committed" if total > 0 else "not-run",
1948
1974
  }
1949
1975
  if "blocked" in metrics:
@@ -1980,6 +2006,17 @@ def build_verification_projection(
1980
2006
  browser_e2e = validations.get("browserE2E")
1981
2007
  if isinstance(browser_e2e, dict):
1982
2008
  projection["browserE2E"] = _typed_test_metrics(browser_e2e, total_key="total")
2009
+ performance = validations.get("performance")
2010
+ if isinstance(performance, dict):
2011
+ projection["performance"] = {
2012
+ "status": str(performance.get("status") or "NOT_RUN").upper(),
2013
+ "metrics": _deepcopy_json(
2014
+ performance.get("metrics")
2015
+ if isinstance(performance.get("metrics"), dict)
2016
+ else {}
2017
+ ),
2018
+ "source": "committed",
2019
+ }
1983
2020
  return projection
1984
2021
 
1985
2022
 
@@ -2142,14 +2179,25 @@ def _verification_checks_from_events(
2142
2179
  return checks
2143
2180
 
2144
2181
 
2145
- def _artifacts_from_events(events: list[dict[str, Any]]) -> list[dict[str, Any]]:
2182
+ def _artifacts_from_events(
2183
+ events: list[dict[str, Any]],
2184
+ *,
2185
+ change_dir: Path | None = None,
2186
+ ) -> list[dict[str, Any]]:
2146
2187
  out: list[dict[str, Any]] = []
2147
2188
  for e in events:
2148
2189
  if e.get("type") != "artifact":
2149
2190
  continue
2191
+ raw_path = str(e.get("path") or "")
2192
+ archived_path = raw_path
2193
+ if change_dir is not None and raw_path:
2194
+ product_copy = change_dir / "artifacts" / "product" / raw_path
2195
+ if not (change_dir / raw_path).is_file() and product_copy.is_file():
2196
+ archived_path = product_copy.relative_to(change_dir).as_posix()
2150
2197
  out.append(
2151
2198
  {
2152
- "path": e.get("path") or "",
2199
+ "path": archived_path,
2200
+ **({"sourcePath": raw_path} if archived_path != raw_path else {}),
2153
2201
  "kind": e.get("kind") or "",
2154
2202
  "phase": e.get("phase") or "",
2155
2203
  }
@@ -2882,7 +2930,7 @@ def collect_summary_data(
2882
2930
  "dbCompatibility": db,
2883
2931
  "coverageDisplay": coverage,
2884
2932
  }
2885
- for typed_key in ("apiContract", "browserE2E"):
2933
+ for typed_key in ("apiContract", "browserE2E", "performance"):
2886
2934
  if typed_key in projection:
2887
2935
  data["verification"][typed_key] = projection[typed_key]
2888
2936
  if ci_metrics is not None:
@@ -2982,6 +3030,8 @@ def collect_summary_data(
2982
3030
  if not for_replay:
2983
3031
  identity = resolve_product_archive_identity(change_dir, project=project)
2984
3032
  data["productCommit"] = identity.get("productCommit") or data.get("finalCommit")
3033
+ data["featureMergeHash"] = identity.get("featureMergeHash") or data.get("finalCommit")
3034
+ data["releaseTipHash"] = identity.get("releaseTipHash") or data.get("archiveCommit")
2985
3035
  data["productTreeHash"] = identity.get("productTreeHash")
2986
3036
  data["archiveCommit"] = identity.get("archiveCommit") or data.get("finalCommit")
2987
3037
  data["changeIdentity"] = identity
@@ -3049,6 +3099,8 @@ def collect_summary_data(
3049
3099
  data["gitFacts"] = {
3050
3100
  "baseCommit": data.get("baseCommit") or "",
3051
3101
  "finalCommit": data.get("finalCommit") or "",
3102
+ "featureMergeHash": data.get("featureMergeHash") or "",
3103
+ "releaseTipHash": data.get("releaseTipHash") or "",
3052
3104
  "filesChanged": int(diff_for_facts.get("filesChanged") or 0),
3053
3105
  "insertions": int(diff_for_facts.get("insertions") or 0),
3054
3106
  "deletions": int(diff_for_facts.get("deletions") or 0),
@@ -3069,7 +3121,9 @@ def collect_summary_data(
3069
3121
  if not isinstance(data.get("artifacts"), list):
3070
3122
  data["artifacts"] = []
3071
3123
  if not for_replay:
3072
- data["artifacts"] = _artifacts_from_events(projected_events)
3124
+ data["artifacts"] = _artifacts_from_events(
3125
+ projected_events, change_dir=change_dir
3126
+ )
3073
3127
 
3074
3128
  data["reviewSummary"] = _review_summary(
3075
3129
  change_dir,
@@ -3151,7 +3205,9 @@ def collect_summary_data(
3151
3205
  # Cannot invent commands
3152
3206
  pass
3153
3207
  verification_checks = _verification_checks_from_events(projected_events, ledger)
3154
- pipeline_artifacts = _artifacts_from_events(projected_events)
3208
+ pipeline_artifacts = _artifacts_from_events(
3209
+ projected_events, change_dir=change_dir
3210
+ )
3155
3211
  if not sources:
3156
3212
  sources = [NOT_AVAILABLE]
3157
3213
 
@@ -4012,6 +4068,7 @@ def artifact_preflight(change_dir: Path) -> dict[str, Any]:
4012
4068
  if not events_p.is_file():
4013
4069
  return {"ok": True, "items": [], "blocking": []}
4014
4070
  change_id = change_dir.name
4071
+ project_root = find_project_root(change_dir)
4015
4072
  for line in events_p.read_text(encoding="utf-8").splitlines():
4016
4073
  try:
4017
4074
  event = json.loads(line)
@@ -4058,16 +4115,56 @@ def artifact_preflight(change_dir: Path) -> dict[str, Any]:
4058
4115
  "correction": f"append correction --target-event-id {event_id} --target-field path --new-value-json \"{canonical}\"",
4059
4116
  })
4060
4117
  continue
4061
- # Change-relative path: OK.
4062
- items.append({
4118
+ change_file = change_dir / path
4119
+ if change_file.is_file():
4120
+ items.append({
4121
+ "eventId": event_id,
4122
+ "category": "file-backed",
4123
+ "path": path,
4124
+ "exists": True,
4125
+ })
4126
+ continue
4127
+ repository_file = project_root / path
4128
+ if repository_file.is_file():
4129
+ items.append({
4130
+ "eventId": event_id,
4131
+ "category": "repository-file",
4132
+ "path": path,
4133
+ "archivePath": f"artifacts/product/{path}",
4134
+ "exists": True,
4135
+ })
4136
+ continue
4137
+ item = {
4063
4138
  "eventId": event_id,
4064
- "category": "file-backed",
4139
+ "category": "blocking",
4065
4140
  "path": path,
4066
- "exists": (change_dir / path).is_file(),
4067
- })
4141
+ "kind": kind,
4142
+ "reason": "artifact file not found in change or project root",
4143
+ }
4144
+ items.append(item)
4145
+ blocking.append(item)
4068
4146
  return {"ok": not blocking, "items": items, "blocking": blocking}
4069
4147
 
4070
4148
 
4149
+ def materialize_repository_artifacts(change_dir: Path) -> dict[str, Any]:
4150
+ """Copy project-root business artifacts into the immutable archive namespace."""
4151
+ change_dir = change_dir.resolve()
4152
+ project_root = find_project_root(change_dir)
4153
+ preflight = artifact_preflight(change_dir)
4154
+ copied: list[str] = []
4155
+ for item in preflight.get("items") or []:
4156
+ if item.get("category") != "repository-file":
4157
+ continue
4158
+ source = (project_root / str(item["path"])).resolve()
4159
+ target = (change_dir / str(item["archivePath"])).resolve()
4160
+ if not source.is_relative_to(project_root) or not target.is_relative_to(change_dir):
4161
+ raise ValueError(f"artifact materialization escaped boundary: {item['path']}")
4162
+ target.parent.mkdir(parents=True, exist_ok=True)
4163
+ shutil.copy2(source, target)
4164
+ copied.append(target.relative_to(change_dir).as_posix())
4165
+ return {"ok": True, "copied": sorted(copied)}
4166
+
4167
+
4071
4168
  def run_knowledge_poststeps(project_root: Path) -> dict[str, Any]:
4072
4169
  results: dict[str, Any] = {"ran": False, "steps": [], "warnings": []}
4073
4170
  if not KNOWLEDGE_SCRIPT.is_file():
@@ -4343,6 +4440,16 @@ def cmd_finalize(
4343
4440
  warnings.append(f"cleanup failed: {exc}")
4344
4441
  payload["steps"]["cleanup"] = {"ok": False, "error": str(exc)}
4345
4442
 
4443
+ # Product/business artifacts may live at repository-relative paths. Freeze
4444
+ # byte-for-byte copies inside the staged archive before either manifest.
4445
+ try:
4446
+ materialized = materialize_repository_artifacts(work_dir)
4447
+ payload["steps"]["artifact_materialization"] = materialized
4448
+ except (OSError, ValueError) as exc:
4449
+ payload["error"] = f"artifact materialization failed: {exc}"
4450
+ _restore_finalize_failure()
4451
+ return 1, payload
4452
+
4346
4453
  # --- 1. before-manifest ---
4347
4454
  before_path = work_dir / "evidence" / "archive-manifest-before.json"
4348
4455
  try:
@@ -16,6 +16,7 @@ import re
16
16
  import shutil
17
17
  import subprocess
18
18
  import sys
19
+ import time
19
20
  import uuid
20
21
  from pathlib import Path
21
22
  from typing import Any, Iterable
@@ -38,6 +39,7 @@ HEADING_RE = re.compile(r"^(#{2,6})\s+(.+?)\s*$")
38
39
  FRAGMENT_HINT_RE = re.compile(r"^>\s*片段:\[\[shared/[^\]]+\]\]\s*.*$")
39
40
 
40
41
  BUILD_MARKER = ".harness-build.json"
42
+ _REPLACE_RETRY_DELAYS_SECONDS = (0.05, 0.1, 0.2, 0.4, 0.8)
41
43
  # Install-side managed manifests record which files a prior install owned, so a
42
44
  # later conservative install can delete removed managed files while preserving
43
45
  # user-owned files (design §3.8 要点4). Skills manifest lives in the skills
@@ -76,6 +78,23 @@ def now_iso() -> str:
76
78
  return dt.datetime.now().astimezone().isoformat(timespec="seconds")
77
79
 
78
80
 
81
+ def replace_with_retry(source: Path, target: Path) -> None:
82
+ """Bounded retry for transient directory locks during atomic swaps.
83
+
84
+ Windows indexers and antivirus scanners may briefly hold a newly generated
85
+ bundle directory. Retrying only ``PermissionError`` keeps real path and
86
+ contract failures fail-fast while avoiding an expensive full bundle rerun.
87
+ """
88
+ for attempt in range(len(_REPLACE_RETRY_DELAYS_SECONDS) + 1):
89
+ try:
90
+ os.replace(source, target)
91
+ return
92
+ except PermissionError:
93
+ if attempt >= len(_REPLACE_RETRY_DELAYS_SECONDS):
94
+ raise
95
+ time.sleep(_REPLACE_RETRY_DELAYS_SECONDS[attempt])
96
+
97
+
79
98
  def emit_json(payload: dict[str, Any], *, ok: bool = True) -> int:
80
99
  print(json.dumps(payload, ensure_ascii=False, indent=2))
81
100
  return 0 if ok else 1
@@ -596,15 +615,15 @@ def cmd_build(
596
615
  if out_dir.exists():
597
616
  if (out_dir / BUILD_MARKER).is_file():
598
617
  old_backup = out_dir.parent / f".{out_dir.name}.old-{uuid.uuid4().hex[:8]}"
599
- os.replace(out_dir, old_backup)
618
+ replace_with_retry(out_dir, old_backup)
600
619
  else:
601
620
  shutil.rmtree(staging, ignore_errors=True)
602
621
  raise ValueError(f"refusing to overwrite unmarked out_dir: {out_dir}")
603
622
  try:
604
- os.replace(staging, out_dir)
623
+ replace_with_retry(staging, out_dir)
605
624
  except OSError:
606
625
  if old_backup is not None and old_backup.exists():
607
- os.replace(old_backup, out_dir)
626
+ replace_with_retry(old_backup, out_dir)
608
627
  raise
609
628
  if old_backup is not None:
610
629
  shutil.rmtree(old_backup, ignore_errors=True)
@@ -257,6 +257,42 @@ def journal_path(project_root: Path, transaction_id: str) -> Path:
257
257
  return journal_dir(project_root, transaction_id) / "journal.json"
258
258
 
259
259
 
260
+ def _write_verify_log(
261
+ project_root: Path,
262
+ transaction_id: str,
263
+ index: int,
264
+ *,
265
+ command: Sequence[str],
266
+ resolved_command: Sequence[str],
267
+ started: dt.datetime,
268
+ finished: dt.datetime,
269
+ exit_code: int | None,
270
+ stdout: str | bytes | None = None,
271
+ stderr: str | bytes | None = None,
272
+ error: str | None = None,
273
+ ) -> str:
274
+ def as_text(value: str | bytes | None) -> str:
275
+ if isinstance(value, bytes):
276
+ return value.decode("utf-8", errors="replace")
277
+ return value or ""
278
+
279
+ path = journal_dir(project_root, transaction_id) / "logs" / f"verify-{index + 1}.log"
280
+ path.parent.mkdir(parents=True, exist_ok=True)
281
+ lines = [
282
+ f"command: {json.dumps(list(command), ensure_ascii=False)}",
283
+ f"resolvedCommand: {json.dumps(list(resolved_command), ensure_ascii=False)}",
284
+ f"startedAt: {started.isoformat(timespec='milliseconds')}",
285
+ f"finishedAt: {finished.isoformat(timespec='milliseconds')}",
286
+ f"durationMs: {int((finished - started).total_seconds() * 1000)}",
287
+ f"exitCode: {exit_code if exit_code is not None else 'null'}",
288
+ ]
289
+ if error:
290
+ lines.append(f"error: {error}")
291
+ lines.extend(["--- stdout ---", as_text(stdout), "--- stderr ---", as_text(stderr)])
292
+ path.write_text("\n".join(lines) + "\n", encoding="utf-8", newline="\n")
293
+ return path.relative_to(project_root).as_posix()
294
+
295
+
260
296
  def load_journal(project_root: Path, transaction_id: str) -> dict[str, Any]:
261
297
  path = journal_path(project_root, transaction_id)
262
298
  if not path.is_file():
@@ -965,7 +1001,7 @@ class IntegrationTransaction:
965
1001
  )
966
1002
  intg_root = Path(journal["integrationRoot"]).resolve()
967
1003
  results: list[dict[str, Any]] = []
968
- for command in commands:
1004
+ for index, command in enumerate(commands):
969
1005
  executable_command = _normalize_verify_command(command)
970
1006
  started = dt.datetime.now().astimezone()
971
1007
  try:
@@ -979,8 +1015,21 @@ class IntegrationTransaction:
979
1015
  check=False,
980
1016
  timeout=timeout_seconds,
981
1017
  )
982
- except subprocess.TimeoutExpired:
1018
+ except subprocess.TimeoutExpired as exc:
983
1019
  finished = dt.datetime.now().astimezone()
1020
+ log_path = _write_verify_log(
1021
+ self.project_root,
1022
+ self.transaction_id,
1023
+ index,
1024
+ command=command,
1025
+ resolved_command=executable_command,
1026
+ started=started,
1027
+ finished=finished,
1028
+ exit_code=None,
1029
+ stdout=exc.stdout,
1030
+ stderr=exc.stderr,
1031
+ error=f"timed out after {timeout_seconds}s",
1032
+ )
984
1033
  results.append(
985
1034
  {
986
1035
  "command": list(command),
@@ -993,6 +1042,7 @@ class IntegrationTransaction:
993
1042
  "durationMs": int(
994
1043
  (finished - started).total_seconds() * 1000
995
1044
  ),
1045
+ "logPath": log_path,
996
1046
  }
997
1047
  )
998
1048
  journal["verifyResults"] = results
@@ -1002,6 +1052,17 @@ class IntegrationTransaction:
1002
1052
  )
1003
1053
  except FileNotFoundError as exc:
1004
1054
  finished = dt.datetime.now().astimezone()
1055
+ log_path = _write_verify_log(
1056
+ self.project_root,
1057
+ self.transaction_id,
1058
+ index,
1059
+ command=command,
1060
+ resolved_command=executable_command,
1061
+ started=started,
1062
+ finished=finished,
1063
+ exit_code=None,
1064
+ error=str(exc),
1065
+ )
1005
1066
  results.append(
1006
1067
  {
1007
1068
  "command": list(command),
@@ -1013,6 +1074,7 @@ class IntegrationTransaction:
1013
1074
  "durationMs": int(
1014
1075
  (finished - started).total_seconds() * 1000
1015
1076
  ),
1077
+ "logPath": log_path,
1016
1078
  }
1017
1079
  )
1018
1080
  journal["verifyResults"] = results
@@ -1021,6 +1083,18 @@ class IntegrationTransaction:
1021
1083
  f"verification executable not found: {executable_command[0]}"
1022
1084
  ) from exc
1023
1085
  finished = dt.datetime.now().astimezone()
1086
+ log_path = _write_verify_log(
1087
+ self.project_root,
1088
+ self.transaction_id,
1089
+ index,
1090
+ command=command,
1091
+ resolved_command=executable_command,
1092
+ started=started,
1093
+ finished=finished,
1094
+ exit_code=proc.returncode,
1095
+ stdout=proc.stdout,
1096
+ stderr=proc.stderr,
1097
+ )
1024
1098
  results.append(
1025
1099
  {
1026
1100
  "command": list(command),
@@ -1032,6 +1106,7 @@ class IntegrationTransaction:
1032
1106
  "durationMs": int(
1033
1107
  (finished - started).total_seconds() * 1000
1034
1108
  ),
1109
+ "logPath": log_path,
1035
1110
  }
1036
1111
  )
1037
1112
  if proc.returncode != 0: