rvlib-shipkit 2.31.0 → 2.32.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 (384) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +98 -73
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +26 -198
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +25 -23
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +92 -182
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +257 -85
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Checks.ts +0 -14
  67. package/src/cli/cmd_Db.ts +3 -82
  68. package/src/cli/cmd_Home.ts +4 -32
  69. package/src/cli/cmd_Hq.ts +0 -17
  70. package/src/cli/cmd_Releases.ts +57 -4
  71. package/src/cli/cmd_Review.ts +333 -354
  72. package/src/cli/cmd_SocialDrafts.ts +6 -13
  73. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  74. package/src/cli/cmd_Time.ts +1 -1
  75. package/src/cli/cmd_Trailer.ts +1 -1
  76. package/src/cli/inbox-hook-run.ts +5 -23
  77. package/src/cli/registry-heads.ts +5 -55
  78. package/src/cli/registry.ts +1 -5
  79. package/src/cli/review-here.ts +1 -1
  80. package/src/cli.ts +2 -2
  81. package/src/collections/collection-types.ts +1 -1
  82. package/src/collections/review.ts +5 -4
  83. package/src/core/agent-allow-policy.ts +32 -2
  84. package/src/core/agent-env.ts +8 -0
  85. package/src/core/allow-rows.ts +74 -0
  86. package/src/core/check-file-names.ts +19 -106
  87. package/src/core/footprint.ts +17 -13
  88. package/src/core/identities-root.ts +1 -4
  89. package/src/core/layout.ts +1 -2
  90. package/src/core/machine-db.ts +33 -208
  91. package/src/core/machine-layout.ts +14 -127
  92. package/src/core/mask-source.ts +60 -0
  93. package/src/core/memory-watch.ts +17 -14
  94. package/src/core/motherhome.ts +8 -35
  95. package/src/core/one-way-in-policy.ts +0 -3
  96. package/src/core/repo-walk.ts +0 -9
  97. package/src/core/retention.ts +1 -9
  98. package/src/core/retired-checks.ts +2 -0
  99. package/src/core/tmux-policy.ts +1 -1
  100. package/src/core/tree-watch.ts +2 -2
  101. package/src/core/when.ts +7 -45
  102. package/src/gate/discover-checks.ts +42 -32
  103. package/src/gate/gate-checks.ts +21 -131
  104. package/src/gate/pre-commit-discovery.ts +16 -25
  105. package/src/gate/run-check.ts +0 -4
  106. package/src/gate/run-fix.ts +5 -17
  107. package/src/gate/run-fixers.ts +6 -42
  108. package/src/home/app-sign.ts +2 -2
  109. package/src/home/backup-status.ts +52 -92
  110. package/src/home/backup-verdict.ts +2 -2
  111. package/src/home/daemon-jobs.ts +51 -95
  112. package/src/home/database-words.ts +1 -2
  113. package/src/home/databases.ts +9 -25
  114. package/src/home/home-launchd.ts +0 -6
  115. package/src/home/home-paths.ts +8 -4
  116. package/src/home/home-routes.ts +3 -10
  117. package/src/home/home-state.ts +2 -14
  118. package/src/home/inbox-shape.ts +14 -15
  119. package/src/home/inbox.ts +1 -1
  120. package/src/home/machine-repair.ts +102 -103
  121. package/src/home/resume.ts +1 -15
  122. package/src/home/run-daemon.ts +4 -11
  123. package/src/home/space-page.ts +3 -2
  124. package/src/home/supervise.ts +3 -7
  125. package/src/hooks/hook-config.ts +6 -7
  126. package/src/hooks/leak-guard.ts +1 -1
  127. package/src/hooks/run-hooks.ts +0 -5
  128. package/src/hq/daemon-db.ts +8 -8
  129. package/src/hq/door.ts +3 -16
  130. package/src/hq/hq-db.ts +4 -3
  131. package/src/hq/hq-local.ts +1 -2
  132. package/src/hq/hq-store.ts +0 -15
  133. package/src/hq/item-direct.ts +8 -10
  134. package/src/hq/item-fill.ts +37 -0
  135. package/src/hq/kinds/item-gone.ts +7 -10
  136. package/src/hq/kinds/item-msg.ts +12 -18
  137. package/src/hq/kinds/item.ts +13 -19
  138. package/src/hq/kinds/report.ts +3 -4
  139. package/src/hq/owner-switch.ts +3 -3
  140. package/src/hq/report.ts +5 -9
  141. package/src/hq/switch.ts +2 -11
  142. package/src/hq/thread-sync.ts +5 -17
  143. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  144. package/src/http/owner-word.ts +1 -1
  145. package/src/identities/machine.ts +16 -0
  146. package/src/init-repo.ts +0 -1
  147. package/src/ledger/check-stats.ts +6 -5
  148. package/src/ledger/db.ts +2 -4
  149. package/src/ledger/record-kept.ts +117 -48
  150. package/src/ledger/run-log.ts +21 -2
  151. package/src/ledger/slow-tests.ts +96 -0
  152. package/src/ledger/store.ts +3 -86
  153. package/src/ledger/suite-log.ts +8 -2
  154. package/src/media-store/backup/facts.ts +3 -37
  155. package/src/media-store/backup/keys.ts +1 -8
  156. package/src/media-store/backup/manifest.ts +6 -67
  157. package/src/media-store/backup/restore.ts +4 -13
  158. package/src/media-store/backup/retention.ts +13 -1
  159. package/src/media-store/backup/run.ts +6 -267
  160. package/src/media-store/backup/snapshot.ts +2 -38
  161. package/src/media-store/backup/sources.ts +3 -113
  162. package/src/media-store/backup/target-send.ts +5 -29
  163. package/src/media-store/db.ts +8 -7
  164. package/src/media-store/forget-one.ts +1 -1
  165. package/src/media-store/forget.ts +1 -80
  166. package/src/orchestrator/guards.ts +0 -1
  167. package/src/orchestrator/presence.ts +2 -2
  168. package/src/orchestrator/routes.ts +1 -1
  169. package/src/orchestrator/started.ts +0 -9
  170. package/src/orchestrator/talk-key.ts +3 -4
  171. package/src/orchestrator/unheard.ts +1 -1
  172. package/src/recordings/edit.ts +3 -3
  173. package/src/recordings/marks-draw.ts +17 -6
  174. package/src/recordings/marks.ts +120 -9
  175. package/src/reflections/reflections-queue.ts +3 -10
  176. package/src/release/notes.ts +1 -1
  177. package/src/release/public-clean.ts +66 -6
  178. package/src/release/run-bump.ts +11 -0
  179. package/src/release/run-release.ts +4 -0
  180. package/src/releases/from-thread.ts +3 -3
  181. package/src/releases/model.ts +186 -36
  182. package/src/releases/store.ts +13 -3
  183. package/src/releases/validate.ts +83 -0
  184. package/src/repo-config.ts +29 -64
  185. package/src/review/answer-kinds.ts +61 -4
  186. package/src/review/blocked-guard.ts +11 -0
  187. package/src/review/blocked-object.ts +298 -0
  188. package/src/review/cells.ts +116 -229
  189. package/src/review/close.ts +39 -1
  190. package/src/review/doc-save.ts +3 -2
  191. package/src/review/draft-item.ts +1 -1
  192. package/src/review/events.ts +3 -7
  193. package/src/review/expect.ts +23 -39
  194. package/src/review/format.ts +79 -46
  195. package/src/review/glyphs.ts +1 -0
  196. package/src/review/hand-over.ts +3 -3
  197. package/src/review/heard.ts +1 -1
  198. package/src/review/holds-sync.ts +2 -1
  199. package/src/review/inbox-hook.ts +2 -2
  200. package/src/review/inbox-read.ts +39 -33
  201. package/src/review/instruction-guards.ts +12 -0
  202. package/src/review/instructions.ts +0 -1
  203. package/src/review/item-db.ts +13 -43
  204. package/src/review/item-hq.ts +2 -2
  205. package/src/review/item-rows.ts +3 -14
  206. package/src/review/kind-catalog.ts +3 -1
  207. package/src/review/kinds.ts +18 -8
  208. package/src/review/live-view.ts +3 -0
  209. package/src/review/media-kind.ts +1 -1
  210. package/src/review/mentions.ts +1 -2
  211. package/src/review/model.ts +158 -114
  212. package/src/review/move.ts +149 -0
  213. package/src/review/need-threads.ts +3 -2
  214. package/src/review/object-card.ts +11 -0
  215. package/src/review/object-read.ts +6 -1
  216. package/src/review/one-block.ts +1 -1
  217. package/src/review/owner-read.ts +1 -1
  218. package/src/review/phone-push.ts +10 -9
  219. package/src/review/previews.ts +32 -4
  220. package/src/review/push.ts +2 -2
  221. package/src/review/recap.ts +129 -0
  222. package/src/review/referring.ts +6 -3
  223. package/src/review/reflection-object.ts +4 -3
  224. package/src/review/routes.ts +49 -19
  225. package/src/review/secret-route.ts +3 -2
  226. package/src/review/settle.ts +0 -6
  227. package/src/review/snooze.ts +5 -3
  228. package/src/review/speaker.ts +68 -0
  229. package/src/review/start-title.ts +19 -0
  230. package/src/review/store.ts +86 -59
  231. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  232. package/src/review/thread-md.ts +35 -14
  233. package/src/review/thread-state.ts +798 -0
  234. package/src/review/threads.ts +29 -347
  235. package/src/review/traces.ts +104 -7
  236. package/src/review/trailer-item.ts +1 -1
  237. package/src/review/unit.ts +7 -9
  238. package/src/review/verdict-items.ts +12 -10
  239. package/src/review/view-layout.ts +25 -1
  240. package/src/review/watch-feed.ts +1 -2
  241. package/src/review/working-guards.ts +2 -3
  242. package/src/rules/untrack-generated.ts +1 -15
  243. package/src/secrets/lapse.ts +2 -1
  244. package/src/serve/hub-app/advisor-app.tsx +4 -4
  245. package/src/serve/hub-app/advisor-face.tsx +9 -3
  246. package/src/serve/hub-app/advisor-host.ts +27 -27
  247. package/src/serve/hub-app/advisors-model.ts +17 -8
  248. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  249. package/src/serve/hub-app/advisors-st.ts +15 -14
  250. package/src/serve/hub-app/advisors-view.tsx +13 -11
  251. package/src/serve/hub-app/app-bridge.ts +23 -3
  252. package/src/serve/hub-app/asks-page.tsx +1 -1
  253. package/src/serve/hub-app/auto-text.tsx +71 -16
  254. package/src/serve/hub-app/check-view.tsx +0 -8
  255. package/src/serve/hub-app/controls.css +14 -3
  256. package/src/serve/hub-app/database-view.tsx +1 -2
  257. package/src/serve/hub-app/git-view.tsx +3 -1
  258. package/src/serve/hub-app/hub.css +12 -5
  259. package/src/serve/hub-app/icons.tsx +1 -1
  260. package/src/serve/hub-app/inbox-view.tsx +1 -2
  261. package/src/serve/hub-app/live-sources.ts +2 -2
  262. package/src/serve/hub-app/main-panel.tsx +2 -1
  263. package/src/serve/hub-app/panel-repo.ts +0 -9
  264. package/src/serve/hub-app/pic.tsx +29 -12
  265. package/src/serve/hub-app/polled.ts +16 -2
  266. package/src/serve/hub-app/recordings-st.ts +23 -2
  267. package/src/serve/hub-app/recordings-view.tsx +68 -10
  268. package/src/serve/hub-app/ref-pill.ts +1 -1
  269. package/src/serve/hub-app/repo-st.ts +1 -2
  270. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  271. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  272. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  273. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  274. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  275. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  276. package/src/serve/hub-app/review/kit.tsx +4 -11
  277. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  278. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  279. package/src/serve/hub-app/review/line-window.ts +4 -1
  280. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  281. package/src/serve/hub-app/review/live-view.tsx +57 -1
  282. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  283. package/src/serve/hub-app/review/question-views.tsx +181 -54
  284. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  285. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  286. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  287. package/src/serve/hub-app/review/review-host.ts +2 -2
  288. package/src/serve/hub-app/review/review-kit.ts +17 -11
  289. package/src/serve/hub-app/review/review-list.tsx +23 -31
  290. package/src/serve/hub-app/review/review-st.ts +30 -40
  291. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  292. package/src/serve/hub-app/review/review-views.tsx +124 -68
  293. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  294. package/src/serve/hub-app/review/start-st.ts +2 -5
  295. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  296. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  297. package/src/serve/hub-app/review/thread-st.ts +372 -201
  298. package/src/serve/hub-app/review/tone-bar.tsx +126 -0
  299. package/src/serve/hub-app/review/tones.ts +35 -0
  300. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  301. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  302. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  303. package/src/serve/hub-app/review.css +180 -106
  304. package/src/serve/hub-app/search-view.tsx +1 -1
  305. package/src/serve/hub-app/social/social-model.ts +0 -4
  306. package/src/serve/hub-app/source-acts.ts +2 -1
  307. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  308. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  309. package/src/serve/hub-app/thread-row.tsx +3 -4
  310. package/src/serve/hub-app/tree-build.ts +0 -4
  311. package/src/serve/hub-app/urls-view.tsx +2 -1
  312. package/src/serve/hub-app/view-layout.css +13 -3
  313. package/src/serve/hub-app/wikis-view.tsx +5 -2
  314. package/src/serve/hub-runtime.ts +7 -37
  315. package/src/serve/project-gutter-route.ts +6 -2
  316. package/src/serve/read-thread.ts +20 -2
  317. package/src/serve/read-worker.ts +9 -1
  318. package/src/serve/record-pages.ts +46 -0
  319. package/src/serve/serve-hub.ts +2 -2
  320. package/src/serve/terminal-host.ts +1 -1
  321. package/src/serve/terminal-route.ts +1 -3
  322. package/src/serve/tracked-watch.ts +1 -3
  323. package/src/setup-house.ts +2 -2
  324. package/src/shipkit-files.ts +1 -1
  325. package/src/shipkit.ts +1 -6
  326. package/src/shot/film-box.ts +0 -20
  327. package/src/social/drafts.ts +1 -1
  328. package/src/social/kinds.ts +6 -29
  329. package/src/social/load.ts +2 -2
  330. package/src/social/post-object.ts +3 -2
  331. package/src/social/release-stage.ts +1 -1
  332. package/src/social/stage.ts +2 -2
  333. package/src/stores/model.ts +4 -0
  334. package/src/stores/routes.ts +11 -3
  335. package/src/suite/judge-suites.ts +58 -0
  336. package/src/suite/red-alone.ts +54 -18
  337. package/src/suite/runner-shapes.ts +2 -2
  338. package/src/suite/suite-cli.ts +67 -14
  339. package/src/suite/test-units.ts +2 -1
  340. package/src/urls/fill.ts +1 -1
  341. package/src/urls/places.ts +1 -2
  342. package/src/vault/vault-config.ts +2 -2
  343. package/src/vault/vault-init.ts +1 -5
  344. package/src/wiki/graph-page.ts +14 -2
  345. package/src/advisors/copy-truth.ts +0 -49
  346. package/src/advisors/door-child.ts +0 -112
  347. package/src/advisors/door-serve.ts +0 -52
  348. package/src/advisors/door.ts +0 -118
  349. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  350. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  351. package/src/checks/SK048-one-local-file.check.ts +0 -36
  352. package/src/core/config-rewrite.ts +0 -111
  353. package/src/core/daemon-port.ts +0 -10
  354. package/src/core/legacy-shapes.ts +0 -263
  355. package/src/core/migrate-layout.ts +0 -638
  356. package/src/core/port-check-cli.ts +0 -52
  357. package/src/core/port-check-file.ts +0 -295
  358. package/src/core/port-check-files.ts +0 -31
  359. package/src/gate/discover-legacy-checks.ts +0 -26
  360. package/src/home/home-move.ts +0 -527
  361. package/src/home/machine-fold.ts +0 -810
  362. package/src/hq/item-shapes.ts +0 -54
  363. package/src/hq/kinds/items-read.ts +0 -4
  364. package/src/media-store/backup/daemon.ts +0 -220
  365. package/src/media-store/backup/kept.ts +0 -241
  366. package/src/media-store/backup/prune.ts +0 -359
  367. package/src/media-store/backup/secret.ts +0 -88
  368. package/src/media-store/backup/ssh-space.ts +0 -202
  369. package/src/media-store/backup/watch.ts +0 -117
  370. package/src/review/band.ts +0 -182
  371. package/src/review/folders.ts +0 -216
  372. package/src/review/hook-ask.ts +0 -58
  373. package/src/review/role.ts +0 -48
  374. package/src/review/thread-fold.ts +0 -64
  375. package/src/review/wait.ts +0 -91
  376. package/src/rules/rule.ts +0 -43
  377. package/src/serve/hook-thread.ts +0 -37
  378. package/src/serve/hook-work.ts +0 -92
  379. package/src/serve/hook-worker.ts +0 -57
  380. package/src/serve/hub-app/review/dock.tsx +0 -147
  381. package/src/serve/hub-app/review/faces.tsx +0 -18
  382. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  383. package/src/serve/hub-app/review/review-board.tsx +0 -48
  384. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -561,6 +561,64 @@ export function interruptedSuites(output: string): string[] {
561
561
  return out
562
562
  }
563
563
 
564
+ /** the suites bun lists under `N file(s) had not started:` when a parallel phase is killed: one indented path each
565
+ * (bun 1.4.6) */
566
+ export function notStartedSuites(output: string): string[] {
567
+ const out: string[] = []
568
+ let inBlock = false
569
+ for (const line of output.split('\n')) {
570
+ if (/^\d+ file(?:s|\(s\))? had not started:\s*$/.test(line)) { inBlock = true; continue }
571
+ if (!inBlock) continue
572
+ const m = /^\s+(\S+\.(?:test|spec)\.[cm]?[jt]sx?)\s*$/.exec(line)
573
+ if (m == null) { inBlock = false; continue }
574
+ out.push(normSuitePath(m[1]!))
575
+ }
576
+ return out
577
+ }
578
+
579
+ export type TimedOutTest = { test: string; ms: number }
580
+
581
+ /** the suites whose EVERY failure is a test past its timeout, with each such test and the wall bun gave it. A
582
+ * suite with one assertion, one throw outside a test or one crashed worker is not in it: its red is not the
583
+ * machine's speed */
584
+ export function timedOutTests(output: string): Map<string, TimedOutTest[]> {
585
+ const late = new Map<string, TimedOutTest[]>()
586
+ const other = new Set<string>()
587
+ const lines = output.split('\n')
588
+ let cur: string | null = null
589
+ for (let i = 0; i < lines.length; i++) {
590
+ const line = lines[i]!.trimEnd()
591
+ const head = line.match(HEADER)
592
+ if (head != null) { cur = normSuitePath(head[1]!); continue }
593
+ if (BUN_RECAP.test(line)) { cur = null; continue }
594
+ if (cur == null) continue
595
+ if (line.startsWith(BETWEEN_TESTS) || /^\s*✗\s+\S+\s+\(worker crashed: /.test(line)) { other.add(cur); continue }
596
+ const fail = line.match(/^\(fail\) (.*?)(?: \[([\d.]+)ms\])?$/)
597
+ if (fail == null) continue
598
+ if (TIMED_OUT.test(lines[i + 1] ?? '')) late.set(cur, [...(late.get(cur) ?? []), { test: fail[1]!, ms: Number(fail[2] ?? 0) }])
599
+ else other.add(cur)
600
+ }
601
+ for (const f of other) late.delete(f)
602
+ return late
603
+ }
604
+
605
+ const unescapeXml = (s: string): string => s.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&#(\d+);/g, (_, n: string) => String.fromCharCode(Number(n))).replace(/&amp;/g, '&')
606
+
607
+ /** each test of a junit report bun wrote, named as its `(fail)` line names it (`outer > inner > test`), with its
608
+ * wall: a passing test prints no line in a piped run, so its time alone comes from here */
609
+ export function junitTests(xml: string): { name: string; ms: number }[] {
610
+ const out: { name: string; ms: number }[] = []
611
+ for (const m of xml.matchAll(/<testcase\b([^>]*)>/g)) {
612
+ const attr = (k: string): string | null => new RegExp(`\\b${k}="([^"]*)"`).exec(m[1]!)?.[1] ?? null
613
+ const name = attr('name')
614
+ const time = Number(attr('time'))
615
+ if (name == null || !Number.isFinite(time)) continue
616
+ const outer = unescapeXml(attr('classname') ?? '').split(' > ').filter((s) => s !== '').reverse()
617
+ out.push({ name: [...outer, unescapeXml(name)].join(' > '), ms: time * 1000 })
618
+ }
619
+ return out
620
+ }
621
+
564
622
  /** the line a phase killed at its ceiling fails with. Measured on bun 1.4.3:
565
623
  * a plain await of a promise that never settles fails at the per test
566
624
  * timeout, while `expect(p).resolves` or `.rejects` on one blocks the worker
@@ -1,19 +1,27 @@
1
1
  // a suite red in the parallel run runs again alone, once, before the run can say red: green alone is a WARN that
2
- // names it, red alone stays red. The lone runs go one at a time, and all of them together stay inside one budget
2
+ // names it, red alone stays red. A suite the phase ceiling killed, or never started, runs alone the same way, and
3
+ // a kill alone is never its red. A suite whose every failure was a timeout, or that the kill caught, is slow under
4
+ // load when it passes alone: one line per test, kept for the cleanup (slow-tests.ts). The lone runs go one at a
5
+ // time, and all of them together stay inside one budget
3
6
  import { machineWords, type MachineLoad } from '../core/machine-busy.ts'
4
- import { failLines, passedAlone } from './judge-suites.ts'
7
+ import { failLines, passedAlone, type TimedOutTest } from './judge-suites.ts'
8
+ import { slowWords, type SlowTest } from '../ledger/slow-tests.ts'
5
9
 
6
- /** the most red suites that run again alone. Load and leftover state turned one to four suites red per run in the
7
- * lane gates measured; past this the tree is broken, and a lone run each would only delay the red */
10
+ /** the most suites red on an assertion, a throw or a crash that run again alone. Load and leftover state turned
11
+ * one to four suites red per run in the lane gates measured; past this the tree is broken, and a lone run each
12
+ * would only delay the red. A timeout and a kill are the machine's speed and count against the budget only */
8
13
  export const RED_RERUN_CAP = 5
9
14
  /** the most wall the lone runs spend together. A suite still waiting when it is spent stays red, with a note */
10
- export const RED_RERUN_BUDGET_MS = 60_000
15
+ export const RED_RERUN_BUDGET_MS = 240_000
11
16
  /** the least wall one lone run gets: twice its parallel wall when that is more (a pool runs a suite slower than a
12
17
  * lone run does), never past the phase ceiling nor the budget left */
13
18
  export const RED_RERUN_MIN_MS = 30_000
14
19
  export const redRerunCeiling = (pooledMs: number | undefined, ceilingMs: number): number => Math.min(ceilingMs, Math.max(RED_RERUN_MIN_MS, 2 * (pooledMs ?? 0)))
20
+ /** a lone run's per test timeout: half its ceiling, so a test that needs more than bun's 5 s under load passes and
21
+ * is listed, and one that hangs still fails at its own timeout before the kill */
22
+ export const loneTestTimeout = (ceilingMs: number): number => Math.floor(ceilingMs / 2)
15
23
 
16
- export type LoneRun = { code: number; signal: string | null; stalled: boolean; out: string }
24
+ export type LoneRun = { code: number; signal: string | null; stalled: boolean; out: string; /** each test's wall, from the run's junit report */ tests?: { name: string; ms: number }[] }
17
25
 
18
26
  const secs = (ms: number): string => `${(ms / 1000).toFixed(1)}s`
19
27
 
@@ -21,12 +29,27 @@ const secs = (ms: number): string => `${(ms / 1000).toFixed(1)}s`
21
29
  export const rescuedWords = (file: string, pooledMs: number | undefined, why: string, load: MachineLoad): string =>
22
30
  `WARN red under load, green alone: ${file}, ${pooledMs != null ? secs(pooledMs) : 'no time'} in the run (${why}), at ${machineWords(load)}: a test there depends on the machine's speed (a timeout, a sleep, a wall clock budget) or on state another suite left (a global, a file, a port), make it wait on the state it needs`
23
31
 
24
- /** each red suite of a parallel phase that ran to its end, alone and in order, until the cap or the budget stops
25
- * it. `run` is the lone run itself, given the ceiling it must stop at; `clock` reads the wall it spent */
32
+ /** the slow tests a suite that passed alone stands for: each test past its timeout in the pool, or for a suite
33
+ * the kill caught, its slowest test alone */
34
+ function slowOf(file: string, r: LoneRun, timedOut: TimedOutTest[] | undefined, pooledMs: number | undefined): SlowTest[] {
35
+ const alone = (name: string): number | null => r.tests?.find((t) => t.name === name)?.ms ?? null
36
+ if (timedOut != null) return timedOut.map((t) => ({ file, test: t.test, aloneMs: alone(t.test), loadedMs: t.ms, why: 'timeout' as const }))
37
+ const slowest = [...(r.tests ?? [])].sort((a, b) => b.ms - a.ms)[0]
38
+ return [{ file, test: slowest?.name ?? '(no test named)', aloneMs: slowest?.ms ?? null, loadedMs: pooledMs ?? null, why: 'killed' }]
39
+ }
40
+
41
+ /** each red suite of a parallel phase, then each one its ceiling killed or never started, alone and in order,
42
+ * until the cap or the budget stops it. `run` is the lone run itself, given the ceiling it must stop at; `clock`
43
+ * reads the wall it spent */
26
44
  export async function rerunRedAlone(o: {
27
45
  red: string[]
28
- /** the phase was a pool and ran to its end: a kill keeps its own line, a sequential run already ran alone */
46
+ /** the suites still running when the phase ceiling killed it, then the ones it never started */
47
+ unfinished?: string[]
48
+ /** the red suites whose every failure was a timeout (judge-suites.ts timedOutTests) */
49
+ timedOut?: Map<string, TimedOutTest[]>
50
+ /** the phase was a pool: a sequential run already ran each suite alone */
29
51
  pooled: boolean
52
+ /** no signal from outside stopped the phase (an out of memory kill keeps its own line); its own ceiling may have */
30
53
  ended: boolean
31
54
  pooledMs: Record<string, number>
32
55
  pooledWhy: Map<string, string>
@@ -36,34 +59,47 @@ export async function rerunRedAlone(o: {
36
59
  clock?: () => number
37
60
  cap?: number
38
61
  budgetMs?: number
39
- }): Promise<{ ran: string[]; rescued: string[]; notes: string[]; warns: string[]; spentMs: number }> {
62
+ }): Promise<{ ran: string[]; rescued: string[]; /** each lone run that failed, with its failure */ failed: { file: string; why: string }[]; slow: SlowTest[]; notes: string[]; warns: string[]; spentMs: number }> {
40
63
  const cap = o.cap ?? RED_RERUN_CAP
41
64
  const budget = o.budgetMs ?? RED_RERUN_BUDGET_MS
42
65
  const clock = o.clock ?? Date.now
43
- const out = { ran: [] as string[], rescued: [] as string[], notes: [] as string[], warns: [] as string[], spentMs: 0 }
44
- if (o.red.length === 0 || !o.pooled || !o.ended) return out
45
- if (o.red.length > cap) {
46
- out.notes.push(`note: ${o.red.length} suites failed in the parallel run, more than the ${cap} a load or a leftover explains: the tree is broken, none ran again alone`)
66
+ const timedOut = o.timedOut ?? new Map<string, TimedOutTest[]>()
67
+ const unfinished = (o.unfinished ?? []).filter((f) => !o.red.includes(f))
68
+ const out = { ran: [] as string[], rescued: [] as string[], failed: [] as { file: string; why: string }[], slow: [] as SlowTest[], notes: [] as string[], warns: [] as string[], spentMs: 0 }
69
+ if ((o.red.length === 0 && unfinished.length === 0) || !o.pooled || !o.ended) return out
70
+ const broken = o.red.filter((f) => !timedOut.has(f))
71
+ if (broken.length > cap) {
72
+ out.notes.push(`note: ${broken.length} suites failed in the parallel run, more than the ${cap} a load or a leftover explains: the tree is broken, none ran again alone`)
47
73
  return out
48
74
  }
75
+ // the timeouts first: they are the likeliest to pass, and a kill's suites last, since a kill costs no red alone
76
+ const order = [...o.red.filter((f) => timedOut.has(f)), ...broken, ...unfinished]
49
77
  const t0 = clock()
50
78
  const left: string[] = []
51
- for (const file of o.red) {
79
+ for (const file of order) {
52
80
  const remaining = budget - (clock() - t0)
53
81
  if (remaining <= 0) { left.push(file); continue }
54
82
  const ceiling = Math.min(redRerunCeiling(o.pooledMs[file], o.ceilingMs), remaining)
55
83
  const r = await o.run(file, ceiling)
56
84
  out.ran.push(file)
85
+ const killed = unfinished.includes(file)
57
86
  if (passedAlone(r)) {
58
87
  out.rescued.push(file)
59
- out.warns.push(rescuedWords(file, o.pooledMs[file], o.pooledWhy.get(file) ?? 'bun named no failure', o.load))
88
+ if (killed || timedOut.has(file)) {
89
+ const slow = slowOf(file, r, timedOut.get(file), o.pooledMs[file])
90
+ out.slow.push(...slow)
91
+ out.warns.push(...slow.map((s) => slowWords(s, o.load, o.ceilingMs)))
92
+ } else out.warns.push(rescuedWords(file, o.pooledMs[file], o.pooledWhy.get(file) ?? 'bun named no failure', o.load))
60
93
  continue
61
94
  }
62
95
  const again = failLines(r.out).get(file) ?? (r.stalled ? `killed at its ${secs(ceiling)} ceiling` : r.signal != null ? `killed by ${r.signal}` : `bun exited ${r.code}`)
63
- out.notes.push(`note: ${file} failed in the parallel run and again alone (${again}): its failure stands`)
96
+ out.failed.push({ file, why: again })
97
+ out.notes.push(killed
98
+ ?`note: ${file} did not finish in the parallel run before its ${secs(o.ceilingMs)} ceiling, and failed alone (${again}): its failure stands`
99
+ : `note: ${file} failed in the parallel run and again alone (${again}): its failure stands`)
64
100
  }
65
101
  out.spentMs = clock() - t0
66
102
  if (left.length > 0) out.notes.push(`note: ${left.join(', ')} did not run again alone, the ${secs(budget)} budget of the lone runs was spent: the red stands`)
67
- out.notes.push(`note: ${out.ran.length} red suite(s) ran again alone, one at a time, in ${secs(out.spentMs)} of the ${secs(budget)} budget`)
103
+ out.notes.push(`note: ${out.ran.length} suite(s) ran again alone, one at a time, in ${secs(out.spentMs)} of the ${secs(budget)} budget`)
68
104
  return out
69
105
  }
@@ -5,8 +5,8 @@
5
5
  // which file each one reaches. A hand written check running `bun test` is a
6
6
  // second runner nobody plans, times or dedupes. Rule SK019 fails on one.
7
7
  //
8
- // Read from source text, never by importing it: a legacy check script runs its
9
- // body on import. The reader only looks at code, never at comments, and only at
8
+ // Read from source text, never by importing it: importing a check file runs its
9
+ // top level. The reader only looks at code, never at comments, and only at
10
10
  // three shapes that EXECUTE something: an argv literal (`['bun', 'test']`), a
11
11
  // command string handed to a shell (`sh -c`, `$\`…\``, `execSync(…)`), and a
12
12
  // reference to the suite runner module. A string that merely NAMES a command
@@ -25,10 +25,11 @@ import { gitRoot } from '../core/git-root.ts'
25
25
  import { noAutoMaintenance, realGitFirst } from '../core/git-bin.ts'
26
26
  import { suiteHomeEnv } from '../home/home-paths.ts'
27
27
  import { runReaches, type TestRun } from './test-units.ts'
28
- import { rerunRedAlone } from './red-alone.ts'
28
+ import { loneTestTimeout, rerunRedAlone } from './red-alone.ts'
29
+ import { keepSlowTests, slowTestsPath } from '../ledger/slow-tests.ts'
29
30
  import { loadConfig } from '../ts/config.ts'
30
31
  import { conversionRate, machineRate } from './calibrate.ts'
31
- import { asMeasuredMs, totalOver, aloneRunsNeeded, bunfigTest, failuresIn, OWN_RATE_MIN_MS, quickTierWords, coreMs, cpuAllowance, loadShare, type SuiteWork, type BunfigTest, readPhaseCpu, redBeforeKill, SUITE_CPU_ENV, type AloneRun, type Confirmed, confirmOver, crashedWorkers, interruptedSuites, overWords, ranAs, retryAlone, smallerRun, stallWords, DEFAULT_BUDGET_MS, FULL_CEILING_MS, failedSuites, failLines, judgeSuites, normSuitePath, tierFailsOnTime, parseSuiteFlags, planPhases, QUICK_CEILING_MS, redWords } from './judge-suites.ts'
32
+ import { asMeasuredMs, totalOver, aloneRunsNeeded, bunfigTest, failuresIn, OWN_RATE_MIN_MS, quickTierWords, coreMs, cpuAllowance, loadShare, type SuiteWork, type BunfigTest, readPhaseCpu, redBeforeKill, SUITE_CPU_ENV, type AloneRun, type Confirmed, confirmOver, crashedWorkers, interruptedSuites, junitTests, notStartedSuites, timedOutTests, overWords, ranAs, retryAlone, smallerRun, stallWords, DEFAULT_BUDGET_MS, FULL_CEILING_MS, failedSuites, failLines, judgeSuites, normSuitePath, tierFailsOnTime, parseSuiteFlags, planPhases, QUICK_CEILING_MS, redWords } from './judge-suites.ts'
32
33
 
33
34
  type Phase = { code: number; signal: string | null; stalled: boolean; out: string; timings: Record<string, number>; cpuMs: number | null }
34
35
 
@@ -245,16 +246,16 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
245
246
  const p2 = serialArgs != null ? await runPhase(serialArgs, timed ? join(dir, 'serial.json') : null, ceilingMs, tmp, true, null, rec) : null
246
247
  const p2Ms = p2 == null ? null : Date.now() - p2At
247
248
  const phases = [p1, ...(p2 != null ? [p2] : [])]
248
- const ran = phases.reduce((n, p) => n + lastCount(p.out, /Ran (\d+) tests?/g), 0)
249
+ let ran = phases.reduce((n, p) => n + lastCount(p.out, /Ran (\d+) tests?/g), 0)
249
250
  const crashed = crashedWorkers(p1.out)
250
251
 
251
252
  // a lone run of one suite, in its own process so its CPU is its own. One at a time: four alone runs side
252
253
  // by side each burned about 40% more CPU than one alone (8 cores)
253
254
  const aloneRuns: Record<string, AloneRun> = {}
254
255
  const aloneAt = Date.now()
255
- const runAlone = async (file: string, name: string, ceiling = ceilingMs): Promise<{ alone: AloneRun | null; phase: Phase }> => {
256
+ const runAlone = async (file: string, name: string, ceiling = ceilingMs, extra: string[] = []): Promise<{ alone: AloneRun | null; phase: Phase }> => {
256
257
  const lines = counted ? join(dir, `${name}.tsv`) : null
257
- const run = await runPhase([...plan.alone, file], join(dir, `${name}.json`), ceiling, tmp, false, lines, rec)
258
+ const run = await runPhase([...plan.alone, ...extra, file], join(dir, `${name}.json`), ceiling, tmp, false, lines, rec)
258
259
  const wallMs = Object.entries(run.timings).find(([f]) => normSuitePath(f) === file)?.[1]
259
260
  if (wallMs == null) return { alone: null, phase: run }
260
261
  const work = lines != null && existsSync(lines) ? readPhaseCpu(readFileSync(lines, 'utf8'), process.cwd()).work[file] : undefined
@@ -265,8 +266,20 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
265
266
  }
266
267
 
267
268
  // a suite red in the pooled run runs again alone, once, and stays red only when it fails there too: the
268
- // load read before the run, or after the pool when the machine got busier meanwhile
269
- const pooledRed = [...new Set([...failedSuites(p1.out), ...crashed.map((c) => c.file)])]
269
+ // load read before the run, or after the pool when the machine got busier meanwhile. A ceiling kill makes
270
+ // bun report each worker it held as crashed: those suites, and the ones it never started, did not finish,
271
+ // and run alone the same way
272
+ // A crash on another signal is the suite's own, red as ever
273
+ const byKill = (c: { signal: string }): boolean => p1.stalled && (c.signal === 'SIGTERM' || c.signal === 'SIGKILL')
274
+ const pooledRed = [...new Set([...failedSuites(p1.out), ...crashed.filter((c) => !byKill(c)).map((c) => c.file)])]
275
+ // bun does not always print what it never started, so the suites the phase was to run and did not finish
276
+ // are counted from the plan: what the workers wrote as finished, against what discovery names. A plan the
277
+ // runner cannot list leaves the kill red
278
+ const planned = p1.stalled ? plannedSuites({ cpuFile, pickedSet, serialSet, rawArgs, bunfig, phaseArgs: parallelArgs }) : null
279
+ const finished = new Set([...phaseCpu.ran, ...pooledRed])
280
+ const listed = [...interruptedSuites(p1.out), ...crashed.filter(byKill).map((c) => c.file), ...notStartedSuites(p1.out)]
281
+ const unlisted = (planned ?? []).filter((f) => !finished.has(f) && !listed.includes(f))
282
+ const unfinished = p1.stalled ? [...new Set([...listed, ...unlisted])].filter((f) => !pooledRed.includes(f)) : []
270
283
  const after = machineLoad()
271
284
  const busy = load.busy == null && after.busy == null ? null : Math.max(load.busy ?? 0, after.busy ?? 0)
272
285
  const during = { load1: Math.max(load.load1, after.load1), cores: load.cores, ...(busy != null ? { busy } : {}) }
@@ -274,24 +287,43 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
274
287
  for (const c of crashed) if (!pooledWhy.has(c.file)) pooledWhy.set(c.file, `its worker crashed: ${c.signal}`)
275
288
  const pooledMs = Object.fromEntries(Object.entries(p1.timings).map(([f, ms]) => [normSuitePath(f), ms]))
276
289
  const loneRuns: Record<string, AloneRun> = {}
290
+ const loneOut: Record<string, string> = {}
277
291
  let lone = 0
292
+ // a lone run gets a per test timeout of its own, after the script's (bun reads the last), and a junit report
293
+ // for each test's time alone, which a piped run prints for no passing test
294
+ const junit = !rawArgs.some((a) => a.startsWith('--reporter'))
295
+ const ownTimeout = Number(plan.alone.map((a) => /^--timeout=(\d+)$/.exec(a)?.[1]).filter((n) => n != null).at(-1) ?? 0)
278
296
  const redAlone = await rerunRedAlone({
279
- red: pooledRed, pooled: parallel && !parallelEmpty, ended: !p1.stalled && p1.signal == null, pooledMs, pooledWhy, load: during, ceilingMs,
297
+ red: pooledRed, unfinished, timedOut: timedOutTests(p1.out), pooled: parallel && !parallelEmpty, ended: p1.signal == null, pooledMs, pooledWhy, load: during, ceilingMs,
280
298
  run: async (file, ceiling) => {
281
- const { alone, phase } = await runAlone(file, `red-${lone++}`, ceiling)
299
+ const name = `red-${lone++}`
300
+ const report = join(dir, `${name}.xml`)
301
+ const { alone, phase } = await runAlone(file, name, ceiling, [`--timeout=${Math.max(ownTimeout, loneTestTimeout(ceiling))}`, ...(junit ? ['--reporter=junit', `--reporter-outfile=${report}`] : [])])
282
302
  if (alone != null) loneRuns[file] = alone
283
- return phase
303
+ loneOut[file] = phase.out
304
+ let tests: { name: string; ms: number }[] = []
305
+ try { if (existsSync(report)) tests = junitTests(readFileSync(report, 'utf8')) } catch { tests = [] }
306
+ return { ...phase, tests }
284
307
  },
285
308
  })
286
309
  notes.push(...redAlone.notes)
287
310
  const rescued = new Set(redAlone.rescued)
311
+ const keptSlow = keepSlowTests(slowTestsPath(process.cwd()), redAlone.slow.map((s) => ({ ...s, file: normSuitePath(s.file) })), { unit, tier, load: during, at: Date.now() })
312
+ if (keptSlow != null) notes.push(keptSlow)
313
+ // every suite the kill caught passed alone: the kill is no red, and what they ran counts
314
+ const killRescued = p1.stalled && planned != null && unfinished.length > 0 && unfinished.every((f) => rescued.has(f))
315
+ // a killed phase prints its counts only when bun reaped its workers in time, and never a file it did not start
316
+ const p1Counted = /Ran \d+ tests?/.test(p1.out)
317
+ const notStarted = new Set([...notStartedSuites(p1.out), ...unlisted])
318
+ ran += unfinished.filter((f) => rescued.has(f) && (!p1Counted || notStarted.has(f))).reduce((n, f) => n + lastCount(loneOut[f] ?? '', /Ran (\d+) tests?/g), 0)
288
319
  for (const f of rescued) if (loneRuns[f] != null) aloneRuns[f] = loneRuns[f]!
289
320
  const rescuedWarns = redAlone.warns
290
321
  // what the pool counted for the suites that passed alone is not the run's failure
291
322
  const off = failuresIn(p1.out, rescued)
292
- const failedTests = phases.reduce((n, p) => n + lastCount(p.out, /^\s*(\d+) fail$/gm), 0) - off.tests
293
- const errors = phases.reduce((n, p) => n + lastCount(p.out, /^\s*(\d+) errors?$/gm), 0) - off.errors
294
- const p1Clean = p1.code === 0 || (rescued.size > 0 && pooledRed.every((f) => rescued.has(f))
323
+ const failedTests = Math.max(0, phases.reduce((n, p) => n + lastCount(p.out, /^\s*(\d+) fail$/gm), 0) - off.tests)
324
+ const errors = Math.max(0, phases.reduce((n, p) => n + lastCount(p.out, /^\s*(\d+) errors?$/gm), 0) - off.errors)
325
+ // a phase its ceiling killed prints no counts of its own: it is clean when every suite it caught and every red passed alone
326
+ const p1Clean = p1.code === 0 || (p1.stalled ? killRescued && pooledRed.every((f) => rescued.has(f)) : rescued.size > 0 && pooledRed.every((f) => rescued.has(f))
295
327
  && lastCount(p1.out, /^\s*(\d+) fail$/gm) === off.tests && lastCount(p1.out, /^\s*(\d+) errors?$/gm) === off.errors)
296
328
  const timings = Object.assign({}, ...phases.map((p) => p.timings)) as Record<string, number>
297
329
  // a crashed worker left no timing: its lone run's stands
@@ -337,7 +369,9 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
337
369
  const stalledIn = (name: string, p: Phase | null, files: string[]): string | null =>
338
370
  p?.stalled === true ? stallWords(name, ceilingMs, [...new Set([...files, ...interruptedSuites(p.out)])]) : null
339
371
  const killed = p1.stalled ? [] : crashed.filter((c) => !rescued.has(c.file)).map((c) => `killed by ${c.signal} while running ${c.file} (out of memory, or killed from outside)`)
340
- const stalls = [stalledIn('the parallel phase', p1, crashed.map((c) => c.file)), stalledIn('the serial phase', p2, phaseFiles(serialArgs ?? [], rawArgs).filter((a) => p2?.timings[normSuitePath(a)] == null).map(normSuitePath))]
372
+ // a kill some suites cleared alone names only the ones that did not
373
+ const p1Stall = !p1.stalled || killRescued ? null : stallWords('the parallel phase', ceilingMs, unfinished.length > 0 ? unfinished.filter((f) => !rescued.has(f)) : crashed.map((c) => c.file))
374
+ const stalls = [p1Stall, stalledIn('the serial phase', p2, phaseFiles(serialArgs ?? [], rawArgs).filter((a) => p2?.timings[normSuitePath(a)] == null).map(normSuitePath))]
341
375
  for (const line of stalls) if (line != null) killed.unshift(line)
342
376
  if (p1.signal != null) killed.push(`killed by ${p1.signal} during the parallel run (out of memory, or killed from outside)`)
343
377
  if (p2?.signal != null) {
@@ -398,7 +432,10 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
398
432
  : null
399
433
  // a kill at the ceiling leads with the files that had already finished red: the kill is the second news
400
434
  const redFirst = p1.stalled || p2?.stalled === true ? redBeforeKill(phases.map((p) => p.out).join('\n'), rescued) : null
435
+ // what the kill caught and then failed alone is the red to fix, ahead of the kill itself
436
+ const killedRed = redAlone.failed.filter((f) => unfinished.includes(f.file))
401
437
  const fails: string[] = [
438
+ ...(killedRed.length > 0 ? [`FAIL: ${killedRed.length} suite(s) the ${secs(ceilingMs)} ceiling caught failed alone too: ${killedRed.slice(0, 5).map((f) => `${f.file} (${f.why})`).join('; ')}${killedRed.length > 5 ? `; ${killedRed.length - 5} more` : ''}`] : []),
402
439
  ...(redFirst != null ? [`FAIL: ${redFirst}`] : []),
403
440
  ...killed.map((k) => `FAIL: ${k}`),
404
441
  ...(vacuous ? ['FAIL: ran 0 tests: a suite with no test in it proves nothing, write a real one'] : []),
@@ -421,6 +458,22 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
421
458
  }
422
459
  }
423
460
 
461
+ /** the suites the parallel phase was to run, cwd relative, or null when the runner cannot list them: no CPU lines
462
+ * (nothing says which finished), a script that names its own paths, no git work tree, a failed listing */
463
+ function plannedSuites(o: { cpuFile: string | null; pickedSet: Set<string> | null; serialSet: Set<string>; rawArgs: string[]; bunfig: BunfigTest; phaseArgs: string[] }): string[] | null {
464
+ if (o.cpuFile == null) return null
465
+ if (o.pickedSet != null) return [...o.pickedSet].filter((f) => !o.serialSet.has(f))
466
+ if (positional(o.rawArgs) != null) return null
467
+ const g = gitRoot(process.cwd())
468
+ if (g == null) return null
469
+ const ignores = [...o.bunfig.ignores, ...o.phaseArgs.filter((a) => a.startsWith('--path-ignore-patterns=')).map((a) => a.slice('--path-ignore-patterns='.length))]
470
+ try {
471
+ return suiteFiles(g.top, g.prefix.replace(/\/$/, ''), o.bunfig.root, ignores, isBunSuite).map(normSuitePath).filter((f) => !o.serialSet.has(f))
472
+ } catch {
473
+ return null
474
+ }
475
+ }
476
+
424
477
  /** a selection in flight: the recorder's file, the state it started from,
425
478
  * the snapshot taken before the run, and the suites it picked (cwd
426
479
  * relative, null = every suite) */
@@ -12,6 +12,7 @@ import { basename, posix } from 'path'
12
12
  import { rawName, routesToShipkit, slotBody } from '../core/canonical-scripts.ts'
13
13
  import { parseJsonc } from '../ts/jsonc.ts'
14
14
  import { repoOff, type OffKeys } from '../core/when.ts'
15
+ import type { RepoConfig } from '../repo-config.ts'
15
16
  import { bunfigTest, inDotDir, normSuitePath, parseBunTestScript, type BunfigTest, type TestsConfig } from './judge-suites.ts'
16
17
 
17
18
  export { bunfigTest, type BunfigTest }
@@ -207,7 +208,7 @@ export function planTests(o: {
207
208
  /** the whole plan for a repo, from what its config and files say. `read`
208
209
  * answers a repo-relative path, null when absent */
209
210
  export function testPlanOf(o: {
210
- config: OffKeys & { units?: { dir?: unknown; id?: string; tests?: TestsConfig; tsconfig?: string; release?: boolean; deps?: string[] }[] }
211
+ config: OffKeys & Pick<RepoConfig, 'defaults'> & { units?: { dir?: unknown; id?: string; tests?: TestsConfig; tsconfig?: string; release?: boolean; deps?: string[] }[] }
211
212
  files: string[]
212
213
  read: (rel: string) => string | null
213
214
  }): TestPlan & { units: TestUnitDecl[] } {
package/src/urls/fill.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  // and a password never goes to a plain http origin off this Mac
7
7
  import { browserMarks, broughtByTailnet } from '../http/owner-word.ts'
8
8
  import { hostName, loopbackHost, loopbackName } from '../http/same-origin.ts'
9
- import { AGENT_ENV } from '../vault/vault-init.ts'
9
+ import { AGENT_ENV } from '../core/agent-env.ts'
10
10
  import { loadUrls, loginCode, loginValue, UrlsRefusal } from './rows.ts'
11
11
  import type { CodeNow } from './totp.ts'
12
12
 
@@ -25,7 +25,6 @@ export type DoorHere = { port: number } | { closed: string }
25
25
 
26
26
  /** the switch a place's report carries (hq/door.ts), under its name before for a place that runs an older checkout */
27
27
  const MACHINE_URLS = 'machine-urls'
28
- const MACHINE_URLS_WAS = 'machine-door'
29
28
 
30
29
  const pathOf = (url: string): string => {
31
30
  try {
@@ -58,7 +57,7 @@ export function repoPlaces(view: { you: string; machines: readonly MachineView[]
58
57
  if (names.size === 0) continue
59
58
  const machine = m.name
60
59
  // a place under another OS user of the viewer's machine: the door opens this machine's own processes only
61
- const closed = 'closed' in door ? door.closed : m === mine ? `${machine}/${n.osUser} is this machine under another OS user: the hq's proxy opens this machine's own processes only` : body.switches?.[MACHINE_URLS] === true || (body.switches?.[MACHINE_URLS] == null && body.switches?.[MACHINE_URLS_WAS] === true) ? null : `${machine} keeps its urls closed: « urls to the hq's home » on ${machine}'s own hub (machines page)`
60
+ const closed = 'closed' in door ? door.closed : m === mine ? `${machine}/${n.osUser} is this machine under another OS user: the hq's proxy opens this machine's own processes only` : body.switches?.[MACHINE_URLS] === true ? null : `${machine} keeps its urls closed: « urls to the hq's home » on ${machine}'s own hub (machines page)`
62
61
  const all = seesAll?.(n.id) ?? false
63
62
  const through = (label: string, url: string): { open: string | null; why: string | null; sandbox?: true } => {
64
63
  if (!all) return { open: null, why: seesAll == null ? UNKNOWN_GRANT : loopbackOrigin(url) == null ? SANDBOX_URL : SANDBOX_DOOR, sandbox: true }
@@ -64,8 +64,8 @@ export function userHome(): string {
64
64
  }
65
65
 
66
66
  /** the vault of this machine's real home (the OS user's own, userHome): the default of homeDir() under the machine's one root (layout.ts
67
- * machinePath, the old root until the machine moved), whatever SHIPKIT_HOME_DIR says. A path that resolves to it
68
- * through a link (the old root once moved) is it too */
67
+ * machinePath), whatever SHIPKIT_HOME_DIR says. A path that resolves to it through a link (`~/.config/shipkit`) is
68
+ * it too */
69
69
  export function isRealPlace(p: VaultPlace, home: string = userHome()): boolean {
70
70
  const real = join(machinePath('home', home), 'vault')
71
71
  if (resolve(p.dir) === real) return true
@@ -8,13 +8,9 @@ import { AUDIT_DEVICE, auditLog, configFile, dataDir, isSealKey, markerFile, sea
8
8
  import { handOver, holdSealNote, initNote, KeyGuard, sealNote, type Clipboard, type Signals, type Terminal } from './vault-handover.ts'
9
9
  import { VaultApi, vaultHealth, waitHealth } from './vault-http.ts'
10
10
  import { MINTER_PERIOD, MINTER_POLICY, MINTER_POLICY_NAME, writeNodeSetup } from './vault-minter.ts'
11
+ import { AGENT_ENV, SSH_ENV } from '../core/agent-env.ts'
11
12
  import { auditPathOf, baoVersion, markerBaoProblem, readMarker, startBao, type SealStore } from './vault-serve.ts'
12
13
 
13
- /** variables a coding agent's session sets in the shell it runs commands in. CLAUDE_CONFIG_DIR is not one: an
14
- * owner's own terminal may set it to pick an account */
15
- export const AGENT_ENV = ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT', 'CLAUDE_CODE_SESSION_ID', 'CLAUDE_PID', 'AI_AGENT', 'CODEX_SANDBOX', 'CODEX_THREAD_ID', 'GEMINI_CLI', 'CURSOR_AGENT']
16
- /** variables ssh sets in the shell of a session it opened: none of an agent's marks travels through it */
17
- export const SSH_ENV = ['SSH_TTY', 'SSH_CONNECTION', 'SSH_CLIENT']
18
14
 
19
15
  /** why this run is not the owner typing at the Mac's own desktop, null when it is. A guard against a mistake, not
20
16
  * a wall: any process of his user reads the seal key, since `sk vault serve` reads it with no prompt */
@@ -139,17 +139,27 @@ function draw() {
139
139
  }
140
140
  ctx.restore()
141
141
  }
142
+ // the loop sleeps once nothing moves on screen: each tick is a pass over every pair of balls, so a graph that ticked
143
+ // while still took about 45 % of a core in WebKit. Any act on the graph wakes it
144
+ let awake = false, still = 0
145
+ function wake() { still = 0; if (!awake) { awake = true; requestAnimationFrame(loop) } }
142
146
  function loop() {
143
147
  simStep(sim)
148
+ // the farthest a ball moved this tick, in screen pixels (the step moved it by its velocity before the damping)
149
+ let moved = 0
150
+ for (const n of N) moved = Math.max(moved, Math.hypot(n.vx, n.vy) / 0.85 * sim.alpha * scale)
144
151
  if (fitting) fit()
145
152
  if (glide != null) {
146
153
  const tx = innerWidth / 2 - glide.x * scale, ty = innerHeight / 2 - glide.y * scale
147
154
  ox += (tx - ox) * 0.15; oy += (ty - oy) * 0.15
148
155
  if (Math.abs(tx - ox) < 0.5 && Math.abs(ty - oy) < 0.5) glide = null
149
156
  }
150
- draw(); requestAnimationFrame(loop)
157
+ draw()
158
+ still = moved < 0.05 && glide == null && sim.drag == null && panning == null ? still + 1 : 0
159
+ if (still < 30) requestAnimationFrame(loop)
160
+ else awake = false
151
161
  }
152
- loop()
162
+ wake()
153
163
 
154
164
  const saveOnceAfter = ${saveOnceAfter.toString()}
155
165
  ${layoutIsSane.toString()}
@@ -175,7 +185,9 @@ addEventListener('message', ev => {
175
185
  if (m == null || typeof m !== 'object') return
176
186
  if (m.type === 'wiki-graph:theme') { dark = m.theme === 'dark'; applyTheme() }
177
187
  if (m.type === 'wiki-graph:focus') { selected = byId.get(m.id) ?? null; if (selected) { glide = selected; fitting = false } }
188
+ wake()
178
189
  })
190
+ for (const on of ['pointerdown', 'pointermove', 'pointerup', 'wheel', 'resize']) addEventListener(on, wake, { passive: true })
179
191
  canvas.addEventListener('pointerdown', ev => {
180
192
  const n = nodeAt(ev.clientX, ev.clientY)
181
193
  down = { x: ev.clientX, y: ev.clientY, n }
@@ -1,49 +0,0 @@
1
- // what a person's copy says of the thread as a whole (wiki tools/shipkit/advisors.md, What the advisor sees): the
2
- // thread's own title and state, never those of an older version standing as the copy's head (the newest a draft not
3
- // ready); the thread's own version numbers. Pure: the sync runs it on the copy the output whitelist wrote
4
- // (advisor-view.ts), before the turn is read for the person
5
- import type { ShownStatus } from '../review/model.ts'
6
- import type { Turn } from '../review/band.ts'
7
- import type { AdvisorThread } from './advisor-view.ts'
8
- import type { ProjectedItems } from './project.ts'
9
-
10
- /** the thread as the store holds it, as far as the person may know it: who acts now, and its newest version's status */
11
- export interface RealState {
12
- turn: Turn
13
- status: ShownStatus
14
- }
15
-
16
- /** the copy told the truth about the thread: its title, its own numbers, and its state when its newest version is not
17
- * in the copy */
18
- export function truthfulCopy(copy: AdvisorThread, p: Pick<ProjectedItems, 'title' | 'numbers' | 'headKept'>, real: RealState): AdvisorThread {
19
- const { view, row } = copy
20
- view.title = p.title
21
- row.title = p.title
22
- let top = 0
23
- view.cells = view.cells.map((c) => {
24
- if (c.kind === 'version') {
25
- const n = p.numbers.get(c.item.id) ?? c.n
26
- top = Math.max(top, n)
27
- return { ...c, n }
28
- }
29
- if (c.kind === 'verdict') return { ...c, n: p.numbers.get(c.on) ?? c.n }
30
- return c
31
- })
32
- if (top > 0) {
33
- view.versions = top
34
- row.versions = top
35
- }
36
- if (!p.headKept) {
37
- // the copy's head is an older version: its verdict is not the thread's, and nothing of it waits on the person
38
- view.turn = real.turn
39
- row.turn = real.turn
40
- const status: ShownStatus = real.turn === 'done' ? real.status : 'pending'
41
- view.status = status
42
- row.status = status
43
- view.verdict = null
44
- view.waits = false
45
- row.waits = false
46
- if (real.turn !== 'done') delete row.validated
47
- }
48
- return copy
49
- }