@codyswann/lisa 5.4.0 → 5.5.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 (370) hide show
  1. package/README.md +60 -3
  2. package/all/copy-contents/gitignore +16 -0
  3. package/all/copy-contents/scripts/lisa-mutation.sh +4 -6
  4. package/all/copy-overwrite/scripts/fetch-test-access-map.d.mts +71 -0
  5. package/all/copy-overwrite/scripts/fetch-test-access-map.mjs +674 -0
  6. package/all/copy-overwrite/scripts/lib/affected-tests.mjs +818 -0
  7. package/all/copy-overwrite/scripts/lib/automation-provenance-local.mjs +22 -1
  8. package/all/copy-overwrite/scripts/lib/build-marker.mjs +410 -0
  9. package/all/copy-overwrite/scripts/lib/gate-pass-cache.mjs +537 -0
  10. package/all/copy-overwrite/scripts/lib/kill-marks.mjs +1 -2
  11. package/all/copy-overwrite/scripts/lib/lisa-cleanup-sweep-processes.mjs +3 -4
  12. package/all/copy-overwrite/scripts/lib/npm-update-controller-broker.mjs +1 -1
  13. package/all/copy-overwrite/scripts/lib/npm-update-gate-hooks.mjs +2 -1
  14. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +8 -1
  15. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +1 -1
  16. package/all/copy-overwrite/scripts/lib/npm-update-tool-launcher.mjs +1 -1
  17. package/all/copy-overwrite/scripts/lib/push-admission.mjs +158 -0
  18. package/all/copy-overwrite/scripts/lib/push-gate-defaults.d.mts +34 -0
  19. package/all/copy-overwrite/scripts/lib/push-gate-defaults.mjs +147 -0
  20. package/all/copy-overwrite/scripts/lib/push-timing.mjs +323 -0
  21. package/all/copy-overwrite/scripts/lib/rspec-selection.mjs +672 -0
  22. package/all/copy-overwrite/scripts/lisa-affected-tests.mjs +566 -0
  23. package/all/copy-overwrite/scripts/lisa-gates.mjs +29 -0
  24. package/all/copy-overwrite/scripts/lisa-lint-staged-preflight.mjs +10 -1
  25. package/all/copy-overwrite/scripts/lisa-push-timing-report.mjs +153 -0
  26. package/all/copy-overwrite/scripts/lisa-rspec-select.mjs +982 -0
  27. package/all/copy-overwrite/scripts/lisa-run-gates.mjs +231 -6
  28. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +105 -17
  29. package/all/deletions.json +11 -2
  30. package/cdk/create-only/vitest.config.local.ts +1 -7
  31. package/cdk/package-lisa/package.lisa.json +4 -4
  32. package/dist/cli/admit-cmd.d.ts +21 -0
  33. package/dist/cli/admit-cmd.d.ts.map +1 -0
  34. package/dist/cli/admit-cmd.js +142 -0
  35. package/dist/cli/admit-cmd.js.map +1 -0
  36. package/dist/cli/check-cmd.d.ts +72 -0
  37. package/dist/cli/check-cmd.d.ts.map +1 -0
  38. package/dist/cli/check-cmd.js +316 -0
  39. package/dist/cli/check-cmd.js.map +1 -0
  40. package/dist/cli/index.d.ts.map +1 -1
  41. package/dist/cli/index.js +6 -4
  42. package/dist/cli/index.js.map +1 -1
  43. package/dist/cli/lisa-test-run-admission.d.ts +18 -0
  44. package/dist/cli/lisa-test-run-admission.d.ts.map +1 -0
  45. package/dist/cli/lisa-test-run-admission.js +62 -0
  46. package/dist/cli/lisa-test-run-admission.js.map +1 -0
  47. package/dist/cli/lisa-test-run-payload.d.ts +37 -0
  48. package/dist/cli/lisa-test-run-payload.d.ts.map +1 -0
  49. package/dist/cli/lisa-test-run-payload.js +55 -0
  50. package/dist/cli/lisa-test-run-payload.js.map +1 -0
  51. package/dist/cli/lisa-test-run-shard-files.d.ts +89 -0
  52. package/dist/cli/lisa-test-run-shard-files.d.ts.map +1 -0
  53. package/dist/cli/lisa-test-run-shard-files.js +239 -0
  54. package/dist/cli/lisa-test-run-shard-files.js.map +1 -0
  55. package/dist/cli/lisa-test-run-shard.d.ts +6 -2
  56. package/dist/cli/lisa-test-run-shard.d.ts.map +1 -1
  57. package/dist/cli/lisa-test-run-shard.js +25 -13
  58. package/dist/cli/lisa-test-run-shard.js.map +1 -1
  59. package/dist/cli/lisa-test-run.d.ts +1 -1
  60. package/dist/cli/lisa-test-run.d.ts.map +1 -1
  61. package/dist/cli/lisa-test-run.js +47 -10
  62. package/dist/cli/lisa-test-run.js.map +1 -1
  63. package/dist/cli/update-check-hook.d.ts.map +1 -1
  64. package/dist/cli/update-check-hook.js +3 -0
  65. package/dist/cli/update-check-hook.js.map +1 -1
  66. package/dist/configs/vitest/base.d.ts +58 -135
  67. package/dist/configs/vitest/base.d.ts.map +1 -1
  68. package/dist/configs/vitest/base.js +76 -228
  69. package/dist/configs/vitest/base.js.map +1 -1
  70. package/dist/configs/vitest/cdk.d.ts.map +1 -1
  71. package/dist/configs/vitest/cdk.js +3 -2
  72. package/dist/configs/vitest/cdk.js.map +1 -1
  73. package/dist/configs/vitest/coverage-include-global-setup.d.ts.map +1 -1
  74. package/dist/configs/vitest/coverage-include-global-setup.js +3 -4
  75. package/dist/configs/vitest/coverage-include-global-setup.js.map +1 -1
  76. package/dist/configs/vitest/coverage-reports-directory.d.ts +27 -5
  77. package/dist/configs/vitest/coverage-reports-directory.d.ts.map +1 -1
  78. package/dist/configs/vitest/coverage-reports-directory.js +47 -10
  79. package/dist/configs/vitest/coverage-reports-directory.js.map +1 -1
  80. package/dist/configs/vitest/harper-fabric.d.ts.map +1 -1
  81. package/dist/configs/vitest/harper-fabric.js +3 -2
  82. package/dist/configs/vitest/harper-fabric.js.map +1 -1
  83. package/dist/configs/vitest/nestjs.d.ts.map +1 -1
  84. package/dist/configs/vitest/nestjs.js +3 -2
  85. package/dist/configs/vitest/nestjs.js.map +1 -1
  86. package/dist/configs/vitest/phaser.d.ts.map +1 -1
  87. package/dist/configs/vitest/phaser.js +3 -2
  88. package/dist/configs/vitest/phaser.js.map +1 -1
  89. package/dist/configs/vitest/refusal-announcement.d.ts +51 -0
  90. package/dist/configs/vitest/refusal-announcement.d.ts.map +1 -0
  91. package/dist/configs/vitest/refusal-announcement.js +97 -0
  92. package/dist/configs/vitest/refusal-announcement.js.map +1 -0
  93. package/dist/configs/vitest/socket-safe-temp-base.d.ts +3 -4
  94. package/dist/configs/vitest/socket-safe-temp-base.d.ts.map +1 -1
  95. package/dist/configs/vitest/socket-safe-temp-base.js +7 -6
  96. package/dist/configs/vitest/socket-safe-temp-base.js.map +1 -1
  97. package/dist/configs/vitest/typescript.d.ts.map +1 -1
  98. package/dist/configs/vitest/typescript.js +3 -2
  99. package/dist/configs/vitest/typescript.js.map +1 -1
  100. package/dist/core/admission-decision.d.ts +110 -0
  101. package/dist/core/admission-decision.d.ts.map +1 -0
  102. package/dist/core/admission-decision.js +91 -0
  103. package/dist/core/admission-decision.js.map +1 -0
  104. package/dist/core/admission-lock.d.ts +69 -0
  105. package/dist/core/admission-lock.d.ts.map +1 -0
  106. package/dist/core/admission-lock.js +278 -0
  107. package/dist/core/admission-lock.js.map +1 -0
  108. package/dist/core/admission-settings.d.ts +69 -0
  109. package/dist/core/admission-settings.d.ts.map +1 -0
  110. package/dist/core/admission-settings.js +204 -0
  111. package/dist/core/admission-settings.js.map +1 -0
  112. package/dist/core/admission-state.d.ts +50 -0
  113. package/dist/core/admission-state.d.ts.map +1 -0
  114. package/dist/core/admission-state.js +168 -0
  115. package/dist/core/admission-state.js.map +1 -0
  116. package/dist/core/admission.d.ts +70 -0
  117. package/dist/core/admission.d.ts.map +1 -0
  118. package/dist/core/admission.js +205 -0
  119. package/dist/core/admission.js.map +1 -0
  120. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  121. package/dist/core/lisa-owned-hash-ledger.js +318 -0
  122. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  123. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  124. package/dist/core/project-config-push-gate.d.ts +66 -0
  125. package/dist/core/project-config-push-gate.d.ts.map +1 -0
  126. package/dist/core/project-config-push-gate.js +82 -0
  127. package/dist/core/project-config-push-gate.js.map +1 -0
  128. package/dist/core/project-config.d.ts +4 -0
  129. package/dist/core/project-config.d.ts.map +1 -1
  130. package/dist/core/project-config.js +14 -9
  131. package/dist/core/project-config.js.map +1 -1
  132. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  133. package/dist/core/upstream-evidence-manifest.js +197 -123
  134. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  135. package/expo/package-lisa/package.lisa.json +2 -2
  136. package/harper-fabric/package-lisa/package.lisa.json +4 -4
  137. package/nestjs/create-only/vitest.config.local.ts +1 -7
  138. package/nestjs/package-lisa/package.lisa.json +4 -4
  139. package/npm-package/package-lisa/package.lisa.json +4 -4
  140. package/package.json +12 -11
  141. package/phaser/package-lisa/package.lisa.json +4 -4
  142. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  143. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  144. package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  145. package/plugins/lisa/.codex-plugin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  146. package/plugins/lisa/.codex-plugin/skills/lisa-implement/SKILL.md +1 -1
  147. package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  148. package/plugins/lisa/skills/lisa-git-submit-pr/SKILL.md +1 -1
  149. package/plugins/lisa/skills/lisa-implement/SKILL.md +1 -1
  150. package/plugins/lisa-agy/plugin.json +1 -1
  151. package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  152. package/plugins/lisa-agy/skills/lisa-git-submit-pr/SKILL.md +1 -1
  153. package/plugins/lisa-agy/skills/lisa-implement/SKILL.md +1 -1
  154. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  155. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  156. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  157. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  158. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  159. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  160. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  161. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  162. package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  163. package/plugins/lisa-copilot/skills/lisa-git-submit-pr/SKILL.md +1 -1
  164. package/plugins/lisa-copilot/skills/lisa-implement/SKILL.md +1 -1
  165. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  166. package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  167. package/plugins/lisa-cursor/skills/lisa-git-submit-pr/SKILL.md +1 -1
  168. package/plugins/lisa-cursor/skills/lisa-implement/SKILL.md +1 -1
  169. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  170. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  171. package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  172. package/plugins/lisa-devin/skills/lisa-git-submit-pr/SKILL.md +1 -1
  173. package/plugins/lisa-devin/skills/lisa-implement/SKILL.md +1 -1
  174. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  176. package/plugins/lisa-expo-agy/plugin.json +1 -1
  177. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  178. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  180. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  181. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  183. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  184. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  185. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  186. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  187. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  188. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  189. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  190. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  191. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  192. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  193. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  194. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  195. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  197. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  198. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  199. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  200. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  201. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  202. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  203. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  204. package/plugins/lisa-rails-agy/plugin.json +1 -1
  205. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  206. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  207. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  208. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  209. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  210. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  211. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  212. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  213. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  214. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  215. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  216. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  217. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  218. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  219. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  220. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  221. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  222. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  223. package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
  224. package/plugins/src/base/skills/lisa-git-submit-pr/SKILL.md +1 -1
  225. package/plugins/src/base/skills/lisa-implement/SKILL.md +1 -1
  226. package/rails/copy-overwrite/Gemfile.lisa +8 -0
  227. package/rails/copy-overwrite/lefthook.yml +25 -11
  228. package/rails/copy-overwrite/scripts/lisa-rails-gates.mjs +686 -0
  229. package/rails/copy-overwrite/scripts/lisa-rspec-shards.mjs +2 -2
  230. package/rails/copy-overwrite/scripts/lisa_crystalball_recorder.rb +239 -0
  231. package/rails/copy-overwrite/scripts/lisa_rspec_partial_coverage.rb +83 -0
  232. package/scripts/build-unless-marked.mjs +83 -0
  233. package/scripts/check-plugins-sync.sh +22 -5
  234. package/scripts/classify-markdown-assertions.mjs +141 -0
  235. package/scripts/integration-shard-build.mjs +143 -0
  236. package/scripts/lib/history-scanner-suites.mjs +19 -0
  237. package/scripts/lib/markdown-assertions/classify.mjs +289 -0
  238. package/scripts/lib/markdown-assertions/context.mjs +53 -0
  239. package/scripts/lib/markdown-assertions/corpus.mjs +222 -0
  240. package/scripts/lib/markdown-assertions/manifest-cull.mjs +86 -0
  241. package/scripts/lib/markdown-assertions/record-setup.mjs +265 -0
  242. package/scripts/lib/markdown-assertions/record.mjs +115 -0
  243. package/scripts/lib/markdown-assertions/record.vitest.config.mjs +24 -0
  244. package/scripts/lib/markdown-assertions/sites.mjs +273 -0
  245. package/scripts/lib/markdown-assertions/test-cull.mjs +768 -0
  246. package/scripts/lib/markdown-assertions/tokens.mjs +158 -0
  247. package/scripts/lib/shell-guard-trace.mjs +6 -0
  248. package/scripts/lib/test-access-map-setup.mjs +40 -0
  249. package/scripts/lib/test-access-map-tracer.mjs +205 -0
  250. package/scripts/lib/test-access-map.d.mts +72 -0
  251. package/scripts/lib/test-access-map.mjs +395 -0
  252. package/scripts/lib/test-timings-reporter.d.mts +17 -0
  253. package/scripts/lib/test-timings-reporter.mjs +99 -0
  254. package/scripts/plan-integration-shards.mjs +300 -0
  255. package/scripts/test-timing-report.d.mts +41 -0
  256. package/scripts/test-timing-report.mjs +361 -0
  257. package/scripts/two-channel-couplings.json +132 -36
  258. package/scripts/verify-npm-advisories-4333.mjs +3 -12
  259. package/typescript/copy-overwrite/.prettierignore +12 -0
  260. package/typescript/create-only/vitest.config.local.ts +1 -7
  261. package/typescript/package-lisa/package.lisa.json +4 -4
  262. package/all/copy-overwrite/scripts/lisa-scratch-run.sh +0 -1078
  263. package/dist/cli/lisa-test-run-bootstrap.d.ts +0 -3
  264. package/dist/cli/lisa-test-run-bootstrap.d.ts.map +0 -1
  265. package/dist/cli/lisa-test-run-bootstrap.js +0 -229
  266. package/dist/cli/lisa-test-run-bootstrap.js.map +0 -1
  267. package/dist/cli/lisa-test-run-ipc.d.ts +0 -49
  268. package/dist/cli/lisa-test-run-ipc.d.ts.map +0 -1
  269. package/dist/cli/lisa-test-run-ipc.js +0 -226
  270. package/dist/cli/lisa-test-run-ipc.js.map +0 -1
  271. package/dist/cli/lisa-test-run-process-group.d.ts +0 -30
  272. package/dist/cli/lisa-test-run-process-group.d.ts.map +0 -1
  273. package/dist/cli/lisa-test-run-process-group.js +0 -140
  274. package/dist/cli/lisa-test-run-process-group.js.map +0 -1
  275. package/dist/cli/lisa-test-run-reaper.d.ts +0 -3
  276. package/dist/cli/lisa-test-run-reaper.d.ts.map +0 -1
  277. package/dist/cli/lisa-test-run-reaper.js +0 -195
  278. package/dist/cli/lisa-test-run-reaper.js.map +0 -1
  279. package/dist/cli/lisa-test-run-runtime.d.ts +0 -46
  280. package/dist/cli/lisa-test-run-runtime.d.ts.map +0 -1
  281. package/dist/cli/lisa-test-run-runtime.js +0 -123
  282. package/dist/cli/lisa-test-run-runtime.js.map +0 -1
  283. package/dist/cli/lisa-test-run-supervisor.d.ts +0 -13
  284. package/dist/cli/lisa-test-run-supervisor.d.ts.map +0 -1
  285. package/dist/cli/lisa-test-run-supervisor.js +0 -265
  286. package/dist/cli/lisa-test-run-supervisor.js.map +0 -1
  287. package/dist/configs/vitest/fleet-admission-global-setup.d.ts +0 -34
  288. package/dist/configs/vitest/fleet-admission-global-setup.d.ts.map +0 -1
  289. package/dist/configs/vitest/fleet-admission-global-setup.js +0 -123
  290. package/dist/configs/vitest/fleet-admission-global-setup.js.map +0 -1
  291. package/dist/configs/vitest/fleet-admission.d.ts +0 -129
  292. package/dist/configs/vitest/fleet-admission.d.ts.map +0 -1
  293. package/dist/configs/vitest/fleet-admission.js +0 -239
  294. package/dist/configs/vitest/fleet-admission.js.map +0 -1
  295. package/dist/configs/vitest/scratch-authority.d.ts +0 -25
  296. package/dist/configs/vitest/scratch-authority.d.ts.map +0 -1
  297. package/dist/configs/vitest/scratch-authority.js +0 -107
  298. package/dist/configs/vitest/scratch-authority.js.map +0 -1
  299. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts +0 -5
  300. package/dist/configs/vitest/scratch-bound-cleanup-programs.d.ts.map +0 -1
  301. package/dist/configs/vitest/scratch-bound-cleanup-programs.js +0 -219
  302. package/dist/configs/vitest/scratch-bound-cleanup-programs.js.map +0 -1
  303. package/dist/configs/vitest/scratch-bound-cleanup.d.ts +0 -28
  304. package/dist/configs/vitest/scratch-bound-cleanup.d.ts.map +0 -1
  305. package/dist/configs/vitest/scratch-bound-cleanup.js +0 -155
  306. package/dist/configs/vitest/scratch-bound-cleanup.js.map +0 -1
  307. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts +0 -17
  308. package/dist/configs/vitest/scratch-bound-root-cleanup.d.ts.map +0 -1
  309. package/dist/configs/vitest/scratch-bound-root-cleanup.js +0 -149
  310. package/dist/configs/vitest/scratch-bound-root-cleanup.js.map +0 -1
  311. package/dist/configs/vitest/scratch-global-setup.d.ts +0 -258
  312. package/dist/configs/vitest/scratch-global-setup.d.ts.map +0 -1
  313. package/dist/configs/vitest/scratch-global-setup.js +0 -505
  314. package/dist/configs/vitest/scratch-global-setup.js.map +0 -1
  315. package/dist/configs/vitest/scratch-leak-setup.d.ts +0 -2
  316. package/dist/configs/vitest/scratch-leak-setup.d.ts.map +0 -1
  317. package/dist/configs/vitest/scratch-leak-setup.js +0 -108
  318. package/dist/configs/vitest/scratch-leak-setup.js.map +0 -1
  319. package/dist/configs/vitest/scratch-namespace-authority.d.ts +0 -80
  320. package/dist/configs/vitest/scratch-namespace-authority.d.ts.map +0 -1
  321. package/dist/configs/vitest/scratch-namespace-authority.js +0 -291
  322. package/dist/configs/vitest/scratch-namespace-authority.js.map +0 -1
  323. package/dist/configs/vitest/scratch-owner.d.ts +0 -131
  324. package/dist/configs/vitest/scratch-owner.d.ts.map +0 -1
  325. package/dist/configs/vitest/scratch-owner.js +0 -297
  326. package/dist/configs/vitest/scratch-owner.js.map +0 -1
  327. package/dist/configs/vitest/scratch-route-profile.d.ts +0 -46
  328. package/dist/configs/vitest/scratch-route-profile.d.ts.map +0 -1
  329. package/dist/configs/vitest/scratch-route-profile.js +0 -233
  330. package/dist/configs/vitest/scratch-route-profile.js.map +0 -1
  331. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts +0 -33
  332. package/dist/configs/vitest/scratch-run-root-compatibility.d.ts.map +0 -1
  333. package/dist/configs/vitest/scratch-run-root-compatibility.js +0 -137
  334. package/dist/configs/vitest/scratch-run-root-compatibility.js.map +0 -1
  335. package/dist/configs/vitest/scratch-run-root-intent.d.ts +0 -66
  336. package/dist/configs/vitest/scratch-run-root-intent.d.ts.map +0 -1
  337. package/dist/configs/vitest/scratch-run-root-intent.js +0 -183
  338. package/dist/configs/vitest/scratch-run-root-intent.js.map +0 -1
  339. package/dist/configs/vitest/scratch-setup.d.ts +0 -46
  340. package/dist/configs/vitest/scratch-setup.d.ts.map +0 -1
  341. package/dist/configs/vitest/scratch-setup.js +0 -226
  342. package/dist/configs/vitest/scratch-setup.js.map +0 -1
  343. package/dist/configs/vitest/scratch-supervision-intent.d.ts +0 -8
  344. package/dist/configs/vitest/scratch-supervision-intent.d.ts.map +0 -1
  345. package/dist/configs/vitest/scratch-supervision-intent.js +0 -125
  346. package/dist/configs/vitest/scratch-supervision-intent.js.map +0 -1
  347. package/dist/configs/vitest/scratch-supervision-protocol.d.ts +0 -12
  348. package/dist/configs/vitest/scratch-supervision-protocol.d.ts.map +0 -1
  349. package/dist/configs/vitest/scratch-supervision-protocol.js +0 -230
  350. package/dist/configs/vitest/scratch-supervision-protocol.js.map +0 -1
  351. package/dist/configs/vitest/scratch-supervision.d.ts +0 -69
  352. package/dist/configs/vitest/scratch-supervision.d.ts.map +0 -1
  353. package/dist/configs/vitest/scratch-supervision.js +0 -244
  354. package/dist/configs/vitest/scratch-supervision.js.map +0 -1
  355. package/dist/configs/vitest/scratch-sweep.d.ts +0 -66
  356. package/dist/configs/vitest/scratch-sweep.d.ts.map +0 -1
  357. package/dist/configs/vitest/scratch-sweep.js +0 -82
  358. package/dist/configs/vitest/scratch-sweep.js.map +0 -1
  359. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts +0 -48
  360. package/dist/configs/vitest/scratch-tmpdir-trust.d.ts.map +0 -1
  361. package/dist/configs/vitest/scratch-tmpdir-trust.js +0 -194
  362. package/dist/configs/vitest/scratch-tmpdir-trust.js.map +0 -1
  363. package/dist/configs/vitest/scratch.d.ts +0 -19
  364. package/dist/configs/vitest/scratch.d.ts.map +0 -1
  365. package/dist/configs/vitest/scratch.js +0 -34
  366. package/dist/configs/vitest/scratch.js.map +0 -1
  367. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts +0 -86
  368. package/dist/configs/vitest/synthesis-scratch-reclaim.d.ts.map +0 -1
  369. package/dist/configs/vitest/synthesis-scratch-reclaim.js +0 -226
  370. package/dist/configs/vitest/synthesis-scratch-reclaim.js.map +0 -1
@@ -1,226 +0,0 @@
1
- /**
2
- * Vitest Configuration - Per-process scratch redirection (setup file)
3
- *
4
- * Wired as a Vitest `setupFiles` entry, so it executes inside every test worker
5
- * before any test file runs. It points `os.tmpdir()` at a run root this process
6
- * owns, which relocates EVERY `mkdtemp(os.tmpdir())` call in the suite without
7
- * editing a single test — in Lisa's own suite, 481 call sites across 211 files.
8
- *
9
- * `os.tmpdir()` re-reads the environment on every call rather than caching it at
10
- * startup, which is the seam this relies on:
11
- *
12
- * ```
13
- * $ node -e 'const os=require("os"); console.log(os.tmpdir());
14
- * process.env.TMPDIR="/tmp/probe"; console.log(os.tmpdir())'
15
- * /var/folders/<...>/T
16
- * /tmp/probe
17
- * ```
18
- *
19
- * A signalled exit is covered too, which is not obvious and is the whole of
20
- * CodySwannGT/lisa#2950: see the signal handlers in `installScratchRoot`.
21
- *
22
- * Because the assignment mutates the process environment, subprocesses the
23
- * tests spawn inherit the redirection too — a fixture's `git`, `npm pack` or
24
- * `tsc` child writes into the same bounded root, so a child that outlives its
25
- * test cannot leak into the shared directory either.
26
- *
27
- * The work is done once per process, not once per test file, even though Vitest
28
- * re-executes setup files for each file.
29
- *
30
- * A run supervised by `lisa-test-run` inherits its suite lease from the
31
- * environment. A direct `vitest` invocation has no lease and mints its own
32
- * rather than refusing — see `acquireSuiteLease` for why refusing was the wrong
33
- * failure mode for a module that runs during collection.
34
- * @see {@link module:configs/vitest/scratch} for why the root is shaped this way
35
- * @module configs/vitest/scratch-setup
36
- */
37
- import { env } from "node:process";
38
- import { SCRATCH_SUPERVISION_LEASE_ENV, assertScratchSupervisionTempRoot, createScratchSupervisionLease, createSupervisedWorkerScope, parseScratchSupervisionLease, removeSupervisedWorkerScope, } from "./scratch-supervision.js";
39
- import { assertScratchRouteProfile } from "./scratch-route-profile.js";
40
- import { materializeOwnedScratchRunRoot, prepareOwnedScratchRunRoot, removeOwnedScratchRunRoot, } from "./scratch-run-root-intent.js";
41
- /**
42
- * Signals a worker is reaped with, each of which skips `exit` by default.
43
- *
44
- * `SIGTERM` is the one measured in this repository — it is how vitest's
45
- * `forks` pool ends a worker. `SIGINT` and `SIGHUP` are here because they
46
- * reach the same process by the same route with the same default action: an
47
- * operator pressing ctrl-C, and a terminal closing on a run left going. A
48
- * handler that covered only the case that happened to be measured would leave
49
- * the other two producing exactly the residue this removes.
50
- *
51
- * `SIGKILL` is deliberately absent — it cannot be caught in this worker. The
52
- * detached `lisa-test-run` reaper owns that arm; reclaim-on-start remains the
53
- * compatibility fallback and is tested separately.
54
- */
55
- const REAPING_SIGNALS = [
56
- "SIGTERM",
57
- "SIGINT",
58
- "SIGHUP",
59
- ];
60
- /** Key under which the per-process run root is memoised. */
61
- const RUN_ROOT_KEY = "__lisaScratchRunRoot__";
62
- /** Key holding the authority/token handle while preserving the path memo ABI. */
63
- const RUN_ROOT_HANDLE_KEY = "__lisaScratchWorkerScopeV1__";
64
- /**
65
- * Warning printed once when a run mints its own lease instead of inheriting one.
66
- *
67
- * It names the wrapper, because adopting the wrapper is the fix, and it names
68
- * what is actually given up — the detached reaper, and nothing else — so the
69
- * line cannot be read as "your scratch directories are unbounded now".
70
- */
71
- const UNSUPERVISED_WARNING = "lisa scratch: no supervised lease in the environment, so this run is " +
72
- "self-supervised. Fixture directories are still bounded to a run root this " +
73
- "process owns and removed on exit; what is missing is the detached reaper " +
74
- "that reclaims the root after a SIGKILL, which the next run's startup sweep " +
75
- "recovers instead. Run through `lisa-test-run --profile <profile> " +
76
- "--adapter vitest -- vitest ...` for a supervised run.\n";
77
- /**
78
- * Tear down this worker's scope without letting the attempt change the outcome.
79
- *
80
- * `removeSupervisedWorkerScope` validates the suite root OUTSIDE its own
81
- * try/catch, so a suite root that has gone missing throws straight out of it.
82
- * Unguarded, that throw lands in a `process.on("exit")` listener -- where node
83
- * turns it into an uncaught exception and rewrites the exit code, so a green
84
- * run reports as a failed one -- or in a reaping-signal listener, BEFORE the
85
- * re-raise below, so the worker never dies of the signal the pool sent and the
86
- * pool sees the wrong status. Cleanup is best-effort by construction: it must
87
- * never be the thing that decides how this process ends. The failure is still
88
- * reported, because a silent one is how the leak this file exists to close
89
- * came back the first time.
90
- *
91
- * The suite root is removed only when this process minted its own lease. Under
92
- * a wrapper the suite root belongs to `lisa-test-run`, which reclaims it for
93
- * every worker at once; a worker removing it there would pull the directory out
94
- * from under its siblings.
95
- * @param worker - This worker's supervised scope
96
- * @param lease - The suite lease the scope was created under
97
- * @param ownedSuiteRoot - Suite root this process minted, when self-supervised
98
- */
99
- const teardownWorkerScope = (worker, lease, ownedSuiteRoot) => {
100
- try {
101
- removeSupervisedWorkerScope(worker, lease);
102
- }
103
- catch (error) {
104
- process.stderr.write(`lisa scratch worker teardown failed: ${error instanceof Error ? error.message : String(error)}\n`);
105
- }
106
- if (ownedSuiteRoot === undefined)
107
- return;
108
- try {
109
- removeOwnedScratchRunRoot(ownedSuiteRoot);
110
- }
111
- catch (error) {
112
- process.stderr.write(`lisa scratch suite teardown failed: ${error instanceof Error ? error.message : String(error)}\n`);
113
- }
114
- };
115
- /**
116
- * Obtain the suite lease, minting one when the environment carries none.
117
- *
118
- * An inherited lease is the supervised case and is preferred whenever it is
119
- * present. Its absence means someone ran `vitest` directly, which is an
120
- * ordinary thing to do — from an editor, a watch mode, a CI step that predates
121
- * the wrapper — and it used to throw out of a `setupFiles` module. A throw
122
- * there fails collection, so the suite reports zero tests and a gate goes red
123
- * having evaluated nothing. That is a worse outcome than an unsupervised run:
124
- * it looks like a verdict and is not one.
125
- *
126
- * So the unsupervised caller gets the same lifecycle, self-supervised. The
127
- * minted lease is a real lease over a real owned root, which keeps the rest of
128
- * this file — and the leak guard in `scratch-leak-setup`, which requires a
129
- * `worker-` scope — on exactly one code path. The single capability the wrapper
130
- * adds is the detached reaper covering `SIGKILL`; without it, reclaim-on-start
131
- * recovers the residue at the next run, which is the documented fallback.
132
- *
133
- * Exported for its own unit case. `installScratchRoot()` cannot stand in for
134
- * it: that function registers `exit` and signal handlers on the process it is
135
- * called from, so a case that drove the unsupervised branch through it would
136
- * leave a handler behind pointing at a root the case had already cleaned up,
137
- * and every later suite in the same worker would inherit the noise.
138
- * @returns The lease to run under, and the suite root to reclaim if self-owned.
139
- */
140
- export const acquireSuiteLease = () => {
141
- const rawLease = env[SCRATCH_SUPERVISION_LEASE_ENV];
142
- if (rawLease !== undefined && rawLease !== "") {
143
- return { lease: parseScratchSupervisionLease(rawLease) };
144
- }
145
- const intent = prepareOwnedScratchRunRoot();
146
- const lease = (() => {
147
- process.stderr.write(UNSUPERVISED_WARNING);
148
- materializeOwnedScratchRunRoot(intent);
149
- return createScratchSupervisionLease(intent, {
150
- suiteLabel: intent.suiteLabel,
151
- registeredPrefixes: intent.registeredPrefixes,
152
- });
153
- })();
154
- return { lease, ownedSuiteRoot: intent };
155
- };
156
- /**
157
- * Points this process's temp directory at a run root it owns, creating the root
158
- * on first call and reusing it afterwards.
159
- *
160
- * All three of `TMPDIR`, `TMP` and `TEMP` are set: Node reads `TMPDIR` on POSIX
161
- * and `TEMP`/`TMP` on Windows, and non-Node tools spawned by fixtures read
162
- * whichever their platform prefers. Setting one would leave the others pointing
163
- * at the shared directory for exactly the callers hardest to see.
164
- * @returns Absolute path of this process's run root.
165
- */
166
- export const installScratchRoot = () => {
167
- const scope = globalThis;
168
- const existing = scope[RUN_ROOT_KEY];
169
- if (existing !== undefined && scope[RUN_ROOT_HANDLE_KEY] !== undefined) {
170
- return existing;
171
- }
172
- const { lease, ownedSuiteRoot } = acquireSuiteLease();
173
- const worker = (() => {
174
- // Only an INHERITED lease is worth asserting against. The check exists to
175
- // catch a Vitest environment that disagrees with the profile the wrapper
176
- // froze before collection — two independent sources that must agree. A
177
- // self-minted lease is derived from that same environment one line earlier,
178
- // so the comparison is vacuous, and it does not merely pass vacuously: the
179
- // assertion demands `LISA_TEST_SCRATCH_SUITE` be set, which is the
180
- // wrapper's job, so an unsupervised run fails it every time. Running it
181
- // here would trade one collection-time throw for another.
182
- if (ownedSuiteRoot === undefined) {
183
- assertScratchRouteProfile(lease);
184
- assertScratchSupervisionTempRoot(lease);
185
- }
186
- return createSupervisedWorkerScope(lease);
187
- })();
188
- const root = worker.path;
189
- scope[RUN_ROOT_KEY] = root;
190
- scope[RUN_ROOT_HANDLE_KEY] = worker;
191
- env["TMPDIR"] = root;
192
- env["TMP"] = root;
193
- env["TEMP"] = root;
194
- // Covers an ordinary exit, including one where tests failed.
195
- process.once("exit", () => {
196
- teardownWorkerScope(worker, lease, ownedSuiteRoot);
197
- });
198
- // And covers the exit this suite ACTUALLY takes, which is not an ordinary
199
- // one. Measured on vitest 4.1.9, `forks` pool, by recording every lifecycle
200
- // event a worker reaches: the pool ends a worker with SIGTERM, and node's
201
- // default action for SIGTERM terminates the process WITHOUT running `exit`
202
- // handlers. So the handler above — the only mechanism that removes a run's
203
- // own root — never ran for any worker, and a completely green run left its
204
- // root behind every time (CodySwannGT/lisa#2950).
205
- //
206
- // That was invisible for the usual reason: the next run's sweep reclaims a
207
- // root whose pid is dead, so the residue disappeared before anyone looked
208
- // for it, and the namespace never grew. The behaviour was reported as
209
- // present because its effect was eventually produced by something else.
210
- //
211
- // The same probe shows a worker DOES reach `exit` once a listener for the
212
- // signal exists, because installing one displaces node's default action.
213
- // Removing the listener and re-raising restores it, so the process still
214
- // dies of the signal it was sent, with the status the pool expects — this
215
- // buys the cleanup, not a different lifecycle.
216
- for (const signal of REAPING_SIGNALS) {
217
- process.once(signal, () => {
218
- teardownWorkerScope(worker, lease, ownedSuiteRoot);
219
- process.removeAllListeners(signal);
220
- process.kill(process.pid, signal);
221
- });
222
- }
223
- return root;
224
- };
225
- installScratchRoot();
226
- //# sourceMappingURL=scratch-setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratch-setup.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,GAG5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,GAE1B,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe,GAA8B;IACjD,SAAS;IACT,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF,4DAA4D;AAC5D,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C,iFAAiF;AACjF,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,oBAAoB,GACxB,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,6EAA6E;IAC7E,mEAAmE;IACnE,yDAAyD,CAAC;AAU5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,mBAAmB,GAAG,CAC1B,MAA6B,EAC7B,KAAgC,EAChC,cAAuC,EACjC,EAAE;IACR,IAAI,CAAC;QACH,2BAA2B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wCAAwC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,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,EAAE;IACF,0EAA0E;IAC1E,yEAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,+CAA+C;IAC/C,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;YACxB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;YACnD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAkB,EAAE,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { ScratchRunRootIntentV1 } from "./scratch.js";
2
- /**
3
- * Validate an inert scratch-root intent received over IPC.
4
- * @param value - Candidate intent
5
- * @returns Schema-validated intent
6
- */
7
- export declare function validateScratchRunRootIntent(value: unknown): ScratchRunRootIntentV1;
8
- //# sourceMappingURL=scratch-supervision-intent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratch-supervision-intent.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision-intent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAwG3D;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,sBAAsB,CA6CxB"}
@@ -1,125 +0,0 @@
1
- /** Exact IPC validation for immutable scratch run-root intents. */
2
- import * as path from "node:path";
3
- /**
4
- * Whether an object has exactly the declared own string keys.
5
- * @param value - Candidate object
6
- * @param keys - Required exact keys
7
- * @returns Whether the keys match exactly
8
- */
9
- function hasExactKeys(value, keys) {
10
- const actual = Object.keys(value).sort((left, right) => left.localeCompare(right));
11
- const expected = [...keys].sort((left, right) => left.localeCompare(right));
12
- return (actual.length === expected.length &&
13
- actual.every((key, index) => key === expected[index]));
14
- }
15
- /**
16
- * Whether a value contains an ASCII control code.
17
- * @param value - Candidate string
18
- * @returns Whether a control code is present
19
- */
20
- function hasControlCode(value) {
21
- return [...value].some(character => {
22
- const codePoint = character.codePointAt(0) ?? 0;
23
- return codePoint <= 31 || codePoint === 127;
24
- });
25
- }
26
- /**
27
- * Whether one value is a bounded, control-free direct basename.
28
- * @param value - Candidate basename
29
- * @returns Whether the basename is inert and bounded
30
- */
31
- function validBasename(value) {
32
- return (typeof value === "string" &&
33
- value !== "" &&
34
- value !== "." &&
35
- value !== ".." &&
36
- path.basename(value) === value &&
37
- !value.includes("/") &&
38
- !value.includes("\\") &&
39
- Buffer.byteLength(value, "utf8") <= 1_024 &&
40
- !hasControlCode(value));
41
- }
42
- /**
43
- * Whether one namespace identity has exact bounded fields.
44
- * @param value - Candidate identity
45
- * @returns Whether the identity is exact and typed
46
- */
47
- function validNamespaceIdentity(value) {
48
- if (typeof value !== "object" || value === null)
49
- return false;
50
- const candidate = value;
51
- const keys = Object.hasOwn(candidate, "uid")
52
- ? ["canonicalPath", "dev", "ino", "uid"]
53
- : ["canonicalPath", "dev", "ino"];
54
- return (hasExactKeys(candidate, keys) &&
55
- typeof candidate["canonicalPath"] === "string" &&
56
- path.isAbsolute(candidate["canonicalPath"]) &&
57
- Number.isSafeInteger(candidate["dev"]) &&
58
- Number.isSafeInteger(candidate["ino"]) &&
59
- (!Object.hasOwn(candidate, "uid") || Number.isSafeInteger(candidate["uid"])));
60
- }
61
- /**
62
- * Whether the scalar and collection fields of one root intent are valid.
63
- * @param intent - Candidate intent object
64
- * @param prefixes - Candidate prefix registry
65
- * @returns Whether every field is bounded and typed
66
- */
67
- function validIntentFields(intent, prefixes) {
68
- return (Number.isSafeInteger(intent["pid"]) &&
69
- intent["pid"] > 0 &&
70
- typeof intent["processBirthFingerprint"] === "string" &&
71
- intent["processBirthFingerprint"] !== "" &&
72
- Buffer.byteLength(intent["processBirthFingerprint"], "utf8") <= 256 &&
73
- typeof intent["createdAt"] === "string" &&
74
- !Number.isNaN(Date.parse(intent["createdAt"])) &&
75
- typeof intent["token"] === "string" &&
76
- /^[a-f0-9]{32}$/u.test(intent["token"]) &&
77
- typeof intent["suiteLabel"] === "string" &&
78
- intent["suiteLabel"] !== "" &&
79
- Buffer.byteLength(intent["suiteLabel"], "utf8") <= 256 &&
80
- Array.isArray(prefixes) &&
81
- prefixes.length <= 64 &&
82
- prefixes.every(validBasename));
83
- }
84
- /**
85
- * Validate an inert scratch-root intent received over IPC.
86
- * @param value - Candidate intent
87
- * @returns Schema-validated intent
88
- */
89
- export function validateScratchRunRootIntent(value) {
90
- if (typeof value !== "object" || value === null) {
91
- throw new Error("Scratch root intent must be an object");
92
- }
93
- const intent = value;
94
- const authority = intent["authority"];
95
- const namespace = authority?.["namespace"];
96
- const validAuthority = authority !== undefined &&
97
- authority !== null &&
98
- hasExactKeys(authority, ["baseCanonicalPath", "namespace"]) &&
99
- typeof authority["baseCanonicalPath"] === "string" &&
100
- validNamespaceIdentity(namespace);
101
- const validPath = validAuthority &&
102
- validBasename(intent["basename"]) &&
103
- typeof intent["rootPath"] === "string" &&
104
- intent["rootPath"] ===
105
- path.join(namespace.canonicalPath, intent["basename"]);
106
- if (intent["schema"] !== 1 ||
107
- !hasExactKeys(intent, [
108
- "schema",
109
- "authority",
110
- "basename",
111
- "rootPath",
112
- "pid",
113
- "processBirthFingerprint",
114
- "createdAt",
115
- "token",
116
- "suiteLabel",
117
- "registeredPrefixes",
118
- ]) ||
119
- !validPath ||
120
- !validIntentFields(intent, intent["registeredPrefixes"])) {
121
- throw new Error("Invalid scratch root intent schema");
122
- }
123
- return value;
124
- }
125
- //# sourceMappingURL=scratch-supervision-intent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratch-supervision-intent.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision-intent.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,KAA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AS,GACb,cAAc;QACd,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,QAAQ;QACtC,MAAM,CAAC,UAAU,CAAC;YAChB,IAAI,CAAC,IAAI,CACN,SAAiC,CAAC,aAAa,EAChD,MAAM,CAAC,UAAU,CAAC,CACnB,CAAC;IACN,IACE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QACtB,CAAC,YAAY,CAAC,MAAM,EAAE;YACpB,QAAQ;YACR,WAAW;YACX,UAAU;YACV,UAAU;YACV,KAAK;YACL,yBAAyB;YACzB,WAAW;YACX,OAAO;YACP,YAAY;YACZ,oBAAoB;SACrB,CAAC;QACF,CAAC,SAAS;QACV,CAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,EACxD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,KAA+B,CAAC;AACzC,CAAC"}
@@ -1,12 +0,0 @@
1
- /** Versioned IPC envelope after bounded structural validation. */
2
- export interface ScratchProtocolMessageV1 extends Record<string, unknown> {
3
- readonly schema: 1;
4
- readonly type: string;
5
- }
6
- /**
7
- * Validate a bounded version-one IPC message against the closed vocabulary.
8
- * @param value - Candidate message
9
- * @returns Validated message envelope
10
- */
11
- export declare function parseScratchProtocolMessage(value: unknown): ScratchProtocolMessageV1;
12
- //# sourceMappingURL=scratch-supervision-protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratch-supervision-protocol.d.ts","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision-protocol.ts"],"names":[],"mappings":"AA8CA,kEAAkE;AAClE,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAoND;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,wBAAwB,CA8B1B"}
@@ -1,230 +0,0 @@
1
- /** Bounded, exact IPC envelopes shared by the test-run protocol processes. */
2
- import * as path from "node:path";
3
- import { validateScratchRunRootIntent } from "./scratch-supervision-intent.js";
4
- /** Maximum serialized IPC envelope accepted by a protocol process. */
5
- const MAX_PROTOCOL_BYTES = 128 * 1_024;
6
- /** Empty message types whose exact schema has no payload fields. */
7
- const EMPTY_TYPES = new Set([
8
- "REAPER_READY",
9
- "COMMAND_READY",
10
- "GO",
11
- "STOP",
12
- "CLEANED",
13
- "DISARMED",
14
- ]);
15
- /** Correlated acknowledgement types carrying only the intent token. */
16
- const CORRELATED_TYPES = new Set([
17
- "ROOT_INTENT_ARMED",
18
- "TARGET_ARMED",
19
- "MATERIALIZE_ROOT",
20
- ]);
21
- /** Closed protocol message vocabulary. */
22
- const PROTOCOL_TYPES = new Set([
23
- ...EMPTY_TYPES,
24
- ...CORRELATED_TYPES,
25
- "ROOT_INTENT",
26
- "ROOT_ARMED",
27
- "BOOTSTRAP_READY",
28
- "COMMAND",
29
- "TARGET_INTENT",
30
- "SIGNAL",
31
- "PAYLOAD_EXIT",
32
- "PAYLOAD_ERROR",
33
- ]);
34
- /** Catchable signals accepted by the forwarding protocol. */
35
- const PROTOCOL_SIGNALS = new Set([
36
- "SIGINT",
37
- "SIGTERM",
38
- "SIGHUP",
39
- ]);
40
- /**
41
- * Whether an object has exactly the declared own string keys.
42
- * @param value - Candidate object
43
- * @param keys - Required exact keys
44
- * @returns Whether the keys match exactly
45
- */
46
- function hasExactKeys(value, keys) {
47
- const actual = Object.keys(value).sort((left, right) => left.localeCompare(right));
48
- const expected = [...keys].sort((left, right) => left.localeCompare(right));
49
- return (actual.length === expected.length &&
50
- actual.every((key, index) => key === expected[index]));
51
- }
52
- /**
53
- * Whether a correlation is one exact root-intent token.
54
- * @param value - Candidate correlation
55
- * @returns Whether it is one exact token
56
- */
57
- function validCorrelation(value) {
58
- return typeof value === "string" && /^[a-f0-9]{32}$/u.test(value);
59
- }
60
- /**
61
- * Whether a bootstrap command is exact, bounded, and inert.
62
- * @param value - Candidate command
63
- * @returns Whether the command contract is valid
64
- */
65
- function validBootstrapCommand(value) {
66
- if (typeof value !== "object" || value === null)
67
- return false;
68
- const command = value;
69
- const argv = command["argv"];
70
- const commandEnv = command["env"];
71
- return (hasExactKeys(command, ["schema", "argv", "env"]) &&
72
- command["schema"] === 1 &&
73
- Array.isArray(argv) &&
74
- argv.length > 0 &&
75
- argv.length <= 4_096 &&
76
- argv.every(argument => typeof argument === "string" &&
77
- Buffer.byteLength(argument, "utf8") <= 16 * 1_024) &&
78
- typeof commandEnv === "object" &&
79
- commandEnv !== null &&
80
- Object.keys(commandEnv).length <= 4_096 &&
81
- Object.entries(commandEnv).every(([key, entry]) => key !== "" &&
82
- Buffer.byteLength(key, "utf8") <= 1_024 &&
83
- typeof entry === "string" &&
84
- Buffer.byteLength(entry, "utf8") <= 64 * 1_024));
85
- }
86
- /**
87
- * Whether a target is one exact, birth-bound process-group leader.
88
- * @param value - Candidate target
89
- * @returns Whether the target contract is valid
90
- */
91
- function validTargetIntent(value) {
92
- if (typeof value !== "object" || value === null)
93
- return false;
94
- const target = value;
95
- return (hasExactKeys(target, ["pid", "pgid", "processBirthFingerprint"]) &&
96
- Number.isSafeInteger(target["pid"]) &&
97
- target["pid"] > 0 &&
98
- target["pgid"] === target["pid"] &&
99
- typeof target["processBirthFingerprint"] === "string" &&
100
- target["processBirthFingerprint"] !== "" &&
101
- Buffer.byteLength(target["processBirthFingerprint"], "utf8") <= 256);
102
- }
103
- /**
104
- * Whether a root identity carries only exact canonical inode authority.
105
- * @param value - Candidate root identity
106
- * @returns Whether the value is exact and bounded
107
- */
108
- function validRootIdentity(value) {
109
- if (typeof value !== "object" || value === null)
110
- return false;
111
- const root = value;
112
- return (hasExactKeys(root, ["canonicalPath", "dev", "ino"]) &&
113
- typeof root["canonicalPath"] === "string" &&
114
- path.isAbsolute(root["canonicalPath"]) &&
115
- Buffer.byteLength(root["canonicalPath"], "utf8") <= 4_096 &&
116
- Number.isSafeInteger(root["dev"]) &&
117
- Number.isSafeInteger(root["ino"]));
118
- }
119
- /**
120
- * Exact-key helper specialized to one protocol message.
121
- * @param message - Candidate message
122
- * @param keys - Message-specific keys
123
- * @returns Whether the complete key set matches
124
- */
125
- function exactMessageKeys(message, keys) {
126
- return hasExactKeys(message, ["schema", "type", ...keys]);
127
- }
128
- /**
129
- * Validate one correlated ROOT_INTENT message.
130
- * @param message - Candidate message
131
- * @returns Whether the root intent is exact
132
- */
133
- function validRootIntentMessage(message) {
134
- return (exactMessageKeys(message, ["correlation", "intent"]) &&
135
- validCorrelation(message["correlation"]) &&
136
- validateScratchRunRootIntent(message["intent"]).token ===
137
- message["correlation"]);
138
- }
139
- /**
140
- * Validate one birth-bound TARGET_INTENT message.
141
- * @param message - Candidate message
142
- * @returns Whether the target intent is exact
143
- */
144
- function validTargetIntentMessage(message) {
145
- return (exactMessageKeys(message, ["correlation", "target"]) &&
146
- validCorrelation(message["correlation"]) &&
147
- validTargetIntent(message["target"]));
148
- }
149
- /**
150
- * Validate one terminal payload result.
151
- * @param message - Candidate message
152
- * @returns Whether the result is exact
153
- */
154
- function validPayloadExitMessage(message) {
155
- return (exactMessageKeys(message, ["code", "signal"]) &&
156
- (message["code"] === null || Number.isInteger(message["code"])) &&
157
- (message["signal"] === null ||
158
- (typeof message["signal"] === "string" &&
159
- /^SIG[A-Z0-9]+$/u.test(message["signal"]))));
160
- }
161
- /** Message-specific validators outside the empty/correlation families. */
162
- const BODY_VALIDATORS = {
163
- BOOTSTRAP_READY: message => exactMessageKeys(message, ["pid"]) &&
164
- Number.isSafeInteger(message["pid"]) &&
165
- message["pid"] > 0,
166
- ROOT_INTENT: validRootIntentMessage,
167
- TARGET_INTENT: validTargetIntentMessage,
168
- ROOT_ARMED: message => exactMessageKeys(message, ["correlation", "root"]) &&
169
- validCorrelation(message["correlation"]) &&
170
- validRootIdentity(message["root"]),
171
- COMMAND: message => exactMessageKeys(message, ["command"]) &&
172
- validBootstrapCommand(message["command"]),
173
- SIGNAL: message => exactMessageKeys(message, ["signal"]) &&
174
- typeof message["signal"] === "string" &&
175
- PROTOCOL_SIGNALS.has(message["signal"]),
176
- PAYLOAD_ERROR: message => exactMessageKeys(message, ["message"]) &&
177
- typeof message["message"] === "string" &&
178
- message["message"] !== "" &&
179
- Buffer.byteLength(message["message"], "utf8") <= 4_096,
180
- PAYLOAD_EXIT: validPayloadExitMessage,
181
- };
182
- /**
183
- * Whether one exact message-specific body matches its declared type.
184
- * @param message - Candidate message
185
- * @param type - Declared protocol type
186
- * @returns Whether the message-specific shape is exact
187
- */
188
- function validMessageBody(message, type) {
189
- if (EMPTY_TYPES.has(type))
190
- return exactMessageKeys(message, []);
191
- if (CORRELATED_TYPES.has(type)) {
192
- return (exactMessageKeys(message, ["correlation"]) &&
193
- validCorrelation(message["correlation"]));
194
- }
195
- return BODY_VALIDATORS[type]?.(message) ?? false;
196
- }
197
- /**
198
- * Validate a bounded version-one IPC message against the closed vocabulary.
199
- * @param value - Candidate message
200
- * @returns Validated message envelope
201
- */
202
- export function parseScratchProtocolMessage(value) {
203
- const serialized = (() => {
204
- try {
205
- return JSON.stringify(value);
206
- }
207
- catch {
208
- throw new Error("Scratch protocol message must be serializable");
209
- }
210
- })();
211
- if (serialized === undefined ||
212
- Buffer.byteLength(serialized, "utf8") > MAX_PROTOCOL_BYTES) {
213
- throw new Error("Scratch protocol message exceeds its byte bound");
214
- }
215
- if (typeof value !== "object" || value === null) {
216
- throw new Error("Scratch protocol message must be an object");
217
- }
218
- const message = value;
219
- const type = message["type"];
220
- if (message["schema"] !== 1 ||
221
- typeof type !== "string" ||
222
- !PROTOCOL_TYPES.has(type)) {
223
- throw new Error("Invalid scratch protocol message schema");
224
- }
225
- if (!validMessageBody(message, type)) {
226
- throw new Error(`Invalid ${type} scratch protocol message`);
227
- }
228
- return value;
229
- }
230
- //# sourceMappingURL=scratch-supervision-protocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratch-supervision-protocol.js","sourceRoot":"","sources":["../../../src/configs/vitest/scratch-supervision-protocol.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAE/E,sEAAsE;AACtE,MAAM,kBAAkB,GAAG,GAAG,GAAG,KAAK,CAAC;AAEvC,oEAAoE;AACpE,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IAC/C,cAAc;IACd,eAAe;IACf,IAAI;IACJ,MAAM;IACN,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC;IACpD,mBAAmB;IACnB,cAAc;IACd,kBAAkB;CACnB,CAAC,CAAC;AAEH,0CAA0C;AAC1C,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;IAClD,GAAG,WAAW;IACd,GAAG,gBAAgB;IACnB,aAAa;IACb,YAAY;IACZ,iBAAiB;IACjB,SAAS;IACT,eAAe;IACf,QAAQ;IACR,cAAc;IACd,eAAe;CAChB,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC;IACpD,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAQH;;;;;GAKG;AACH,SAAS,YAAY,CACnB,KAAwC,EACxC,IAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACrD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAC1B,CAAC;IACF,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,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