@holmes-lab/holmes-kit 0.39.0 → 0.40.1

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 (325) hide show
  1. package/CHANGELOG.md +578 -6
  2. package/README.md +120 -41
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
  5. package/dist/holmes/admission/core/admission-policy.js +147 -0
  6. package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
  7. package/dist/holmes/admission/core/bounded-reader.js +135 -0
  8. package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
  9. package/dist/holmes/admission/core/change-classifier.js +278 -0
  10. package/dist/holmes/admission/core/config-loader.d.ts +30 -0
  11. package/dist/holmes/admission/core/config-loader.js +145 -0
  12. package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
  13. package/dist/holmes/admission/core/event-judgement.js +251 -0
  14. package/dist/holmes/admission/core/path-rules.d.ts +35 -0
  15. package/dist/holmes/admission/core/path-rules.js +88 -0
  16. package/dist/holmes/admission/core/pin.d.ts +7 -0
  17. package/dist/holmes/admission/core/pin.js +29 -0
  18. package/dist/holmes/admission/core/ports.d.ts +48 -0
  19. package/dist/holmes/admission/core/ports.js +11 -0
  20. package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
  21. package/dist/holmes/admission/core/range-resolver.js +51 -0
  22. package/dist/holmes/admission/core/self-containment.d.ts +1 -0
  23. package/dist/holmes/admission/core/self-containment.js +125 -0
  24. package/dist/holmes/admission/core/signature-source.d.ts +9 -0
  25. package/dist/holmes/admission/core/signature-source.js +4 -0
  26. package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
  27. package/dist/holmes/admission/core/transition-planner.js +14 -0
  28. package/dist/holmes/admission/core/verdict.d.ts +38 -0
  29. package/dist/holmes/admission/core/verdict.js +17 -0
  30. package/dist/holmes/admission/core/wiring.d.ts +44 -0
  31. package/dist/holmes/admission/core/wiring.js +618 -0
  32. package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
  33. package/dist/holmes/admission/forge/git-object-port.js +132 -0
  34. package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
  35. package/dist/holmes/assoc/assoc-arm.js +1 -1
  36. package/dist/holmes/cli/agents.d.ts +8 -0
  37. package/dist/holmes/cli/agents.js +9 -5
  38. package/dist/holmes/cli/approve-cli.d.ts +2 -0
  39. package/dist/holmes/cli/approve-cli.js +392 -0
  40. package/dist/holmes/cli/approve-ref.d.ts +13 -7
  41. package/dist/holmes/cli/approve-ref.js +30 -10
  42. package/dist/holmes/cli/approve-status.d.ts +26 -2
  43. package/dist/holmes/cli/approve-status.js +98 -18
  44. package/dist/holmes/cli/approve-watch.d.ts +5 -0
  45. package/dist/holmes/cli/approve-watch.js +10 -5
  46. package/dist/holmes/cli/approve.d.ts +49 -13
  47. package/dist/holmes/cli/approve.js +249 -67
  48. package/dist/holmes/cli/attest.js +2 -1
  49. package/dist/holmes/cli/autonomy.d.ts +4 -1
  50. package/dist/holmes/cli/autonomy.js +17 -10
  51. package/dist/holmes/cli/codex-oracle.d.ts +11 -0
  52. package/dist/holmes/cli/codex-oracle.js +5 -1
  53. package/dist/holmes/cli/codex-toml.d.ts +10 -0
  54. package/dist/holmes/cli/codex-toml.js +36 -2
  55. package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
  56. package/dist/holmes/cli/doctor-boundary.js +308 -0
  57. package/dist/holmes/cli/doctor-locks.d.ts +15 -0
  58. package/dist/holmes/cli/doctor-locks.js +119 -0
  59. package/dist/holmes/cli/doctor.d.ts +2 -0
  60. package/dist/holmes/cli/doctor.js +34 -5
  61. package/dist/holmes/cli/flags.d.ts +23 -0
  62. package/dist/holmes/cli/flags.js +89 -0
  63. package/dist/holmes/cli/index.d.ts +5 -1
  64. package/dist/holmes/cli/index.js +226 -442
  65. package/dist/holmes/cli/init.js +33 -0
  66. package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
  67. package/dist/holmes/cli/interactive-prompt.js +98 -16
  68. package/dist/holmes/cli/lock-recover.d.ts +5 -0
  69. package/dist/holmes/cli/lock-recover.js +126 -0
  70. package/dist/holmes/cli/mcp-processes.js +1 -1
  71. package/dist/holmes/cli/release-docs.js +1 -1
  72. package/dist/holmes/cli/run-exec.d.ts +141 -0
  73. package/dist/holmes/cli/run-exec.js +1435 -0
  74. package/dist/holmes/cli/run-provision.d.ts +3 -1
  75. package/dist/holmes/cli/run-provision.js +255 -44
  76. package/dist/holmes/cli/run-wiring.d.ts +69 -0
  77. package/dist/holmes/cli/run-wiring.js +270 -0
  78. package/dist/holmes/cli/run.d.ts +21 -0
  79. package/dist/holmes/cli/run.js +341 -92
  80. package/dist/holmes/cli/runtime-binding-approval.js +32 -19
  81. package/dist/holmes/cli/screen-safe.d.ts +3 -92
  82. package/dist/holmes/cli/screen-safe.js +18 -756
  83. package/dist/holmes/config/config.d.ts +19 -0
  84. package/dist/holmes/config/config.js +18 -3
  85. package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
  86. package/dist/holmes/cpg/import-resolver.js +1 -1
  87. package/dist/holmes/governance/approval-decisions.d.ts +47 -0
  88. package/dist/holmes/governance/approval-decisions.js +29 -0
  89. package/dist/holmes/governance/approval-grants.d.ts +220 -1
  90. package/dist/holmes/governance/approval-grants.js +612 -33
  91. package/dist/holmes/governance/approval-queue.d.ts +26 -0
  92. package/dist/holmes/governance/approval-queue.js +109 -11
  93. package/dist/holmes/governance/approval-spend.d.ts +95 -0
  94. package/dist/holmes/governance/approval-spend.js +191 -0
  95. package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
  96. package/dist/holmes/governance/autonomous-shell.js +332 -0
  97. package/dist/holmes/governance/autonomy.d.ts +12 -0
  98. package/dist/holmes/governance/autonomy.js +51 -15
  99. package/dist/holmes/governance/constitution.d.ts +5 -0
  100. package/dist/holmes/governance/constitution.js +32 -12
  101. package/dist/holmes/governance/full-autonomy.d.ts +10 -0
  102. package/dist/holmes/governance/full-autonomy.js +103 -7
  103. package/dist/holmes/governance/harness-catalog.d.ts +103 -0
  104. package/dist/holmes/governance/harness-catalog.js +348 -0
  105. package/dist/holmes/governance/human-channel.d.ts +38 -0
  106. package/dist/holmes/governance/human-channel.js +49 -0
  107. package/dist/holmes/governance/install-manifest.d.ts +22 -0
  108. package/dist/holmes/governance/install-manifest.js +160 -0
  109. package/dist/holmes/governance/ledger-rechain.js +2 -0
  110. package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
  111. package/dist/holmes/governance/ledger-store.conformance.js +66 -0
  112. package/dist/holmes/governance/ledger-store.d.ts +88 -11
  113. package/dist/holmes/governance/ledger-store.js +186 -8
  114. package/dist/holmes/governance/provenance-chain.d.ts +16 -4
  115. package/dist/holmes/governance/provenance-chain.js +19 -4
  116. package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
  117. package/dist/holmes/governance/provenance-ledger.js +53 -18
  118. package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
  119. package/dist/holmes/governance/push-gate-runner.js +50 -9
  120. package/dist/holmes/governance/push-gate.d.ts +13 -2
  121. package/dist/holmes/governance/push-gate.js +106 -14
  122. package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
  123. package/dist/holmes/governance/recorded-pairs.js +522 -0
  124. package/dist/holmes/governance/replica-id.d.ts +1 -1
  125. package/dist/holmes/governance/replica-id.js +1 -1
  126. package/dist/holmes/governance/spec-seam.d.ts +59 -0
  127. package/dist/holmes/governance/spec-seam.js +587 -0
  128. package/dist/holmes/governance/spend-kinds.d.ts +16 -0
  129. package/dist/holmes/governance/spend-kinds.js +18 -0
  130. package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
  131. package/dist/holmes/guardrail/advisory-line.js +718 -0
  132. package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
  133. package/dist/holmes/guardrail/decision-ledger.js +2 -1
  134. package/dist/holmes/guardrail/impact-gate.d.ts +7 -0
  135. package/dist/holmes/guardrail/impact-gate.js +33 -6
  136. package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
  137. package/dist/holmes/guardrail/line-continuation.js +39 -0
  138. package/dist/holmes/guardrail/operator-person.d.ts +28 -4
  139. package/dist/holmes/guardrail/operator-person.js +57 -11
  140. package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
  141. package/dist/holmes/guardrail/refusal-codes.js +64 -10
  142. package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
  143. package/dist/holmes/guardrail/risk-classifier.js +228 -16
  144. package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
  145. package/dist/holmes/guardrail/risk-gate.js +7 -34
  146. package/dist/holmes/guardrail/risk-types.d.ts +10 -0
  147. package/dist/holmes/guardrail/run-plan-scope.js +3 -1
  148. package/dist/holmes/guardrail/run-refusals.js +24 -8
  149. package/dist/holmes/guardrail/run-stages.d.ts +5 -0
  150. package/dist/holmes/guardrail/run-stages.js +25 -5
  151. package/dist/holmes/guardrail/scope-judgment.js +1 -1
  152. package/dist/holmes/guardrail/shell-words.js +24 -3
  153. package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
  154. package/dist/holmes/guardrail/unresolved-write.js +556 -0
  155. package/dist/holmes/guardrail/write-target.d.ts +3 -0
  156. package/dist/holmes/guardrail/write-target.js +26 -5
  157. package/dist/holmes/hooks/pre-tool-use.d.ts +116 -1
  158. package/dist/holmes/hooks/pre-tool-use.js +1176 -170
  159. package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
  160. package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
  161. package/dist/holmes/hooks/session-start.js +17 -1
  162. package/dist/holmes/hooks/stop.d.ts +23 -0
  163. package/dist/holmes/hooks/stop.js +86 -33
  164. package/dist/holmes/mcp/approval-adapters.js +3 -1
  165. package/dist/holmes/mcp/approval-commit.js +3 -2
  166. package/dist/holmes/mcp/approval-policy.d.ts +2 -1
  167. package/dist/holmes/mcp/approval-policy.js +3 -1
  168. package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
  169. package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
  170. package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
  171. package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
  172. package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
  173. package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
  174. package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
  175. package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
  176. package/dist/holmes/mcp/handlers/entity-store.js +133 -59
  177. package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
  178. package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
  179. package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
  180. package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
  181. package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
  182. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
  183. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
  184. package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
  185. package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
  186. package/dist/holmes/mcp/handlers/review-queries.js +8 -1
  187. package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
  188. package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
  189. package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
  190. package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
  191. package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
  192. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
  193. package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
  194. package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
  195. package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
  196. package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
  197. package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
  198. package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
  199. package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
  200. package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
  201. package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
  202. package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
  203. package/dist/holmes/mcp/handlers/test-execution.d.ts +471 -4
  204. package/dist/holmes/mcp/handlers/test-execution.js +199 -21
  205. package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
  206. package/dist/holmes/mcp/handlers.d.ts +557 -82
  207. package/dist/holmes/mcp/handlers.js +74 -23
  208. package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
  209. package/dist/holmes/mcp/harness-attestation.js +325 -53
  210. package/dist/holmes/mcp/maintenance-analyze.d.ts +6 -1
  211. package/dist/holmes/mcp/maintenance-analyze.js +13 -11
  212. package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
  213. package/dist/holmes/mcp/maintenance-evidence.js +35 -3
  214. package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
  215. package/dist/holmes/mcp/server-staleness.js +1 -1
  216. package/dist/holmes/mcp/server.js +9 -8
  217. package/dist/holmes/mcp/spec-id-guard.js +1 -1
  218. package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
  219. package/dist/holmes/mcp/tool-schemas.js +42 -9
  220. package/dist/holmes/project/act-root.d.ts +19 -0
  221. package/dist/holmes/project/act-root.js +100 -0
  222. package/dist/holmes/project/baseline.d.ts +15 -2
  223. package/dist/holmes/project/baseline.js +14 -8
  224. package/dist/holmes/project/bounded-group.d.ts +47 -0
  225. package/dist/holmes/project/bounded-group.js +140 -0
  226. package/dist/holmes/project/bounded-io.d.ts +51 -2
  227. package/dist/holmes/project/bounded-io.js +140 -6
  228. package/dist/holmes/project/change-source.d.ts +4 -0
  229. package/dist/holmes/project/change-source.js +14 -6
  230. package/dist/holmes/project/instance-id.d.ts +10 -0
  231. package/dist/holmes/project/instance-id.js +233 -0
  232. package/dist/holmes/project/machine-identity.d.ts +25 -0
  233. package/dist/holmes/project/machine-identity.js +133 -0
  234. package/dist/holmes/project/owned-lock.d.ts +84 -0
  235. package/dist/holmes/project/owned-lock.js +263 -0
  236. package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
  237. package/dist/holmes/project/plain-lock-fs.js +126 -0
  238. package/dist/holmes/project/request-lock.d.ts +85 -0
  239. package/dist/holmes/project/request-lock.js +459 -0
  240. package/dist/holmes/project/root.d.ts +12 -4
  241. package/dist/holmes/project/root.js +29 -8
  242. package/dist/holmes/project/run-records.d.ts +19 -0
  243. package/dist/holmes/project/run-records.js +94 -12
  244. package/dist/holmes/project/screen-text.d.ts +94 -0
  245. package/dist/holmes/project/screen-text.js +763 -0
  246. package/dist/holmes/project/spend-lock.d.ts +82 -0
  247. package/dist/holmes/project/spend-lock.js +413 -0
  248. package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
  249. package/dist/holmes/refresh/freshness-coordinator.js +1 -1
  250. package/dist/holmes/review/condition-hunk-replay.js +4 -2
  251. package/dist/holmes/review/confidence-calibration.d.ts +1 -1
  252. package/dist/holmes/review/confidence-calibration.js +1 -1
  253. package/dist/holmes/review/content-verify.js +1 -1
  254. package/dist/holmes/review/evidence-mode.d.ts +21 -0
  255. package/dist/holmes/review/evidence-mode.js +33 -0
  256. package/dist/holmes/review/head-worktree.d.ts +55 -0
  257. package/dist/holmes/review/head-worktree.js +329 -0
  258. package/dist/holmes/review/hop-ablation.d.ts +4 -4
  259. package/dist/holmes/review/hop-ablation.js +5 -5
  260. package/dist/holmes/review/mrp.js +13 -3
  261. package/dist/holmes/review/point-in-time-replay.js +12 -3
  262. package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
  263. package/dist/holmes/review/rank-diagnosis.js +1 -1
  264. package/dist/holmes/review/replay-corpus.d.ts +10 -4
  265. package/dist/holmes/review/replay-corpus.js +25 -9
  266. package/dist/holmes/review/requirement-triage.js +2 -2
  267. package/dist/holmes/review/run-provenance.d.ts +45 -0
  268. package/dist/holmes/review/run-provenance.js +314 -0
  269. package/dist/holmes/review/semantic-arm.d.ts +3 -3
  270. package/dist/holmes/review/semantic-arm.js +3 -3
  271. package/dist/holmes/review/test-evidence.d.ts +174 -0
  272. package/dist/holmes/review/test-evidence.js +330 -2
  273. package/dist/holmes/review/test-outcomes.js +3 -1
  274. package/dist/holmes/review/test-reports.d.ts +94 -0
  275. package/dist/holmes/review/test-reports.js +382 -0
  276. package/dist/holmes/review/test-runner.d.ts +180 -58
  277. package/dist/holmes/review/test-runner.js +560 -324
  278. package/dist/holmes/review/test-selection-breadth.js +2 -2
  279. package/dist/holmes/review/test-units.d.ts +159 -0
  280. package/dist/holmes/review/test-units.js +814 -0
  281. package/dist/holmes/review/verdicts.d.ts +105 -8
  282. package/dist/holmes/review/verdicts.js +640 -36
  283. package/dist/holmes/rtm/anchor-census.d.ts +9 -0
  284. package/dist/holmes/rtm/anchor-census.js +151 -0
  285. package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
  286. package/dist/holmes/rtm/anchor-ids.js +45 -2
  287. package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
  288. package/dist/holmes/rtm/comment-ranges.js +104 -0
  289. package/dist/holmes/rtm/counted-tests.d.ts +1 -0
  290. package/dist/holmes/rtm/counted-tests.js +63 -0
  291. package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
  292. package/dist/holmes/rtm/known-defects.js +1 -1
  293. package/dist/holmes/rtm/localize.js +1 -1
  294. package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
  295. package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
  296. package/dist/holmes/rtm/test-scope.d.ts +31 -0
  297. package/dist/holmes/rtm/test-scope.js +166 -5
  298. package/dist/holmes/rtm/trace-gaps.js +1 -1
  299. package/dist/holmes/runtime/dispatch.d.ts +10 -0
  300. package/dist/holmes/runtime/dispatch.js +12 -1
  301. package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
  302. package/dist/holmes/semantic/cloud-usage.js +1 -1
  303. package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
  304. package/dist/holmes/semantic/unreadable-paths.js +1 -1
  305. package/dist/holmes/spec/approval-blockers.js +1 -1
  306. package/dist/holmes/spec/entity-store.d.ts +6 -1
  307. package/dist/holmes/spec/entity-store.js +16 -2
  308. package/dist/holmes/spec/entity-transaction.d.ts +7 -2
  309. package/dist/holmes/spec/entity-transaction.js +87 -170
  310. package/dist/holmes/spec/spec-store.d.ts +12 -6
  311. package/dist/holmes/spec/spec-store.js +4 -2
  312. package/dist/holmes/spec/spec-types.js +1 -1
  313. package/dist/holmes/spec/succession-guard.d.ts +56 -0
  314. package/dist/holmes/spec/succession-guard.js +187 -0
  315. package/dist/holmes/spec/succession.d.ts +70 -0
  316. package/dist/holmes/spec/succession.js +171 -0
  317. package/dist/holmes/spec/transition-policy.d.ts +2 -2
  318. package/docs/install-guide.md +9 -3
  319. package/docs/language-support.md +78 -0
  320. package/package.json +4 -3
  321. package/playbooks/author-slice/PLAYBOOK.md +1 -1
  322. package/playbooks/promote-slice/PLAYBOOK.md +5 -1
  323. package/playbooks/publish/PLAYBOOK.md +47 -34
  324. package/dist/holmes/review/manual-baseline.d.ts +0 -209
  325. package/dist/holmes/review/manual-baseline.js +0 -2847
@@ -0,0 +1,55 @@
1
+ /** L1: `<pid>-<base36 time>-<base36 random>`; the pid is the owner, so ownership needs no record that can be forged. */
2
+ export declare const ID_RE: RegExp;
3
+ export interface HeadWorktree {
4
+ /** The worktree's absolute path: the run's root. */
5
+ dir: string;
6
+ createMs: number;
7
+ prepareMs: number;
8
+ /** Removes the worktree through git, by its exact path; null, or the reason git could not (A-SPEC-128.15 L5); never throws. */
9
+ close(): string | null;
10
+ }
11
+ export type OpenedWorktree = {
12
+ ok: true;
13
+ wt: HeadWorktree;
14
+ } | {
15
+ ok: false;
16
+ reason: string;
17
+ };
18
+ export interface WorktreeOptions {
19
+ /** ax.config.json testRun.prepare as read from HEAD (the worktree) — never guessed. */
20
+ prepareOf: (dir: string) => string[] | undefined;
21
+ /** Runs one prepare child within `budgetMs`; throws like execFileSync on a non-zero exit or the bound. */
22
+ run: (cmd: string, args: string[], cwd: string, budgetMs: number) => string;
23
+ /** L4: the run's own budget in milliseconds (the handler owns the budget), which bounds the prepare too. */
24
+ prepareBudgetMs: number;
25
+ /** A-SPEC-128.16 W1: ax.config.json testRun.linkWalk as read from HEAD (the worktree); the default when absent. */
26
+ walkBoundOf?: (dir: string) => {
27
+ entries: number;
28
+ seconds: number;
29
+ } | undefined;
30
+ }
31
+ /** L1: the per-user base and this repository's key directory (sha256 of git's common directory); null without git. */
32
+ export declare function runKeyDir(root: string, tmpdir?: string): string | null;
33
+ /**
34
+ * E1, A-SPEC-128.15 O2: every symbolic link at any depth of a linked node_modules (links are resolved, never followed).
35
+ * The first that lands inside the work tree outside every node_modules is a reason naming it; a walk past its bound is a
36
+ * reason too; otherwise null.
37
+ */
38
+ export declare const LINK_WALK: {
39
+ entries: number;
40
+ seconds: number;
41
+ };
42
+ export declare function workTreeLink(rootReal: string, nmReal: string, label: string, bound?: {
43
+ entries: number;
44
+ seconds: number;
45
+ }): string | null;
46
+ /**
47
+ * L4: a package-manager install would write the work tree's node_modules through the link. A heuristic (A-SPEC-128.15
48
+ * L6): flag values are skipped, npx and corepack are read through, and a shell's command string is split into commands.
49
+ */
50
+ export declare function installPrepare(argv: string[]): boolean;
51
+ /**
52
+ * W1, L1–L4: a detached worktree of `head` under this repository's key directory, prepared (node_modules linked,
53
+ * testRun.prepare run) and ready to run; or the reason it could not be made.
54
+ */
55
+ export declare function openHeadWorktree(root: string, head: string, opts: WorktreeOptions): OpenedWorktree;
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.LINK_WALK = exports.ID_RE = void 0;
37
+ exports.runKeyDir = runKeyDir;
38
+ exports.workTreeLink = workTreeLink;
39
+ exports.installPrepare = installPrepare;
40
+ exports.openHeadWorktree = openHeadWorktree;
41
+ // @implements A-SPEC-128.13, A-SPEC-128.14, A-SPEC-128.15
42
+ /**
43
+ * A full test_run asks "is this commit green", so it runs on the commit: a clean detached worktree of HEAD
44
+ * (A-SPEC-128.13 W1, W2). Untracked, ignored, modified, assume-unchanged and skip-worktree files of the work tree never
45
+ * reach the run. This module owns the worktree's whole lifetime: where it lives, how it is made, the linked
46
+ * node_modules, the declared prepare command, and its removal. Every failure is a reason the caller reports as
47
+ * environment — nothing here throws to the caller.
48
+ *
49
+ * A-SPEC-128.14 moves it out of the repository, to `<tmp>/holmes-run-<user>/<key>/<id>/`: inside the repository jest
50
+ * collected the copy, pytest climbed to the work tree's untracked configuration, and an agent shell that `cd`ed there
51
+ * locked its session. Removal is git's alone and by exact path: holmes never deletes a directory and never prunes.
52
+ */
53
+ const crypto = __importStar(require("node:crypto"));
54
+ const fs = __importStar(require("node:fs"));
55
+ const os = __importStar(require("node:os"));
56
+ const path = __importStar(require("node:path"));
57
+ const node_child_process_1 = require("node:child_process");
58
+ const root_1 = require("../project/root");
59
+ const run_provenance_1 = require("./run-provenance");
60
+ const bounded_io_1 = require("../project/bounded-io");
61
+ /** L1: `<pid>-<base36 time>-<base36 random>`; the pid is the owner, so ownership needs no record that can be forged. */
62
+ exports.ID_RE = /^[1-9][0-9]*-[0-9a-z]+-[0-9a-z]{1,8}$/;
63
+ const git = (cwd, args) => (0, node_child_process_1.execFileSync)('git', ['-C', cwd, ...args], {
64
+ encoding: 'utf8', timeout: bounded_io_1.GIT_TIMEOUT_MS * 4, maxBuffer: 64 * 1024 * 1024, env: (0, root_1.cleanSubprocessEnv)(), stdio: ['ignore', 'pipe', 'pipe'],
65
+ });
66
+ const firstLine = (s) => (s.split('\n').find((l) => l.trim() !== '') ?? '').trim().slice(0, 200);
67
+ const alive = (pid) => { try {
68
+ process.kill(pid, 0);
69
+ return true;
70
+ }
71
+ catch (e) {
72
+ return e.code === 'EPERM';
73
+ } };
74
+ const real = (p) => { try {
75
+ return fs.realpathSync(p);
76
+ }
77
+ catch {
78
+ return null;
79
+ } };
80
+ const inside = (child, parent) => { const rel = path.relative(parent, child); return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel); };
81
+ /** L1: the per-user base and this repository's key directory (sha256 of git's common directory); null without git. */
82
+ function runKeyDir(root, tmpdir = os.tmpdir()) {
83
+ let common;
84
+ try {
85
+ common = real(path.resolve(root, git(root, ['rev-parse', '--git-common-dir']).trim()));
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ const base = real(tmpdir);
91
+ if (!common || !base)
92
+ return null;
93
+ const who = typeof process.getuid === 'function' ? String(process.getuid()) : os.userInfo().username.replace(/[^A-Za-z0-9_.-]/g, '_');
94
+ // A-SPEC-128.15 L5: `holmes-headwt-`, never `holmes-run-` — run exec sweeps `<tmp>/holmes-run-*` (run-exec.ts)
95
+ return path.join(base, `holmes-headwt-${who}`, crypto.createHash('sha256').update(common).digest('hex').slice(0, 16));
96
+ }
97
+ /** L1: an existing directory must be a real directory of this user; a missing one is made 0700. */
98
+ function ownDirectory(dir) {
99
+ let st = null;
100
+ try {
101
+ st = fs.lstatSync(dir);
102
+ }
103
+ catch {
104
+ st = null;
105
+ }
106
+ if (st === null) {
107
+ try {
108
+ fs.mkdirSync(dir, { mode: 0o700 });
109
+ return null;
110
+ }
111
+ catch (e) {
112
+ return `${dir} could not be made: ${firstLine(String(e.message ?? e))}`;
113
+ }
114
+ }
115
+ if (st.isSymbolicLink() || !st.isDirectory())
116
+ return `${dir} is a link or not a directory — holmes makes nothing there`;
117
+ if (typeof process.getuid === 'function' && st.uid !== process.getuid())
118
+ return `${dir} belongs to another user — holmes makes nothing there`;
119
+ if (typeof process.getuid === 'function' && (st.mode & 0o022) !== 0)
120
+ return `${dir} is group- or world-writable — holmes makes nothing there`;
121
+ return null;
122
+ }
123
+ /** The worktree paths git lists for this repository, exactly as git spells them. */
124
+ function listedWorktrees(root) {
125
+ try {
126
+ return git(root, ['worktree', 'list', '--porcelain']).split('\n').filter((l) => l.startsWith('worktree ')).map((l) => l.slice('worktree '.length));
127
+ }
128
+ catch {
129
+ return [];
130
+ }
131
+ }
132
+ /** L3: git removes a worktree it lists at exactly this path — and its entry, when the directory is already gone. */
133
+ function removeListed(root, dir, noHooks) {
134
+ if (!listedWorktrees(root).includes(dir))
135
+ return null;
136
+ try {
137
+ git(root, ['-c', `core.hooksPath=${noHooks}`, 'worktree', 'remove', '--force', dir]);
138
+ return null;
139
+ }
140
+ catch (e) {
141
+ const err = e;
142
+ return `HEAD's worktree ${dir} could not be removed: ${firstLine(err.stderr || err.message || String(e))}`;
143
+ }
144
+ }
145
+ /** L3: leftovers — listed, a direct child of the key directory, id-shaped, and their pid gone. Nothing else. */
146
+ function removeStale(root, keyDir, noHooks) {
147
+ for (const w of listedWorktrees(root)) {
148
+ const id = path.basename(w);
149
+ if (path.dirname(w) !== keyDir || !exports.ID_RE.test(id) || alive(Number(id.split('-')[0])))
150
+ continue;
151
+ removeListed(root, w, noHooks);
152
+ }
153
+ }
154
+ /**
155
+ * E1, A-SPEC-128.15 O2: every symbolic link at any depth of a linked node_modules (links are resolved, never followed).
156
+ * The first that lands inside the work tree outside every node_modules is a reason naming it; a walk past its bound is a
157
+ * reason too; otherwise null.
158
+ */
159
+ exports.LINK_WALK = { entries: 500_000, seconds: 20 };
160
+ function workTreeLink(rootReal, nmReal, label, bound = exports.LINK_WALK) {
161
+ const t0 = Date.now();
162
+ const stack = [[nmReal, label]];
163
+ let seen = 0;
164
+ while (stack.length > 0) {
165
+ const [d, l] = stack.pop();
166
+ let kids = [];
167
+ // A-SPEC-128.16 W1: a directory the walk cannot read is not proven clean
168
+ try {
169
+ kids = fs.readdirSync(d, { withFileTypes: true });
170
+ }
171
+ catch (e) {
172
+ return `${l} cannot be read (${e.code ?? 'error'}) — HEAD's run cannot prove it loads no work-tree code through it`;
173
+ }
174
+ for (const k of kids) {
175
+ if (++seen > bound.entries || Date.now() - t0 > bound.seconds * 1000) {
176
+ return `${label} is too large to check within ${bound.entries} entries or ${bound.seconds} s — raise ax.config.json testRun.linkWalk ({ "entries": …, "seconds": … }) to let HEAD's run prove it loads no work-tree code`;
177
+ }
178
+ const abs = path.join(d, k.name);
179
+ if (k.isSymbolicLink()) {
180
+ const to = real(abs);
181
+ if (to !== null && inside(to, rootReal) && !path.relative(rootReal, to).split(path.sep).includes('node_modules')) {
182
+ return `${l}/${k.name} links into the work tree — HEAD's run would load uncommitted code through it (a workspace package); 0.40.x does not evidence a linked workspace`;
183
+ }
184
+ }
185
+ else if (k.isDirectory())
186
+ stack.push([abs, `${l}/${k.name}`]);
187
+ }
188
+ }
189
+ return null;
190
+ }
191
+ /** W2: link every gitignored node_modules of the work tree into the worktree at the same place, after E1's check. */
192
+ function linkNodeModules(root, dir, bound = exports.LINK_WALK) {
193
+ let ignored = [];
194
+ try {
195
+ ignored = git(root, ['ls-files', '--others', '--ignored', '--exclude-standard', '--directory', '-z']).split('\0').filter(Boolean);
196
+ }
197
+ catch {
198
+ ignored = [];
199
+ }
200
+ const roots = ignored.map((p) => p.replace(/\/+$/, ''))
201
+ .filter((p) => path.posix.basename(p) === 'node_modules' && !p.split('/').slice(0, -1).includes('node_modules'));
202
+ const rootReal = real(root) ?? root;
203
+ for (const rel of roots) {
204
+ const source = real(path.join(root, ...rel.split('/')));
205
+ if (source === null)
206
+ continue;
207
+ const reaching = workTreeLink(rootReal, source, rel, bound);
208
+ if (reaching !== null)
209
+ return reaching;
210
+ const target = path.join(dir, ...rel.split('/'));
211
+ if (fs.existsSync(target))
212
+ continue;
213
+ try {
214
+ fs.mkdirSync(path.dirname(target), { recursive: true });
215
+ fs.symlinkSync(source, target, process.platform === 'win32' ? 'junction' : 'dir');
216
+ }
217
+ catch (e) {
218
+ return `node_modules could not be linked into HEAD's worktree (${rel}): ${firstLine(String(e.message ?? e))}`;
219
+ }
220
+ }
221
+ return null;
222
+ }
223
+ const MANAGERS = new Set(['npm', 'pnpm', 'yarn', 'bun']);
224
+ const INSTALLS = new Set(['install', 'i', 'ci', 'add']);
225
+ const VALUE_FLAGS = new Set(['--prefix', '-C', '--cwd', '--dir', '--filter', '--workspace', '-w']);
226
+ const SHELLS = new Set(['sh', 'bash', 'zsh', 'dash', 'cmd']);
227
+ /**
228
+ * L4: a package-manager install would write the work tree's node_modules through the link. A heuristic (A-SPEC-128.15
229
+ * L6): flag values are skipped, npx and corepack are read through, and a shell's command string is split into commands.
230
+ */
231
+ function installPrepare(argv) {
232
+ // A-SPEC-128.16 I1: a version suffix (pnpm@8) names the same tool
233
+ const tool = path.basename(argv[0] ?? '').replace(/\.(cmd|exe|ps1)$/i, '').replace(/(.)@[^/]*$/, '$1').toLowerCase();
234
+ if (SHELLS.has(tool)) {
235
+ return argv.slice(1).filter((a) => !/^[-/]/.test(a)).join(' ').split(/&&|\|\||[;|&\n]/).some((c) => installPrepare(c.trim().split(/\s+/).filter(Boolean)));
236
+ }
237
+ if (tool === 'npx' || tool === 'corepack') {
238
+ const i = argv.findIndex((a, n) => n > 0 && !a.startsWith('-'));
239
+ return i > 0 && installPrepare(argv.slice(i));
240
+ }
241
+ if (!MANAGERS.has(tool))
242
+ return false;
243
+ let verb;
244
+ for (let i = 1; i < argv.length; i++) {
245
+ if (VALUE_FLAGS.has(argv[i])) {
246
+ i++;
247
+ continue;
248
+ }
249
+ if (argv[i].startsWith('-'))
250
+ continue;
251
+ verb = argv[i];
252
+ // A-SPEC-128.16 I1: `npm exec -- pnpm install` / `pnpm exec pnpm install` read through to the tool they start
253
+ if (verb === 'exec' || verb === 'x' || verb === 'dlx') {
254
+ let rest = argv.slice(i + 1);
255
+ while (rest.length > 0 && rest[0] !== '--' && rest[0].startsWith('-'))
256
+ rest = rest.slice(1);
257
+ return installPrepare(rest[0] === '--' ? rest.slice(1) : rest);
258
+ }
259
+ break;
260
+ }
261
+ return verb === undefined ? tool === 'yarn' : INSTALLS.has(verb);
262
+ }
263
+ /**
264
+ * W1, L1–L4: a detached worktree of `head` under this repository's key directory, prepared (node_modules linked,
265
+ * testRun.prepare run) and ready to run; or the reason it could not be made.
266
+ */
267
+ function openHeadWorktree(root, head, opts) {
268
+ const keyDir = runKeyDir(root);
269
+ if (keyDir === null)
270
+ return { ok: false, reason: 'the run location could not be resolved (git common directory or the OS temporary directory)' };
271
+ const refused = ownDirectory(path.dirname(keyDir)) ?? ownDirectory(keyDir);
272
+ if (refused !== null)
273
+ return { ok: false, reason: refused };
274
+ const noHooks = path.join(keyDir, '.no-hooks'); // never created: git reads a missing hooks directory as no hooks
275
+ removeStale(root, keyDir, noHooks);
276
+ const id = `${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8) || '0'}`;
277
+ const dir = path.join(keyDir, id);
278
+ // A-SPEC-128.15 L5: the reason git could not remove it, and an empty key directory is not left behind
279
+ const close = () => {
280
+ const left = removeListed(root, dir, noHooks);
281
+ try {
282
+ fs.rmdirSync(keyDir);
283
+ }
284
+ catch { /* not empty, or gone */ }
285
+ return left;
286
+ };
287
+ const t0 = Date.now();
288
+ try {
289
+ // L2: no checkout by add (no hook, no sparsity inherited), then the whole commit with sparsity off for this call only
290
+ git(root, ['-c', `core.hooksPath=${noHooks}`, 'worktree', 'add', '--no-checkout', '--detach', '--quiet', dir, head]);
291
+ git(dir, ['-c', 'core.sparseCheckout=false', '-c', 'core.sparseCheckoutCone=false', '-c', `core.hooksPath=${noHooks}`, 'reset', '--hard', '-q', head]);
292
+ // A-SPEC-128.15 L5: sparsity inherited through the worktree's own config is turned off there, and only there
293
+ try {
294
+ if (git(dir, ['config', '--bool', 'extensions.worktreeConfig']).trim() === 'true' && git(dir, ['config', '--worktree', '--bool', 'core.sparseCheckout']).trim() === 'true') {
295
+ git(dir, ['config', '--worktree', 'core.sparseCheckout', 'false']);
296
+ }
297
+ }
298
+ catch { /* not sparse through its own config */ }
299
+ }
300
+ catch (e) {
301
+ close();
302
+ const err = e;
303
+ return { ok: false, reason: `HEAD's worktree could not be made: ${firstLine(err.stderr || err.message || String(e))}` };
304
+ }
305
+ const createMs = Date.now() - t0;
306
+ // A-SPEC-128.16 E4: after linking, node is asked where HEAD's package names resolve (NODE_PATH included)
307
+ const linked = linkNodeModules(root, dir, opts.walkBoundOf?.(dir) ?? exports.LINK_WALK) ?? (0, run_provenance_1.nodeNamesResolveToWorkTree)(dir, root, (0, root_1.cleanTestEnv)());
308
+ if (linked !== null) {
309
+ close();
310
+ return { ok: false, reason: linked };
311
+ }
312
+ const t1 = Date.now();
313
+ const prepare = opts.prepareOf(dir);
314
+ if (prepare && prepare.length > 0) {
315
+ if (installPrepare(prepare)) {
316
+ close();
317
+ return { ok: false, reason: `testRun.prepare installs packages (${prepare.join(' ')}) — node_modules is the work tree's, linked; an install would change it. Declare a build, not an install` };
318
+ }
319
+ try {
320
+ opts.run(prepare[0], prepare.slice(1), dir, opts.prepareBudgetMs);
321
+ }
322
+ catch (e) {
323
+ const err = e;
324
+ close();
325
+ return { ok: false, reason: `testRun.prepare failed (${prepare.join(' ')}): ${firstLine(err.stderr || err.stdout || err.message || String(e))}` };
326
+ }
327
+ }
328
+ return { ok: true, wt: { dir, createMs, prepareMs: Date.now() - t1, close } };
329
+ }
@@ -37,7 +37,7 @@ export declare function hopContribution(slice: HopSlice): number;
37
37
  /** Case-weighted mean contribution — the single number, with its smallness visible. */
38
38
  export declare function weightedHopContribution(slices: readonly HopSlice[]): number;
39
39
  /**
40
- * Why the jarvis `union recall` floor fell from 0.8813 to 0.8508 when the hop went in.
40
+ * Why the consumer corpus's `union recall` floor fell from 0.8813 to 0.8508 when the hop went in.
41
41
  *
42
42
  * It was recorded as an open question, with a hypothesis: the hop pushes lexically-matched files out
43
43
  * of the top ten, which shrinks the symbols the call closure is seeded from, so `impactedFiles`
@@ -66,7 +66,7 @@ export interface UnionDrop {
66
66
  impactRecallWithHop: number;
67
67
  impactRecallWithoutHop: number;
68
68
  }
69
- /** Measured 2026-08-29 on `casesFor(JARVIS_CORPUS, 30)` — the set the floors are pinned on. */
69
+ /** Measured 2026-08-29 on `casesFor(CONSUMER_CORPUS, 30)` — the set the floors are pinned on. */
70
70
  export declare const UNION_DROP: UnionDrop;
71
71
  /** Net answers the hop put into the union, counted as files rather than averaged over cases. */
72
72
  export declare function unionFileDelta(d: UnionDrop): number;
@@ -74,12 +74,12 @@ export declare function unionFileDelta(d: UnionDrop): number;
74
74
  * What the rank fusion (A-SPEC-405) is worth, measured the same way the hop was.
75
75
  *
76
76
  * A-SPEC-405 was approved under a criterion of its own writing — "no existing figure falls on either
77
- * clean slice" — and then adopted with jarvis Top-10 precision down from 0.145 to 0.135. I recorded
77
+ * clean slice" — and then adopted with consumer-corpus Top-10 precision down from 0.145 to 0.135. I recorded
78
78
  * the violation and left the revert decision open. This is the number that decision needs, taken
79
79
  * through the product path rather than the arm the original used.
80
80
  *
81
81
  * The violation is REAL and is confirmed here, and a second cost the original never measured shows
82
- * up with it: on jarvis the fusion also leaves two fewer answers inside the forty the caller sees.
82
+ * up with it: on the consumer corpus the fusion also leaves two fewer answers inside the forty the caller sees.
83
83
  *
84
84
  * It is kept anyway, and the trade is stated rather than smoothed: +0.172 and +0.069 of Top-5 recall
85
85
  * against −0.012 of precision and two answers. Nobody should read this as the criterion being met.
@@ -14,14 +14,14 @@ exports.HOP_ABLATION = [
14
14
  withoutHop: { top1: 0.300, top5Recall: 0.493, top10Recall: 0.633, top10Precision: 0.127, truthInsideExposed: 45 },
15
15
  },
16
16
  {
17
- slice: 'jarvis 0-29',
17
+ slice: 'consumer 0-29',
18
18
  cases: 30,
19
19
  withHop: { top1: 0.533, top5Recall: 0.528, top10Recall: 0.612, top10Precision: 0.133, truthInsideExposed: 52 },
20
20
  withoutHop: { top1: 0.533, top5Recall: 0.488, top10Recall: 0.612, top10Precision: 0.135, truthInsideExposed: 53 },
21
21
  },
22
22
  {
23
23
  // The slice the adoption never saw. It is the one that disagrees.
24
- slice: 'jarvis 32-63',
24
+ slice: 'consumer 32-63',
25
25
  cases: 32,
26
26
  withHop: { top1: 0.469, top5Recall: 0.463, top10Recall: 0.611, top10Precision: 0.204, truthInsideExposed: 87 },
27
27
  withoutHop: { top1: 0.469, top5Recall: 0.510, top10Recall: 0.627, top10Precision: 0.204, truthInsideExposed: 88 },
@@ -38,9 +38,9 @@ function weightedHopContribution(slices) {
38
38
  return 0;
39
39
  return slices.reduce((a, s) => a + hopContribution(s) * s.cases, 0) / cases;
40
40
  }
41
- /** Measured 2026-08-29 on `casesFor(JARVIS_CORPUS, 30)` — the set the floors are pinned on. */
41
+ /** Measured 2026-08-29 on `casesFor(CONSUMER_CORPUS, 30)` — the set the floors are pinned on. */
42
42
  exports.UNION_DROP = {
43
- slice: 'jarvis newest-30',
43
+ slice: 'consumer newest-30',
44
44
  lostFiles: 2,
45
45
  lostFromRanked: 2,
46
46
  lostFromImpacted: 0,
@@ -64,7 +64,7 @@ exports.FUSION_ABLATION = [
64
64
  withoutFusion: { top1: 0.300, top5Recall: 0.382, top10Recall: 0.604, top10Precision: 0.117, truthInsideExposed: 44 },
65
65
  },
66
66
  {
67
- slice: 'jarvis clean-30',
67
+ slice: 'consumer clean-30',
68
68
  cases: 30,
69
69
  withFusion: { top1: 0.533, top5Recall: 0.528, top10Recall: 0.612, top10Precision: 0.133, truthInsideExposed: 52 },
70
70
  withoutFusion: { top1: 0.533, top5Recall: 0.459, top10Recall: 0.612, top10Precision: 0.145, truthInsideExposed: 54 },
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.buildMrp = buildMrp;
37
- // @implements A-SPEC-102.6, A-SPEC-102.7
37
+ // @implements A-SPEC-102.6, A-SPEC-102.7, A-SPEC-128.2, A-SPEC-128.5, A-SPEC-128.6
38
38
  /**
39
39
  * @implements A-SPEC-102.6 — the merge-ready package: one artefact a person reads before approving a merge. It names
40
40
  * the spec chain behind the changed files, the test evidence for the head, the review verdict, and — explicitly —
@@ -44,6 +44,7 @@ const fs = __importStar(require("node:fs"));
44
44
  const path = __importStar(require("node:path"));
45
45
  const spec_parser_1 = require("../spec/spec-parser");
46
46
  const test_evidence_1 = require("./test-evidence");
47
+ const evidence_mode_1 = require("./evidence-mode");
47
48
  const verdicts_1 = require("./verdicts");
48
49
  function loadSpecs(dir, out = new Map(), depth = 0) {
49
50
  if (depth > 6)
@@ -89,8 +90,12 @@ function buildMrp(root, base, head) {
89
90
  return { aspec: id, status: a?.status ?? 'missing', tspec: tspec ? { id: tspec.id, status: tspec.status } : null, hspec: link(hId), req: link(reqId) };
90
91
  });
91
92
  const ev = (0, test_evidence_1.readTestEvidence)(root);
93
+ // @implements A-SPEC-128.2 — merge readiness reads full evidence only, as the push gate does
94
+ const fullEv = !!ev && (0, test_evidence_1.isFullEvidence)(ev);
95
+ // @implements A-SPEC-128.6 — through THE push-evidence predicate the writer and the gate read
96
+ const problem = (0, test_evidence_1.pushEvidenceProblem)(ev, range.head);
92
97
  const evidence = ev
93
- ? { head: ev.head, fresh: ev.head === range.head, passed: ev.passed,
98
+ ? { head: ev.head, fresh: problem === null, passed: ev.passed,
94
99
  executed: [...aspecs].reduce((n, id) => n + (ev.executedByAspec[id] ?? 0), 0) }
95
100
  : { fresh: false };
96
101
  const review = (0, verdicts_1.gateRange)(root, range.base, range.head, {});
@@ -111,8 +116,13 @@ function buildMrp(root, base, head) {
111
116
  else if (c.req.status !== 'approved')
112
117
  missing.push(`${c.req.id} is ${c.req.status}`);
113
118
  }
114
- if (!evidence.fresh || evidence.passed !== true)
119
+ // @implements A-SPEC-128.5 — the same call the push gate names
120
+ if (ev && !fullEv)
121
+ missing.push(`test evidence is not from a full run (${(0, test_evidence_1.evidenceKind)(ev)}) — run ${evidence_mode_1.FULL_RUN_CALL} at ${range.head}`);
122
+ else if (!ev || ev.head !== range.head || ev.passed !== true)
115
123
  missing.push(`test evidence is not fresh or not green for ${range.head}`);
124
+ else if (problem !== null)
125
+ missing.push(`test evidence is not push evidence: ${problem} — run ${evidence_mode_1.FULL_RUN_CALL} at ${range.head}`);
116
126
  missing.push(...review.reasons);
117
127
  const unique = [...new Set(missing)];
118
128
  return { base: range.base, head: range.head, files, chain, evidence, review, coverage: 'unmeasured', mutation: 'unmeasured', ready: unique.length === 0, missing: unique };
@@ -43,6 +43,7 @@ const path = __importStar(require("node:path"));
43
43
  const crypto = __importStar(require("node:crypto"));
44
44
  const node_child_process_1 = require("node:child_process");
45
45
  const bounded_io_1 = require("../project/bounded-io");
46
+ const root_1 = require("../project/root");
46
47
  /**
47
48
  * A pathspec is ours to control, but a caller mistake here writes outside the destination, so it is
48
49
  * checked rather than trusted: repo-relative, no escape, no absolute root.
@@ -53,8 +54,10 @@ function pathspecIsSafe(pathspec) {
53
54
  const normalized = path.normalize(pathspec);
54
55
  return !normalized.startsWith('..') && !normalized.split(path.sep).includes('..');
55
56
  }
57
+ // @implements A-SPEC-792.42 — the shared inert git environment (its archive ran the repository's smudge filters)
58
+ const replayEnv = () => (0, bounded_io_1.gitEnv)((0, root_1.cleanSubprocessEnv)());
56
59
  function git(repoRoot, args) {
57
- return (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, ...args], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
60
+ return (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, ...args], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, env: replayEnv() });
58
61
  }
59
62
  /** `path mode sha` triples the commit records for the pathspec, keyed by repo-relative path. */
60
63
  function blobsAt(repoRoot, commitish, pathspec) {
@@ -96,6 +99,11 @@ function materializeTreeAt(repoRoot, commitish, pathspec, destDir, opts) {
96
99
  return { ok: false, reason: `destination-not-empty: destination is not empty: ${destDir}` };
97
100
  }
98
101
  fs.mkdirSync(destDir, { recursive: true });
102
+ // @implements A-SPEC-792.44 — the filter and hook names first: neither the listing nor the archive runs without them
103
+ const env = replayEnv();
104
+ const drivers = (0, bounded_io_1.inertDriverArgs)(repoRoot, env);
105
+ if (drivers.error)
106
+ return { ok: false, reason: `archive-or-extract-failed: ${drivers.error}` };
99
107
  let blobs;
100
108
  try {
101
109
  blobs = blobsAt(repoRoot, commitish, pathspec);
@@ -120,7 +128,8 @@ function materializeTreeAt(repoRoot, commitish, pathspec, destDir, opts) {
120
128
  // the fidelity check would see a file the commit never had.
121
129
  const tarPath = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'pit-tar-')), 'tree.tar');
122
130
  try {
123
- const tar = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'archive', '--format=tar', commitish, '--', pathspec], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, maxBuffer: 512 * 1024 * 1024 });
131
+ // @implements A-SPEC-792.43 — no archive without the overrides (read above, A-SPEC-792.44)
132
+ const tar = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, ...drivers.args, 'archive', '--format=tar', commitish, '--', pathspec], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, maxBuffer: 512 * 1024 * 1024, env });
124
133
  fs.writeFileSync(tarPath, tar);
125
134
  (0, node_child_process_1.execFileSync)('tar', ['-x', '-C', destDir, '-f', tarPath], { maxBuffer: 512 * 1024 * 1024 });
126
135
  // Archive preserves modes/layout, but applies EOL/export substitutions. Read raw objects in
@@ -130,7 +139,7 @@ function materializeTreeAt(repoRoot, commitish, pathspec, destDir, opts) {
130
139
  const refs = fs.openSync(refsPath, 'r');
131
140
  let raw;
132
141
  try {
133
- raw = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'cat-file', '--batch'], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS,
142
+ raw = (0, node_child_process_1.execFileSync)('git', ['-C', repoRoot, 'cat-file', '--batch'], { timeout: bounded_io_1.GIT_LONG_TIMEOUT_MS, env,
134
143
  stdio: [refs, 'pipe', 'pipe'], maxBuffer: 512 * 1024 * 1024,
135
144
  });
136
145
  }
@@ -7,7 +7,7 @@
7
7
  * does nothing). Thirteen rejected retrieval mechanisms were all attempts at the first one. This
8
8
  * module measures which it actually is, so the next attempt is aimed at the measured cause.
9
9
  *
10
- * On the eight blind jarvis cases of A-SPEC-404 the answer is unambiguous, and it is the second:
10
+ * On the eight blind consumer-corpus cases of A-SPEC-404 the answer is unambiguous, and it is the second:
11
11
  * every truth file was already in the pool.
12
12
  */
13
13
  export interface PooledTruth {
@@ -34,7 +34,7 @@ export declare function diagnoseRanking(cases: ReadonlyArray<{
34
34
  truth: readonly PooledTruth[];
35
35
  }>, cut: number): RankDiagnosis;
36
36
  /**
37
- * Measured 2026-08-29 on the eight A-SPEC-404 blind jarvis cases, through the shipped pipeline
37
+ * Measured 2026-08-29 on the eight A-SPEC-404 blind consumer-corpus cases, through the shipped pipeline
38
38
  * (localizeIssue at pool 500, then the recency x commit-text re-rank of A-SPEC-378/388).
39
39
  */
40
40
  export declare const S405_POOLED_TRUTH: ReadonlyArray<{
@@ -33,7 +33,7 @@ function diagnoseRanking(cases, cut) {
33
33
  };
34
34
  }
35
35
  /**
36
- * Measured 2026-08-29 on the eight A-SPEC-404 blind jarvis cases, through the shipped pipeline
36
+ * Measured 2026-08-29 on the eight A-SPEC-404 blind consumer-corpus cases, through the shipped pipeline
37
37
  * (localizeIssue at pool 500, then the recency x commit-text re-rank of A-SPEC-378/388).
38
38
  */
39
39
  exports.S405_POOLED_TRUTH = [
@@ -61,10 +61,16 @@ export declare const HOLMES_CORPUS: ReplayCorpus;
61
61
  * truth files, and its own `.ax/specs`. Tests live in `tests/` rather than beside the source, which
62
62
  * is precisely the assumption that had to stop being hard-coded.
63
63
  *
64
- * Absent on any machine but this one, and callers skip rather than fail — a benchmark that requires
65
- * someone else's checkout is a benchmark nobody else can run.
64
+ * Absent unless HOLMES_CONSUMER_CORPUS names a checkout of it, and callers skip rather than fail — a benchmark that
65
+ * requires someone else's checkout is a benchmark nobody else can run. A-SPEC-794.57: a caller that skips says so
66
+ * (`absentCorpusNotice`), so a green run does not hide that nothing was measured.
66
67
  */
67
- export declare const JARVIS_CORPUS: ReplayCorpus;
68
+ export declare const CONSUMER_CORPUS: ReplayCorpus;
69
+ /**
70
+ * @implements A-SPEC-794.57 — the line a caller prints when it skips because `corpus` is not checked out, or null when it
71
+ * is. The variable that names it is said, so the run says how to measure it.
72
+ */
73
+ export declare function absentCorpusNotice(corpus: ReplayCorpus, label: string, variable: string): string | null;
68
74
  /**
69
75
  * A third party's repository, with no spec store at all.
70
76
  *
@@ -110,7 +116,7 @@ export declare function casesFor(corpus: ReplayCorpus, limit: number, offset?: n
110
116
  * A deterministic sub-sample of a spec store, for holding a repository fixed while varying only how
111
117
  * many specs it has.
112
118
  *
113
- * The advantage over a no-graph baseline is 2.5x on this repository (585 specs) and a wash on jarvis
119
+ * The advantage over a no-graph baseline is 2.5x on this repository (585 specs) and a wash on the consumer corpus
114
120
  * (54). Reading that as a DENSITY effect is, so far, a correlation: the two corpora differ in
115
121
  * language, size, subject and commit style as well. Thinning one corpus is the controlled version of
116
122
  * the same question — everything else stays exactly where it is.