@smoothbricks/nx-plugin 0.5.7 → 0.6.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 (432) hide show
  1. package/README.md +1086 -360
  2. package/dist/.build-inputs.json +138 -0
  3. package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
  4. package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
  6. package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
  7. package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
  9. package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
  10. package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-nextest-timings.js +28 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +14 -15
  15. package/dist/build-state-output-policy.d.ts +95 -1
  16. package/dist/build-state-output-policy.d.ts.map +1 -1
  17. package/dist/build-state-output-policy.js +368 -30
  18. package/dist/bun-lock-scope.d.ts +44 -0
  19. package/dist/bun-lock-scope.d.ts.map +1 -0
  20. package/dist/bun-lock-scope.js +97 -0
  21. package/dist/cargo-build-script-env.d.ts +49 -0
  22. package/dist/cargo-build-script-env.d.ts.map +1 -0
  23. package/dist/cargo-build-script-env.js +324 -0
  24. package/dist/cargo-closure-input.d.ts +31 -4
  25. package/dist/cargo-closure-input.d.ts.map +1 -1
  26. package/dist/cargo-closure-input.js +66 -6
  27. package/dist/cargo-retention-hook.d.ts +17 -0
  28. package/dist/cargo-retention-hook.d.ts.map +1 -0
  29. package/dist/cargo-retention-hook.js +85 -0
  30. package/dist/cargo-source-hash.d.ts +25 -7
  31. package/dist/cargo-source-hash.d.ts.map +1 -1
  32. package/dist/cargo-source-hash.js +108 -43
  33. package/dist/cargo-toolchain-paths.d.ts +40 -0
  34. package/dist/cargo-toolchain-paths.d.ts.map +1 -0
  35. package/dist/cargo-toolchain-paths.js +84 -0
  36. package/dist/cargo-toolchain-policy.d.ts +25 -8
  37. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  38. package/dist/cargo-toolchain-policy.js +39 -5
  39. package/dist/cargo-workspace.d.ts +10 -4
  40. package/dist/cargo-workspace.d.ts.map +1 -1
  41. package/dist/cargo-workspace.js +65 -95
  42. package/dist/cross-check-policy.d.ts +9 -9
  43. package/dist/cross-check-policy.d.ts.map +1 -1
  44. package/dist/cross-check-policy.js +11 -11
  45. package/dist/disk-command-policy.d.ts.map +1 -1
  46. package/dist/disk-command-policy.js +1 -0
  47. package/dist/ensure-built-receipt.d.ts +13 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +126 -47
  50. package/dist/ensure-built-witness.d.ts +27 -8
  51. package/dist/ensure-built-witness.d.ts.map +1 -1
  52. package/dist/ensure-built-witness.js +45 -15
  53. package/dist/ensure-built.d.ts.map +1 -1
  54. package/dist/ensure-built.js +9 -1
  55. package/dist/eslint-config-closure.d.ts +7 -0
  56. package/dist/eslint-config-closure.d.ts.map +1 -0
  57. package/dist/eslint-config-closure.js +346 -0
  58. package/dist/executors/bounded-exec/bounds.d.ts +56 -0
  59. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
  60. package/dist/executors/bounded-exec/bounds.js +43 -0
  61. package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
  62. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  63. package/dist/executors/bounded-exec/cpu-pool.js +54 -119
  64. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  65. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  66. package/dist/executors/bounded-exec/executor.js +371 -239
  67. package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
  68. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/gateway-lease.js +81 -28
  70. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  71. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  73. package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
  74. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  75. package/dist/executors/bounded-exec/lease-wait.js +68 -0
  76. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  77. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  78. package/dist/executors/bounded-exec/lock-wait.js +108 -0
  79. package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
  80. package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/owned-subtree.js +178 -0
  82. package/dist/executors/bounded-exec/progress.d.ts +4 -1
  83. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  84. package/dist/executors/bounded-exec/progress.js +5 -2
  85. package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
  86. package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/ram-attach.js +207 -0
  88. package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
  89. package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
  90. package/dist/executors/bounded-exec/ram-detach.js +207 -0
  91. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
  92. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
  93. package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
  94. package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
  95. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  96. package/dist/executors/bounded-exec/ram-temp.js +1213 -399
  97. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
  98. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  99. package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
  100. package/dist/executors/bounded-exec/runner-hook.js +14 -5
  101. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
  102. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  103. package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
  104. package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
  105. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
  106. package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
  107. package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
  108. package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
  109. package/dist/executors/bounded-exec/runtime-pin.js +167 -0
  110. package/dist/executors/bounded-exec/schema.d.ts +18 -1
  111. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  112. package/dist/executors/bounded-exec/verdict.d.ts +40 -11
  113. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  114. package/dist/executors/bounded-exec/verdict.js +88 -19
  115. package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
  116. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  117. package/dist/executors/cargo-zigbuild/executor.js +67 -12
  118. package/dist/executors/clean-outputs/executor.js +1 -0
  119. package/dist/executors/scriptc-native/executor.d.ts +79 -0
  120. package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
  121. package/dist/executors/scriptc-native/executor.js +367 -0
  122. package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
  123. package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
  124. package/dist/executors/scriptc-native/ffi-paths.js +25 -0
  125. package/dist/executors/scriptc-native/schema.d.ts +34 -0
  126. package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
  127. package/dist/executors/scriptc-native/schema.js +1 -0
  128. package/dist/executors/typescript-emit/executor.d.ts +3 -1
  129. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  130. package/dist/executors/typescript-emit/executor.js +164 -33
  131. package/dist/forbidden-spelling-policy.d.ts +56 -0
  132. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  133. package/dist/forbidden-spelling-policy.js +176 -0
  134. package/dist/generators/create-package/generator.d.ts.map +1 -1
  135. package/dist/generators/create-package/generator.js +3 -4
  136. package/dist/graph-input-contract.d.ts +14 -0
  137. package/dist/graph-input-contract.d.ts.map +1 -1
  138. package/dist/graph-input-contract.js +67 -2
  139. package/dist/index.d.ts +23 -6
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +672 -214
  142. package/dist/managed-assets.d.ts +2 -0
  143. package/dist/managed-assets.d.ts.map +1 -1
  144. package/dist/managed-files/files.d.ts +3 -3
  145. package/dist/managed-files/files.d.ts.map +1 -1
  146. package/dist/managed-files/files.js +28 -3
  147. package/dist/managed-files/managed-format.d.ts.map +1 -1
  148. package/dist/managed-files/managed-format.js +1 -0
  149. package/dist/nextest-code-bound.js +1 -0
  150. package/dist/nextest-timings.d.ts +35 -0
  151. package/dist/nextest-timings.d.ts.map +1 -0
  152. package/dist/nextest-timings.js +168 -0
  153. package/dist/owned-installation.d.ts +6 -5
  154. package/dist/owned-installation.d.ts.map +1 -1
  155. package/dist/owned-installation.js +150 -26
  156. package/dist/package-target-policy.d.ts.map +1 -1
  157. package/dist/package-target-policy.js +2 -3
  158. package/dist/process-children.d.ts +7 -0
  159. package/dist/process-children.d.ts.map +1 -0
  160. package/dist/process-children.darwin.d.ts +7 -0
  161. package/dist/process-children.darwin.d.ts.map +1 -0
  162. package/dist/process-children.darwin.js +13 -0
  163. package/dist/process-children.js +14 -0
  164. package/dist/process-children.linux.d.ts +8 -0
  165. package/dist/process-children.linux.d.ts.map +1 -0
  166. package/dist/process-children.linux.js +25 -0
  167. package/dist/process-group.d.ts +108 -0
  168. package/dist/process-group.d.ts.map +1 -0
  169. package/dist/process-group.js +171 -0
  170. package/dist/process-listing.d.ts +7 -0
  171. package/dist/process-listing.d.ts.map +1 -0
  172. package/dist/process-listing.js +51 -0
  173. package/dist/producer-receipts.d.ts +8 -2
  174. package/dist/producer-receipts.d.ts.map +1 -1
  175. package/dist/producer-receipts.js +75 -48
  176. package/dist/task-graph-policy.d.ts +21 -0
  177. package/dist/task-graph-policy.d.ts.map +1 -0
  178. package/dist/task-graph-policy.js +91 -0
  179. package/dist/test-timings.js +4 -4
  180. package/dist/test-walk-policy.d.ts +14 -5
  181. package/dist/test-walk-policy.d.ts.map +1 -1
  182. package/dist/test-walk-policy.js +8 -2
  183. package/dist/testing.d.ts +73 -28
  184. package/dist/testing.d.ts.map +1 -1
  185. package/dist/testing.js +217 -223
  186. package/dist/tool-bins.d.ts +33 -0
  187. package/dist/tool-bins.d.ts.map +1 -0
  188. package/dist/tool-bins.js +72 -0
  189. package/dist/typecheck-test-policy.d.ts.map +1 -1
  190. package/dist/typecheck-test-policy.js +3 -4
  191. package/dist/wait-why-policy.d.ts +28 -0
  192. package/dist/wait-why-policy.d.ts.map +1 -0
  193. package/dist/wait-why-policy.js +223 -0
  194. package/dist/workspace-config-policy.d.ts +14 -8
  195. package/dist/workspace-config-policy.d.ts.map +1 -1
  196. package/dist/workspace-config-policy.js +60 -16
  197. package/dist/workspace-manifest.d.ts +41 -6
  198. package/dist/workspace-manifest.d.ts.map +1 -1
  199. package/dist/workspace-manifest.js +57 -0
  200. package/executors.json +16 -1
  201. package/loader.js +2 -0
  202. package/managed/raw/envrc +11 -0
  203. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  204. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  205. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  206. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  207. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  208. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  209. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  210. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  211. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  212. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  213. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  214. package/managed/raw/tooling/direnv/repo-path +68 -6
  215. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  216. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  217. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  218. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  219. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  220. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  221. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  222. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  223. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  224. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  225. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  226. package/package.json +77 -13
  227. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  228. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  229. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  230. package/src/bounded-test-policy.ts +12 -14
  231. package/src/build-state-output-policy.ts +458 -34
  232. package/src/bun-lock-scope.ts +108 -0
  233. package/src/cargo-build-script-env.ts +265 -0
  234. package/src/cargo-closure-input.ts +74 -7
  235. package/src/cargo-retention-hook.ts +94 -0
  236. package/src/cargo-source-hash.ts +138 -41
  237. package/src/cargo-toolchain-paths.ts +95 -0
  238. package/src/cargo-toolchain-policy.ts +49 -5
  239. package/src/cargo-workspace.ts +72 -123
  240. package/src/cross-check-policy.ts +12 -10
  241. package/src/disk-command-policy.ts +1 -0
  242. package/src/ensure-built-receipt.ts +132 -39
  243. package/src/ensure-built-witness.ts +62 -10
  244. package/src/ensure-built.ts +11 -1
  245. package/src/eslint-config-closure.ts +357 -0
  246. package/src/executors/bounded-exec/bounds.ts +76 -0
  247. package/src/executors/bounded-exec/cpu-pool.ts +51 -117
  248. package/src/executors/bounded-exec/executor.ts +423 -259
  249. package/src/executors/bounded-exec/gateway-lease.ts +82 -33
  250. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  251. package/src/executors/bounded-exec/lease-wait.ts +89 -0
  252. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  253. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  254. package/src/executors/bounded-exec/progress.ts +9 -3
  255. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  256. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  257. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  258. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  259. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  260. package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
  261. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  262. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  263. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  264. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  265. package/src/executors/bounded-exec/schema.json +11 -2
  266. package/src/executors/bounded-exec/schema.ts +19 -1
  267. package/src/executors/bounded-exec/verdict.ts +137 -34
  268. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  269. package/src/executors/clean-outputs/executor.ts +1 -0
  270. package/src/executors/scriptc-native/executor.ts +394 -0
  271. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  272. package/src/executors/scriptc-native/schema.json +60 -0
  273. package/src/executors/scriptc-native/schema.ts +34 -0
  274. package/src/executors/typescript-emit/executor.ts +205 -38
  275. package/src/forbidden-spelling-policy.ts +226 -0
  276. package/src/generators/create-package/generator.ts +7 -7
  277. package/src/graph-input-contract.ts +61 -2
  278. package/src/index.ts +788 -224
  279. package/src/managed-assets.ts +3 -0
  280. package/src/managed-files/files.ts +28 -3
  281. package/src/managed-files/managed-format.ts +1 -0
  282. package/src/nextest-code-bound.ts +1 -0
  283. package/src/nextest-timings.ts +106 -0
  284. package/src/owned-installation.ts +150 -23
  285. package/src/package-target-policy.ts +2 -3
  286. package/src/process-children.darwin.ts +14 -0
  287. package/src/process-children.linux.ts +33 -0
  288. package/src/process-children.ts +22 -0
  289. package/src/process-group.ts +209 -0
  290. package/src/process-listing.ts +54 -0
  291. package/src/producer-receipts.ts +68 -45
  292. package/src/task-graph-policy.ts +98 -0
  293. package/src/test-walk-policy.ts +23 -8
  294. package/src/testing.ts +240 -232
  295. package/src/tool-bins.ts +108 -0
  296. package/src/typecheck-test-policy.ts +2 -3
  297. package/src/wait-why-policy.ts +226 -0
  298. package/src/workspace-config-policy.ts +63 -15
  299. package/src/workspace-manifest.ts +89 -6
  300. package/test-timings.json +122 -98
  301. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  302. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  303. package/dist/bin/smoo-nx-failures.js +0 -3
  304. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  305. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  306. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  307. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  308. package/dist/failure-summary.d.ts +0 -5
  309. package/dist/failure-summary.d.ts.map +0 -1
  310. package/dist/failure-summary.js +0 -118
  311. package/dist/nextest-extraction.d.ts +0 -117
  312. package/dist/nextest-extraction.d.ts.map +0 -1
  313. package/dist/nextest-extraction.js +0 -303
  314. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  315. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  316. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  317. package/src/__tests__/counted-cargo-process.ts +0 -286
  318. package/src/__tests__/counted-cargo.ts +0 -713
  319. package/src/__tests__/directory-change.ts +0 -27
  320. package/src/__tests__/fixture-cargo-home.ts +0 -36
  321. package/src/__tests__/fixture-nx-env.ts +0 -193
  322. package/src/__tests__/owned-installation.ts +0 -13
  323. package/src/__tests__/past-tick.ts +0 -12
  324. package/src/__tests__/progress-clock.ts +0 -43
  325. package/src/__tests__/runtime-input.ts +0 -23
  326. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  327. package/src/bin/smoo-nx-failures.ts +0 -4
  328. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  329. package/src/bounded-test-policy.test.ts +0 -1029
  330. package/src/build-state-output-policy.test.ts +0 -115
  331. package/src/bun-bootstrap.test.ts +0 -102
  332. package/src/bun-file-packages.test.ts +0 -47
  333. package/src/cargo-closure-filesets.test.ts +0 -63
  334. package/src/cargo-closure-input.property.test.ts +0 -50
  335. package/src/cargo-closure-input.test.ts +0 -506
  336. package/src/cargo-closure-key.test.ts +0 -240
  337. package/src/cargo-resolve-cache.test.ts +0 -1181
  338. package/src/cargo-source-hash.test.ts +0 -707
  339. package/src/cargo-workspace.test.ts +0 -615
  340. package/src/cross-check-policy.test.ts +0 -316
  341. package/src/disk-command-policy.test.ts +0 -61
  342. package/src/ensure-built-receipt.test.ts +0 -279
  343. package/src/ensure-built-witness.test.ts +0 -688
  344. package/src/ensure-built.test.ts +0 -1462
  345. package/src/executors/all-verdicts/executor.test.ts +0 -135
  346. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  347. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  348. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  349. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  350. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  351. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  352. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  353. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  354. package/src/executors/bounded-exec/progress.test.ts +0 -139
  355. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  356. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  357. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  358. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  359. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  360. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  361. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  362. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  363. package/src/executors/clean-outputs/executor.test.ts +0 -20
  364. package/src/executors/typescript-emit/executor.test.ts +0 -83
  365. package/src/failure-summary.ts +0 -119
  366. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  367. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  368. package/src/generators/create-package/generator.test.ts +0 -190
  369. package/src/generators/make-public/generator.test.ts +0 -137
  370. package/src/graph-input-contract.test.ts +0 -379
  371. package/src/host-controller-wiring.test.ts +0 -31
  372. package/src/index.test.ts +0 -3321
  373. package/src/linked-snapshots.nx.test.ts +0 -254
  374. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  375. package/src/managed-files/generator.test.ts +0 -243
  376. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  377. package/src/managed-files/json-edit.test.ts +0 -216
  378. package/src/managed-files/managed-content.test.ts +0 -166
  379. package/src/managed-files/managed-format-json.test.ts +0 -308
  380. package/src/managed-files/repo-path.test.ts +0 -172
  381. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  382. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  383. package/src/managed-files/tree-permissions.test.ts +0 -109
  384. package/src/managed-files/tree.test.ts +0 -123
  385. package/src/manifest-hash.test.ts +0 -219
  386. package/src/nextest-code-bound.test.ts +0 -161
  387. package/src/nextest-extraction.test.ts +0 -216
  388. package/src/nextest-extraction.ts +0 -371
  389. package/src/nextest-partitions.test.ts +0 -501
  390. package/src/nx-cache-bound.test.ts +0 -109
  391. package/src/nx-cache-restore-mtime.test.ts +0 -170
  392. package/src/nx-daemon-claim.test.ts +0 -279
  393. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  394. package/src/nx-daemon-idle-policy.test.ts +0 -111
  395. package/src/nx-daemon-ignore-files.test.ts +0 -210
  396. package/src/nx-daemon-root-normalization.test.ts +0 -105
  397. package/src/nx-daemon-start-never.test.ts +0 -292
  398. package/src/nx-daemon-validity.test.ts +0 -1055
  399. package/src/nx-dot-input-policy.test.ts +0 -353
  400. package/src/nx-failure-life-cycles.test.ts +0 -207
  401. package/src/nx-files-archive-racy.test.ts +0 -97
  402. package/src/nx-foreign-workspace-env.test.ts +0 -329
  403. package/src/nx-incomplete-run-summary.test.ts +0 -70
  404. package/src/nx-plugin-load-errors.test.ts +0 -120
  405. package/src/nx-project-graph-errors.test.ts +0 -70
  406. package/src/nx-project-resolution-cache.test.ts +0 -176
  407. package/src/nx-raw-inputs.test.ts +0 -166
  408. package/src/nx-resident-graph-workers.test.ts +0 -112
  409. package/src/nx-run-information.test.ts +0 -118
  410. package/src/nx-skipped-task-exit.test.ts +0 -180
  411. package/src/nx-state-location.test.ts +0 -63
  412. package/src/nx-store-resolution.test.ts +0 -81
  413. package/src/nx-task-graph-cycles.test.ts +0 -148
  414. package/src/nx-task-output-lease.test.ts +0 -550
  415. package/src/nx-use-local.test.ts +0 -105
  416. package/src/owned-installation.test.ts +0 -105
  417. package/src/package-target-policy.test.ts +0 -1014
  418. package/src/producer-receipts.test.ts +0 -285
  419. package/src/release-config-policy.test.ts +0 -311
  420. package/src/runtime-input.test.ts +0 -393
  421. package/src/serial-group-wiring.test.ts +0 -326
  422. package/src/task-history-namespace.test.ts +0 -181
  423. package/src/task-results.test.ts +0 -228
  424. package/src/test-clock-policy.test.ts +0 -338
  425. package/src/test-program.test.ts +0 -303
  426. package/src/test-timings.test.ts +0 -240
  427. package/src/test-walk-policy.test.ts +0 -620
  428. package/src/testing.test.ts +0 -509
  429. package/src/typecheck-test-policy.test.ts +0 -1468
  430. package/src/typescript-resolution.test.ts +0 -76
  431. package/src/version-actions.test.ts +0 -80
  432. package/src/workspace-config-policy.test.ts +0 -737
@@ -1,13 +1,14 @@
1
+ import { CpuLeaseWait } from './lease-wait.js';
1
2
  /**
2
- * The client half of a lease held on the cowshed gateway's control socket: the host
3
- * disk-lifecycle lease (`disk-lease.ts`) and the host CPU budget (`cpu-tokens.ts`) speak the same
4
- * protocol (specs/cowshed/05_gateway.md, "Disk-lifecycle lease" and "Host CPU budget").
3
+ * The client half of a lease held on a unix socket: the gateway's host disk-lifecycle lease
4
+ * (`disk-lease.ts`) and a parent's CPU pool (`cpu-pool.ts`) speak the same protocol
5
+ * (specs/cowshed/05_gateway.md, "Disk-lifecycle lease").
5
6
  *
6
7
  * The client writes one request line and keeps the connection open without half-closing it. The
7
8
  * gateway answers `queued` at once and `granted` when the lease is the client's, and the lease
8
9
  * lasts until the client closes the connection, so a client that dies holding one releases it with
9
- * its socket. A lease never decides whether a command runs: without a grant, it runs without one
10
- * and the caller says why.
10
+ * its socket. The caller decides what a refusal means: disk work may run unleased, while CPU
11
+ * admission fails rather than running outside its parent's count.
11
12
  */
12
13
  /** The cowshed gateway's control socket, at the store root every peer agrees on. */
13
14
  export declare const GATEWAY_SOCKET = "/private/cowshed/store/gateway.sock";
@@ -20,11 +21,18 @@ export interface LeaseBounds {
20
21
  grantMs: number | null;
21
22
  }
22
23
  /**
23
- * Why a command runs without a lease: no gateway listens, the gateway predates this kind of lease,
24
- * the gateway knows the lease but predates a field the request names (it refuses the field at
25
- * once), or any other refusal, silence or breakage.
24
+ * Why a lease is not held: no gateway listens, the gateway predates this kind of lease, the gateway
25
+ * knows the lease but predates a field the request names (it refuses the field at once), or any
26
+ * other refusal, silence or breakage.
26
27
  */
27
28
  export type UnleasedCause = 'absent' | 'predates' | 'predates-field' | 'other';
29
+ /** A refusal: the lease is not held, and why. */
30
+ export type Unleased = {
31
+ granted: false;
32
+ cause: UnleasedCause;
33
+ reason: string;
34
+ code?: string;
35
+ };
28
36
  /**
29
37
  * A granted lease with its `granted` answer, held until released, or why there is none. `closed`
30
38
  * resolves when the connection really closes: after `release`, when the gateway ends it, or when
@@ -35,18 +43,13 @@ export type HeldLease = {
35
43
  answer: Readonly<Record<string, unknown>>;
36
44
  release: () => void;
37
45
  closed: Promise<void>;
38
- } | {
39
- granted: false;
40
- cause: UnleasedCause;
41
- reason: string;
42
- code?: string;
43
- };
46
+ } | Unleased;
44
47
  /**
45
48
  * Ask the gateway at `socket` for the lease `request` names, `what` in its messages ("disk
46
- * leases", "the CPU budget"). A gateway from before one-line requests says nothing until it reads
47
- * EOF, so a request not queued within `ackMs` is half-closed and that gateway's refusal read; a
48
- * gateway that reads the line but does not know the operation refuses it at once. Both predate the
49
- * lease.
49
+ * leases", "the parent CPU pool"). A gateway from before one-line requests says nothing until it reads
50
+ * EOF, so a disk request not queued within its ack bound is half-closed to read that gateway's
51
+ * refusal. CPU admission instead uses its own control/silence policy: no compatibility half-close,
52
+ * and no total queue bound (specs/cowshed/05_gateway.md, "Deadlines").
50
53
  */
51
- export declare function holdLease(socket: string, request: Readonly<Record<string, unknown>>, what: string, bounds: LeaseBounds, onQueued?: () => void): Promise<HeldLease>;
54
+ export declare function holdLease(socket: string, request: Readonly<Record<string, unknown>>, what: string, bounds: LeaseBounds | CpuLeaseWait, onQueued?: () => void): Promise<HeldLease>;
52
55
  //# sourceMappingURL=gateway-lease.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-lease.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/gateway-lease.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,oFAAoF;AACpF,eAAO,MAAM,cAAc,wCAAwC,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GACxG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,SAAS,CAAC,CAwHpB"}
1
+ {"version":3,"file":"gateway-lease.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/gateway-lease.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;;;;GAUG;AAEH,oFAAoF;AACpF,eAAO,MAAM,cAAc,wCAAwC,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAE/E,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GACxG,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAAG,YAAY,EAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAAC,SAAS,CAAC,CAkKpB"}
@@ -1,23 +1,36 @@
1
1
  import { connect } from 'node:net';
2
+ import typia from 'typia';
3
+ import { CpuLeaseWait } from './lease-wait.js';
4
+ const isCpuProgress = (() => {
5
+ const _io0 = (input, _exceptionable = true) => true === input.ok && "number" === typeof input.progress && (2 === Object.keys(input).length || Object.keys(input).every(key => {
6
+ if (["ok", "progress"].some(prop => key === prop))
7
+ return true;
8
+ const value = input[key];
9
+ if (undefined === value)
10
+ return true;
11
+ return false;
12
+ }));
13
+ return (input, _exceptionable = true) => "object" === typeof input && null !== input && _io0(input, true);
14
+ })();
2
15
  /**
3
- * The client half of a lease held on the cowshed gateway's control socket: the host
4
- * disk-lifecycle lease (`disk-lease.ts`) and the host CPU budget (`cpu-tokens.ts`) speak the same
5
- * protocol (specs/cowshed/05_gateway.md, "Disk-lifecycle lease" and "Host CPU budget").
16
+ * The client half of a lease held on a unix socket: the gateway's host disk-lifecycle lease
17
+ * (`disk-lease.ts`) and a parent's CPU pool (`cpu-pool.ts`) speak the same protocol
18
+ * (specs/cowshed/05_gateway.md, "Disk-lifecycle lease").
6
19
  *
7
20
  * The client writes one request line and keeps the connection open without half-closing it. The
8
21
  * gateway answers `queued` at once and `granted` when the lease is the client's, and the lease
9
22
  * lasts until the client closes the connection, so a client that dies holding one releases it with
10
- * its socket. A lease never decides whether a command runs: without a grant, it runs without one
11
- * and the caller says why.
23
+ * its socket. The caller decides what a refusal means: disk work may run unleased, while CPU
24
+ * admission fails rather than running outside its parent's count.
12
25
  */
13
26
  /** The cowshed gateway's control socket, at the store root every peer agrees on. */
14
27
  export const GATEWAY_SOCKET = '/private/cowshed/store/gateway.sock';
15
28
  /**
16
29
  * Ask the gateway at `socket` for the lease `request` names, `what` in its messages ("disk
17
- * leases", "the CPU budget"). A gateway from before one-line requests says nothing until it reads
18
- * EOF, so a request not queued within `ackMs` is half-closed and that gateway's refusal read; a
19
- * gateway that reads the line but does not know the operation refuses it at once. Both predate the
20
- * lease.
30
+ * leases", "the parent CPU pool"). A gateway from before one-line requests says nothing until it reads
31
+ * EOF, so a disk request not queued within its ack bound is half-closed to read that gateway's
32
+ * refusal. CPU admission instead uses its own control/silence policy: no compatibility half-close,
33
+ * and no total queue bound (specs/cowshed/05_gateway.md, "Deadlines").
21
34
  */
22
35
  export function holdLease(socket, request, what, bounds, onQueued) {
23
36
  // `Promise.withResolvers` would read better but needs lib es2024; this package inherits lib
@@ -26,6 +39,8 @@ export function holdLease(socket, request, what, bounds, onQueued) {
26
39
  const promise = new Promise((settled) => {
27
40
  resolve = settled;
28
41
  });
42
+ const cpu = bounds instanceof CpuLeaseWait ? bounds : null;
43
+ // eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: CPU connect/send is control-bounded and its answer heartbeat-silence-bounded by armCpu(); disk acknowledgement and half-close are bounded below, and a queued disk lease lasts until its holder releases it
29
44
  const connection = connect(socket);
30
45
  // `closed` is made when a consumer reads it, so a lease nobody watches allocates no promise. The
31
46
  // flag, not `connection.destroyed`, says the socket really closed: `destroy()` sets that flag before
@@ -51,46 +66,75 @@ export function holdLease(socket, request, what, bounds, onQueued) {
51
66
  clearTimeout(timer);
52
67
  timer = setTimeout(onExpiry, ms);
53
68
  };
69
+ const armCpu = () => {
70
+ if (cpu === null || state === 'settled')
71
+ return;
72
+ wait(cpu.remainingMs(), () => {
73
+ cpu.look();
74
+ const failure = cpu.expired();
75
+ if (failure === null) {
76
+ armCpu();
77
+ return;
78
+ }
79
+ unleased(`${failure.code}: cpu-pool: the lease endpoint ${socket} exceeded ${failure.boundMs} ms (waited ${failure.elapsedMs} ms; last progress: ${failure.last})`, 'other', failure.code);
80
+ });
81
+ };
82
+ armCpu();
54
83
  const answer = (line) => {
84
+ if (state === 'settled')
85
+ return;
55
86
  let parsed;
56
87
  try {
57
88
  parsed = JSON.parse(line);
58
89
  }
59
90
  catch {
60
- unleased(`the gateway answered something that is not an answer: ${line}`);
91
+ unleased(`the lease endpoint ${socket} answered something that is not an answer: ${line}`);
61
92
  return;
62
93
  }
63
94
  if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
64
- unleased(`the gateway answered something that is not an answer: ${line}`);
95
+ unleased(`the lease endpoint ${socket} answered something that is not an answer: ${line}`);
65
96
  return;
66
97
  }
67
98
  const fields = Object.fromEntries(Object.entries(parsed));
99
+ if (cpu !== null && isCpuProgress(parsed)) {
100
+ if (!cpu.heartbeat(parsed.progress)) {
101
+ unleased(`the lease endpoint ${socket} sent non-advancing CPU progress: ${line}`);
102
+ }
103
+ else {
104
+ armCpu();
105
+ }
106
+ return;
107
+ }
68
108
  const lease = fields.lease;
69
109
  if (fields.ok !== true) {
70
110
  const error = String(fields.error ?? '');
71
111
  const why = `${String(fields.code ?? 'refused')}: ${error}`;
72
112
  if (state === 'half-closed' || error.endsWith('unknown gateway control operation')) {
73
- unleased(`the gateway predates ${what} (${why}); restart it with \`cowshed setup\``, 'predates');
113
+ unleased(`the lease endpoint ${socket} predates ${what} (${why}); restart it with \`cowshed setup\``, 'predates');
74
114
  }
75
115
  else if (error.endsWith('contains an unknown field')) {
76
- unleased(`the gateway predates a field of ${what} (${why}); restart it with \`cowshed setup\``, 'predates-field');
116
+ unleased(`the lease endpoint ${socket} predates a field of ${what} (${why}); restart it with \`cowshed setup\``, 'predates-field');
77
117
  }
78
118
  else {
79
- unleased(`the gateway refused the lease (${why})`, 'other', typeof fields.code === 'string' ? fields.code : undefined);
119
+ unleased(`the lease endpoint ${socket} refused the lease (${why})`, 'other', typeof fields.code === 'string' ? fields.code : undefined);
80
120
  }
81
121
  }
82
122
  else if (state === 'half-closed') {
83
- unleased('the gateway did not queue the request in time; it is alive but overloaded');
123
+ unleased(`the lease endpoint ${socket} did not queue the request in time; it is alive but overloaded`);
84
124
  }
85
125
  else if (state === 'asked' && lease === 'queued') {
86
126
  state = 'queued';
87
127
  onQueued?.();
88
- const grantMs = bounds.grantMs;
89
- if (grantMs === null) {
128
+ if (bounds instanceof CpuLeaseWait) {
129
+ bounds.queued();
130
+ armCpu();
131
+ }
132
+ else if (bounds.grantMs === null) {
90
133
  clearTimeout(timer);
91
134
  }
92
135
  else {
93
- wait(grantMs, () => unleased(`the gateway granted nothing within ${grantMs} ms`));
136
+ const grantMs = bounds.grantMs;
137
+ wait(grantMs, () => unleased(`the lease endpoint ${socket} granted nothing within ${grantMs} ms`));
94
138
  }
95
139
  }
96
140
  else if (state === 'queued' && lease === 'granted') {
@@ -101,23 +145,32 @@ export function holdLease(socket, request, what, bounds, onQueued) {
101
145
  get closed() {
102
146
  closed ??= socketClosed
103
147
  ? Promise.resolve()
104
- : new Promise((done) => connection.once('close', () => done()));
148
+ : // eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a held lease's connection lasts as long as its holder keeps it; release() destroys it on this side, and the gateway's own end closes it too
149
+ new Promise((done) => connection.once('close', () => done()));
105
150
  return closed;
106
151
  },
107
152
  });
108
153
  }
109
154
  else {
110
- unleased(`the gateway answered out of turn: ${line}`);
155
+ unleased(`the lease endpoint ${socket} answered out of turn: ${line}`);
111
156
  }
112
157
  };
113
158
  connection.on('connect', () => {
114
159
  state = 'asked';
115
- connection.write(`${JSON.stringify(request)}\n`);
116
- wait(bounds.ackMs, () => {
117
- state = 'half-closed';
118
- connection.end();
119
- wait(bounds.afterCloseMs, () => unleased('the gateway answered nothing'));
120
- });
160
+ if (bounds instanceof CpuLeaseWait) {
161
+ connection.write(`${JSON.stringify(request)}\n`, () => {
162
+ bounds.sent();
163
+ armCpu();
164
+ });
165
+ }
166
+ else {
167
+ connection.write(`${JSON.stringify(request)}\n`);
168
+ wait(bounds.ackMs, () => {
169
+ state = 'half-closed';
170
+ connection.end();
171
+ wait(bounds.afterCloseMs, () => unleased(`the lease endpoint ${socket} answered nothing`));
172
+ });
173
+ }
121
174
  });
122
175
  connection.on('data', (chunk) => {
123
176
  buffered += chunk.toString('utf8');
@@ -129,7 +182,7 @@ export function holdLease(socket, request, what, bounds, onQueued) {
129
182
  });
130
183
  connection.on('error', (error) => {
131
184
  if (state === 'connecting') {
132
- unleased(`the gateway's control socket ${socket} does not answer (${error.message})`, 'absent');
185
+ unleased(`nothing answers for ${what} at ${socket} (${error.message})`, 'absent');
133
186
  }
134
187
  else {
135
188
  unleased(error.message);
@@ -137,7 +190,7 @@ export function holdLease(socket, request, what, bounds, onQueued) {
137
190
  });
138
191
  connection.on('close', () => {
139
192
  socketClosed = true;
140
- unleased('the gateway closed the lease connection');
193
+ unleased(`the lease connection for ${what} at ${socket} closed`);
141
194
  });
142
195
  return promise;
143
196
  }
@@ -1,10 +1,17 @@
1
- export declare const HANG_CAPTURE_MS = 5000;
1
+ import { type LockWait } from './lock-wait.js';
2
+ /**
3
+ * The pre-expiry capture window. Stack samples set it: under load averages of 27-52 on 18 cores one `sudo -n sample`
4
+ * took 1.1-4.6 s, and in a five-second window two of eight real captures lost their sample at its limit.
5
+ */
6
+ export declare const HANG_CAPTURE_MS = 10000;
2
7
  export interface HangDiagnostics {
3
8
  startedAtMs: number;
4
9
  capturedAtMs: number;
5
10
  /** Positive when the observation completed before the idle expiry. */
6
11
  offsetFromExpiryMs: number;
7
12
  outcome: 'holders' | 'none' | 'incomplete';
13
+ /** Lock waits the snapshot names: empty unless the capture is complete, and always empty without the open-file census. */
14
+ lockWaits: readonly LockWait[];
8
15
  text: string;
9
16
  }
10
17
  export interface HangCaptureRequest {
@@ -32,4 +39,14 @@ export interface HangDiagnosticHost {
32
39
  }
33
40
  /** A pre-expiry observation, never an assertion that an open file is a contested lock. */
34
41
  export declare function captureHangDiagnostics(request: HangCaptureRequest, source?: HangDiagnosticHost): Promise<HangDiagnostics>;
42
+ /**
43
+ * Ends a probe at its limit without waiting for it, and says whether its group still lists members. An ordinary probe
44
+ * runs as this user, so SIGKILL to its process group ends it and anything it started, and the kill is repeated while
45
+ * the group lists members, since one forked as the signal goes out survives it. `sudo` keeps this user's real uid but
46
+ * runs its command as root, which no signal from this user reaches: a group SIGKILL would end sudo alone and orphan
47
+ * the command. Signalled itself, sudo relays SIGTERM to its command and exits only after it. While sudo starts it
48
+ * holds root's real uid, and this throws EPERM. A probe is its caller's child and stays unreaped while the caller
49
+ * waits here, and the kernel lists it as a member of its own group until then, so a group left listed is expected.
50
+ */
51
+ export declare function stopProbe(file: string, pid: number): boolean;
35
52
  //# sourceMappingURL=hang-diagnostics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hang-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/hang-diagnostics.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,OAAQ,CAAC;AAIrC,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvG,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChH;AAUD,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,GAAE,kBAAyB,GAChC,OAAO,CAAC,eAAe,CAAC,CAyK1B"}
1
+ {"version":3,"file":"hang-diagnostics.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/hang-diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,QAAQ,EAKd,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAS,CAAC;AAkCtC,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;IAC3C,0HAA0H;IAC1H,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvG,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChH;AAUD,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,GAAE,kBAAyB,GAChC,OAAO,CAAC,eAAe,CAAC,CAuP1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAM5D"}
@@ -1,8 +1,41 @@
1
1
  import { spawn } from 'node:child_process';
2
+ import { describeTeardown, killProcessGroupNow, TEARDOWN_PATIENCE } from '../../process-group.js';
2
3
  import { withDescendants } from '../../testing.js';
3
- export const HANG_CAPTURE_MS = 5_000;
4
+ import { describeHolders, lockCandidates, lockWaits, parseLsofFields, parseLsofTable, } from './lock-wait.js';
5
+ /**
6
+ * The pre-expiry capture window. Stack samples set it: under load averages of 27-52 on 18 cores one `sudo -n sample`
7
+ * took 1.1-4.6 s, and in a five-second window two of eight real captures lost their sample at its limit.
8
+ */
9
+ export const HANG_CAPTURE_MS = 10_000;
4
10
  const MAX_PROBE_BYTES = 4 * 1024 * 1024;
5
11
  const PS_FIELDS = 'pid=,ppid=,pgid=,stat=,%cpu=,etime=,lstart=,command=';
12
+ /**
13
+ * Stack samples: `sample` suspends a process every millisecond for one second and reports its threads' call graph. The
14
+ * runner and at most this many leaf processes are sampled, all at once. `-mayDie` is not passed: it reads symbols
15
+ * before sampling and measured about a second slower under load, and a process that exits mid-sample is a raced
16
+ * capture all the same.
17
+ */
18
+ const MAX_SAMPLED_LEAVES = 4;
19
+ const SAMPLE_SECONDS = 1;
20
+ /**
21
+ * A process census's limit. The stack samples run until the closing census is this far from the window's end.
22
+ */
23
+ const CENSUS_LIMIT_MS = 1_000;
24
+ /**
25
+ * lsof's mount-table fallback (darwin libproc dmnt.c, readmnt()): a mount it cannot stat(), such as one detaching under a
26
+ * concurrent shed, is kept with its mount-table device. Descriptors come per process from libproc, so this warning omits
27
+ * none of the selected processes' rows.
28
+ */
29
+ const LSOF_MOUNT_FALLBACK = /^lsof: WARNING: can't stat\(\) \S+ file system .*\n {6}Output information may be incomplete\.\n {6}assuming "dev=[0-9a-f]+" from mount table\n/gm;
30
+ /** The lsof stderr that makes its census incomplete: everything except its mount-table fallback. */
31
+ function lsofFaults(stderr) {
32
+ return stderr.replace(LSOF_MOUNT_FALLBACK, '').trim();
33
+ }
34
+ /** A `sample` report up to its binary-image list: its header and call graph name the stacks; the load map is bulk. */
35
+ function callGraph(report) {
36
+ const end = report.indexOf('\nBinary Images:');
37
+ return (end === -1 ? report : report.slice(0, end)).trim();
38
+ }
6
39
  const host = { platform: process.platform, probe: runProbe };
7
40
  /** A pre-expiry observation, never an assertion that an open file is a contested lock. */
8
41
  export function captureHangDiagnostics(request, source = host) {
@@ -14,8 +47,10 @@ export function captureHangDiagnostics(request, source = host) {
14
47
  `Hang snapshot: pid=${request.pid} pgid=${request.pgid ?? 'unknown'} startedAtMs=${startedAtMs}`,
15
48
  'Open files and process observations are evidence, not proof of a contested lock or its owner.',
16
49
  ];
17
- let active = 'process census';
50
+ const active = new Set();
51
+ const during = () => (active.size === 0 ? 'process census' : [...active].join(', '));
18
52
  let finished = false;
53
+ let waits = [];
19
54
  // This package targets lib es2022, which does not declare Promise.withResolvers.
20
55
  return new Promise((resolve) => {
21
56
  const finish = (outcome) => {
@@ -32,17 +67,18 @@ export function captureHangDiagnostics(request, source = host) {
32
67
  capturedAtMs,
33
68
  offsetFromExpiryMs,
34
69
  outcome,
70
+ lockWaits: outcome === 'incomplete' ? [] : waits,
35
71
  text: `${lines.join('\n')}\nHang snapshot outcome=${outcome} capturedAtMs=${capturedAtMs} offsetFromExpiryMs=${offsetFromExpiryMs}\n`,
36
72
  });
37
73
  };
38
74
  const timer = setTimeout(() => {
39
- lines.push(`Capture incomplete: ${budgetMs}ms deadline reached during ${active}; no empty-holder conclusion.`);
75
+ lines.push(`Capture incomplete: ${budgetMs}ms deadline reached during ${during()}; no empty-holder conclusion.`);
40
76
  finish('incomplete');
41
77
  }, budgetMs);
42
78
  const cancelled = () => {
43
79
  if (finished)
44
80
  return;
45
- lines.push(`Capture cancelled during ${active}; its progress generation is no longer current.`);
81
+ lines.push(`Capture cancelled during ${during()}; its progress generation is no longer current.`);
46
82
  finish('incomplete');
47
83
  };
48
84
  request.signal?.addEventListener('abort', cancelled, { once: true });
@@ -56,9 +92,10 @@ export function captureHangDiagnostics(request, source = host) {
56
92
  return;
57
93
  }
58
94
  const probe = async (name, file, args, limitMs) => {
59
- active = name;
95
+ active.add(name);
60
96
  lines.push(`${name}: ${file} ${args.join(' ')}`);
61
97
  const result = await source.probe(file, args, Math.max(0, Math.min(limitMs, endsAtMs - Date.now())), controller.signal);
98
+ active.delete(name);
62
99
  if (!finished) {
63
100
  lines.push(`${name}: ${result.status}${result.status === 'exited' ? ` code=${result.code}` : ` ${result.detail}`}`);
64
101
  if (result.stderr.trim() !== '')
@@ -67,8 +104,8 @@ export function captureHangDiagnostics(request, source = host) {
67
104
  return result;
68
105
  };
69
106
  const census = async (name) => {
70
- // Bare `ps`, resolved through PATH like testing.ts's processTable: NixOS has no /bin/ps.
71
- const result = await probe(name, 'ps', ['-A', '-o', PS_FIELDS], 1_000);
107
+ // Bare `ps`, resolved through PATH like testing.ts's processesOf: NixOS has no /bin/ps.
108
+ const result = await probe(name, 'ps', ['-A', '-o', PS_FIELDS], CENSUS_LIMIT_MS);
72
109
  if (finished)
73
110
  return null;
74
111
  if (result.status !== 'exited' || result.code !== 0) {
@@ -105,6 +142,37 @@ export function captureHangDiagnostics(request, source = host) {
105
142
  }
106
143
  return tree;
107
144
  };
145
+ /**
146
+ * One-second call stacks of the runner and of its tree's leaf processes, taken at once: a stack names the call a
147
+ * process waits in, which the open-file census cannot. A sample sudo refuses, or one that does not answer, is named
148
+ * as no stack for that process; stacks never change the holder outcome.
149
+ */
150
+ const stackSamples = async (tree) => {
151
+ const live = tree.filter((entry) => !entry.stat.startsWith('Z'));
152
+ const parents = new Set(live.map((entry) => entry.ppid));
153
+ const leaves = live.filter((entry) => entry.pid !== request.pid && !parents.has(entry.pid));
154
+ const omitted = leaves.slice(MAX_SAMPLED_LEAVES).map((entry) => entry.pid);
155
+ if (omitted.length > 0)
156
+ lines.push(`Stack samples bounded to the runner and ${MAX_SAMPLED_LEAVES} leaf processes; not sampled: pid ${omitted.join(', ')}`);
157
+ const limitMs = endsAtMs - Date.now() - CENSUS_LIMIT_MS;
158
+ const sampled = [request.pid, ...leaves.slice(0, MAX_SAMPLED_LEAVES).map((entry) => entry.pid)];
159
+ await Promise.all(sampled.map(async (pid) => {
160
+ const name = `stack sample pid ${pid}`;
161
+ // `-file /dev/stdout` writes the report to the probe's pipe alone, not also to a root-owned file in /tmp.
162
+ const args = ['-n', 'sample', String(pid), String(SAMPLE_SECONDS), '-file', '/dev/stdout'];
163
+ const result = await probe(name, 'sudo', args, limitMs);
164
+ if (finished)
165
+ return;
166
+ const report = callGraph(result.stdout);
167
+ if (result.status === 'exited' && result.code === 0 && report !== '') {
168
+ lines.push(`${name} (${SAMPLE_SECONDS}s; binary image list omitted):\n${report}`);
169
+ return;
170
+ }
171
+ if (report !== '')
172
+ lines.push(`Partial ${name} output:\n${report}`);
173
+ lines.push(`${name}: no stack; sudo -n sample did not answer, so the call this process waits in is not observed.`);
174
+ }));
175
+ };
108
176
  const collect = async () => {
109
177
  const before = await census('ps before');
110
178
  if (finished)
@@ -114,31 +182,58 @@ export function captureHangDiagnostics(request, source = host) {
114
182
  let incomplete = false;
115
183
  let observed = before.length > 0;
116
184
  if (source.platform === 'darwin') {
117
- const args = ['-nP', '-p', before.map((entry) => entry.pid).join(',')];
118
- // Bare `sudo`/`lsof` through PATH, like `ps` above: NixOS provides neither /usr/bin/sudo nor /usr/sbin/lsof.
119
- let resources = await probe('lsof privileged', 'sudo', ['-n', 'lsof', ...args], 1_500);
120
- if (finished)
121
- return;
122
- const answered = (result) => result.status === 'exited' && (result.code === 0 || (result.code === 1 && result.stderr.trim() === ''));
123
- if (!answered(resources)) {
124
- incomplete = true;
125
- if (resources.stdout.trim() !== '')
126
- lines.push(`Partial privileged lsof output:\n${resources.stdout.trimEnd()}`);
127
- lines.push('Privileged resource census unavailable; fallback is ordinary-user visibility only, not proof of no holders.');
128
- resources = await probe('lsof user-scoped fallback', 'lsof', args, 1_000);
185
+ const openFiles = async () => {
186
+ const args = ['-nP', '-p', before.map((entry) => entry.pid).join(',')];
187
+ // Bare `sudo`/`lsof` through PATH, like `ps` above: NixOS provides neither /usr/bin/sudo nor /usr/sbin/lsof.
188
+ let resources = await probe('lsof privileged', 'sudo', ['-n', 'lsof', ...args], 1_500);
129
189
  if (finished)
130
190
  return;
131
- }
132
- if (resources.stdout.trim() !== '')
133
- lines.push(`lsof open files/sockets (not contested-lock proof):\n${resources.stdout.trimEnd()}`);
134
- if (!answered(resources) || resources.stderr.trim() !== '')
135
- incomplete = true;
136
- observed = resources.stdout.trim() !== '';
137
- if (!observed && answered(resources))
138
- lines.push('lsof reported no open-file matches within its stated visibility.');
191
+ const answered = (result) => result.status === 'exited' &&
192
+ (result.code === 0 || (result.code === 1 && lsofFaults(result.stderr) === ''));
193
+ if (!answered(resources)) {
194
+ incomplete = true;
195
+ if (resources.stdout.trim() !== '')
196
+ lines.push(`Partial privileged lsof output:\n${resources.stdout.trimEnd()}`);
197
+ lines.push('Privileged resource census unavailable; fallback is ordinary-user visibility only, not proof of no holders.');
198
+ resources = await probe('lsof user-scoped fallback', 'lsof', args, 1_000);
199
+ if (finished)
200
+ return;
201
+ }
202
+ if (resources.stdout.trim() !== '')
203
+ lines.push(`lsof open files/sockets (not contested-lock proof):\n${resources.stdout.trimEnd()}`);
204
+ if (!answered(resources) || lsofFaults(resources.stderr) !== '')
205
+ incomplete = true;
206
+ else if (resources.stderr.trim() !== '')
207
+ lines.push('lsof warned only that it could not stat() the named mounts and kept their mount-table devices; that omits no descriptor of the selected processes.');
208
+ observed = resources.stdout.trim() !== '';
209
+ if (!observed && answered(resources))
210
+ lines.push('lsof reported no open-file matches within its stated visibility.');
211
+ // A lock wait needs a complete census of the run's files: a regular file the run holds on a numbered descriptor
212
+ // that another process also holds open. One privileged lsof names those holders; a probe that did not answer
213
+ // makes the capture incomplete, never an empty holder set.
214
+ const rows = incomplete ? [] : parseLsofTable(resources.stdout);
215
+ const candidates = lockCandidates(rows);
216
+ if (candidates.length > 0) {
217
+ const holders = await probe('lsof lock holders', 'sudo', ['-n', 'lsof', '-nP', '-F', 'pcn', '--', ...candidates], 1_500);
218
+ if (finished)
219
+ return;
220
+ const openers = answered(holders) && lsofFaults(holders.stderr) === '' ? parseLsofFields(holders.stdout) : null;
221
+ if (openers === null) {
222
+ incomplete = true;
223
+ lines.push('Lock holder census incomplete; no lock wait is named.');
224
+ }
225
+ else {
226
+ waits = lockWaits(rows, new Set(before.map((entry) => entry.pid)), openers);
227
+ }
228
+ }
229
+ };
230
+ await Promise.all([openFiles(), stackSamples(before)]);
231
+ if (finished)
232
+ return;
139
233
  }
140
234
  else {
141
235
  lines.push(`Open-file census not provided on ${source.platform}; observations below name processes only.`);
236
+ lines.push(`Stack samples not provided on ${source.platform}; no blocking call is observed.`);
142
237
  }
143
238
  const after = await census('ps after');
144
239
  if (finished)
@@ -155,16 +250,37 @@ export function captureHangDiagnostics(request, source = host) {
155
250
  incomplete = true;
156
251
  lines.push('Process identities or membership changed during capture; open-file census raced.');
157
252
  }
253
+ if (!incomplete) {
254
+ for (const wait of waits) {
255
+ lines.push(`Lock wait (open-handle evidence, not a kernel lock owner): ${wait.path} open in the run by pid ${wait.waiters.join(', ')} and outside it by ${describeHolders(wait.holders)}`);
256
+ }
257
+ }
158
258
  finish(incomplete ? 'incomplete' : observed ? 'holders' : 'none');
159
259
  };
160
260
  void collect().catch((error) => {
161
261
  if (finished)
162
262
  return;
163
- lines.push(`Capture incomplete during ${active}: ${error instanceof Error ? error.message : String(error)}`);
263
+ lines.push(`Capture incomplete during ${during()}: ${error instanceof Error ? error.message : String(error)}`);
164
264
  finish('incomplete');
165
265
  });
166
266
  });
167
267
  }
268
+ /**
269
+ * Ends a probe at its limit without waiting for it, and says whether its group still lists members. An ordinary probe
270
+ * runs as this user, so SIGKILL to its process group ends it and anything it started, and the kill is repeated while
271
+ * the group lists members, since one forked as the signal goes out survives it. `sudo` keeps this user's real uid but
272
+ * runs its command as root, which no signal from this user reaches: a group SIGKILL would end sudo alone and orphan
273
+ * the command. Signalled itself, sudo relays SIGTERM to its command and exits only after it. While sudo starts it
274
+ * holds root's real uid, and this throws EPERM. A probe is its caller's child and stays unreaped while the caller
275
+ * waits here, and the kernel lists it as a member of its own group until then, so a group left listed is expected.
276
+ */
277
+ export function stopProbe(file, pid) {
278
+ if (file === 'sudo') {
279
+ process.kill(pid, 'SIGTERM');
280
+ return false;
281
+ }
282
+ return killProcessGroupNow(pid, TEARDOWN_PATIENCE);
283
+ }
168
284
  /** A probe owns its group and output pipes; its deadline never waits for an unresponsive child to reap. */
169
285
  function runProbe(file, args, timeoutMs, signal) {
170
286
  // Keep the package's es2022-compatible event-completion convention.
@@ -195,10 +311,12 @@ function runProbe(file, args, timeoutMs, signal) {
195
311
  let killFailure = '';
196
312
  if (child.pid !== undefined) {
197
313
  try {
198
- process.kill(-child.pid, 'SIGKILL');
314
+ if (stopProbe(file, child.pid)) {
315
+ killFailure = `; probe group cleanup: ${describeTeardown({ command: file, group: child.pid })}`;
316
+ }
199
317
  }
200
318
  catch (error) {
201
- killFailure = `; probe group cleanup: ${error instanceof Error ? error.message : String(error)}`;
319
+ killFailure = `; probe ${file === 'sudo' ? 'stop through sudo' : 'group cleanup'}: ${error instanceof Error ? error.message : String(error)}`;
202
320
  }
203
321
  }
204
322
  finish({ status, detail: detail + killFailure, stdout, stderr });
@@ -0,0 +1,43 @@
1
+ /** Peer wait classes from specs/cowshed/05_gateway.md, "Deadlines". */
2
+ export declare const CONTROL_MS = 5000;
3
+ export declare const HEARTBEAT_MS = 5000;
4
+ export declare const HEARTBEAT_SILENCE_MS = 15000;
5
+ /** The CPU pool's actor-authored progress, shared by its server and lease client. */
6
+ export interface CpuLeaseProgress {
7
+ ok: true;
8
+ progress: number;
9
+ }
10
+ /** A failed wait, not a failed command: expiry ends this client's admission only. */
11
+ export interface CpuWaitFailure {
12
+ code: 'TIMEOUT' | 'SILENT';
13
+ boundMs: number;
14
+ elapsedMs: number;
15
+ last: string;
16
+ }
17
+ /** Pure CPU admission policy; its injected monotonic clock performs no I/O or scheduling. */
18
+ export declare class CpuLeaseWait {
19
+ private readonly now;
20
+ private readonly started;
21
+ private state;
22
+ /** When the client last looked at its wait or read a frame of it. */
23
+ private looked;
24
+ constructor(now?: () => number);
25
+ /** The kernel took the complete request; only peer silence bounds the answer from here. */
26
+ sent(): void;
27
+ /** A queue entry proves actor progress, not a deadline for returning a token. */
28
+ queued(): void;
29
+ /** Only an advancing actor sequence renews silence; duplicate or invalid progress proves nothing. */
30
+ heartbeat(sequence: number): boolean;
31
+ /**
32
+ * The client looks at its wait before judging it. A look later than the silence bound plus a heartbeat
33
+ * after its previous look or frame means the client's own event loop did not run (a loaded host), so
34
+ * what the pool sent meanwhile is unread: the pool gets one heartbeat more from now (05_gateway.md
35
+ * "Deadlines"). A client that looks in time judges the pool at the bound.
36
+ */
37
+ look(): void;
38
+ /** Milliseconds until the current phase's bound, clipped at zero. */
39
+ remainingMs(): number;
40
+ /** No total queue age exists: an advancing heartbeat keeps the wait alive indefinitely. */
41
+ expired(): CpuWaitFailure | null;
42
+ }
43
+ //# sourceMappingURL=lease-wait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lease-wait.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/lease-wait.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,eAAO,MAAM,UAAU,OAAQ,CAAC;AAChC,eAAO,MAAM,YAAY,OAAQ,CAAC;AAClC,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,qFAAqF;AACrF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,6FAA6F;AAC7F,qBAAa,YAAY;IAMX,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,KAAK,CAAqC;IAClD,qEAAqE;IACrE,OAAO,CAAC,MAAM,CAAS;IAEvB,YAA6B,GAAG,GAAE,MAAM,MAAgC,EAGvE;IAED,2FAA2F;IAC3F,IAAI,IAAI,IAAI,CAKX;IAED,iFAAiF;IACjF,MAAM,IAAI,IAAI,CAKb;IAED,qGAAqG;IACrG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMnC;IAED;;;;;OAKG;IACH,IAAI,IAAI,IAAI,CAMX;IAED,qEAAqE;IACrE,WAAW,IAAI,MAAM,CAGpB;IAED,2FAA2F;IAC3F,OAAO,IAAI,cAAc,GAAG,IAAI,CAQ/B;CACF"}