@hunter-harness/workflow-harness 0.2.54 → 0.2.56

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 (262) hide show
  1. package/harness/bundles/general/claude-code/.harness-build.json +1 -1
  2. package/harness/bundles/general/claude-code/README.md +3 -3
  3. package/harness/bundles/general/claude-code/contracts/workflow-policy.json +1 -1
  4. package/harness/bundles/general/claude-code/harness-archive/SKILL.md +21 -33
  5. package/harness/bundles/general/claude-code/harness-archive/checklist.md +6 -10
  6. package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
  7. package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  8. package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
  9. package/harness/bundles/general/claude-code/harness-plan/SKILL.md +7 -3
  10. package/harness/bundles/general/claude-code/harness-plan/checklist.md +2 -1
  11. package/harness/bundles/general/claude-code/harness-review/SKILL.md +8 -4
  12. package/harness/bundles/general/claude-code/harness-run/SKILL.md +9 -7
  13. package/harness/bundles/general/claude-code/harness-run/checklist.md +1 -1
  14. package/harness/bundles/general/claude-code/harness-run/reference.md +3 -3
  15. package/harness/bundles/general/claude-code/harness-submit/SKILL.md +6 -6
  16. package/harness/bundles/general/claude-code/harness-submit/checklist.md +1 -1
  17. package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
  18. package/harness/bundles/general/claude-code/harness-test/SKILL.md +8 -6
  19. package/harness/bundles/general/claude-code/harness-test/checklist.md +1 -1
  20. package/harness/bundles/general/claude-code/harness-test/reference.md +2 -2
  21. package/harness/bundles/general/claude-code/protocols/ledger-protocol.md +3 -3
  22. package/harness/bundles/general/claude-code/scripts/harness_archive.py +322 -74
  23. package/harness/bundles/general/claude-code/scripts/harness_context.py +236 -63
  24. package/harness/bundles/general/claude-code/scripts/harness_events.py +86 -5
  25. package/harness/bundles/general/claude-code/scripts/harness_events_sync.py +201 -17
  26. package/harness/bundles/general/claude-code/scripts/harness_fixback.py +189 -1
  27. package/harness/bundles/general/claude-code/scripts/harness_gate.py +353 -3
  28. package/harness/bundles/general/claude-code/scripts/harness_ledger.py +195 -11
  29. package/harness/bundles/general/claude-code/scripts/harness_plan_finalize.py +82 -0
  30. package/harness/bundles/general/claude-code/scripts/harness_test_guard.py +37 -44
  31. package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
  32. package/harness/bundles/general/codebuddy/README.md +3 -3
  33. package/harness/bundles/general/codebuddy/contracts/workflow-policy.json +1 -1
  34. package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +21 -33
  35. package/harness/bundles/general/codebuddy/harness-archive/checklist.md +6 -10
  36. package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
  37. package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  38. package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  39. package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +7 -3
  40. package/harness/bundles/general/codebuddy/harness-plan/checklist.md +2 -1
  41. package/harness/bundles/general/codebuddy/harness-review/SKILL.md +8 -4
  42. package/harness/bundles/general/codebuddy/harness-run/SKILL.md +9 -7
  43. package/harness/bundles/general/codebuddy/harness-run/checklist.md +1 -1
  44. package/harness/bundles/general/codebuddy/harness-run/reference.md +3 -3
  45. package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +6 -6
  46. package/harness/bundles/general/codebuddy/harness-submit/checklist.md +1 -1
  47. package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
  48. package/harness/bundles/general/codebuddy/harness-test/SKILL.md +8 -6
  49. package/harness/bundles/general/codebuddy/harness-test/checklist.md +1 -1
  50. package/harness/bundles/general/codebuddy/harness-test/reference.md +2 -2
  51. package/harness/bundles/general/codebuddy/protocols/ledger-protocol.md +3 -3
  52. package/harness/bundles/general/codebuddy/scripts/harness_archive.py +322 -74
  53. package/harness/bundles/general/codebuddy/scripts/harness_context.py +236 -63
  54. package/harness/bundles/general/codebuddy/scripts/harness_events.py +86 -5
  55. package/harness/bundles/general/codebuddy/scripts/harness_events_sync.py +201 -17
  56. package/harness/bundles/general/codebuddy/scripts/harness_fixback.py +189 -1
  57. package/harness/bundles/general/codebuddy/scripts/harness_gate.py +353 -3
  58. package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +195 -11
  59. package/harness/bundles/general/codebuddy/scripts/harness_plan_finalize.py +82 -0
  60. package/harness/bundles/general/codebuddy/scripts/harness_test_guard.py +37 -44
  61. package/harness/bundles/general/codex/.harness-build.json +1 -1
  62. package/harness/bundles/general/codex/README.md +3 -3
  63. package/harness/bundles/general/codex/contracts/workflow-policy.json +1 -1
  64. package/harness/bundles/general/codex/harness-archive/SKILL.md +21 -33
  65. package/harness/bundles/general/codex/harness-archive/checklist.md +6 -10
  66. package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
  67. package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
  68. package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
  69. package/harness/bundles/general/codex/harness-plan/SKILL.md +7 -3
  70. package/harness/bundles/general/codex/harness-plan/checklist.md +2 -1
  71. package/harness/bundles/general/codex/harness-review/SKILL.md +4 -4
  72. package/harness/bundles/general/codex/harness-run/SKILL.md +9 -7
  73. package/harness/bundles/general/codex/harness-run/checklist.md +1 -1
  74. package/harness/bundles/general/codex/harness-run/reference.md +3 -3
  75. package/harness/bundles/general/codex/harness-submit/SKILL.md +6 -6
  76. package/harness/bundles/general/codex/harness-submit/checklist.md +1 -1
  77. package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
  78. package/harness/bundles/general/codex/harness-test/SKILL.md +8 -6
  79. package/harness/bundles/general/codex/harness-test/checklist.md +1 -1
  80. package/harness/bundles/general/codex/harness-test/reference.md +2 -2
  81. package/harness/bundles/general/codex/protocols/ledger-protocol.md +3 -3
  82. package/harness/bundles/general/codex/scripts/harness_archive.py +322 -74
  83. package/harness/bundles/general/codex/scripts/harness_context.py +236 -63
  84. package/harness/bundles/general/codex/scripts/harness_events.py +86 -5
  85. package/harness/bundles/general/codex/scripts/harness_events_sync.py +201 -17
  86. package/harness/bundles/general/codex/scripts/harness_fixback.py +189 -1
  87. package/harness/bundles/general/codex/scripts/harness_gate.py +353 -3
  88. package/harness/bundles/general/codex/scripts/harness_ledger.py +195 -11
  89. package/harness/bundles/general/codex/scripts/harness_plan_finalize.py +82 -0
  90. package/harness/bundles/general/codex/scripts/harness_test_guard.py +37 -44
  91. package/harness/bundles/general/cursor/.harness-build.json +1 -1
  92. package/harness/bundles/general/cursor/README.md +3 -3
  93. package/harness/bundles/general/cursor/contracts/workflow-policy.json +1 -1
  94. package/harness/bundles/general/cursor/harness-archive/SKILL.md +21 -33
  95. package/harness/bundles/general/cursor/harness-archive/checklist.md +6 -10
  96. package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
  97. package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  98. package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
  99. package/harness/bundles/general/cursor/harness-plan/SKILL.md +7 -3
  100. package/harness/bundles/general/cursor/harness-plan/checklist.md +2 -1
  101. package/harness/bundles/general/cursor/harness-review/SKILL.md +4 -4
  102. package/harness/bundles/general/cursor/harness-run/SKILL.md +9 -7
  103. package/harness/bundles/general/cursor/harness-run/checklist.md +1 -1
  104. package/harness/bundles/general/cursor/harness-run/reference.md +3 -3
  105. package/harness/bundles/general/cursor/harness-submit/SKILL.md +6 -6
  106. package/harness/bundles/general/cursor/harness-submit/checklist.md +1 -1
  107. package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
  108. package/harness/bundles/general/cursor/harness-test/SKILL.md +8 -6
  109. package/harness/bundles/general/cursor/harness-test/checklist.md +1 -1
  110. package/harness/bundles/general/cursor/harness-test/reference.md +2 -2
  111. package/harness/bundles/general/cursor/protocols/ledger-protocol.md +3 -3
  112. package/harness/bundles/general/cursor/scripts/harness_archive.py +322 -74
  113. package/harness/bundles/general/cursor/scripts/harness_context.py +236 -63
  114. package/harness/bundles/general/cursor/scripts/harness_events.py +86 -5
  115. package/harness/bundles/general/cursor/scripts/harness_events_sync.py +201 -17
  116. package/harness/bundles/general/cursor/scripts/harness_fixback.py +189 -1
  117. package/harness/bundles/general/cursor/scripts/harness_gate.py +353 -3
  118. package/harness/bundles/general/cursor/scripts/harness_ledger.py +195 -11
  119. package/harness/bundles/general/cursor/scripts/harness_plan_finalize.py +82 -0
  120. package/harness/bundles/general/cursor/scripts/harness_test_guard.py +37 -44
  121. package/harness/bundles/java/claude-code/.harness-build.json +1 -1
  122. package/harness/bundles/java/claude-code/README.md +3 -3
  123. package/harness/bundles/java/claude-code/contracts/workflow-policy.json +1 -1
  124. package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
  125. package/harness/bundles/java/claude-code/harness-archive/SKILL.md +21 -33
  126. package/harness/bundles/java/claude-code/harness-archive/checklist.md +6 -10
  127. package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
  128. package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
  129. package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
  130. package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
  131. package/harness/bundles/java/claude-code/harness-package/checklist.md +1 -1
  132. package/harness/bundles/java/claude-code/harness-plan/SKILL.md +7 -3
  133. package/harness/bundles/java/claude-code/harness-plan/checklist.md +2 -1
  134. package/harness/bundles/java/claude-code/harness-review/SKILL.md +8 -4
  135. package/harness/bundles/java/claude-code/harness-run/SKILL.md +9 -7
  136. package/harness/bundles/java/claude-code/harness-run/checklist.md +1 -1
  137. package/harness/bundles/java/claude-code/harness-run/reference.md +2 -2
  138. package/harness/bundles/java/claude-code/harness-submit/SKILL.md +6 -6
  139. package/harness/bundles/java/claude-code/harness-submit/checklist.md +1 -1
  140. package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
  141. package/harness/bundles/java/claude-code/harness-test/SKILL.md +8 -6
  142. package/harness/bundles/java/claude-code/harness-test/checklist.md +1 -1
  143. package/harness/bundles/java/claude-code/harness-test/reference.md +1 -1
  144. package/harness/bundles/java/claude-code/protocols/ledger-protocol.md +3 -3
  145. package/harness/bundles/java/claude-code/scripts/harness_archive.py +322 -74
  146. package/harness/bundles/java/claude-code/scripts/harness_context.py +236 -63
  147. package/harness/bundles/java/claude-code/scripts/harness_events.py +86 -5
  148. package/harness/bundles/java/claude-code/scripts/harness_events_sync.py +201 -17
  149. package/harness/bundles/java/claude-code/scripts/harness_fixback.py +189 -1
  150. package/harness/bundles/java/claude-code/scripts/harness_gate.py +353 -3
  151. package/harness/bundles/java/claude-code/scripts/harness_ledger.py +195 -11
  152. package/harness/bundles/java/claude-code/scripts/harness_plan_finalize.py +82 -0
  153. package/harness/bundles/java/claude-code/scripts/harness_test_guard.py +37 -44
  154. package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
  155. package/harness/bundles/java/codebuddy/README.md +3 -3
  156. package/harness/bundles/java/codebuddy/contracts/workflow-policy.json +1 -1
  157. package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
  158. package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +21 -33
  159. package/harness/bundles/java/codebuddy/harness-archive/checklist.md +6 -10
  160. package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
  161. package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
  162. package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
  163. package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
  164. package/harness/bundles/java/codebuddy/harness-package/checklist.md +1 -1
  165. package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +7 -3
  166. package/harness/bundles/java/codebuddy/harness-plan/checklist.md +2 -1
  167. package/harness/bundles/java/codebuddy/harness-review/SKILL.md +8 -4
  168. package/harness/bundles/java/codebuddy/harness-run/SKILL.md +9 -7
  169. package/harness/bundles/java/codebuddy/harness-run/checklist.md +1 -1
  170. package/harness/bundles/java/codebuddy/harness-run/reference.md +2 -2
  171. package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +6 -6
  172. package/harness/bundles/java/codebuddy/harness-submit/checklist.md +1 -1
  173. package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
  174. package/harness/bundles/java/codebuddy/harness-test/SKILL.md +8 -6
  175. package/harness/bundles/java/codebuddy/harness-test/checklist.md +1 -1
  176. package/harness/bundles/java/codebuddy/harness-test/reference.md +1 -1
  177. package/harness/bundles/java/codebuddy/protocols/ledger-protocol.md +3 -3
  178. package/harness/bundles/java/codebuddy/scripts/harness_archive.py +322 -74
  179. package/harness/bundles/java/codebuddy/scripts/harness_context.py +236 -63
  180. package/harness/bundles/java/codebuddy/scripts/harness_events.py +86 -5
  181. package/harness/bundles/java/codebuddy/scripts/harness_events_sync.py +201 -17
  182. package/harness/bundles/java/codebuddy/scripts/harness_fixback.py +189 -1
  183. package/harness/bundles/java/codebuddy/scripts/harness_gate.py +353 -3
  184. package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +195 -11
  185. package/harness/bundles/java/codebuddy/scripts/harness_plan_finalize.py +82 -0
  186. package/harness/bundles/java/codebuddy/scripts/harness_test_guard.py +37 -44
  187. package/harness/bundles/java/codex/.harness-build.json +1 -1
  188. package/harness/bundles/java/codex/README.md +3 -3
  189. package/harness/bundles/java/codex/contracts/workflow-policy.json +1 -1
  190. package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
  191. package/harness/bundles/java/codex/harness-archive/SKILL.md +21 -33
  192. package/harness/bundles/java/codex/harness-archive/checklist.md +6 -10
  193. package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
  194. package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
  195. package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
  196. package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
  197. package/harness/bundles/java/codex/harness-package/checklist.md +1 -1
  198. package/harness/bundles/java/codex/harness-plan/SKILL.md +7 -3
  199. package/harness/bundles/java/codex/harness-plan/checklist.md +2 -1
  200. package/harness/bundles/java/codex/harness-review/SKILL.md +4 -4
  201. package/harness/bundles/java/codex/harness-run/SKILL.md +9 -7
  202. package/harness/bundles/java/codex/harness-run/checklist.md +1 -1
  203. package/harness/bundles/java/codex/harness-run/reference.md +2 -2
  204. package/harness/bundles/java/codex/harness-submit/SKILL.md +6 -6
  205. package/harness/bundles/java/codex/harness-submit/checklist.md +1 -1
  206. package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
  207. package/harness/bundles/java/codex/harness-test/SKILL.md +8 -6
  208. package/harness/bundles/java/codex/harness-test/checklist.md +1 -1
  209. package/harness/bundles/java/codex/harness-test/reference.md +1 -1
  210. package/harness/bundles/java/codex/protocols/ledger-protocol.md +3 -3
  211. package/harness/bundles/java/codex/scripts/harness_archive.py +322 -74
  212. package/harness/bundles/java/codex/scripts/harness_context.py +236 -63
  213. package/harness/bundles/java/codex/scripts/harness_events.py +86 -5
  214. package/harness/bundles/java/codex/scripts/harness_events_sync.py +201 -17
  215. package/harness/bundles/java/codex/scripts/harness_fixback.py +189 -1
  216. package/harness/bundles/java/codex/scripts/harness_gate.py +353 -3
  217. package/harness/bundles/java/codex/scripts/harness_ledger.py +195 -11
  218. package/harness/bundles/java/codex/scripts/harness_plan_finalize.py +82 -0
  219. package/harness/bundles/java/codex/scripts/harness_test_guard.py +37 -44
  220. package/harness/bundles/java/cursor/.harness-build.json +1 -1
  221. package/harness/bundles/java/cursor/README.md +3 -3
  222. package/harness/bundles/java/cursor/contracts/workflow-policy.json +1 -1
  223. package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
  224. package/harness/bundles/java/cursor/harness-archive/SKILL.md +21 -33
  225. package/harness/bundles/java/cursor/harness-archive/checklist.md +6 -10
  226. package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
  227. package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
  228. package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
  229. package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
  230. package/harness/bundles/java/cursor/harness-package/checklist.md +1 -1
  231. package/harness/bundles/java/cursor/harness-plan/SKILL.md +7 -3
  232. package/harness/bundles/java/cursor/harness-plan/checklist.md +2 -1
  233. package/harness/bundles/java/cursor/harness-review/SKILL.md +4 -4
  234. package/harness/bundles/java/cursor/harness-run/SKILL.md +9 -7
  235. package/harness/bundles/java/cursor/harness-run/checklist.md +1 -1
  236. package/harness/bundles/java/cursor/harness-run/reference.md +2 -2
  237. package/harness/bundles/java/cursor/harness-submit/SKILL.md +6 -6
  238. package/harness/bundles/java/cursor/harness-submit/checklist.md +1 -1
  239. package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
  240. package/harness/bundles/java/cursor/harness-test/SKILL.md +8 -6
  241. package/harness/bundles/java/cursor/harness-test/checklist.md +1 -1
  242. package/harness/bundles/java/cursor/harness-test/reference.md +1 -1
  243. package/harness/bundles/java/cursor/protocols/ledger-protocol.md +3 -3
  244. package/harness/bundles/java/cursor/scripts/harness_archive.py +322 -74
  245. package/harness/bundles/java/cursor/scripts/harness_context.py +236 -63
  246. package/harness/bundles/java/cursor/scripts/harness_events.py +86 -5
  247. package/harness/bundles/java/cursor/scripts/harness_events_sync.py +201 -17
  248. package/harness/bundles/java/cursor/scripts/harness_fixback.py +189 -1
  249. package/harness/bundles/java/cursor/scripts/harness_gate.py +353 -3
  250. package/harness/bundles/java/cursor/scripts/harness_ledger.py +195 -11
  251. package/harness/bundles/java/cursor/scripts/harness_plan_finalize.py +82 -0
  252. package/harness/bundles/java/cursor/scripts/harness_test_guard.py +37 -44
  253. package/harness/manifests/general/claude-code.json +32 -32
  254. package/harness/manifests/general/codebuddy.json +32 -32
  255. package/harness/manifests/general/codex.json +32 -32
  256. package/harness/manifests/general/cursor.json +32 -32
  257. package/harness/manifests/java/claude-code.json +35 -35
  258. package/harness/manifests/java/codebuddy.json +35 -35
  259. package/harness/manifests/java/codex.json +35 -35
  260. package/harness/manifests/java/cursor.json +35 -35
  261. package/hunter-workflow-family.json +5 -4
  262. package/package.json +1 -1
@@ -145,7 +145,91 @@ def _hash_text(value: str) -> str:
145
145
 
146
146
  def command_set_hash(command: str) -> str:
147
147
  """Stable identity for the exact command set represented by one target."""
148
- return _hash_text(str(command).strip())
148
+ return _hash_text(canonical_command(command))
149
+
150
+
151
+ def canonical_command(command: str) -> str:
152
+ """Normalize supported launch wrappers without mixing runner notes into identity."""
153
+ value = re.sub(r"\s+", " ", str(command).strip())
154
+ value = re.sub(r"\s*\(safe runner\)\s*$", "", value, flags=re.I)
155
+ value = re.sub(r"^npx(?:\s+--no-install)?\s+", "", value, flags=re.I)
156
+ return value.strip()
157
+
158
+
159
+ def default_environment_hash(project_root: Path | None = None) -> str:
160
+ payload = {
161
+ "osName": os.name,
162
+ "platform": sys.platform,
163
+ "pythonImplementation": sys.implementation.name,
164
+ "projectFilesystem": "windows" if os.name == "nt" else "posix",
165
+ }
166
+ return _hash_text(json.dumps(payload, sort_keys=True, separators=(",", ":")))
167
+
168
+
169
+ def default_toolchain_hash(project_root: Path | None = None) -> str:
170
+ root = Path(project_root).resolve() if project_root is not None else None
171
+ manifests: list[dict[str, str]] = []
172
+ if root is not None:
173
+ for name in (
174
+ "package.json", "pyproject.toml", "pom.xml", "build.gradle",
175
+ "build.gradle.kts", "go.mod", "Cargo.toml",
176
+ ):
177
+ path = root / name
178
+ if path.is_file():
179
+ manifests.append({
180
+ "name": name,
181
+ "sha256": hashlib.sha256(path.read_bytes()).hexdigest(),
182
+ })
183
+ payload = {
184
+ "python": sys.version.split()[0],
185
+ "implementation": sys.implementation.name,
186
+ "manifests": manifests,
187
+ }
188
+ return _hash_text(json.dumps(payload, sort_keys=True, separators=(",", ":")))
189
+
190
+
191
+ def frozen_ownership_check(change_dir: Path) -> dict[str, Any]:
192
+ """Reject evidence writes after a Run capsule's ownership scope changed."""
193
+ try:
194
+ state_root = Path(
195
+ harness_paths.resolve_state_dir_for_contract(change_dir)
196
+ ).resolve()
197
+ contract = harness_paths.load_change_contract(change_dir)
198
+ except (OSError, ValueError, json.JSONDecodeError):
199
+ return {"ok": True, "code": "OWNERSHIP_FREEZE_NOT_APPLICABLE"}
200
+ capsule_root = state_root / "runtime" / "phase-context"
201
+ if not capsule_root.is_dir():
202
+ return {"ok": True, "code": "OWNERSHIP_FREEZE_NOT_APPLICABLE"}
203
+ capsules: list[dict[str, Any]] = []
204
+ for path in capsule_root.glob("run-*.json"):
205
+ try:
206
+ item = json.loads(path.read_text(encoding="utf-8-sig"))
207
+ except (OSError, json.JSONDecodeError):
208
+ continue
209
+ if (
210
+ isinstance(item, dict)
211
+ and item.get("phase") == "run"
212
+ and not item.get("closedAt")
213
+ and _nonempty_str(item.get("ownershipHash"))
214
+ ):
215
+ capsules.append(item)
216
+ if not capsules:
217
+ return {"ok": True, "code": "OWNERSHIP_FREEZE_NOT_APPLICABLE"}
218
+ capsule = sorted(capsules, key=lambda item: str(item.get("createdAt") or ""))[-1]
219
+ current = ownership_hash(contract)
220
+ if capsule.get("ownershipHash") != current:
221
+ return {
222
+ "ok": False,
223
+ "code": "OWNERSHIP_CHANGED_BEFORE_VERIFICATION",
224
+ "message": (
225
+ "产品范围在 Run 启动后发生变化;请先通过受控范围更新重启 Run,"
226
+ "系统将只失效受影响的验证。"
227
+ ),
228
+ "storedOwnershipHash": capsule.get("ownershipHash"),
229
+ "currentOwnershipHash": current,
230
+ "runId": capsule.get("runId"),
231
+ }
232
+ return {"ok": True, "code": "OWNERSHIP_FROZEN"}
149
233
 
150
234
 
151
235
  def product_tree_hash(project_root: Path | None) -> str | None:
@@ -284,6 +368,10 @@ def parse_files_manifest(raw: str | None) -> list[str]:
284
368
  ]
285
369
 
286
370
 
371
+ class ProjectRootRequiredError(ValueError):
372
+ """Raised when relative verification inputs have no stable project basis."""
373
+
374
+
287
375
  def resolve_input_files(
288
376
  files: list[str], project_root: Path | None
289
377
  ) -> list[str]:
@@ -313,7 +401,15 @@ def input_files_from_args(args: argparse.Namespace) -> tuple[list[str], Path | N
313
401
  manifest = parse_files_manifest(getattr(args, "files_from", None))
314
402
  if files and manifest:
315
403
  raise ValueError("use only one of --files and --files-from")
316
- return resolve_input_files(files or manifest, project_root), project_root
404
+ selected = files or manifest
405
+ if project_root is None and any(
406
+ not Path(raw).expanduser().is_absolute() for raw in selected
407
+ ):
408
+ raise ProjectRootRequiredError(
409
+ "relative verification inputs require --project so their identity "
410
+ "does not depend on the caller's current directory"
411
+ )
412
+ return resolve_input_files(selected, project_root), project_root
317
413
 
318
414
 
319
415
  def sha256_file(path: Path) -> str:
@@ -1160,6 +1256,8 @@ _DYNAMIC_OWN_DIRS = ("events.ndjson", "logs", "evidence", "reports", "runtime",
1160
1256
 
1161
1257
  def _matches_ownership_path(rel: str, declared: Any) -> bool:
1162
1258
  scope = str(declared).replace("\\", "/").strip("/")
1259
+ if scope.endswith("/**"):
1260
+ scope = scope[:-3].rstrip("/")
1163
1261
  if not scope:
1164
1262
  return False
1165
1263
  normalized = rel.replace("\\", "/").strip("/")
@@ -1672,8 +1770,8 @@ def decide_can_reuse(
1672
1770
  )
1673
1771
  and (
1674
1772
  not _nonempty_str(requested_command)
1675
- or str(candidate.get("command") or "").strip()
1676
- == str(requested_command).strip()
1773
+ or canonical_command(str(candidate.get("command") or ""))
1774
+ == canonical_command(str(requested_command))
1677
1775
  )
1678
1776
  ]
1679
1777
  entry = (
@@ -1821,7 +1919,7 @@ def decide_can_reuse(
1821
1919
  }
1822
1920
 
1823
1921
  if requested_command is not None and str(requested_command).strip():
1824
- if str(command).strip() != str(requested_command).strip():
1922
+ if canonical_command(str(command)) != canonical_command(str(requested_command)):
1825
1923
  return {
1826
1924
  "ok": True,
1827
1925
  "reuse": False,
@@ -2051,10 +2149,29 @@ def cmd_can_reuse(args: argparse.Namespace) -> int:
2051
2149
  verbose = bool(getattr(args, "verbose", False))
2052
2150
  verification = args.verification
2053
2151
  change_dir = resolve_path(args.change_dir)
2152
+ ownership_check = frozen_ownership_check(change_dir)
2153
+ if not ownership_check.get("ok"):
2154
+ return emit_error(
2155
+ str(ownership_check.get("message")),
2156
+ as_json=as_json,
2157
+ error_code=str(ownership_check.get("code")),
2158
+ extra={
2159
+ key: value
2160
+ for key, value in ownership_check.items()
2161
+ if key not in {"ok", "code", "message"}
2162
+ },
2163
+ )
2054
2164
  try:
2055
2165
  files, project_root = input_files_from_args(args)
2166
+ except ProjectRootRequiredError as exc:
2167
+ return emit_error(
2168
+ str(exc),
2169
+ as_json=as_json,
2170
+ error_code="PROJECT_ROOT_REQUIRED",
2171
+ )
2056
2172
  except (OSError, ValueError) as exc:
2057
2173
  return emit_error(f"can-reuse failed: {exc}", as_json=as_json)
2174
+ explicit_files = list(files)
2058
2175
  target = resolve_verification_target(verification, project_root)
2059
2176
  if target is None:
2060
2177
  return emit_error(
@@ -2083,7 +2200,22 @@ def cmd_can_reuse(args: argparse.Namespace) -> int:
2083
2200
  compact_fn=_compact_can_reuse_payload,
2084
2201
  )
2085
2202
  return 0
2086
- files = resolve_input_files(resolved_files, project_root)
2203
+ profile_files = resolve_input_files(resolved_files, project_root)
2204
+ if explicit_files:
2205
+ _explicit_hash, explicit_names = compute_inputs_hash(
2206
+ explicit_files, project_root=project_root
2207
+ )
2208
+ _profile_hash, profile_names = compute_inputs_hash(
2209
+ profile_files, project_root=project_root
2210
+ )
2211
+ if explicit_names != profile_names:
2212
+ return emit_error(
2213
+ "PROFILE_INPUT_FILES_CONFLICT: --files does not match the "
2214
+ "declared build-profile input set",
2215
+ as_json=as_json,
2216
+ error_code="PROFILE_INPUT_FILES_CONFLICT",
2217
+ )
2218
+ files = profile_files
2087
2219
  if not files:
2088
2220
  return emit_error(
2089
2221
  "can-reuse requires --files or a non-empty --profile-input file set",
@@ -2095,10 +2227,20 @@ def cmd_can_reuse(args: argparse.Namespace) -> int:
2095
2227
  verification=verification,
2096
2228
  files=files,
2097
2229
  requested_scope=getattr(args, "scope", None),
2098
- requested_command=getattr(args, "command", None),
2099
- requested_toolchain_hash=getattr(args, "toolchain_hash", None),
2230
+ requested_command=(
2231
+ canonical_command(str(getattr(args, "command", "")))
2232
+ if _nonempty_str(getattr(args, "command", None))
2233
+ else None
2234
+ ),
2235
+ requested_toolchain_hash=(
2236
+ getattr(args, "toolchain_hash", None)
2237
+ or default_toolchain_hash(project_root)
2238
+ ),
2100
2239
  requested_profile_hash=getattr(args, "profile_hash", None),
2101
- requested_environment_hash=getattr(args, "environment_hash", None),
2240
+ requested_environment_hash=(
2241
+ getattr(args, "environment_hash", None)
2242
+ or default_environment_hash(project_root)
2243
+ ),
2102
2244
  requested_db_schema_hash=getattr(args, "db_schema_hash", None),
2103
2245
  requested_product_tree_hash=(
2104
2246
  getattr(args, "product_tree_hash", None) or product_tree_hash(project_root)
@@ -2135,6 +2277,18 @@ def cmd_record(args: argparse.Namespace) -> int:
2135
2277
  as_json = bool(args.json)
2136
2278
  verbose = bool(getattr(args, "verbose", False))
2137
2279
  change_dir = resolve_path(args.change_dir)
2280
+ ownership_check = frozen_ownership_check(change_dir)
2281
+ if not ownership_check.get("ok"):
2282
+ return emit_error(
2283
+ str(ownership_check.get("message")),
2284
+ as_json=as_json,
2285
+ error_code=str(ownership_check.get("code")),
2286
+ extra={
2287
+ key: value
2288
+ for key, value in ownership_check.items()
2289
+ if key not in {"ok", "code", "message"}
2290
+ },
2291
+ )
2138
2292
  verification = args.verification
2139
2293
  contract_v2 = _contract_is_v2(change_dir)
2140
2294
  migration_receipt: dict[str, Any] | None = None
@@ -2142,6 +2296,7 @@ def cmd_record(args: argparse.Namespace) -> int:
2142
2296
  files, project_root = input_files_from_args(args)
2143
2297
  except (OSError, ValueError) as exc:
2144
2298
  return emit_error(f"record failed: {exc}", as_json=as_json)
2299
+ explicit_files = list(files)
2145
2300
  target = resolve_verification_target(verification, project_root)
2146
2301
  if target is None:
2147
2302
  return emit_error(
@@ -2158,7 +2313,22 @@ def cmd_record(args: argparse.Namespace) -> int:
2158
2313
  resolved_files, err = expand_profile_input_files(project_root, profile_input)
2159
2314
  if err:
2160
2315
  return emit_error(f"record failed: {err}", as_json=as_json)
2161
- files = resolve_input_files(resolved_files, project_root)
2316
+ profile_files = resolve_input_files(resolved_files, project_root)
2317
+ if explicit_files:
2318
+ _explicit_hash, explicit_names = compute_inputs_hash(
2319
+ explicit_files, project_root=project_root
2320
+ )
2321
+ _profile_hash, profile_names = compute_inputs_hash(
2322
+ profile_files, project_root=project_root
2323
+ )
2324
+ if explicit_names != profile_names:
2325
+ return emit_error(
2326
+ "PROFILE_INPUT_FILES_CONFLICT: --files does not match the "
2327
+ "declared build-profile input set",
2328
+ as_json=as_json,
2329
+ error_code="PROFILE_INPUT_FILES_CONFLICT",
2330
+ )
2331
+ files = profile_files
2162
2332
  if not files:
2163
2333
  return emit_error(
2164
2334
  "record requires --files or a non-empty --profile-input file set",
@@ -2224,7 +2394,12 @@ def cmd_record(args: argparse.Namespace) -> int:
2224
2394
  entry.update(
2225
2395
  {
2226
2396
  "status": status,
2227
- "command": args.command,
2397
+ "command": canonical_command(args.command),
2398
+ "runnerCommand": (
2399
+ str(getattr(args, "runner_command", None)).strip()
2400
+ if _nonempty_str(getattr(args, "runner_command", None))
2401
+ else str(args.command).strip()
2402
+ ),
2228
2403
  "evidence": args.evidence,
2229
2404
  "exitCode": args.exit_code,
2230
2405
  "durationMs": args.duration_ms,
@@ -2304,6 +2479,10 @@ def cmd_record(args: argparse.Namespace) -> int:
2304
2479
  ("dbSchemaHash", "db_schema_hash"),
2305
2480
  ):
2306
2481
  val = getattr(args, attr, None)
2482
+ if field == "toolchainHash" and not _nonempty_str(val):
2483
+ val = default_toolchain_hash(project_root)
2484
+ elif field == "environmentHash" and not _nonempty_str(val):
2485
+ val = default_environment_hash(project_root)
2307
2486
  if _nonempty_str(val):
2308
2487
  entry[field] = str(val).strip()
2309
2488
  entry["commandSetHash"] = command_set_hash(args.command)
@@ -2656,6 +2835,11 @@ def build_parser() -> argparse.ArgumentParser:
2656
2835
  p_record.add_argument("--verification", required=True)
2657
2836
  p_record.add_argument("--status", required=True)
2658
2837
  p_record.add_argument("--command", required=True)
2838
+ p_record.add_argument(
2839
+ "--runner-command",
2840
+ default=None,
2841
+ help="actual launcher command; stored as execution metadata, not target identity",
2842
+ )
2659
2843
  p_record.add_argument("--exit-code", type=int, required=True)
2660
2844
  p_record.add_argument("--duration-ms", type=int, required=True)
2661
2845
  p_record_files = p_record.add_mutually_exclusive_group()
@@ -30,6 +30,18 @@ if hasattr(sys.stderr, "reconfigure"):
30
30
 
31
31
  SCHEMA_VERSION = 1
32
32
  _LINK = re.compile(r"\[[^\]]+\]\(([^)]+)\)")
33
+ _BACKTICK = re.compile(r"`([^`\r\n]+)`")
34
+ _CODE_PATH_SUFFIXES = {
35
+ ".c", ".cc", ".cpp", ".cs", ".css", ".go", ".h", ".hpp", ".html",
36
+ ".java", ".js", ".jsx", ".kt", ".kts", ".mjs", ".php", ".py", ".rb",
37
+ ".rs", ".scss", ".sh", ".svelte", ".swift", ".ts", ".tsx", ".vue",
38
+ }
39
+ _BUILD_FILE_NAMES = {
40
+ "build.gradle", "build.gradle.kts", "cargo.toml", "composer.json", "go.mod",
41
+ "gradle.properties", "package-lock.json", "package.json", "pnpm-lock.yaml",
42
+ "pom.xml", "pyproject.toml", "requirements.txt", "settings.gradle",
43
+ "settings.gradle.kts", "tsconfig.json", "yarn.lock",
44
+ }
33
45
 
34
46
  # C8: valid ownerPhase values (lifecycle phases that can own tasks).
35
47
  VALID_OWNER_PHASES = {"plan", "run", "test", "review", "submit"}
@@ -615,6 +627,71 @@ def validate_staging(staging: Path, change_name: str) -> dict[str, Any]:
615
627
  }
616
628
 
617
629
 
630
+ def validate_product_ownership(change_dir: Path, staging: Path) -> dict[str, Any]:
631
+ """Ensure Plan declares stable prefix ownership for explicit code/test/build paths."""
632
+ context_path = change_dir / "meta" / "change-context.json"
633
+ if not context_path.is_file():
634
+ return {"ok": True, "code": "PLAN_PRODUCT_PATHS_LEGACY_UNDECLARED"}
635
+ try:
636
+ context = json.loads(context_path.read_text(encoding="utf-8-sig"))
637
+ except (OSError, json.JSONDecodeError) as exc:
638
+ return _result_error("PLAN_CHANGE_CONTEXT_INVALID", str(exc))
639
+ ownership = context.get("ownership") if isinstance(context, dict) else None
640
+ raw_paths = ownership.get("productPaths") if isinstance(ownership, dict) else None
641
+ product_paths = [
642
+ str(item).strip().replace("\\", "/").removeprefix("./")
643
+ for item in raw_paths or []
644
+ if isinstance(item, str) and item.strip()
645
+ ]
646
+ unsupported = sorted(path for path in product_paths if any(char in path for char in "*?[]"))
647
+ if unsupported:
648
+ result = _result_error(
649
+ "PLAN_PRODUCT_PATHS_GLOB_UNSUPPORTED",
650
+ "productPaths 只接受精确文件或目录前缀,不支持通配:" + ", ".join(unsupported),
651
+ )
652
+ result["unsupportedPaths"] = unsupported
653
+ return result
654
+
655
+ planned_paths: set[str] = set()
656
+ for document in sorted(staging.rglob("*.md")):
657
+ text = document.read_text(encoding="utf-8-sig")
658
+ for raw in _BACKTICK.findall(text):
659
+ candidate = raw.strip().strip("'\"").replace("\\", "/")
660
+ if not candidate or " " in candidate or "://" in candidate or "<" in candidate:
661
+ continue
662
+ candidate = re.sub(r":\d+(?::\d+)?$", "", candidate)
663
+ candidate = candidate.removeprefix("./").strip("/.,;,;")
664
+ if not candidate or candidate.startswith("../") or candidate.startswith(".harness/"):
665
+ continue
666
+ pure = PurePosixPath(candidate)
667
+ if pure.name.lower() in _BUILD_FILE_NAMES or pure.suffix.lower() in _CODE_PATH_SUFFIXES:
668
+ planned_paths.add(candidate)
669
+
670
+ def covered(path: str) -> bool:
671
+ return any(
672
+ path == owned.rstrip("/")
673
+ or path.startswith(owned.rstrip("/") + "/")
674
+ for owned in product_paths
675
+ if owned.rstrip("/")
676
+ )
677
+
678
+ missing = sorted(path for path in planned_paths if not covered(path))
679
+ if missing:
680
+ result = _result_error(
681
+ "PLAN_PRODUCT_PATHS_INCOMPLETE",
682
+ "productPaths 未覆盖计划明确引用的产品文件:" + ", ".join(missing),
683
+ )
684
+ result["missingPaths"] = missing
685
+ result["recoveryAction"] = "在 Plan 阶段补充精确文件或目录前缀后重新 finalize。"
686
+ return result
687
+ return {
688
+ "ok": True,
689
+ "code": "PLAN_PRODUCT_PATHS_COMPLETE",
690
+ "plannedPaths": sorted(planned_paths),
691
+ "productPaths": product_paths,
692
+ }
693
+
694
+
618
695
  def _terminal_exists(change_dir: Path, run_id: str, attempt: int) -> bool:
619
696
  try:
620
697
  events = harness_events.load_events(harness_events.events_path(change_dir))
@@ -1125,6 +1202,9 @@ def finalize_plan(
1125
1202
  validation = validate_staging(staging, change_name)
1126
1203
  if not validation["ok"]:
1127
1204
  return validation
1205
+ ownership_validation = validate_product_ownership(change_dir, staging)
1206
+ if not ownership_validation["ok"]:
1207
+ return ownership_validation
1128
1208
  start_validation = _validate_plan_start(change_dir, run_id, attempt)
1129
1209
  if not start_validation["ok"]:
1130
1210
  return start_validation
@@ -1155,6 +1235,7 @@ def finalize_plan(
1155
1235
  "artifactsHash": validation["artifactsHash"],
1156
1236
  "files": validation["files"],
1157
1237
  "receiptPath": str(receipt_path),
1238
+ "artifactRef": "meta/plan-finalization.json",
1158
1239
  }
1159
1240
 
1160
1241
  lock_path.parent.mkdir(parents=True, exist_ok=True)
@@ -1253,6 +1334,7 @@ def finalize_plan(
1253
1334
  "artifactsHash": validation["artifactsHash"],
1254
1335
  "files": validation["files"],
1255
1336
  "receiptPath": str(receipt_path),
1337
+ "artifactRef": "meta/plan-finalization.json",
1256
1338
  "executionLogPath": str(harness_events.execution_log_path(change_dir)),
1257
1339
  }
1258
1340
  except OSError as exc:
@@ -1593,18 +1593,15 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
1593
1593
  [],
1594
1594
  error=str(exc),
1595
1595
  )
1596
- if (
1596
+ profile_changed = bool(
1597
1597
  isinstance(snapshot.get("profileFingerprint"), str)
1598
1598
  and snapshot["profileFingerprint"] != current_profile_fingerprint
1599
- ):
1600
- return _result(False, action, "PROFILE_CHANGED", [])
1599
+ )
1601
1600
  baseline_commit = _snapshot_baseline_commit(
1602
1601
  project_root,
1603
1602
  change_root,
1604
1603
  snapshot,
1605
1604
  )
1606
- profile_changed = False
1607
-
1608
1605
  before_entries = snapshot.get("files")
1609
1606
  if not isinstance(before_entries, list):
1610
1607
  return _result(False, action, "SNAPSHOT_INVALID", [])
@@ -1682,11 +1679,21 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
1682
1679
  return result
1683
1680
 
1684
1681
  recorded = [rel for rel, _ in touched]
1685
- reconciliation = _reconcile_close_manifest(
1686
- project_root,
1687
- change_root,
1688
- set(recorded),
1689
- baseline_commit,
1682
+ reconciliation = (
1683
+ {
1684
+ "ok": True,
1685
+ "code": "PROFILE_REBASED_MANIFEST_PRESERVED",
1686
+ "removedCurrentTouches": 0,
1687
+ "deletedEntries": 0,
1688
+ "preservedForeignEntries": 0,
1689
+ }
1690
+ if profile_changed
1691
+ else _reconcile_close_manifest(
1692
+ project_root,
1693
+ change_root,
1694
+ set(recorded),
1695
+ baseline_commit,
1696
+ )
1690
1697
  )
1691
1698
  if not reconciliation.get("ok"):
1692
1699
  return _result(
@@ -1696,40 +1703,26 @@ def close(project: Path | str, change_dir: Path | str) -> dict[str, Any]:
1696
1703
  list(reconciliation.get("files") or []),
1697
1704
  )
1698
1705
 
1699
- # Cross-check (retro §5.10): if the manifest has active entries for this
1700
- # change but close computed recordedCount=0, the snapshot/manifest/diff
1701
- # are inconsistent. Fail closed instead of silently returning success.
1702
- manifest_path = _manifest_path(change_root)
1703
- if manifest_path is not None and manifest_path.is_file():
1704
- try:
1705
- manifest = _read_json(manifest_path)
1706
- except (OSError, json.JSONDecodeError):
1707
- manifest = None
1708
- if isinstance(manifest, dict):
1709
- manifest_files = manifest.get("files")
1710
- if isinstance(manifest_files, list):
1711
- is_v2 = manifest.get("schemaVersion") == 2
1712
- change_id = change_root.name
1713
- active_entries = [
1714
- f for f in manifest_files
1715
- if isinstance(f, dict)
1716
- and f.get("reason") in ("tdd-created", "test-updated", "stale-test-repair")
1717
- and (
1718
- not is_v2
1719
- or f.get("introducedBy") == change_id
1720
- or change_id in (f.get("touchedBy") or [])
1721
- )
1722
- ]
1723
- if active_entries and not recorded:
1724
- return _result(
1725
- False,
1726
- action,
1727
- "MANIFEST_DIFF_HASH_MISMATCH",
1728
- [],
1729
- manifestEntries=len(active_entries),
1730
- recordedCount=0,
1731
- detail="manifest has active entries but close computed 0 recorded tests",
1732
- )
1706
+ # A manifest is change-wide and intentionally survives phase boundaries.
1707
+ # Therefore pre-existing entries with no new diff are consistent and must
1708
+ # not force a test-guard reset. When the build profile changes mid-phase,
1709
+ # retain the diff result and rebaseline the reusable snapshot atomically.
1710
+ if profile_changed:
1711
+ snapshot.update(
1712
+ {
1713
+ "profileFingerprint": current_profile_fingerprint,
1714
+ "capturedAt": time.strftime("%Y-%m-%dT%H:%M:%S"),
1715
+ "files": [
1716
+ {
1717
+ "path": rel,
1718
+ "sha256": digest,
1719
+ "ignored": _is_ignored(project_root, rel),
1720
+ }
1721
+ for rel, digest in sorted(current.items())
1722
+ ],
1723
+ }
1724
+ )
1725
+ _write_json(snapshot_path, snapshot)
1733
1726
 
1734
1727
  return _result(
1735
1728
  True,
@@ -2,5 +2,5 @@
2
2
  "schemaVersion": 1,
3
3
  "overlay": "none",
4
4
  "agent": "codex",
5
- "coreHash": "bc1768fd08cede0b"
5
+ "coreHash": "27dbbca4ee5ddbbf"
6
6
  }
@@ -278,7 +278,7 @@ harness-skills/
278
278
  | **submit 步骤 4** | 提交前必须展示四项:实际 staged 文件列表、diff stat、commit message、是否 push |
279
279
  | **submit push 前** | `git fetch` 后检查远程是否有新提交;有则**不得直接 pull 后 push**,必须 pull/rebase + 重新 compile/test |
280
280
  | **submit hash 记录** | pre-pull local hash + final pushed hash 双标注(主目录);worktree 模式 submit 段只本地 commit,合并段产生 `mergeFinalHash`,archive 以 `mergeFinalHash` 为准(无则回退 final pushed hash) |
281
- | **archive 阶段 1** | 归档前确认 commit push、hash submit/merge 记录一致、test/review 报告状态;阶段边界由 finalize 单进程维护,调用者不额外 append |
281
+ | **archive 阶段 1** | 归档前确认实际计划阶段的证据与结局;有 Git 时核对最终提交身份,无 Git、无 upstream 或跳过 submit 时使用内容清单身份。发布候选资格与本地封存分开判断;阶段边界由 finalize 单进程维护,调用者不额外 append |
282
282
  | **archive 文件移动** | 只用 PowerShell 或 Read+Write+验证,**禁止 Bash mv/cp/rm**;移动失败时不删除原目录 |
283
283
  | **archive final-summary** | 必须运行 `harness_archive.py finalize` 生成权威 `summary-data.json` 并完成 validate;`final-summary.html` 为可选展示投影(默认渲染,失败只记 warning 不回滚;`finalize --no-html` 可跳过)。无测试或无 review 时必须在 JSON 中标记 `NOT_RUN` / `ADVISORY_NOT_RUN`,禁止伪造 100% 通过率。状态演进须真实展示(✅OK / 🟡WARN / 🔁REUSED / 🔁RETESTED / 📝ADVISORY / 🧹NON_BEHAVIORAL_CLEANUP) |
284
284
 
@@ -339,9 +339,9 @@ harness-skills/
339
339
 
340
340
  > **harness-review 是参考性审查阶段**:默认只生成参考性审查报告和按需 fixback,不影响后续 submit、archive。如果用户选择处理 fixback,回到 `/harness-run --fixback`,再执行 `/harness-test` 和 `/harness-review`;如果团队希望 review RED 阻塞提交,可在 `.harness/config/harness-test-config.md` 中设置 `review.strict-review-gate: true`。
341
341
 
342
- > **submit archive 的时序**:主目录模式流程为 `run testreview(advisory) → submit(含 push) archive`;worktree 模式流程为 `runtestreview submit(本地 commit + 自动 --no-ff 合并 + push 主分支) → archive`。`/harness-merge` 为 submit 的别名触发词。archive 优先读 ledger `mergeFinalHash`。
342
+ > **阶段顺序以计划为准**:Plan 会把本次 `plannedPhases` 写入上下文,后续阶段只消费该计划,不再假定 testreviewsubmit merge 必经。快速流程默认可用 `planrunarchive`;需要完整验证、评审或提交时再把对应阶段加入计划。无 Git、无 upstream、仅本地提交或主动跳过 submit 都不妨碍事实封存;只有“发布候选”需要额外满足发布策略。
343
343
 
344
- > **verification-ledger 驱动跨阶段复用**:每个变更目录维护 `.harness/changes/<change-name>/evidence/verification-ledger.json`,记录 compile/unitTest/apiTest 的结果+证据+diffHash+作用范围。run/test/submit 执行验证前先读 ledger,满足复用条件(diffHash 一致、module/profile 一致、范围更严格、有证据、无行为性 post-test 修改)则跳过重跑并标记 🔁REUSED;post-test 小改动按 7 类分类,非行为性清理可复用 API 测试。详见 `protocols/ledger-protocol.md`。
344
+ > **verification-ledger 驱动跨阶段复用**:先通过共享状态目录解析器定位变更,再读写其 `evidence/verification-ledger.json`,其中记录 compile/unitTest/apiTest 的结果、证据、diffHash 和作用范围。run/test/submit 执行验证前先读 ledger,满足复用条件(diffHash 一致、module/profile 一致、范围更严格、有证据、无行为性 post-test 修改)则跳过重跑并标记 🔁REUSED;post-test 小改动按 7 类分类,非行为性清理可复用 API 测试。详见 `protocols/ledger-protocol.md`。
345
345
 
346
346
  ## 外部方法论吸收(已内化)
347
347
 
@@ -34,7 +34,7 @@
34
34
  "riskTiers": {
35
35
  "fast": {
36
36
  "description": "Low-risk docs/comments/non-behavioral config; no API/DB/security/concurrency. Policy notes: checkpointRules apply only when meta/implementation-checkpoints.json defines the entry for this change; missing file/entry = disabled (gate must not require --task).",
37
- "defaultPhases": ["plan", "run", "submit", "archive"],
37
+ "defaultPhases": ["plan", "run", "archive"],
38
38
  "requiredValidations": ["unitTest"],
39
39
  "conditionalStages": ["review", "package", "apidoc"],
40
40
  "upgradeTriggers": ["api-change", "security", "migration", "concurrency", "breaking-contract"]