@dommaker/harness 1.13.0 → 1.15.0

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 (357) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +4 -2
  3. package/dist/cli/commands/check.js +3 -3
  4. package/dist/cli/commands/check.js.map +1 -1
  5. package/dist/cli/commands/constraints-disable.d.ts +48 -0
  6. package/dist/cli/commands/constraints-disable.d.ts.map +1 -0
  7. package/dist/cli/commands/constraints-disable.js +156 -0
  8. package/dist/cli/commands/constraints-disable.js.map +1 -0
  9. package/dist/cli/commands/constraints-pack-proposal.d.ts +1 -1
  10. package/dist/cli/commands/constraints-pack-proposal.js +1 -1
  11. package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
  12. package/dist/cli/commands/constraints-reactivate.js +4 -2
  13. package/dist/cli/commands/constraints-reactivate.js.map +1 -1
  14. package/dist/cli/commands/constraints-retire.d.ts +14 -4
  15. package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
  16. package/dist/cli/commands/constraints-retire.js +10 -6
  17. package/dist/cli/commands/constraints-retire.js.map +1 -1
  18. package/dist/cli/commands/constraints.d.ts +1 -1
  19. package/dist/cli/commands/constraints.js +1 -1
  20. package/dist/cli/commands/definitions.d.ts.map +1 -1
  21. package/dist/cli/commands/definitions.js +16 -1
  22. package/dist/cli/commands/definitions.js.map +1 -1
  23. package/dist/cli/commands/knowledge-view.d.ts +3 -3
  24. package/dist/cli/commands/knowledge-view.js +4 -4
  25. package/dist/cli/commands/knowledge-view.js.map +1 -1
  26. package/dist/cli/commands/release.d.ts +2 -2
  27. package/dist/cli/commands/release.js +2 -2
  28. package/dist/cli/commands/sync-docs/agents-syncer.js +2 -4
  29. package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -1
  30. package/dist/cli/commands/sync-docs/head-gate.d.ts +34 -0
  31. package/dist/cli/commands/sync-docs/head-gate.d.ts.map +1 -0
  32. package/dist/cli/commands/sync-docs/head-gate.js +86 -0
  33. package/dist/cli/commands/sync-docs/head-gate.js.map +1 -0
  34. package/dist/cli/commands/sync-docs/index.d.ts +7 -0
  35. package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
  36. package/dist/cli/commands/sync-docs/index.js +51 -1
  37. package/dist/cli/commands/sync-docs/index.js.map +1 -1
  38. package/dist/completion-checkers/contract-presence.d.ts +1 -1
  39. package/dist/completion-checkers/contract-presence.js +1 -1
  40. package/dist/core/app-constraints-loader.d.ts +5 -3
  41. package/dist/core/app-constraints-loader.d.ts.map +1 -1
  42. package/dist/core/app-constraints-loader.js +20 -7
  43. package/dist/core/app-constraints-loader.js.map +1 -1
  44. package/dist/core/constraints/capabilities-parser.js +1 -1
  45. package/dist/core/constraints/check-cache.d.ts +1 -1
  46. package/dist/core/constraints/check-cache.js +1 -1
  47. package/dist/core/constraints/checker.d.ts +5 -3
  48. package/dist/core/constraints/checker.d.ts.map +1 -1
  49. package/dist/core/constraints/checker.js +31 -10
  50. package/dist/core/constraints/checker.js.map +1 -1
  51. package/dist/core/constraints/checkers/capability-sync.d.ts +1 -1
  52. package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
  53. package/dist/core/constraints/checkers/capability-sync.js +22 -9
  54. package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
  55. package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -1
  56. package/dist/core/constraints/checkers/context-doc-sync.js +7 -1
  57. package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
  58. package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -1
  59. package/dist/core/constraints/checkers/docs-freshness.js +41 -26
  60. package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
  61. package/dist/core/constraints/checkers/governance-presence.d.ts +4 -1
  62. package/dist/core/constraints/checkers/governance-presence.d.ts.map +1 -1
  63. package/dist/core/constraints/checkers/governance-presence.js +8 -11
  64. package/dist/core/constraints/checkers/governance-presence.js.map +1 -1
  65. package/dist/core/constraints/checkers/index.d.ts +6 -6
  66. package/dist/core/constraints/checkers/index.d.ts.map +1 -1
  67. package/dist/core/constraints/checkers/index.js +16 -11
  68. package/dist/core/constraints/checkers/index.js.map +1 -1
  69. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +34 -0
  70. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +1 -0
  71. package/dist/core/constraints/checkers/no-completion-without-verification.js +157 -0
  72. package/dist/core/constraints/checkers/no-completion-without-verification.js.map +1 -0
  73. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +14 -4
  74. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
  75. package/dist/core/constraints/checkers/no-hardcoded-credentials.js +134 -30
  76. package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
  77. package/dist/core/constraints/checkers/no-test-simplification.d.ts +16 -2
  78. package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -1
  79. package/dist/core/constraints/checkers/no-test-simplification.js +115 -15
  80. package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -1
  81. package/dist/core/constraints/checkers/templated/exec.d.ts +19 -0
  82. package/dist/core/constraints/checkers/templated/exec.d.ts.map +1 -0
  83. package/dist/core/constraints/checkers/templated/exec.js +124 -0
  84. package/dist/core/constraints/checkers/templated/exec.js.map +1 -0
  85. package/dist/core/constraints/checkers/templated/index.d.ts +1 -0
  86. package/dist/core/constraints/checkers/templated/index.d.ts.map +1 -1
  87. package/dist/core/constraints/checkers/templated/index.js +3 -1
  88. package/dist/core/constraints/checkers/templated/index.js.map +1 -1
  89. package/dist/core/constraints/checkers/templates-registry.d.ts +2 -1
  90. package/dist/core/constraints/checkers/templates-registry.d.ts.map +1 -1
  91. package/dist/core/constraints/checkers/templates-registry.js +3 -1
  92. package/dist/core/constraints/checkers/templates-registry.js.map +1 -1
  93. package/dist/core/constraints/checkers/types.d.ts +68 -7
  94. package/dist/core/constraints/checkers/types.d.ts.map +1 -1
  95. package/dist/core/constraints/checkers/types.js +52 -7
  96. package/dist/core/constraints/checkers/types.js.map +1 -1
  97. package/dist/core/constraints/context-builder.d.ts.map +1 -1
  98. package/dist/core/constraints/context-builder.js +0 -17
  99. package/dist/core/constraints/context-builder.js.map +1 -1
  100. package/dist/core/constraints/definitions/guidelines.d.ts +1 -0
  101. package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
  102. package/dist/core/constraints/definitions/guidelines.js +5 -1
  103. package/dist/core/constraints/definitions/guidelines.js.map +1 -1
  104. package/dist/core/constraints/definitions/iron-laws.d.ts +1 -0
  105. package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
  106. package/dist/core/constraints/definitions/iron-laws.js +8 -3
  107. package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
  108. package/dist/core/constraints/definitions.d.ts +8 -1
  109. package/dist/core/constraints/definitions.d.ts.map +1 -1
  110. package/dist/core/constraints/definitions.js +11 -1
  111. package/dist/core/constraints/definitions.js.map +1 -1
  112. package/dist/core/constraints/git-evidence.d.ts +10 -0
  113. package/dist/core/constraints/git-evidence.d.ts.map +1 -1
  114. package/dist/core/constraints/git-evidence.js +2 -0
  115. package/dist/core/constraints/git-evidence.js.map +1 -1
  116. package/dist/core/constraints/index.d.ts +3 -1
  117. package/dist/core/constraints/index.d.ts.map +1 -1
  118. package/dist/core/constraints/index.js +8 -1
  119. package/dist/core/constraints/index.js.map +1 -1
  120. package/dist/core/constraints/run-env.d.ts +3 -2
  121. package/dist/core/constraints/run-env.d.ts.map +1 -1
  122. package/dist/core/constraints/run-env.js +5 -4
  123. package/dist/core/constraints/run-env.js.map +1 -1
  124. package/dist/core/constraints/usage-report.d.ts +0 -5
  125. package/dist/core/constraints/usage-report.d.ts.map +1 -1
  126. package/dist/core/constraints/usage-report.js +3 -12
  127. package/dist/core/constraints/usage-report.js.map +1 -1
  128. package/dist/core/effective-constraints.d.ts +1 -1
  129. package/dist/core/effective-constraints.js +1 -1
  130. package/dist/core/index.d.ts +2 -2
  131. package/dist/core/index.d.ts.map +1 -1
  132. package/dist/core/index.js +6 -1
  133. package/dist/core/index.js.map +1 -1
  134. package/dist/core/retired-constraints.d.ts +66 -0
  135. package/dist/core/retired-constraints.d.ts.map +1 -0
  136. package/dist/core/retired-constraints.js +52 -0
  137. package/dist/core/retired-constraints.js.map +1 -0
  138. package/dist/core/validators/checkpoint.d.ts +4 -2
  139. package/dist/core/validators/checkpoint.d.ts.map +1 -1
  140. package/dist/core/validators/checkpoint.js +4 -2
  141. package/dist/core/validators/checkpoint.js.map +1 -1
  142. package/dist/core/validators/passes-gate.d.ts +2 -2
  143. package/dist/core/validators/passes-gate.d.ts.map +1 -1
  144. package/dist/core/validators/passes-gate.js +4 -3
  145. package/dist/core/validators/passes-gate.js.map +1 -1
  146. package/dist/gates/checker-gate.d.ts +8 -4
  147. package/dist/gates/checker-gate.d.ts.map +1 -1
  148. package/dist/gates/checker-gate.js +13 -6
  149. package/dist/gates/checker-gate.js.map +1 -1
  150. package/dist/gates/index.d.ts +1 -1
  151. package/dist/gates/index.js +1 -1
  152. package/dist/index.d.ts +5 -1
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.js +18 -5
  155. package/dist/index.js.map +1 -1
  156. package/dist/knowledge/audit-scoring.js +1 -1
  157. package/dist/knowledge/audit-scoring.js.map +1 -1
  158. package/dist/monitoring/trace-analyzer.d.ts +2 -2
  159. package/dist/monitoring/trace-analyzer.js +2 -2
  160. package/dist/monitoring/traces.d.ts +1 -1
  161. package/dist/monitoring/traces.js +4 -4
  162. package/dist/monitoring/traces.js.map +1 -1
  163. package/dist/pretool-use-hook.d.ts +1 -1
  164. package/dist/pretool-use-hook.d.ts.map +1 -1
  165. package/dist/pretool-use-hook.js +5 -5
  166. package/dist/pretool-use-hook.js.map +1 -1
  167. package/dist/release/integrity.d.ts +4 -4
  168. package/dist/release/integrity.js +4 -4
  169. package/dist/test-setup/mkdtemp-cleanup.js +1 -1
  170. package/dist/tools/definitions/core/notification/notify.yml +0 -1
  171. package/dist/tools/definitions/ext/browser/browser-close.yml +0 -1
  172. package/dist/tools/definitions/ext/browser/browser-start.yml +0 -1
  173. package/dist/tools/definitions/std/evolution/implement.yml +0 -1
  174. package/dist/tools/definitions/std/evolution/prioritize.yml +0 -1
  175. package/dist/tools/definitions/std/evolution/report-gap.yml +0 -1
  176. package/dist/tools/definitions/std/governance/aggregate-opinions.yml +0 -1
  177. package/dist/tools/definitions/std/governance/audit-task.yml +0 -1
  178. package/dist/tools/definitions/std/governance/cast-vote.yml +0 -1
  179. package/dist/tools/definitions/std/governance/create-voting-session.yml +0 -1
  180. package/dist/tools/definitions/std/governance/define-stance.yml +0 -1
  181. package/dist/tools/definitions/std/governance/impeach.yml +0 -1
  182. package/dist/tools/definitions/std/governance/multi-stance-review.yml +0 -1
  183. package/dist/tools/definitions/std/governance/rollback.yml +0 -1
  184. package/dist/tools/definitions/std/governance/stance-review.yml +0 -1
  185. package/dist/tools/definitions/std/governance/track-effect.yml +0 -1
  186. package/dist/tools/definitions/std/governance/vote-tally.yml +0 -1
  187. package/dist/tools/definitions/std/planning/split-batch.yml +0 -1
  188. package/dist/tools/definitions/std/planning/split-tasks.yml +0 -1
  189. package/dist/types/constraint.d.ts +32 -9
  190. package/dist/types/constraint.d.ts.map +1 -1
  191. package/dist/types/constraint.js +6 -1
  192. package/dist/types/constraint.js.map +1 -1
  193. package/dist/types/passes-gate.d.ts +7 -0
  194. package/dist/types/passes-gate.d.ts.map +1 -1
  195. package/dist/types/passes-gate.js +8 -0
  196. package/dist/types/passes-gate.js.map +1 -1
  197. package/dist/types/trace.d.ts +7 -0
  198. package/dist/types/trace.d.ts.map +1 -1
  199. package/dist/utils/detect-source-roots.d.ts +1 -1
  200. package/dist/utils/detect-source-roots.d.ts.map +1 -1
  201. package/dist/utils/detect-source-roots.js +2 -21
  202. package/dist/utils/detect-source-roots.js.map +1 -1
  203. package/package.json +1 -2
  204. package/src/CONTEXT.md +3 -3
  205. package/src/__tests__/app-constraints-loader.test.ts +86 -3
  206. package/src/__tests__/checker-extra.test.ts +110 -11
  207. package/src/__tests__/checker-primitives-sdk.test.ts +70 -0
  208. package/src/__tests__/checker.test.ts +16 -14
  209. package/src/__tests__/detect-source-roots.test.ts +5 -4
  210. package/src/__tests__/exec-checker-full-chain.test.ts +118 -0
  211. package/src/__tests__/iron-laws.test.ts +13 -20
  212. package/src/__tests__/no-studio-references.test.ts +54 -0
  213. package/src/__tests__/passes-gate-check.test.ts +1 -1
  214. package/src/__tests__/pretool-use-hook.test.ts +2 -2
  215. package/src/__tests__/public-exports.test.ts +6 -0
  216. package/src/__tests__/public-type-surface.test.ts +24 -2
  217. package/src/__tests__/public-value-surface.test.ts +5 -0
  218. package/src/__tests__/retired-constraints.test.ts +99 -0
  219. package/src/__tests__/skip-semantics.test.ts +16 -33
  220. package/src/__tests__/usage-report-public-export.test.ts +3 -3
  221. package/src/cli/commands/CONTEXT.md +7 -6
  222. package/src/cli/commands/__tests__/check-read-count.test.ts +3 -0
  223. package/src/cli/commands/__tests__/check-skip-output.test.ts +4 -4
  224. package/src/cli/commands/__tests__/check.test.ts +35 -6
  225. package/src/cli/commands/__tests__/constraints-disable.test.ts +229 -0
  226. package/src/cli/commands/__tests__/constraints-report-json-flag.test.ts +1 -1
  227. package/src/cli/commands/__tests__/constraints-report.test.ts +4 -4
  228. package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +1 -1
  229. package/src/cli/commands/__tests__/knowledge.test.ts +3 -3
  230. package/src/cli/commands/__tests__/project-path-anchoring.test.ts +4 -1
  231. package/src/cli/commands/__tests__/project-path-convention.test.ts +1 -1
  232. package/src/cli/commands/__tests__/spec-baseline-index-cap.test.ts +1 -1
  233. package/src/cli/commands/__tests__/sync-docs-agents.test.ts +1 -24
  234. package/src/cli/commands/__tests__/sync-docs-gate.test.ts +154 -0
  235. package/src/cli/commands/__tests__/sync-docs-table-layout.test.ts +1 -1
  236. package/src/cli/commands/__tests__/sync-docs.test.ts +3 -3
  237. package/src/cli/commands/check.ts +3 -3
  238. package/src/cli/commands/constraints-disable.ts +145 -0
  239. package/src/cli/commands/constraints-pack-proposal.ts +1 -1
  240. package/src/cli/commands/constraints-reactivate.ts +4 -2
  241. package/src/cli/commands/constraints-retire.ts +11 -8
  242. package/src/cli/commands/constraints.ts +1 -1
  243. package/src/cli/commands/definitions.ts +16 -1
  244. package/src/cli/commands/knowledge-view.ts +4 -4
  245. package/src/cli/commands/release.ts +2 -2
  246. package/src/cli/commands/sync-docs/agents-syncer.ts +2 -4
  247. package/src/cli/commands/sync-docs/head-gate.ts +87 -0
  248. package/src/cli/commands/sync-docs/index.ts +62 -1
  249. package/src/completion-checkers/contract-presence.ts +1 -1
  250. package/src/core/CONTEXT.md +9 -8
  251. package/src/core/app-constraints-loader.ts +23 -8
  252. package/src/core/constraints/__tests__/capabilities-reconcile.test.ts +1 -1
  253. package/src/core/constraints/__tests__/check-cache.test.ts +1 -1
  254. package/src/core/constraints/__tests__/collect-constraints.test.ts +42 -18
  255. package/src/core/constraints/__tests__/git-evidence.test.ts +20 -0
  256. package/src/core/constraints/__tests__/run-env.test.ts +9 -7
  257. package/src/core/constraints/__tests__/trace-injection.test.ts +8 -2
  258. package/src/core/constraints/capabilities-parser.ts +1 -1
  259. package/src/core/constraints/check-cache.ts +1 -1
  260. package/src/core/constraints/checker.ts +35 -12
  261. package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +21 -3
  262. package/src/core/constraints/checkers/__tests__/context-doc-sync.test.ts +20 -12
  263. package/src/core/constraints/checkers/__tests__/docs-freshness-degraded.test.ts +89 -0
  264. package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +4 -2
  265. package/src/core/constraints/checkers/__tests__/exec-checker.test.ts +99 -0
  266. package/src/core/constraints/checkers/__tests__/fixtures/public-repo-sanitization.mjs +40 -0
  267. package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +24 -3
  268. package/src/core/constraints/checkers/__tests__/input-contract.test.ts +135 -0
  269. package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +208 -0
  270. package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +127 -5
  271. package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +144 -21
  272. package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +6 -2
  273. package/src/core/constraints/checkers/capability-sync.ts +25 -11
  274. package/src/core/constraints/checkers/context-doc-sync.ts +8 -1
  275. package/src/core/constraints/checkers/docs-freshness.ts +44 -26
  276. package/src/core/constraints/checkers/governance-presence.ts +8 -9
  277. package/src/core/constraints/checkers/index.ts +23 -13
  278. package/src/core/constraints/checkers/no-completion-without-verification.ts +126 -0
  279. package/src/core/constraints/checkers/no-hardcoded-credentials.ts +153 -29
  280. package/src/core/constraints/checkers/no-test-simplification.ts +128 -17
  281. package/src/core/constraints/checkers/templated/exec.ts +138 -0
  282. package/src/core/constraints/checkers/templated/index.ts +1 -0
  283. package/src/core/constraints/checkers/templates-registry.ts +4 -2
  284. package/src/core/constraints/checkers/types.ts +107 -10
  285. package/src/core/constraints/context-builder.ts +0 -18
  286. package/src/core/constraints/definitions/guidelines.ts +5 -1
  287. package/src/core/constraints/definitions/iron-laws.ts +8 -3
  288. package/src/core/constraints/definitions.ts +11 -1
  289. package/src/core/constraints/doc-freshness/__tests__/runner.test.ts +3 -3
  290. package/src/core/constraints/git-evidence.ts +13 -0
  291. package/src/core/constraints/index.ts +22 -1
  292. package/src/core/constraints/run-env.ts +6 -5
  293. package/src/core/constraints/usage-report.ts +2 -12
  294. package/src/core/effective-constraints.ts +1 -1
  295. package/src/core/index.ts +16 -1
  296. package/src/core/retired-constraints.ts +77 -0
  297. package/src/core/validators/checkpoint.ts +4 -2
  298. package/src/core/validators/passes-gate.ts +4 -3
  299. package/src/gates/CONTEXT.md +3 -2
  300. package/src/gates/__tests__/checker-gate.test.ts +20 -3
  301. package/src/gates/checker-gate.ts +14 -7
  302. package/src/gates/index.ts +1 -1
  303. package/src/hooks/CONTEXT.md +2 -2
  304. package/src/index.ts +35 -3
  305. package/src/knowledge/CONTEXT.md +2 -2
  306. package/src/knowledge/__tests__/audit.test.ts +1 -1
  307. package/src/knowledge/__tests__/flywheel-metrics.test.ts +1 -1
  308. package/src/knowledge/audit-scoring.ts +1 -1
  309. package/src/monitoring/CONTEXT.md +2 -2
  310. package/src/monitoring/__tests__/skipped-lines-report.test.ts +2 -2
  311. package/src/monitoring/__tests__/traces.test.ts +1 -1
  312. package/src/monitoring/trace-analyzer.ts +2 -2
  313. package/src/monitoring/traces.ts +4 -4
  314. package/src/pretool-use-hook.ts +5 -5
  315. package/src/release/CONTEXT.md +3 -3
  316. package/src/release/integrity.ts +4 -4
  317. package/src/test-setup/__tests__/mkdtemp-cleanup.test.ts +1 -1
  318. package/src/test-setup/mkdtemp-cleanup.ts +1 -1
  319. package/src/tools/CONTEXT.md +3 -3
  320. package/src/tools/__tests__/registry.test.ts +3 -3
  321. package/src/tools/definitions/core/notification/notify.yml +0 -1
  322. package/src/tools/definitions/ext/browser/browser-close.yml +0 -1
  323. package/src/tools/definitions/ext/browser/browser-start.yml +0 -1
  324. package/src/tools/definitions/std/evolution/implement.yml +0 -1
  325. package/src/tools/definitions/std/evolution/prioritize.yml +0 -1
  326. package/src/tools/definitions/std/evolution/report-gap.yml +0 -1
  327. package/src/tools/definitions/std/governance/aggregate-opinions.yml +0 -1
  328. package/src/tools/definitions/std/governance/audit-task.yml +0 -1
  329. package/src/tools/definitions/std/governance/cast-vote.yml +0 -1
  330. package/src/tools/definitions/std/governance/create-voting-session.yml +0 -1
  331. package/src/tools/definitions/std/governance/define-stance.yml +0 -1
  332. package/src/tools/definitions/std/governance/impeach.yml +0 -1
  333. package/src/tools/definitions/std/governance/multi-stance-review.yml +0 -1
  334. package/src/tools/definitions/std/governance/rollback.yml +0 -1
  335. package/src/tools/definitions/std/governance/stance-review.yml +0 -1
  336. package/src/tools/definitions/std/governance/track-effect.yml +0 -1
  337. package/src/tools/definitions/std/governance/vote-tally.yml +0 -1
  338. package/src/tools/definitions/std/planning/split-batch.yml +0 -1
  339. package/src/tools/definitions/std/planning/split-tasks.yml +0 -1
  340. package/src/types/constraint.ts +35 -10
  341. package/src/types/passes-gate.ts +8 -0
  342. package/src/types/trace.ts +8 -0
  343. package/src/utils/detect-source-roots.ts +2 -20
  344. package/bin/harness-knowledge-track.sh +0 -47
  345. package/bin/harness-sensitive-check.sh +0 -67
  346. package/dist/core/constraints/checkers/iron-flags.d.ts +0 -12
  347. package/dist/core/constraints/checkers/iron-flags.d.ts.map +0 -1
  348. package/dist/core/constraints/checkers/iron-flags.js +0 -16
  349. package/dist/core/constraints/checkers/iron-flags.js.map +0 -1
  350. package/src/core/constraints/checkers/__tests__/iron-flags.test.ts +0 -30
  351. package/src/core/constraints/checkers/iron-flags.ts +0 -17
  352. package/templates/nextjs-app/.github/workflows/ci.yml +0 -39
  353. package/templates/node-api/.github/workflows/ci.yml +0 -36
  354. package/templates/node-api/package.json +0 -23
  355. package/templates/node-api/src/index.ts +0 -2
  356. package/templates/node-api/tsconfig.json +0 -19
  357. package/templates/python-api/.github/workflows/ci.yml +0 -39
@@ -67,7 +67,7 @@ function stageChange(dir: string, rel: string, content: string): void {
67
67
  git(dir, 'add', '--', rel);
68
68
  }
69
69
 
70
- /** 真验证证据:traces.log 里有一条 pass(未跟踪,不进 diff) */
70
+ /** trace 种子行(未跟踪,不进 diff);仅供 trace 计数/切片类用例预置 */
71
71
  function passTraces(dir: string, lines = 1): void {
72
72
  write(
73
73
  dir,
@@ -76,6 +76,14 @@ function passTraces(dir: string, lines = 1): void {
76
76
  );
77
77
  }
78
78
 
79
+ /**
80
+ * 真验证证据(harness#183):.harness/evidence 落盘一条测试输出(未跟踪,不进 diff)。
81
+ * traces.log 不再充当验证证据(其唯一写入方是约束检查自身,语义循环已拆除)。
82
+ */
83
+ function passEvidence(dir: string): void {
84
+ write(dir, '.harness/evidence/test-fixture.log', '1 passed\n');
85
+ }
86
+
79
87
  /**
80
88
  * 本项目的 trace 落点记录(harness#139:命令侧收集器锚根构造,写的就是 `<projectPath>/DEFAULT_TRACE_FILE` 正本)
81
89
  *
@@ -132,6 +140,8 @@ function recordingEvidence(projectPath: string): {
132
140
  requests.push('headDirs');
133
141
  return shared.headDirs();
134
142
  },
143
+ stagedDiffAvailable: () => shared.stagedDiffAvailable(),
144
+ changedFileNamesAvailable: (staged: boolean) => shared.changedFileNamesAvailable(staged),
135
145
  };
136
146
  return { evidence, requests, commands };
137
147
  }
@@ -144,6 +154,7 @@ function stagedTestDeletion(): string {
144
154
  git(dir, 'commit', '-q', '-m', 'tests');
145
155
  stageChange(dir, 'src/__tests__/existing.test.ts', "test('a', () => {}\n");
146
156
  passTraces(dir);
157
+ passEvidence(dir);
147
158
  return dir;
148
159
  }
149
160
 
@@ -159,6 +170,7 @@ describe('check command(真 git fixture)', () => {
159
170
  const dir = gitRepo();
160
171
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
161
172
  passTraces(dir);
173
+ passEvidence(dir);
162
174
 
163
175
  const result = await check(
164
176
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'code_implementation' },
@@ -181,11 +193,12 @@ describe('check command(真 git fixture)', () => {
181
193
  io
182
194
  );
183
195
 
184
- expect(io.outText()).toContain('禁止无验证声明完成,必须运行验证命令');
185
- expect(result).toEqual({
186
- kind: 'fail',
187
- reason: 'check error: 禁止无验证声明完成,必须运行验证命令',
188
- });
196
+ expect(io.outText()).toContain('禁止无验证声明完成,必须有晚于最新变更的验证证据');
197
+ // reason 携带证据行(harness#119 证据通道),前缀比对即可
198
+ expect(result.kind).toBe('fail');
199
+ expect(result.kind === 'fail' && result.reason).toContain(
200
+ 'check error: 禁止无验证声明完成,必须有晚于最新变更的验证证据(.harness/evidence)'
201
+ );
189
202
  });
190
203
 
191
204
  it('staged 删除测试行 → 真 git diff 驱动 no_test_simplification 拦截', async () => {
@@ -214,6 +227,7 @@ describe('check command(真 git fixture)', () => {
214
227
  'export const a = 1;\nconst pass' + 'word = "correcthorsebattery";\n'
215
228
  );
216
229
  passTraces(dir);
230
+ passEvidence(dir);
217
231
 
218
232
  const result = await check(
219
233
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'code_implementation' },
@@ -231,6 +245,7 @@ describe('check command(真 git fixture)', () => {
231
245
  write(dir, '.harness/config.yml', 'preset: standard\n');
232
246
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
233
247
  passTraces(dir);
248
+ passEvidence(dir);
234
249
 
235
250
  // 不显式传 trigger:governance_presence 的触发词是 file_modification,由 diff 推断
236
251
  const result = await check(
@@ -249,6 +264,7 @@ describe('check command(真 git fixture)', () => {
249
264
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
250
265
  stageChange(dir, 'src/nested/deep.ts', 'export const d = 2;\n');
251
266
  passTraces(dir);
267
+ passEvidence(dir);
252
268
 
253
269
  await check(
254
270
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'code_implementation' },
@@ -272,6 +288,7 @@ describe('check command(真 git fixture)', () => {
272
288
  const dir = gitRepo();
273
289
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
274
290
  passTraces(dir);
291
+ passEvidence(dir);
275
292
 
276
293
  await check({ staged: true, projectPath: dir, trigger: 'code_implementation' }, io);
277
294
  await check(
@@ -307,6 +324,7 @@ describe('check command(真 git fixture)', () => {
307
324
  const dir = capRepo(['src/existing.ts', 'src/nested/deep.ts']);
308
325
  stageChange(dir, 'src/nested/extra.ts', 'export const e = 1;\n');
309
326
  passTraces(dir);
327
+ passEvidence(dir);
310
328
 
311
329
  const result = await check(
312
330
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'module_modification' },
@@ -321,6 +339,7 @@ describe('check command(真 git fixture)', () => {
321
339
  it('仓库级漂移(与本次变更无关)→ 提示块露出,不判违规', async () => {
322
340
  const dir = capRepo(['src/existing.ts']);
323
341
  passTraces(dir);
342
+ passEvidence(dir);
324
343
 
325
344
  const result = await check(
326
345
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'module_modification' },
@@ -340,6 +359,7 @@ describe('check command(真 git fixture)', () => {
340
359
  it('提示与违规都写进 trace 的 evidence 字段(统计侧可诊断)', async () => {
341
360
  const dir = capRepo(['src/existing.ts']);
342
361
  passTraces(dir);
362
+ passEvidence(dir);
343
363
 
344
364
  await check(
345
365
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'module_modification' },
@@ -359,6 +379,7 @@ describe('check command(真 git fixture)', () => {
359
379
  const dir = gitRepo();
360
380
  stageChange(dir, 'src/__tests__/added.test.ts', "test('a', () => {}\n");
361
381
  passTraces(dir);
382
+ passEvidence(dir);
362
383
  const { evidence, requests, commands } = recordingEvidence(dir);
363
384
 
364
385
  const result = await check({ preset: 'standard', staged: true, projectPath: dir, evidence }, io);
@@ -374,6 +395,7 @@ describe('check command(真 git fixture)', () => {
374
395
  const stagedDir = gitRepo();
375
396
  stageChange(stagedDir, 'src/existing.ts', 'export const a = 2;\n');
376
397
  passTraces(stagedDir);
398
+ passEvidence(stagedDir);
377
399
  const staged = recordingEvidence(stagedDir);
378
400
  await check(
379
401
  { preset: 'standard', staged: true, projectPath: stagedDir, trigger: 'code_implementation', evidence: staged.evidence },
@@ -386,6 +408,7 @@ describe('check command(真 git fixture)', () => {
386
408
  const worktreeDir = gitRepo();
387
409
  write(worktreeDir, 'src/existing.ts', 'export const a = 3;\n');
388
410
  passTraces(worktreeDir);
411
+ passEvidence(worktreeDir);
389
412
  const worktree = recordingEvidence(worktreeDir);
390
413
  await check(
391
414
  { preset: 'standard', staged: false, projectPath: worktreeDir, trigger: 'code_implementation', evidence: worktree.evidence },
@@ -402,6 +425,7 @@ describe('check command(真 git fixture)', () => {
402
425
  const dir = gitRepo();
403
426
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
404
427
  passTraces(dir);
428
+ passEvidence(dir);
405
429
  const seeded = projectTraces(dir).length;
406
430
 
407
431
  await check(
@@ -425,6 +449,7 @@ describe('check command(真 git fixture)', () => {
425
449
  const dir = gitRepo();
426
450
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
427
451
  passTraces(dir);
452
+ passEvidence(dir);
428
453
 
429
454
  await check({ preset: 'standard', staged: true, projectPath: dir }, io);
430
455
 
@@ -435,6 +460,7 @@ describe('check command(真 git fixture)', () => {
435
460
  const dir = gitRepo();
436
461
  stageChange(dir, 'src/brandnew/mod.ts', 'export const n = 1;\n');
437
462
  passTraces(dir);
463
+ passEvidence(dir);
438
464
 
439
465
  await check({ preset: 'standard', staged: true, projectPath: dir }, io);
440
466
 
@@ -445,6 +471,7 @@ describe('check command(真 git fixture)', () => {
445
471
  const dir = gitRepo();
446
472
  stageChange(dir, 'src/__tests__/existing.test.ts', "test('a', () => {}\n");
447
473
  passTraces(dir);
474
+ passEvidence(dir);
448
475
 
449
476
  await check({ preset: 'standard', staged: true, projectPath: dir }, io);
450
477
 
@@ -465,6 +492,7 @@ describe('check command(真 git fixture)', () => {
465
492
  const dir = gitRepo();
466
493
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
467
494
  passTraces(dir);
495
+ passEvidence(dir);
468
496
 
469
497
  await check(
470
498
  { preset: 'standard', staged: true, projectPath: dir, trigger: 'design_request' },
@@ -481,6 +509,7 @@ describe('check command(真 git fixture)', () => {
481
509
  const dir = gitRepo();
482
510
  stageChange(dir, 'src/existing.ts', 'export const a = 2;\n');
483
511
  passTraces(dir);
512
+ passEvidence(dir);
484
513
  write(
485
514
  dir,
486
515
  '.harness/config.yml',
@@ -0,0 +1,229 @@
1
+ /**
2
+ * harness constraints disable 测试(harness#190,ADR-0032 决策 6.6 的另一侧)
3
+ *
4
+ * 裸禁用 = config.yml `constraints.<id>.enabled:false`,无 retired 墓碑、无知识沉淀
5
+ * (墓碑与沉淀是 retire 专有语义)。幂等 already_disabled;retired 墓碑不接管不动;
6
+ * 写后验证生效集已缩小,失败回滚(与下游消费方 applier 同一纪律)。
7
+ * CLI 直达(constraintsDisable):--yes 人确认闸门,与 retire/reactivate 同形。
8
+ *
9
+ * 使用真实临时目录。
10
+ */
11
+
12
+ import * as fs from 'fs';
13
+ import * as os from 'os';
14
+ import * as path from 'path';
15
+ import * as yaml from 'js-yaml';
16
+ import { captureIO, type CapturingIO } from '../../command-contract';
17
+ import { getEffectiveConstraints } from '../../../core/effective-constraints';
18
+ import * as effectiveConstraints from '../../../core/effective-constraints';
19
+ import { FileKnowledgeStore } from '../../../knowledge/store';
20
+ import { retireConstraint } from '../constraints-retire';
21
+ import { disableConstraint, constraintsDisable, printDisableResult } from '../constraints-disable';
22
+ import { createProjectFixture, writeProjectConfig } from '../../../test-setup/project-fixture';
23
+
24
+ const FIXED_NOW = new Date('2026-08-08T12:00:00.000Z');
25
+
26
+ function readConfig(root: string): any {
27
+ return yaml.load(fs.readFileSync(path.join(root, '.harness', 'config.yml'), 'utf-8'));
28
+ }
29
+
30
+ let io: CapturingIO;
31
+ beforeEach(() => {
32
+ io = captureIO();
33
+ // disable 不写沉淀——隔离知识库根以便断言「零沉淀」
34
+ process.env.KNOWLEDGE_BASE_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-disable-kb-'));
35
+ });
36
+ afterEach(() => {
37
+ fs.rmSync(process.env.KNOWLEDGE_BASE_DIR!, { recursive: true, force: true });
38
+ delete process.env.KNOWLEDGE_BASE_DIR;
39
+ });
40
+
41
+ describe('disableConstraint 执行逻辑', () => {
42
+ it('禁用落盘:config.yml enabled:false 无 retired 段,约束离开生效集', () => {
43
+ const root = createProjectFixture({ name: 'harness-disable-test' });
44
+ expect(getEffectiveConstraints(root).some(c => c.id === 'capability_sync')).toBe(true);
45
+
46
+ const result = disableConstraint(root, 'capability_sync');
47
+
48
+ expect(result.status).toBe('disabled');
49
+ const entry = readConfig(root).constraints.capability_sync;
50
+ expect(entry.enabled).toBe(false);
51
+ expect(entry.retired).toBeUndefined();
52
+ expect(getEffectiveConstraints(root).some(c => c.id === 'capability_sync')).toBe(false);
53
+ });
54
+
55
+ it('零知识沉淀:disable 不写任何 KnowledgeStore 条目(沉淀是 retire 专有语义)', () => {
56
+ const root = createProjectFixture({ name: 'harness-disable-test' });
57
+
58
+ const result = disableConstraint(root, 'capability_sync');
59
+
60
+ expect(result.status).toBe('disabled');
61
+ const store = new FileKnowledgeStore({ baseDir: process.env.KNOWLEDGE_BASE_DIR! });
62
+ expect(store.list()).toHaveLength(0);
63
+ });
64
+
65
+ it('幂等:裸 enabled:false 已禁用 → already_disabled,配置原样不动', () => {
66
+ const root = createProjectFixture({
67
+ name: 'harness-disable-test',
68
+ config: 'constraints:\n capability_sync:\n enabled: false\n',
69
+ });
70
+ const before = fs.readFileSync(path.join(root, '.harness', 'config.yml'), 'utf-8');
71
+
72
+ const result = disableConstraint(root, 'capability_sync');
73
+
74
+ expect(result.status).toBe('already_disabled');
75
+ expect(fs.readFileSync(path.join(root, '.harness', 'config.yml'), 'utf-8')).toBe(before);
76
+ });
77
+
78
+ it('retired 墓碑不接管:already_retired,墓碑原样保留(disable 不吞 retire 语义)', () => {
79
+ const root = createProjectFixture({ name: 'harness-disable-test' });
80
+ retireConstraint(root, 'capability_sync', { reason: '先退', now: FIXED_NOW });
81
+
82
+ const result = disableConstraint(root, 'capability_sync');
83
+
84
+ expect(result.status).toBe('already_retired');
85
+ const entry = readConfig(root).constraints.capability_sync;
86
+ expect(entry.enabled).toBe(false);
87
+ expect(entry.retired).toBeDefined();
88
+ expect(entry.retired.reason).toBe('先退');
89
+ });
90
+
91
+ it('未知 id:unknown_id,不落盘任何文件', () => {
92
+ const root = createProjectFixture({ name: 'harness-disable-test' });
93
+
94
+ const result = disableConstraint(root, 'not_a_constraint');
95
+
96
+ expect(result.status).toBe('unknown_id');
97
+ expect(fs.existsSync(path.join(root, '.harness'))).toBe(false);
98
+ });
99
+
100
+ it('同文件其他约束条目不受影响', () => {
101
+ const root = createProjectFixture({
102
+ name: 'harness-disable-test',
103
+ config: 'constraints:\n docs_freshness:\n enabled: false\n',
104
+ });
105
+
106
+ const result = disableConstraint(root, 'capability_sync');
107
+
108
+ expect(result.status).toBe('disabled');
109
+ const config = readConfig(root);
110
+ expect(config.constraints.docs_freshness.enabled).toBe(false);
111
+ expect(config.constraints.capability_sync.enabled).toBe(false);
112
+ });
113
+
114
+ it('禁用结果打印:git 仓内附 commit 提示,非 git 目录不提示', () => {
115
+ const gitRoot = createProjectFixture({ name: 'harness-disable-test', files: { '.git/HEAD': 'ref: refs/heads/master\n' } });
116
+ printDisableResult(disableConstraint(gitRoot, 'capability_sync'), io, gitRoot);
117
+ expect(io.outText()).toContain('git add .harness/config.yml');
118
+
119
+ const plainRoot = createProjectFixture({ name: 'harness-disable-test' });
120
+ const plainIo = captureIO();
121
+ printDisableResult(disableConstraint(plainRoot, 'capability_sync'), plainIo, plainRoot);
122
+ expect(plainIo.outText()).not.toContain('git add');
123
+ });
124
+ });
125
+
126
+ describe('写后验证失败回滚(harness#190 AC:失败回滚)', () => {
127
+ afterEach(() => {
128
+ jest.restoreAllMocks();
129
+ });
130
+
131
+ it('生效集仍含该约束 → verify_failed,config.yml 恢复备份逐字节', () => {
132
+ const root = createProjectFixture({
133
+ name: 'harness-disable-test',
134
+ config: 'constraints:\n docs_freshness:\n enabled: false\n',
135
+ });
136
+ const before = fs.readFileSync(path.join(root, '.harness', 'config.yml'), 'utf-8');
137
+ // 强制验证失败:生效集仍含该 id(spy 只钉本用例,afterEach 恢复)
138
+ jest.spyOn(effectiveConstraints, 'getEffectiveConstraints').mockReturnValue([{ id: 'capability_sync' } as any]);
139
+
140
+ const result = disableConstraint(root, 'capability_sync');
141
+
142
+ expect(result.status).toBe('verify_failed');
143
+ expect(fs.readFileSync(path.join(root, '.harness', 'config.yml'), 'utf-8')).toBe(before);
144
+ });
145
+
146
+ it('原本无 config.yml → verify_failed 时删除新建文件,回到零落盘', () => {
147
+ const root = createProjectFixture({ name: 'harness-disable-test' });
148
+ jest.spyOn(effectiveConstraints, 'getEffectiveConstraints').mockReturnValue([{ id: 'capability_sync' } as any]);
149
+
150
+ const result = disableConstraint(root, 'capability_sync');
151
+
152
+ expect(result.status).toBe('verify_failed');
153
+ expect(fs.existsSync(path.join(root, '.harness', 'config.yml'))).toBe(false);
154
+ });
155
+
156
+ it('verify_failed 打印:fail kind + 回滚告知走 stderr', () => {
157
+ const cmdResult = printDisableResult({ id: 'capability_sync', status: 'verify_failed' }, io);
158
+ expect(cmdResult.kind).toBe('fail');
159
+ expect(io.errText()).toContain('已回滚');
160
+ });
161
+ });
162
+
163
+ describe('constraintsDisable 非交互直达', () => {
164
+ it('无 --yes 直达:报错 + 非零退出码 + 不落盘任何文件(人确认闸门)', async () => {
165
+ const root = createProjectFixture({ name: 'harness-disable-test' });
166
+
167
+ const result = await constraintsDisable('capability_sync', { projectPath: root }, io);
168
+
169
+ expect(io.errText()).toContain('--yes');
170
+ expect(result.kind).toBe('usage-error');
171
+ expect(fs.existsSync(path.join(root, '.harness'))).toBe(false);
172
+ expect(getEffectiveConstraints(root).some(c => c.id === 'capability_sync')).toBe(true);
173
+ });
174
+
175
+ it('--yes 直达禁用:落盘并打印结果', async () => {
176
+ const root = createProjectFixture({ name: 'harness-disable-test' });
177
+
178
+ const result = await constraintsDisable('capability_sync', { projectPath: root, yes: true }, io);
179
+
180
+ expect(result.kind).toBe('ok');
181
+ expect(io.outText()).toContain('已禁用');
182
+ expect(readConfig(root).constraints.capability_sync.enabled).toBe(false);
183
+ });
184
+
185
+ it('--yes 直达已禁用:幂等 skip', async () => {
186
+ const root = createProjectFixture({ name: 'harness-disable-test' });
187
+ writeProjectConfig(root, 'constraints:\n capability_sync:\n enabled: false\n');
188
+
189
+ const result = await constraintsDisable('capability_sync', { projectPath: root, yes: true }, io);
190
+
191
+ expect(result.kind).toBe('skip');
192
+ expect(io.outText()).toContain('已处于禁用状态');
193
+ });
194
+
195
+ it('缺 id:usage-error 提示用法', async () => {
196
+ const result = await constraintsDisable(undefined, { yes: true }, io);
197
+ expect(result.kind).toBe('usage-error');
198
+ expect(io.errText()).toContain('用法');
199
+ });
200
+ });
201
+
202
+ describe('应用层约束禁用(ADR-0033 同路径)', () => {
203
+ const APP_YML = [
204
+ 'constraints:',
205
+ ' - id: app_no_internal_url',
206
+ ' rule: Web code must not contain internal URLs',
207
+ ' checker: regex-scan',
208
+ ' params:',
209
+ " pattern: 'https?://10\\.'",
210
+ ' severity: warning',
211
+ '',
212
+ ].join('\n');
213
+
214
+ it('应用层 check 约束可禁用:config.yml enabled:false,离开生效集,constraints.yml 条文保留', () => {
215
+ const root = createProjectFixture({
216
+ name: 'harness-disable-test',
217
+ files: { [path.join('.harness', 'constraints.yml')]: APP_YML },
218
+ });
219
+ expect(getEffectiveConstraints(root).some(c => c.id === 'app_no_internal_url')).toBe(true);
220
+
221
+ const result = disableConstraint(root, 'app_no_internal_url');
222
+
223
+ expect(result.status).toBe('disabled');
224
+ expect(readConfig(root).constraints.app_no_internal_url.enabled).toBe(false);
225
+ expect(getEffectiveConstraints(root).some(c => c.id === 'app_no_internal_url')).toBe(false);
226
+ // 条文保留不删(禁用 = 停用不是删除)
227
+ expect(fs.readFileSync(path.join(root, '.harness', 'constraints.yml'), 'utf-8')).toBe(APP_YML);
228
+ });
229
+ });
@@ -7,7 +7,7 @@
7
7
  * `constraints report --json` 输出的仍是文本格式。
8
8
  *
9
9
  * 修法(计划允许二选一):子命令换名 --json-output。
10
- * 理由:父命令 --json 有活跃消费者(studio-agent 取约束 hash),
10
+ * 理由:父命令 --json 有活跃消费者(下游消费方取约束 hash),
11
11
  * 删除会静默降级其取数;子命令 --json 因本 bug 从未可达、零消费者,
12
12
  * 换名零破坏。
13
13
  *
@@ -97,7 +97,7 @@ describe('buildConstraintsUsageReport', () => {
97
97
  it('四类候选诊断:零触发/不可评估(flag)/不可评估(探测)/高噪/零拦截', () => {
98
98
  const root = createProjectFixture({ name: 'harness-report-test' });
99
99
  writeProjectTraces(root, [
100
- // 不可评估(flag 未接线):全部 skip
100
+ // 不可评估(证据不可用):全部 skip(harness#183 起不再是 flag 未接线)
101
101
  ...tracesOf('no_completion_without_verification', 'skip', 3),
102
102
  // 不可评估(存在性探测未命中):全部 skip
103
103
  ...tracesOf('capability_sync', 'skip', 5),
@@ -113,12 +113,12 @@ describe('buildConstraintsUsageReport', () => {
113
113
  // 零触发(未出现在 trace 的 check 约束)
114
114
  expect(byId.get('docs_freshness')?.kind).toBe('zero_trigger');
115
115
 
116
- // 不可评估 · flag 未接线
116
+ // 不可评估 · 全部 skip(证据不可用/约定未采用不再分列,harness#183 起无 flag 型约束)
117
117
  const flagC = byId.get('no_completion_without_verification');
118
118
  expect(flagC?.kind).toBe('unevaluable');
119
- expect(flagC?.reason).toContain('证据 flag 未接线');
119
+ expect(flagC?.reason).toContain('约定未采用或证据不可用');
120
120
 
121
- // 不可评估 · 约定未采用
121
+ // 不可评估 · 同口径
122
122
  const probeC = byId.get('capability_sync');
123
123
  expect(probeC?.kind).toBe('unevaluable');
124
124
  expect(probeC?.reason).toContain('约定未采用');
@@ -52,7 +52,7 @@ const FIXTURE: KnowledgeEntry[] = [
52
52
  makeEntry('K-001', 'verified', ['agent-a:2026-09-01', 'search:2026-09-01']),
53
53
  makeEntry('K-002', 'verified', ['prompt-inject:2026-08-30', 'test-agent:2026-08-31', 'monitor:2026-09-01']),
54
54
  makeEntry('K-003', 'draft', []),
55
- makeEntry('K-004', 'proven', ['decision-1:2026-07-01', 'studio-web:2026-07-02']),
55
+ makeEntry('K-004', 'proven', ['decision-1:2026-07-01', 'web-app:2026-07-02']),
56
56
  ];
57
57
 
58
58
  function setupKnowledgeBase(): string {
@@ -86,7 +86,7 @@ beforeEach(() => {
86
86
 
87
87
  // 解析函数本体自 #133 起住 knowledge-view.ts(resolveKnowledgeBaseDir),行为面不变:
88
88
  // 这里经 knowledgeStats 观测 `-p` / KNOWLEDGE_BASE_DIR / 缺省目录三条路径的解析结果
89
- // (ADR-0034:旧 ~/.studio/knowledge 兼容沿用已退役,不再属观测面)
89
+ // (ADR-0034:旧消费方数据区兼容沿用已退役,不再属观测面)
90
90
  describe('getKnowledgeDir', () => {
91
91
  const fs = require('fs');
92
92
  const os = require('os');
@@ -127,8 +127,8 @@ describe('getKnowledgeDir', () => {
127
127
  }));
128
128
  });
129
129
 
130
- it('should NOT fall back to legacy ~/.studio/knowledge even when it has data (ADR-0034 目录收编:兼容沿用已退役)', async () => {
131
- const legacyDir = path.join(tmpHome, '.studio', 'knowledge');
130
+ it('should NOT fall back to legacy consumer data dir even when it has data (ADR-0034 目录收编:兼容沿用已退役)', async () => {
131
+ const legacyDir = path.join(tmpHome, '.legacy', 'knowledge');
132
132
  fs.mkdirSync(legacyDir, { recursive: true });
133
133
  fs.writeFileSync(path.join(legacyDir, 'guideline-x.md'), 'data');
134
134
  await knowledgeStats({ json: true }, io);
@@ -169,7 +169,7 @@ describe('-p 锚定:执行与 IO 必须落在 projectPath(cwd ≠ projectPat
169
169
  execFileSync('git', args, { cwd: dir, stdio: 'pipe' });
170
170
  }
171
171
 
172
- /** check 能真跑完的项目:已提交基线 + staged 改动 + 一条 pass trace(验证证据) */
172
+ /** check 能真跑完的项目:已提交基线 + staged 改动 + 真验证证据(harness#183:.harness/evidence 落盘) */
173
173
  function checkProject(name: string): string {
174
174
  const dir = createProjectFixture({
175
175
  name,
@@ -183,6 +183,9 @@ describe('-p 锚定:执行与 IO 必须落在 projectPath(cwd ≠ projectPat
183
183
  git(dir, 'commit', '-q', '-m', 'baseline');
184
184
  fs.writeFileSync(path.join(dir, 'src/existing.ts'), 'export const a = 2;\n', 'utf-8');
185
185
  git(dir, 'add', '--', 'src/existing.ts');
186
+ // 验证证据须在变更之后落盘(mtime 新鲜度口径)
187
+ fs.mkdirSync(path.join(dir, '.harness', 'evidence'), { recursive: true });
188
+ fs.writeFileSync(path.join(dir, '.harness', 'evidence', 'test-fixture.log'), '1 passed\n', 'utf-8');
186
189
  return dir;
187
190
  }
188
191
 
@@ -211,7 +211,7 @@ const RELATIVE_PATH_DEFAULT_EXEMPTIONS: Record<string, string> = {
211
211
  'src/monitoring/trace-analyzer.ts':
212
212
  'summaryFile: ".harness/logs/traces-summary.json" 同型病灶(#139 实测的第二处命中)。不在本票修:' +
213
213
  'harness 侧无生产写点(`status` 自 ADR-0020 起直调纯函数,不构造 analyzer),修它等于给无人消费的面' +
214
- '新增根参数。与 trace 的 failure/summary 三件套同型病灶一并由 studio 侧迁移票带走(#139 Out of scope)。',
214
+ '新增根参数。与 trace 的 failure/summary 三件套同型病灶一并由下游消费方迁移票带走(#139 Out of scope)。',
215
215
  };
216
216
 
217
217
  describe('projectPath 传递约定(harness#95)', () => {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * #146 把 `sourceContents()` 改成全仓内容常驻一个 Map:排除面只有
5
5
  * node_modules / dist / 隐藏目录与 .ts/.js 后缀,**无单文件字节、总量、条目上限**——
6
- * 峰值内存由 O(单文件) 变 O(全仓源码),studio 级 monorepo 跑本命令会承担这个峰值,
6
+ * 峰值内存由 O(单文件) 变 O(全仓源码),大型 monorepo 跑本命令会承担这个峰值,
7
7
  * 而本仓 146 个源文件的规模测不出来。
8
8
  *
9
9
  * 裁决(票面修法二):索引加总量上限(条目数 + 字节数双闸),超限即放弃驻留、
@@ -281,29 +281,6 @@ describe('sync-docs --agents', () => {
281
281
  fs.rmSync(testDir, { recursive: true, force: true });
282
282
  });
283
283
 
284
- it('旧正本 .studio/CONTEXT.md 仍在场时兼容沿用(免迁移),两者同在以 .harness/ 为准', async () => {
285
- const legacyDir = path.join(tempDir, 'legacy-context-model');
286
- createFixture(legacyDir, { pnpm: true, withCapabilities: true });
287
- fs.mkdirSync(path.join(legacyDir, '.studio'), { recursive: true });
288
- fs.writeFileSync(path.join(legacyDir, '.studio', 'CONTEXT.md'), '# 模块上下文\n\n## src\n\n职责:夹具\n');
289
- await syncDocs({ projectPath: legacyDir, agents: true }, io);
290
- expect(fs.readFileSync(path.join(legacyDir, 'AGENTS.md'), 'utf-8'))
291
- .toContain('模块上下文正本:`.studio/CONTEXT.md`(模块锚点组织),改动代码时同步更新');
292
- fs.rmSync(legacyDir, { recursive: true, force: true });
293
-
294
- const bothDir = path.join(tempDir, 'both-context-model');
295
- createFixture(bothDir, { pnpm: true, withCapabilities: true });
296
- fs.mkdirSync(path.join(bothDir, '.studio'), { recursive: true });
297
- fs.writeFileSync(path.join(bothDir, '.studio', 'CONTEXT.md'), '# 旧\n');
298
- fs.mkdirSync(path.join(bothDir, '.harness'), { recursive: true });
299
- fs.writeFileSync(path.join(bothDir, '.harness', 'CONTEXT.md'), '# 新\n');
300
- await syncDocs({ projectPath: bothDir, agents: true }, io);
301
- const content = fs.readFileSync(path.join(bothDir, 'AGENTS.md'), 'utf-8');
302
- expect(content).toContain('模块上下文正本:`.harness/CONTEXT.md`');
303
- expect(content).not.toContain('.studio/CONTEXT.md');
304
- fs.rmSync(bothDir, { recursive: true, force: true });
305
- });
306
-
307
284
  it('正本不存在时保持散置模型行,--check 无漂移', async () => {
308
285
  const testDir = path.join(tempDir, 'scattered-context-model');
309
286
  createFixture(testDir, { pnpm: true, withCapabilities: true });
@@ -630,7 +607,7 @@ describe('sync-docs --agents', () => {
630
607
  fs.rmSync(testDir, { recursive: true, force: true });
631
608
  });
632
609
 
633
- it('PRESERVE:governance 治理契约段开箱即用:重新生成保留、--check 通过(studio #302)', async () => {
610
+ it('PRESERVE:governance 治理契约段开箱即用:重新生成保留、--check 通过(ADR 2026-08-21 落点模型)', async () => {
634
611
  const testDir = path.join(tempDir, 'preserve-governance');
635
612
  createFixture(testDir, { pnpm: true, withCapabilities: true });
636
613