rvlib-shipkit 2.31.0 → 2.33.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 (408) hide show
  1. package/CHANGELOG.md +51 -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 +122 -76
  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 +20 -221
  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 +27 -25
  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 +97 -183
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +261 -87
  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_Capacity.ts +6 -2
  67. package/src/cli/cmd_Checks.ts +0 -14
  68. package/src/cli/cmd_Ci.ts +2 -1
  69. package/src/cli/cmd_Db.ts +3 -82
  70. package/src/cli/cmd_Home.ts +4 -32
  71. package/src/cli/cmd_Hq.ts +0 -17
  72. package/src/cli/cmd_Releases.ts +57 -4
  73. package/src/cli/cmd_Review.ts +333 -354
  74. package/src/cli/cmd_Shot.ts +26 -4
  75. package/src/cli/cmd_SocialDrafts.ts +6 -13
  76. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  77. package/src/cli/cmd_Time.ts +1 -1
  78. package/src/cli/cmd_Trailer.ts +1 -1
  79. package/src/cli/inbox-hook-run.ts +5 -23
  80. package/src/cli/registry-heads.ts +5 -55
  81. package/src/cli/registry.ts +1 -5
  82. package/src/cli/review-here.ts +1 -1
  83. package/src/cli.ts +15 -4
  84. package/src/collections/collection-types.ts +1 -1
  85. package/src/collections/review.ts +5 -4
  86. package/src/core/admission.ts +268 -0
  87. package/src/core/agent-allow-policy.ts +32 -2
  88. package/src/core/agent-env.ts +8 -0
  89. package/src/core/allow-rows.ts +74 -0
  90. package/src/core/check-file-names.ts +19 -106
  91. package/src/core/code-lines.ts +36 -21
  92. package/src/core/footprint.ts +17 -13
  93. package/src/core/identities-root.ts +1 -4
  94. package/src/core/layout.ts +1 -2
  95. package/src/core/machine-db.ts +33 -208
  96. package/src/core/machine-layout.ts +14 -127
  97. package/src/core/machine-read.ts +5 -2
  98. package/src/core/mask-source.ts +60 -0
  99. package/src/core/memory-watch.ts +17 -14
  100. package/src/core/motherhome.ts +8 -35
  101. package/src/core/one-way-in-policy.ts +0 -3
  102. package/src/core/peer-sk.ts +8 -0
  103. package/src/core/repo-walk.ts +0 -9
  104. package/src/core/retention.ts +1 -9
  105. package/src/core/retired-checks.ts +2 -0
  106. package/src/core/tmux-policy.ts +1 -1
  107. package/src/core/tree-watch.ts +2 -2
  108. package/src/core/when.ts +7 -45
  109. package/src/gate/admit-heavy.ts +150 -0
  110. package/src/gate/check-runner.ts +6 -0
  111. package/src/gate/discover-checks.ts +42 -32
  112. package/src/gate/gate-checks.ts +21 -131
  113. package/src/gate/head-gate.ts +1 -1
  114. package/src/gate/job-run.ts +2 -1
  115. package/src/gate/pre-commit-discovery.ts +22 -28
  116. package/src/gate/run-check.ts +3 -4
  117. package/src/gate/run-ci.ts +4 -0
  118. package/src/gate/run-fix.ts +5 -17
  119. package/src/gate/run-fixers.ts +6 -42
  120. package/src/home/app-sign.ts +2 -2
  121. package/src/home/backup-status.ts +52 -92
  122. package/src/home/backup-verdict.ts +2 -2
  123. package/src/home/daemon-jobs.ts +51 -95
  124. package/src/home/database-words.ts +1 -2
  125. package/src/home/databases.ts +9 -25
  126. package/src/home/home-launchd.ts +0 -6
  127. package/src/home/home-paths.ts +8 -4
  128. package/src/home/home-routes.ts +3 -10
  129. package/src/home/home-state.ts +2 -14
  130. package/src/home/inbox-shape.ts +14 -15
  131. package/src/home/inbox.ts +1 -1
  132. package/src/home/machine-repair.ts +102 -103
  133. package/src/home/resume.ts +1 -15
  134. package/src/home/run-daemon.ts +7 -12
  135. package/src/home/space-page.ts +3 -2
  136. package/src/home/supervise.ts +3 -7
  137. package/src/hooks/commit-msg-run.ts +61 -0
  138. package/src/hooks/commit-run.ts +16 -166
  139. package/src/hooks/gate-outcome.ts +108 -0
  140. package/src/hooks/git-hook.ts +9 -9
  141. package/src/hooks/hook-config.ts +8 -8
  142. package/src/hooks/leak-guard.ts +1 -1
  143. package/src/hooks/pre-commit-checks.ts +1 -1
  144. package/src/hooks/run-hooks.ts +2 -6
  145. package/src/hooks/shared-file.ts +3 -2
  146. package/src/hq/daemon-db.ts +8 -8
  147. package/src/hq/door.ts +3 -16
  148. package/src/hq/hq-db.ts +4 -3
  149. package/src/hq/hq-local.ts +1 -2
  150. package/src/hq/hq-store.ts +0 -15
  151. package/src/hq/item-direct.ts +8 -10
  152. package/src/hq/item-fill.ts +37 -0
  153. package/src/hq/kinds/item-gone.ts +7 -10
  154. package/src/hq/kinds/item-msg.ts +12 -18
  155. package/src/hq/kinds/item.ts +13 -19
  156. package/src/hq/kinds/report.ts +3 -4
  157. package/src/hq/owner-switch.ts +3 -3
  158. package/src/hq/report.ts +5 -9
  159. package/src/hq/switch.ts +2 -11
  160. package/src/hq/thread-sync.ts +5 -17
  161. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  162. package/src/http/owner-word.ts +1 -1
  163. package/src/identities/machine.ts +16 -0
  164. package/src/init-repo.ts +0 -1
  165. package/src/ledger/check-stats.ts +6 -5
  166. package/src/ledger/db.ts +2 -4
  167. package/src/ledger/record-kept.ts +117 -48
  168. package/src/ledger/run-log.ts +21 -2
  169. package/src/ledger/slow-tests.ts +96 -0
  170. package/src/ledger/store.ts +3 -86
  171. package/src/ledger/suite-log.ts +8 -2
  172. package/src/media-store/backup/facts.ts +3 -37
  173. package/src/media-store/backup/keys.ts +1 -8
  174. package/src/media-store/backup/manifest.ts +6 -67
  175. package/src/media-store/backup/restore.ts +4 -13
  176. package/src/media-store/backup/retention.ts +13 -1
  177. package/src/media-store/backup/run.ts +6 -267
  178. package/src/media-store/backup/snapshot.ts +2 -38
  179. package/src/media-store/backup/sources.ts +3 -113
  180. package/src/media-store/backup/target-send.ts +5 -29
  181. package/src/media-store/db.ts +8 -7
  182. package/src/media-store/forget-one.ts +1 -1
  183. package/src/media-store/forget.ts +1 -80
  184. package/src/orchestrator/guards.ts +0 -1
  185. package/src/orchestrator/presence.ts +2 -2
  186. package/src/orchestrator/routes.ts +1 -1
  187. package/src/orchestrator/started.ts +0 -9
  188. package/src/orchestrator/talk-key.ts +3 -4
  189. package/src/orchestrator/unheard.ts +1 -1
  190. package/src/plan/planner.ts +3 -2
  191. package/src/recordings/edit.ts +3 -3
  192. package/src/recordings/marks-draw.ts +17 -6
  193. package/src/recordings/marks.ts +120 -9
  194. package/src/reflections/reflections-queue.ts +3 -10
  195. package/src/release/notes.ts +1 -1
  196. package/src/release/public-clean.ts +66 -6
  197. package/src/release/run-bump.ts +11 -0
  198. package/src/release/run-release.ts +4 -0
  199. package/src/releases/from-thread.ts +3 -3
  200. package/src/releases/model.ts +186 -36
  201. package/src/releases/store.ts +13 -3
  202. package/src/releases/validate.ts +83 -0
  203. package/src/repo-config.ts +36 -64
  204. package/src/review/answer-kinds.ts +63 -4
  205. package/src/review/blocked-guard.ts +11 -0
  206. package/src/review/blocked-object.ts +298 -0
  207. package/src/review/cells.ts +144 -230
  208. package/src/review/close.ts +39 -1
  209. package/src/review/doc-save.ts +3 -2
  210. package/src/review/draft-item.ts +1 -1
  211. package/src/review/events.ts +3 -7
  212. package/src/review/expect.ts +23 -39
  213. package/src/review/format.ts +79 -46
  214. package/src/review/glyphs.ts +1 -0
  215. package/src/review/hand-over.ts +3 -3
  216. package/src/review/heard.ts +1 -1
  217. package/src/review/holds-sync.ts +2 -1
  218. package/src/review/inbox-hook.ts +2 -2
  219. package/src/review/inbox-read.ts +39 -33
  220. package/src/review/instruction-guards.ts +12 -0
  221. package/src/review/instructions.ts +0 -1
  222. package/src/review/item-db.ts +13 -43
  223. package/src/review/item-hq.ts +2 -2
  224. package/src/review/item-rows.ts +3 -14
  225. package/src/review/kind-catalog.ts +3 -1
  226. package/src/review/kinds.ts +18 -8
  227. package/src/review/live-view.ts +3 -0
  228. package/src/review/media-kind.ts +1 -1
  229. package/src/review/mentions.ts +1 -2
  230. package/src/review/model.ts +158 -114
  231. package/src/review/move.ts +149 -0
  232. package/src/review/need-threads.ts +3 -2
  233. package/src/review/object-card.ts +11 -0
  234. package/src/review/object-read.ts +6 -1
  235. package/src/review/one-block.ts +1 -1
  236. package/src/review/owner-read.ts +1 -1
  237. package/src/review/phone-push.ts +10 -9
  238. package/src/review/previews.ts +32 -4
  239. package/src/review/push.ts +2 -2
  240. package/src/review/recap.ts +129 -0
  241. package/src/review/referring.ts +6 -3
  242. package/src/review/reflection-object.ts +4 -3
  243. package/src/review/routes.ts +51 -47
  244. package/src/review/secret-route.ts +3 -2
  245. package/src/review/settle.ts +0 -6
  246. package/src/review/snooze.ts +5 -3
  247. package/src/review/speaker.ts +68 -0
  248. package/src/review/start-title.ts +19 -0
  249. package/src/review/store-parties.ts +28 -0
  250. package/src/review/store.ts +94 -59
  251. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  252. package/src/review/thread-md.ts +35 -14
  253. package/src/review/thread-state.ts +804 -0
  254. package/src/review/threads.ts +29 -347
  255. package/src/review/traces.ts +104 -7
  256. package/src/review/trailer-item.ts +1 -1
  257. package/src/review/unit.ts +7 -9
  258. package/src/review/verdict-items.ts +12 -10
  259. package/src/review/view-layout.ts +25 -1
  260. package/src/review/watch-feed.ts +1 -2
  261. package/src/review/working-guards.ts +2 -3
  262. package/src/rules/untrack-generated.ts +1 -15
  263. package/src/secrets/copy.ts +4 -4
  264. package/src/secrets/lapse.ts +2 -1
  265. package/src/serve/hub-app/advisor-app.tsx +4 -4
  266. package/src/serve/hub-app/advisor-face.tsx +9 -3
  267. package/src/serve/hub-app/advisor-host.ts +27 -27
  268. package/src/serve/hub-app/advisors-model.ts +17 -8
  269. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  270. package/src/serve/hub-app/advisors-st.ts +15 -14
  271. package/src/serve/hub-app/advisors-view.tsx +13 -11
  272. package/src/serve/hub-app/app-bridge.ts +23 -3
  273. package/src/serve/hub-app/asks-page.tsx +1 -1
  274. package/src/serve/hub-app/auto-text.tsx +71 -16
  275. package/src/serve/hub-app/check-view.tsx +0 -8
  276. package/src/serve/hub-app/controls.css +14 -3
  277. package/src/serve/hub-app/database-view.tsx +1 -2
  278. package/src/serve/hub-app/dock-st.ts +1 -1
  279. package/src/serve/hub-app/git-view.tsx +3 -1
  280. package/src/serve/hub-app/hub.css +12 -5
  281. package/src/serve/hub-app/icons.tsx +1 -1
  282. package/src/serve/hub-app/inbox-view.tsx +1 -2
  283. package/src/serve/hub-app/live-sources.ts +2 -2
  284. package/src/serve/hub-app/main-panel.tsx +2 -1
  285. package/src/serve/hub-app/panel-repo.ts +0 -9
  286. package/src/serve/hub-app/pic.tsx +29 -12
  287. package/src/serve/hub-app/polled.ts +16 -2
  288. package/src/serve/hub-app/recordings-st.ts +23 -2
  289. package/src/serve/hub-app/recordings-view.tsx +68 -10
  290. package/src/serve/hub-app/ref-pill.ts +1 -1
  291. package/src/serve/hub-app/repo-st.ts +1 -2
  292. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  293. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  294. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  295. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  296. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  297. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  298. package/src/serve/hub-app/review/kit.tsx +4 -11
  299. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  300. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  301. package/src/serve/hub-app/review/line-window.ts +4 -1
  302. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  303. package/src/serve/hub-app/review/live-view.tsx +57 -1
  304. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  305. package/src/serve/hub-app/review/question-views.tsx +191 -53
  306. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  307. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  308. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  309. package/src/serve/hub-app/review/review-host.ts +8 -4
  310. package/src/serve/hub-app/review/review-kit.ts +17 -11
  311. package/src/serve/hub-app/review/review-list.tsx +30 -35
  312. package/src/serve/hub-app/review/review-st.ts +32 -42
  313. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  314. package/src/serve/hub-app/review/review-views.tsx +127 -68
  315. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  316. package/src/serve/hub-app/review/start-st.ts +2 -5
  317. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  318. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  319. package/src/serve/hub-app/review/thread-st.ts +381 -202
  320. package/src/serve/hub-app/review/tone-bar.tsx +129 -0
  321. package/src/serve/hub-app/review/tones.ts +53 -0
  322. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  323. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  324. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  325. package/src/serve/hub-app/review.css +189 -106
  326. package/src/serve/hub-app/search-view.tsx +1 -1
  327. package/src/serve/hub-app/social/social-model.ts +0 -4
  328. package/src/serve/hub-app/source-acts.ts +2 -1
  329. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  330. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  331. package/src/serve/hub-app/thread-row.tsx +3 -4
  332. package/src/serve/hub-app/tree-build.ts +0 -4
  333. package/src/serve/hub-app/urls-view.tsx +2 -1
  334. package/src/serve/hub-app/view-layout.css +13 -3
  335. package/src/serve/hub-app/wikis-view.tsx +5 -2
  336. package/src/serve/hub-runtime.ts +7 -37
  337. package/src/serve/project-gutter-route.ts +6 -2
  338. package/src/serve/read-thread.ts +20 -2
  339. package/src/serve/read-worker.ts +9 -1
  340. package/src/serve/record-pages.ts +46 -0
  341. package/src/serve/serve-hub.ts +2 -2
  342. package/src/serve/terminal-host.ts +1 -1
  343. package/src/serve/terminal-route.ts +1 -3
  344. package/src/serve/tracked-watch.ts +1 -3
  345. package/src/setup-house.ts +2 -2
  346. package/src/shipkit-files.ts +1 -1
  347. package/src/shipkit.ts +1 -6
  348. package/src/shot/client.ts +2 -1
  349. package/src/shot/film-box.ts +0 -20
  350. package/src/shot/on-place.ts +141 -0
  351. package/src/social/drafts.ts +1 -1
  352. package/src/social/kinds.ts +6 -29
  353. package/src/social/load.ts +2 -2
  354. package/src/social/post-object.ts +3 -2
  355. package/src/social/release-stage.ts +1 -1
  356. package/src/social/stage.ts +2 -2
  357. package/src/stores/model.ts +4 -0
  358. package/src/stores/routes.ts +11 -3
  359. package/src/suite/judge-suites.ts +58 -0
  360. package/src/suite/red-alone.ts +54 -18
  361. package/src/suite/runner-shapes.ts +2 -2
  362. package/src/suite/suite-cli.ts +67 -14
  363. package/src/suite/test-units.ts +2 -1
  364. package/src/urls/fill.ts +1 -1
  365. package/src/urls/places.ts +1 -2
  366. package/src/vault/vault-config.ts +2 -2
  367. package/src/vault/vault-init.ts +1 -5
  368. package/src/wiki/graph-page.ts +14 -2
  369. package/src/advisors/copy-truth.ts +0 -49
  370. package/src/advisors/door-child.ts +0 -112
  371. package/src/advisors/door-serve.ts +0 -52
  372. package/src/advisors/door.ts +0 -118
  373. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  374. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  375. package/src/checks/SK048-one-local-file.check.ts +0 -36
  376. package/src/core/config-rewrite.ts +0 -111
  377. package/src/core/daemon-port.ts +0 -10
  378. package/src/core/legacy-shapes.ts +0 -263
  379. package/src/core/migrate-layout.ts +0 -638
  380. package/src/core/port-check-cli.ts +0 -52
  381. package/src/core/port-check-file.ts +0 -295
  382. package/src/core/port-check-files.ts +0 -31
  383. package/src/gate/discover-legacy-checks.ts +0 -26
  384. package/src/home/home-move.ts +0 -527
  385. package/src/home/machine-fold.ts +0 -810
  386. package/src/hq/item-shapes.ts +0 -54
  387. package/src/hq/kinds/items-read.ts +0 -4
  388. package/src/media-store/backup/daemon.ts +0 -220
  389. package/src/media-store/backup/kept.ts +0 -241
  390. package/src/media-store/backup/prune.ts +0 -359
  391. package/src/media-store/backup/secret.ts +0 -88
  392. package/src/media-store/backup/ssh-space.ts +0 -202
  393. package/src/media-store/backup/watch.ts +0 -117
  394. package/src/review/band.ts +0 -182
  395. package/src/review/folders.ts +0 -216
  396. package/src/review/hook-ask.ts +0 -58
  397. package/src/review/role.ts +0 -48
  398. package/src/review/thread-fold.ts +0 -64
  399. package/src/review/wait.ts +0 -91
  400. package/src/rules/rule.ts +0 -43
  401. package/src/serve/hook-thread.ts +0 -37
  402. package/src/serve/hook-work.ts +0 -92
  403. package/src/serve/hook-worker.ts +0 -57
  404. package/src/serve/hub-app/review/dock.tsx +0 -147
  405. package/src/serve/hub-app/review/faces.tsx +0 -18
  406. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  407. package/src/serve/hub-app/review/review-board.tsx +0 -48
  408. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  // what a post is for (wiki guides/post-kinds/index.md): the closed set of kinds a draft's `kind` takes, a project's
2
- // own kinds from its social unit, the old words each kind replaces, and the one check the load and SK042 share. Pure:
2
+ // own kinds from its social unit, and the one check the load and SK042 share. Pure:
3
3
  // the unit module and the hub page import it
4
4
 
5
5
  /** the shared kinds, in the order the desk lists them */
@@ -32,20 +32,6 @@ export interface OwnKind {
32
32
  page: string
33
33
  }
34
34
 
35
- /** the words in use before the set closed, each with the kind it maps to by default; null: a text that stays on a
36
- * venue, a profile row of the identity and no post kind */
37
- export const OLD_KINDS: Readonly<Record<string, PostKind | null>> = {
38
- hello: 'announcement',
39
- welcome: 'announcement',
40
- devlog: 'iteration',
41
- wip: 'iteration',
42
- look: 'iteration',
43
- roundup: 'iteration',
44
- people: 'showcase',
45
- puzzle: 'showcase',
46
- page: null,
47
- }
48
-
49
35
  export const isPostKind = (k: string): k is PostKind => (POST_KINDS as readonly string[]).includes(k)
50
36
 
51
37
  /** a front matter value as written, trimmed and out of one pair of quotes: `"feature"` is feature, `""` is empty */
@@ -54,25 +40,16 @@ const unquote = (v: string | undefined): string => (v ?? '').trim().replace(/^([
54
40
  /** a draft's kind and its `kindWhy`, read the one way the load and SK042 read them */
55
41
  export const kindOfMeta = (meta: Readonly<Record<string, string | undefined>>): { kind: string; why: string } => ({ kind: unquote(meta['kind']), why: unquote(meta['kindWhy']) })
56
42
 
57
- /** why a draft's kind is wrong, or null; `old`: a word of the old words table, which a gate only warns on */
58
- export type KindProblem = { text: string; old: boolean }
59
-
60
43
  const INDEX = 'wiki guides/post-kinds/index.md'
61
44
 
62
- /** the kind a draft names, with its `kindWhy`, against the shared set and the project's own kinds */
63
- export function kindProblem(kind: string, why: string, own: readonly Pick<OwnKind, 'id'>[]): KindProblem | null {
45
+ /** why the kind a draft names, with its `kindWhy`, is none of the shared set and the project's own kinds, or null */
46
+ export function kindProblem(kind: string, why: string, own: readonly Pick<OwnKind, 'id'>[]): string | null {
64
47
  const k = kind.trim()
65
48
  const set = [...POST_KINDS, ...own.map((o) => o.id)].join(', ')
66
- if (k === '') return { text: `no kind: a draft names what it is for, one of ${set} (${INDEX})`, old: false }
67
- if (k === 'custom') return why.trim() === '' ? { text: `kind custom names no kindWhy: one line on why no kind fits (wiki ${kindPage('custom')})`, old: false } : null
49
+ if (k === '') return `no kind: a draft names what it is for, one of ${set} (${INDEX})`
50
+ if (k === 'custom') return why.trim() === '' ? `kind custom names no kindWhy: one line on why no kind fits (wiki ${kindPage('custom')})` : null
68
51
  if (isPostKind(k) || own.some((o) => o.id === k)) return null
69
- if (k in OLD_KINDS) {
70
- const to = OLD_KINDS[k]
71
- return to == null
72
- ? { text: `kind "${k}" is an old word and no post kind: a text that stays on a venue is a profile row of the identity (wiki tools/shipkit/social-identities.md)`, old: true }
73
- : { text: `kind "${k}" is an old word: ${to} by default, or the kind its intent reads as (wiki guides/post-kinds/old-words.md)`, old: true }
74
- }
75
- return { text: `kind "${k}" is not one of ${set}: a project's own kind is declared in its social unit's kinds (${INDEX})`, old: false }
52
+ return `kind "${k}" is not one of ${set}: a project's own kind is declared in its social unit's kinds (${INDEX})`
76
53
  }
77
54
 
78
55
  const WORD = /^[a-z][a-z0-9-]*$/
@@ -345,8 +345,8 @@ export function deskOf(root: string, ids: Identities, sources: readonly DraftSou
345
345
  }
346
346
  const kp = kindProblem(draft.kind, draft.kindWhy, unit?.kinds ?? [])
347
347
  if (kp != null) {
348
- draft.kindProblem = kp.text
349
- ;(kp.old ? warnings : errors).push(`${file}: ${kp.text}`)
348
+ draft.kindProblem = kp
349
+ errors.push(`${file}: ${kp}`)
350
350
  }
351
351
  const landings = new Map<string, Landing[]>()
352
352
  const placesFor = (a: DeskAccount): Landing[] => landings.get(a.id) ?? (landings.set(a.id, placesOf(a, errors)), landings.get(a.id)!)
@@ -1,10 +1,11 @@
1
1
  // one post's page (wiki tools/shipkit/social.md, Posts and their groups): the post as the desk loads it, its group and
2
2
  // siblings, its versions, and every thread that refers to it, the open ones first. Read only
3
3
  import { readAllCached, specOf, storeDir } from '../review/store.ts'
4
- import { membersOf, ownAddressesOf, threadsOf, threadTitle, turnOf } from '../review/threads.ts'
4
+ import { membersOf, ownAddressesOf, threadsOf, threadTitle } from '../review/threads.ts'
5
5
  import { accountOf, type Desk } from './load.ts'
6
6
  import { groupNow } from './post-sources.ts'
7
7
  import { postHistory, threadsReferring } from './posts.ts'
8
+ import { threadState } from '../review/thread-state.ts'
8
9
 
9
10
  export interface ThreadRef {
10
11
  /** what `sk thread show` and the threads page take: the thread's own address, else an item id of it */
@@ -31,7 +32,7 @@ export function refsOf(root: string, slug: string): ThreadRef[] {
31
32
  const out: ThreadRef[] = []
32
33
  for (const key of threadsReferring(root, slug)) {
33
34
  const t = threads.find((x) => ownAddressesOf(x, specOf(dir)).includes(key) || membersOf(x).some((m) => m.item.id === key))
34
- if (t != null) out.push({ key, id: t.head.item.id, title: threadTitle(t), open: turnOf(t) !== 'done' })
35
+ if (t != null) out.push({ key, id: t.head.item.id, title: threadTitle(t), open: threadState(t).active })
35
36
  }
36
37
  return out.sort((a, b) => Number(b.open) - Number(a.open))
37
38
  }
@@ -251,7 +251,7 @@ export function releaseThreads(root: string, slug: string): { range: string; thr
251
251
  const threads = threadsOf(items)
252
252
  .filter(ships)
253
253
  .map((t) => t.head)
254
- .filter((x) => x.item.origin.by === 'agent' && isApproved(verdictOf(x)?.status ?? 'rejected'))
254
+ .filter((x) => x.item.origin.by === 'agent' && isApproved(verdictOf(x)?.status ?? 'rework'))
255
255
  .sort((a, b) => b.item.created.localeCompare(a.item.created))
256
256
  .map((x) => ({ id: x.item.id, title: x.item.title, media: stageablesOf(x.item, 1) }))
257
257
  return { range, threads }
@@ -122,12 +122,12 @@ export function draftText(input: StageInput, media: string | null): string {
122
122
  export const stageSlug = (title: string, now: Date): string => idOf(now, title)
123
123
 
124
124
  /** the guard's problems with what the stage would write, and its kind's: run before any file is. A stage never writes
125
- * an old word or a custom with no reason, so every kind problem refuses it */
125
+ * a word off the set or a custom with no reason, so every kind problem refuses it */
126
126
  export function guardStage(unit: SocialUnit | null, input: StageInput): string[] {
127
127
  const kind = kindProblem(stagedKind(input), input.kindWhy ?? '', unit?.kinds ?? [])
128
128
  return [
129
129
  ...guardWith(unit, { title: input.title, alt: input.alt ?? '', texts: [input.text, ...(input.tags?.trim() ? [input.tags] : [])], files: stageMedia(input).map((m) => m.file) }),
130
- ...(kind ? [kind.text] : []),
130
+ ...(kind ? [kind] : []),
131
131
  ]
132
132
  }
133
133
 
@@ -3,6 +3,10 @@
3
3
  // its ask, the contract's lines. No fs, no fetch: desk.ts reads the files, the hub page imports this too
4
4
 
5
5
  export const STORE_IDS = ['steam', 'itch', 'chrome-web-store'] as const
6
+
7
+ /** the width a picture tile of the stores page loads (its file's url with `w`), in px: a tile draws about 456 px
8
+ * wide, sharp at 2x. The real size view and the lightbox load the file itself */
9
+ export const TILE_W = 960
6
10
  export type StoreId = (typeof STORE_IDS)[number]
7
11
  export const isStore = (s: unknown): s is StoreId => (STORE_IDS as readonly unknown[]).includes(s)
8
12
 
@@ -8,8 +8,9 @@ import { machineCommit } from '../core/machine-commit.ts'
8
8
  import { bad, FRESH, NO_STORE, ranged } from '../review/http.ts'
9
9
  import { noteOn } from '../review/notes.ts'
10
10
  import { openReview } from '../review/project.ts'
11
+ import { sizedImage } from '../review/previews.ts'
11
12
  import { FILE_ROUTE, loadStoresUnit, pasteHash, readPasted, shownFile, storesState, textFiles } from './desk.ts'
12
- import { fieldAsset, isStore, PASTED_FILE, setSection, STORE_DIR, STORE_NAME, type StoreId } from './model.ts'
13
+ import { fieldAsset, isStore, PASTED_FILE, setSection, STORE_DIR, STORE_NAME, TILE_W, type StoreId } from './model.ts'
13
14
  import { RENDER_FAMILIES, RENDER_TARGET, type RenderFamily } from './unit.ts'
14
15
 
15
16
  /** one make again at a time, per repo */
@@ -134,8 +135,15 @@ export async function storesRoutes(root: string, req: Request, path: string): Pr
134
135
  return Response.json(await storesState(root, dir), { headers: NO_STORE })
135
136
  }
136
137
  if (path.startsWith(FILE_ROUTE) && req.method === 'GET') {
137
- const abs = shownFile(root, decodeURIComponent(path.slice(FILE_ROUTE.length)))
138
- return abs ? ranged(req, abs, FRESH) : bad(`${path}?`, 404)
138
+ const rel = decodeURIComponent(path.slice(FILE_ROUTE.length))
139
+ const abs = shownFile(root, rel)
140
+ if (!abs) return bad(`${path}?`, 404)
141
+ // a tile asks its picture at the width it draws (TILE_W): a copy made once, the file itself when it does not read
142
+ if (new URL(req.url).searchParams.get('w') === String(TILE_W)) {
143
+ const small = await sizedImage(abs, join(root, '.shipkit', 'cache', 'previews', 'stores'), rel, TILE_W)
144
+ if (small) return new Response(Bun.file(small), { headers: { 'content-type': 'image/webp', 'cache-control': 'private, max-age=31536000, immutable' } })
145
+ }
146
+ return ranged(req, abs, FRESH)
139
147
  }
140
148
  if (req.method !== 'POST') return bad(`stores: no route ${req.method} ${path}`, 404)
141
149
  const body = (await req.json().catch(() => ({}))) as Record<string, unknown>
@@ -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 */