@warpgogol/forge 9.7.0 → 10.0.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 (327) hide show
  1. package/AGENTS.md +50 -27
  2. package/CHANGELOG.md +52 -0
  3. package/bin/cli.js +0 -0
  4. package/dist/os/adr/handlers/archive.d.ts.map +1 -1
  5. package/dist/os/adr/handlers/archive.js +3 -7
  6. package/dist/os/adr/handlers/archive.js.map +1 -1
  7. package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
  8. package/dist/os/adr/handlers/list-create.js +8 -6
  9. package/dist/os/adr/handlers/list-create.js.map +1 -1
  10. package/dist/os/audit/handlers/archive.d.ts.map +1 -1
  11. package/dist/os/audit/handlers/archive.js +3 -7
  12. package/dist/os/audit/handlers/archive.js.map +1 -1
  13. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
  14. package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
  15. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
  16. package/dist/os/core/archive-regen.d.ts +1 -0
  17. package/dist/os/core/archive-regen.d.ts.map +1 -1
  18. package/dist/os/core/archive-regen.js +31 -6
  19. package/dist/os/core/archive-regen.js.map +1 -1
  20. package/dist/os/core/core.module.d.ts.map +1 -1
  21. package/dist/os/core/core.module.js +6 -69
  22. package/dist/os/core/core.module.js.map +1 -1
  23. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
  24. package/dist/os/core/handlers/assets-helpers.js +2 -3
  25. package/dist/os/core/handlers/assets-helpers.js.map +1 -1
  26. package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
  27. package/dist/os/core/handlers/determinism-check.js +2 -3
  28. package/dist/os/core/handlers/determinism-check.js.map +1 -1
  29. package/dist/os/core/handlers/pinned-check.d.ts +13 -0
  30. package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
  31. package/dist/os/core/handlers/pinned-check.js +25 -0
  32. package/dist/os/core/handlers/pinned-check.js.map +1 -1
  33. package/dist/os/core/handlers/pinned-types.d.ts +7 -0
  34. package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
  35. package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
  36. package/dist/os/core/handlers/pinned-validate.js +24 -1
  37. package/dist/os/core/handlers/pinned-validate.js.map +1 -1
  38. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
  39. package/dist/os/core/handlers/release-prepare.js +2 -4
  40. package/dist/os/core/handlers/release-prepare.js.map +1 -1
  41. package/dist/os/flow/digest.d.ts +73 -1
  42. package/dist/os/flow/digest.d.ts.map +1 -1
  43. package/dist/os/flow/digest.js +344 -92
  44. package/dist/os/flow/digest.js.map +1 -1
  45. package/dist/os/flow/evidence-lock.d.ts +36 -0
  46. package/dist/os/flow/evidence-lock.d.ts.map +1 -0
  47. package/dist/os/flow/evidence-lock.js +156 -0
  48. package/dist/os/flow/evidence-lock.js.map +1 -0
  49. package/dist/os/flow/flow.module.d.ts.map +1 -1
  50. package/dist/os/flow/flow.module.js +36 -14
  51. package/dist/os/flow/flow.module.js.map +1 -1
  52. package/dist/os/flow/git.d.ts +50 -3
  53. package/dist/os/flow/git.d.ts.map +1 -1
  54. package/dist/os/flow/git.js +144 -12
  55. package/dist/os/flow/git.js.map +1 -1
  56. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
  57. package/dist/os/flow/handlers/flow-digest.js +3 -5
  58. package/dist/os/flow/handlers/flow-digest.js.map +1 -1
  59. package/dist/os/flow/handlers/flow-peers.js +1 -1
  60. package/dist/os/flow/handlers/flow-peers.js.map +1 -1
  61. package/dist/os/flow/handlers/flow-push.d.ts +81 -0
  62. package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
  63. package/dist/os/flow/handlers/flow-push.js +642 -138
  64. package/dist/os/flow/handlers/flow-push.js.map +1 -1
  65. package/dist/os/flow/locks.d.ts +8 -0
  66. package/dist/os/flow/locks.d.ts.map +1 -1
  67. package/dist/os/flow/locks.js +6 -3
  68. package/dist/os/flow/locks.js.map +1 -1
  69. package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
  70. package/dist/os/flow/open-missions.d.ts.map +1 -0
  71. package/dist/os/flow/open-missions.js +37 -0
  72. package/dist/os/flow/open-missions.js.map +1 -0
  73. package/dist/os/flow/preflight.d.ts.map +1 -1
  74. package/dist/os/flow/preflight.js +5 -3
  75. package/dist/os/flow/preflight.js.map +1 -1
  76. package/dist/os/flow/registry.d.ts +9 -5
  77. package/dist/os/flow/registry.d.ts.map +1 -1
  78. package/dist/os/flow/registry.js +2 -2
  79. package/dist/os/flow/registry.js.map +1 -1
  80. package/dist/os/friction/friction.module.d.ts.map +1 -1
  81. package/dist/os/friction/friction.module.js +30 -5
  82. package/dist/os/friction/friction.module.js.map +1 -1
  83. package/dist/os/friction/handlers/friction-add.d.ts.map +1 -1
  84. package/dist/os/friction/handlers/friction-add.js +10 -17
  85. package/dist/os/friction/handlers/friction-add.js.map +1 -1
  86. package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -1
  87. package/dist/os/friction/handlers/friction-migrate.js +188 -2
  88. package/dist/os/friction/handlers/friction-migrate.js.map +1 -1
  89. package/dist/os/friction/store.d.ts +4 -0
  90. package/dist/os/friction/store.d.ts.map +1 -1
  91. package/dist/os/friction/store.js +20 -0
  92. package/dist/os/friction/store.js.map +1 -1
  93. package/dist/os/friction/types.d.ts +12 -0
  94. package/dist/os/friction/types.d.ts.map +1 -1
  95. package/dist/os/friction/types.js +8 -0
  96. package/dist/os/friction/types.js.map +1 -1
  97. package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
  98. package/dist/os/gate/handlers/gate-probe-catalog.js +38 -5
  99. package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
  100. package/dist/os/plan/handlers/archive.d.ts.map +1 -1
  101. package/dist/os/plan/handlers/archive.js +3 -7
  102. package/dist/os/plan/handlers/archive.js.map +1 -1
  103. package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
  104. package/dist/os/rfc/handlers/archive.js +3 -7
  105. package/dist/os/rfc/handlers/archive.js.map +1 -1
  106. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  107. package/dist/os/rfc/handlers/list-create.js +15 -7
  108. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  109. package/dist/os/session/handlers/archive.d.ts.map +1 -1
  110. package/dist/os/session/handlers/archive.js +3 -7
  111. package/dist/os/session/handlers/archive.js.map +1 -1
  112. package/dist/os/system/handlers/system-product-register.d.ts +24 -0
  113. package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
  114. package/dist/os/system/handlers/system-product-register.js +322 -0
  115. package/dist/os/system/handlers/system-product-register.js.map +1 -0
  116. package/dist/os/system/handlers/system-products-status.d.ts +23 -0
  117. package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
  118. package/dist/os/system/handlers/system-products-status.js +235 -0
  119. package/dist/os/system/handlers/system-products-status.js.map +1 -0
  120. package/dist/os/system/schemas.d.ts +13 -0
  121. package/dist/os/system/schemas.d.ts.map +1 -1
  122. package/dist/os/system/schemas.js +15 -0
  123. package/dist/os/system/schemas.js.map +1 -1
  124. package/dist/os/system/system.module.d.ts.map +1 -1
  125. package/dist/os/system/system.module.js +113 -3
  126. package/dist/os/system/system.module.js.map +1 -1
  127. package/dist/src/command-modules.d.ts.map +1 -1
  128. package/dist/src/command-modules.js +0 -2
  129. package/dist/src/command-modules.js.map +1 -1
  130. package/dist/src/config/forge-config.d.ts +2 -0
  131. package/dist/src/config/forge-config.d.ts.map +1 -1
  132. package/dist/src/config/forge-config.js +11 -10
  133. package/dist/src/config/forge-config.js.map +1 -1
  134. package/dist/src/index.d.ts +0 -2
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/src/index.js +0 -2
  137. package/dist/src/index.js.map +1 -1
  138. package/dist/src/onboarding/create.d.ts.map +1 -1
  139. package/dist/src/onboarding/create.js +27 -2
  140. package/dist/src/onboarding/create.js.map +1 -1
  141. package/dist/src/onboarding/doctor.d.ts +0 -5
  142. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  143. package/dist/src/onboarding/doctor.js +6 -79
  144. package/dist/src/onboarding/doctor.js.map +1 -1
  145. package/dist/src/onboarding/npm-token-check.d.ts +1 -1
  146. package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
  147. package/dist/src/onboarding/npm-token-check.js +2 -2
  148. package/dist/src/onboarding/npm-token-check.js.map +1 -1
  149. package/dist/src/profiles/stack-profile.js +2 -2
  150. package/dist/src/types.js +2 -2
  151. package/dist/src/utils/hash.d.ts +1 -0
  152. package/dist/src/utils/hash.d.ts.map +1 -1
  153. package/dist/src/utils/hash.js +4 -0
  154. package/dist/src/utils/hash.js.map +1 -1
  155. package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
  156. package/dist/src/utils/lockfile.d.ts.map +1 -0
  157. package/dist/src/utils/lockfile.js +70 -0
  158. package/dist/src/utils/lockfile.js.map +1 -0
  159. package/dist/src/utils/verifier-git.d.ts +27 -1
  160. package/dist/src/utils/verifier-git.d.ts.map +1 -1
  161. package/dist/src/utils/verifier-git.js +36 -6
  162. package/dist/src/utils/verifier-git.js.map +1 -1
  163. package/docs/reference/system-hub.md +104 -0
  164. package/os/adr/handlers/archive.ts +3 -11
  165. package/os/adr/handlers/list-create.test.ts +174 -0
  166. package/os/adr/handlers/list-create.ts +16 -8
  167. package/os/audit/handlers/archive.ts +3 -11
  168. package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
  169. package/os/core/archive-regen.ts +33 -7
  170. package/os/core/core.module.ts +10 -76
  171. package/os/core/docs-archive.test.ts +25 -0
  172. package/os/core/handlers/assets-helpers.ts +2 -4
  173. package/os/core/handlers/determinism-check.ts +2 -3
  174. package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
  175. package/os/core/handlers/pinned-check.ts +30 -0
  176. package/os/core/handlers/pinned-types.ts +7 -0
  177. package/os/core/handlers/pinned-validate.ts +28 -3
  178. package/os/core/handlers/release-prepare.ts +2 -4
  179. package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
  180. package/os/flow/digest.ts +436 -95
  181. package/os/flow/evidence-lock.ts +184 -0
  182. package/os/flow/flow.module.ts +37 -14
  183. package/os/flow/git.ts +206 -11
  184. package/os/flow/handlers/flow-digest.ts +12 -8
  185. package/os/flow/handlers/flow-peers.ts +1 -1
  186. package/os/flow/handlers/flow-push.ts +725 -137
  187. package/os/flow/locks.ts +24 -7
  188. package/os/flow/open-missions.ts +45 -0
  189. package/os/flow/preflight.ts +5 -3
  190. package/os/flow/registry.ts +7 -3
  191. package/os/flow/tests/digest-id-inputs.test.ts +106 -0
  192. package/os/flow/tests/digest-persist.test.ts +243 -0
  193. package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
  194. package/os/flow/tests/flow-push-attest.test.ts +137 -0
  195. package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
  196. package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
  197. package/os/flow/tests/release-lines.test.ts +136 -0
  198. package/os/flow/tests/state-roots.test.ts +1 -48
  199. package/os/friction/friction-add.test.ts +42 -0
  200. package/os/friction/friction-migrate.test.ts +67 -2
  201. package/os/friction/friction.module.ts +33 -5
  202. package/os/friction/handlers/friction-add.ts +10 -15
  203. package/os/friction/handlers/friction-migrate.ts +220 -1
  204. package/os/friction/store.ts +19 -0
  205. package/os/friction/types.ts +8 -0
  206. package/os/gate/handlers/gate-probe-catalog.ts +39 -7
  207. package/os/gate/handlers/gate-probe-ratchet.test.ts +57 -22
  208. package/os/plan/handlers/archive.ts +3 -11
  209. package/os/rfc/handlers/archive.ts +3 -11
  210. package/os/rfc/handlers/list-create.ts +22 -17
  211. package/os/rfc/handlers/validate-corpus.test.ts +149 -0
  212. package/os/rfc/probe-batch.test.ts +253 -0
  213. package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
  214. package/os/session/handlers/archive.ts +3 -11
  215. package/os/system/handlers/system-product-register.ts +492 -0
  216. package/os/system/handlers/system-products-status.ts +395 -0
  217. package/os/system/schemas.ts +17 -0
  218. package/os/system/system.module.ts +117 -3
  219. package/os/system/tests/system-product-register.test.ts +304 -0
  220. package/os/system/tests/system-products-status.test.ts +154 -0
  221. package/package.json +161 -506
  222. package/profiles/root-agents-system.md +82 -0
  223. package/profiles/system.yaml +1 -0
  224. package/src/command-modules.ts +0 -2
  225. package/src/config/forge-config.ts +16 -11
  226. package/src/index.ts +0 -2
  227. package/src/onboarding/create-superfolder-guard.test.ts +73 -0
  228. package/src/onboarding/create.ts +28 -2
  229. package/src/onboarding/doctor.ts +9 -96
  230. package/src/onboarding/npm-token-check.ts +3 -3
  231. package/src/profiles/stack-profile.ts +2 -2
  232. package/src/tests/evidence-consult-serialization.test.ts +202 -0
  233. package/src/tests/pinned-validate.test.ts +194 -0
  234. package/src/tests/pkg-health-self-scan.test.ts +29 -0
  235. package/src/tests/profile-flow-hooks.test.ts +1 -0
  236. package/src/tests/profile-schema.test.ts +1 -0
  237. package/src/tests/rfc-evidence-sync.test.ts +369 -0
  238. package/src/tests/skill-agents-sync.test.ts +192 -0
  239. package/src/tests/stack-profile.test.ts +1 -0
  240. package/src/types.ts +2 -2
  241. package/src/utils/hash.ts +5 -0
  242. package/src/utils/lockfile.ts +78 -0
  243. package/src/utils/verifier-git.ts +53 -5
  244. package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
  245. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
  246. package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
  247. package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
  248. package/dist/os/mission/handlers/archive.d.ts +0 -4
  249. package/dist/os/mission/handlers/archive.d.ts.map +0 -1
  250. package/dist/os/mission/handlers/archive.js +0 -587
  251. package/dist/os/mission/handlers/archive.js.map +0 -1
  252. package/dist/os/mission/importer-block.d.ts +0 -19
  253. package/dist/os/mission/importer-block.d.ts.map +0 -1
  254. package/dist/os/mission/importer-block.js +0 -124
  255. package/dist/os/mission/importer-block.js.map +0 -1
  256. package/dist/os/mission/index.d.ts +0 -2
  257. package/dist/os/mission/index.d.ts.map +0 -1
  258. package/dist/os/mission/index.js +0 -15
  259. package/dist/os/mission/index.js.map +0 -1
  260. package/dist/os/mission/lockfile.d.ts.map +0 -1
  261. package/dist/os/mission/lockfile.js +0 -138
  262. package/dist/os/mission/lockfile.js.map +0 -1
  263. package/dist/os/mission/mission.module.d.ts +0 -3
  264. package/dist/os/mission/mission.module.d.ts.map +0 -1
  265. package/dist/os/mission/mission.module.js +0 -63
  266. package/dist/os/mission/mission.module.js.map +0 -1
  267. package/dist/os/mission/open-missions.d.ts.map +0 -1
  268. package/dist/os/mission/open-missions.js +0 -42
  269. package/dist/os/mission/open-missions.js.map +0 -1
  270. package/dist/os/mission/types.d.ts +0 -23
  271. package/dist/os/mission/types.d.ts.map +0 -1
  272. package/dist/os/mission/types.js +0 -19
  273. package/dist/os/mission/types.js.map +0 -1
  274. package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
  275. package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
  276. package/dist/os/werkstatt/handlers/lock.js +0 -153
  277. package/dist/os/werkstatt/handlers/lock.js.map +0 -1
  278. package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
  279. package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
  280. package/dist/os/werkstatt/handlers/schema.js +0 -42
  281. package/dist/os/werkstatt/handlers/schema.js.map +0 -1
  282. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
  283. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
  284. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
  285. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
  286. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
  287. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
  288. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
  289. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
  290. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
  291. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
  292. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
  293. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
  294. package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
  295. package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
  296. package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
  297. package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
  298. package/dist/os/werkstatt/index.d.ts +0 -7
  299. package/dist/os/werkstatt/index.d.ts.map +0 -1
  300. package/dist/os/werkstatt/index.js +0 -18
  301. package/dist/os/werkstatt/index.js.map +0 -1
  302. package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
  303. package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
  304. package/dist/os/werkstatt/werkstatt.module.js +0 -91
  305. package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
  306. package/os/core/handlers/forge-autonomy-validate.ts +0 -276
  307. package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
  308. package/os/mission/handlers/archive.test.ts +0 -764
  309. package/os/mission/handlers/archive.ts +0 -719
  310. package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
  311. package/os/mission/importer-block.ts +0 -119
  312. package/os/mission/index.ts +0 -15
  313. package/os/mission/lockfile.ts +0 -152
  314. package/os/mission/mission.module.ts +0 -68
  315. package/os/mission/open-missions.ts +0 -50
  316. package/os/mission/types.ts +0 -42
  317. package/os/werkstatt/handlers/lock.ts +0 -168
  318. package/os/werkstatt/handlers/schema.ts +0 -47
  319. package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
  320. package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
  321. package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
  322. package/os/werkstatt/handlers/workspace-deps.ts +0 -56
  323. package/os/werkstatt/index.ts +0 -39
  324. package/os/werkstatt/werkstatt.module.ts +0 -95
  325. package/src/tests/doctor-autonomy.test.ts +0 -246
  326. package/src/tests/forge-autonomy-validate.test.ts +0 -159
  327. package/src/tests/werkstatt-lock.test.ts +0 -357
@@ -0,0 +1,253 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for probe-batch — segment planning across barriers, per-(file,testName) report attribution, runProbeSet ordering and --no-batch escape, and the one-spawn e2e (RFC-1489).
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1489: batched test-probe planning + attribution coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
15
+ import { test, expect, describe } from "vitest";
16
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
17
+ import { join } from "node:path";
18
+ import { tmpdir } from "node:os";
19
+
20
+ import {
21
+ planProbeSegments,
22
+ attributeProbeResult,
23
+ runBatchedTestSegment,
24
+ type ProbeSegment,
25
+ } from "./probe-batch.ts";
26
+ import { runProbeSet } from "./acceptance.ts";
27
+ import type { AcceptanceProbe } from "./types.ts";
28
+
29
+ const WORKSPACE_ROOT = join(__dirname, "..", "..", "..", "..");
30
+
31
+ const testProbe = (
32
+ file: string,
33
+ overrides: Partial<Extract<AcceptanceProbe, { probe: "test" }>> = {},
34
+ ): Extract<AcceptanceProbe, { probe: "test" }> => ({
35
+ probe: "test",
36
+ file,
37
+ expect: { exitCode: 0 },
38
+ ...overrides,
39
+ });
40
+
41
+ const fileExists = (path: string): AcceptanceProbe => ({ probe: "file-exists", path });
42
+ const runProbe = (command: string): AcceptanceProbe => ({
43
+ probe: "run",
44
+ command,
45
+ expect: { exitCode: 0 },
46
+ });
47
+
48
+ describe("planProbeSegments — AC-1 barrier-free grouping", () => {
49
+ test("contiguous same-bound test probes form one segment", () => {
50
+ const probes = [
51
+ testProbe("a.test.ts"),
52
+ testProbe("b.test.ts"),
53
+ testProbe("c.test.ts", { timeoutMs: 120_000 }),
54
+ ];
55
+ expect(planProbeSegments(probes, 120_000)).toEqual([
56
+ { start: 0, members: [0, 1, 2], boundMs: 120_000 },
57
+ ]);
58
+ });
59
+
60
+ test("a timeoutMs change closes the segment", () => {
61
+ const probes = [
62
+ testProbe("a.test.ts"),
63
+ testProbe("b.test.ts", { timeoutMs: 5_000 }),
64
+ testProbe("c.test.ts"),
65
+ ];
66
+ expect(planProbeSegments(probes, 120_000)).toEqual([
67
+ { start: 0, members: [0], boundMs: 120_000 },
68
+ { start: 1, members: [1], boundMs: 5_000 },
69
+ { start: 2, members: [2], boundMs: 120_000 },
70
+ ]);
71
+ });
72
+
73
+ test("run/page/proof are the only barriers — other kinds span without splitting", () => {
74
+ const probes: AcceptanceProbe[] = [
75
+ testProbe("a.test.ts"),
76
+ runProbe("site-kernel run x"),
77
+ testProbe("b.test.ts"),
78
+ { probe: "page", target: "site", path: "/", expect: { status: 200 } } as AcceptanceProbe,
79
+ testProbe("c.test.ts"),
80
+ { probe: "proof", spec: "s.yaml" },
81
+ testProbe("d.test.ts"),
82
+ fileExists("x.txt"),
83
+ testProbe("e.test.ts"),
84
+ ];
85
+ expect(planProbeSegments(probes, 120_000)).toEqual([
86
+ { start: 0, members: [0], boundMs: 120_000 },
87
+ { start: 2, members: [2], boundMs: 120_000 },
88
+ { start: 4, members: [4], boundMs: 120_000 },
89
+ { start: 6, members: [6, 8], boundMs: 120_000 },
90
+ ]);
91
+ });
92
+ });
93
+
94
+ describe("attributeProbeResult — AC-2/AC-3 per-slice attribution", () => {
95
+ const report = {
96
+ testResults: [
97
+ {
98
+ name: join(WORKSPACE_ROOT, "os/rfc/a.test.ts"),
99
+ status: "passed",
100
+ assertionResults: [
101
+ { title: "first", fullName: "suite first", status: "passed" },
102
+ { title: "second", fullName: "suite second", status: "passed" },
103
+ ],
104
+ },
105
+ {
106
+ name: join(WORKSPACE_ROOT, "os/rfc/b.test.ts"),
107
+ status: "failed",
108
+ assertionResults: [
109
+ { title: "x", fullName: "bsuite x", status: "failed" },
110
+ { title: "y", fullName: "bsuite y", status: "passed" },
111
+ ],
112
+ },
113
+ ],
114
+ };
115
+
116
+ test("each probe derives only from its own file slice", () => {
117
+ const a = attributeProbeResult(testProbe("os/rfc/a.test.ts"), WORKSPACE_ROOT, report);
118
+ const b = attributeProbeResult(testProbe("os/rfc/b.test.ts"), WORKSPACE_ROOT, report);
119
+ expect(a.ok).toBe(true);
120
+ expect(a.verdict).toBe("pass");
121
+ expect(b.ok).toBe(false);
122
+ expect(b.verdict).toBe("fail");
123
+ expect(b.detail).toContain("expected 0");
124
+ });
125
+
126
+ test("testName attribution matches only its own assertions", () => {
127
+ const ok = attributeProbeResult(
128
+ testProbe("os/rfc/b.test.ts", { testName: "bsuite y" }),
129
+ WORKSPACE_ROOT,
130
+ report,
131
+ );
132
+ expect(ok.ok).toBe(true);
133
+ const fail = attributeProbeResult(
134
+ testProbe("os/rfc/b.test.ts", { testName: "bsuite x" }),
135
+ WORKSPACE_ROOT,
136
+ report,
137
+ );
138
+ expect(fail.ok).toBe(false);
139
+ });
140
+
141
+ test("expected-nonzero exitCode inverts the derived verdict", () => {
142
+ const p = attributeProbeResult(
143
+ testProbe("os/rfc/b.test.ts", { expect: { exitCode: 1 } }),
144
+ WORKSPACE_ROOT,
145
+ report,
146
+ );
147
+ expect(p.ok).toBe(true);
148
+ expect(p.verdict).toBe("pass");
149
+ });
150
+
151
+ test("absent file slice is unverified, never pass", () => {
152
+ const p = attributeProbeResult(testProbe("os/rfc/missing.test.ts"), WORKSPACE_ROOT, report);
153
+ expect(p.ok).toBe(false);
154
+ expect(p.verdict).toBe("unverified");
155
+ });
156
+
157
+ test("testName matching no assertion is a fail (vitest -t parity, spec §4)", () => {
158
+ const p = attributeProbeResult(
159
+ testProbe("os/rfc/a.test.ts", { testName: "no such test" }),
160
+ WORKSPACE_ROOT,
161
+ report,
162
+ );
163
+ expect(p.ok).toBe(false);
164
+ expect(p.verdict).toBe("fail");
165
+ expect(p.detail).toContain("no testName match");
166
+ });
167
+
168
+ test("file-level requires status passed — skipped cannot prove execution", () => {
169
+ const skipped = {
170
+ testResults: [
171
+ {
172
+ name: join(WORKSPACE_ROOT, "os/rfc/s.test.ts"),
173
+ status: "skipped",
174
+ assertionResults: [{ title: "x", fullName: "s x", status: "skipped" }],
175
+ },
176
+ ],
177
+ };
178
+ const p = attributeProbeResult(testProbe("os/rfc/s.test.ts"), WORKSPACE_ROOT, skipped);
179
+ expect(p.ok).toBe(false);
180
+ expect(p.verdict).not.toBe("pass");
181
+ });
182
+ });
183
+
184
+ describe("runProbeSet — AC-2 order/shape, AC-4 --no-batch", () => {
185
+ test("preserves declared order across barriers; missing files are unverified", async () => {
186
+ const dir = mkdtempSync(join(tmpdir(), "probe-set-"));
187
+ try {
188
+ writeFileSync(join(dir, "present.txt"), "x");
189
+ const probes: AcceptanceProbe[] = [
190
+ fileExists("present.txt"),
191
+ testProbe("missing-a.test.ts"),
192
+ testProbe("missing-b.test.ts"),
193
+ fileExists("absent.txt"),
194
+ testProbe("missing-c.test.ts"),
195
+ ];
196
+ const { results, durationsMs } = await runProbeSet(probes, { workspaceRoot: dir });
197
+ expect(results).toHaveLength(5);
198
+ expect(results[0]!.ok).toBe(true);
199
+ expect(results[1]!.verdict).toBe("unverified");
200
+ expect(results[1]!.detail).toContain("missing-a.test.ts");
201
+ expect(results[2]!.verdict).toBe("unverified");
202
+ expect(results[3]!.ok).toBe(false);
203
+ expect(results[3]!.verdict).not.toBe("unverified");
204
+ // Indexes 1,2,4 are all same-bound test probes with no run/page/proof
205
+ // barrier between them — they share ONE segment; each missing file is
206
+ // attributed unverified from its own slice.
207
+ expect(results[4]!.verdict).toBe("unverified");
208
+ expect(results[4]!.detail).toContain("missing-c.test.ts");
209
+ expect(durationsMs).toHaveLength(5);
210
+ // Each batched result echoes its own declared probe.
211
+ results.forEach((r, i) => expect(r.probe).toBe(probes[i]));
212
+ } finally {
213
+ rmSync(dir, { recursive: true, force: true });
214
+ }
215
+ });
216
+
217
+ test("--no-batch forces the legacy per-probe path (spawn-failure != unverified)", async () => {
218
+ const dir = mkdtempSync(join(tmpdir(), "probe-set-nb-"));
219
+ try {
220
+ const probes = [testProbe("missing-a.test.ts"), testProbe("missing-b.test.ts")];
221
+ const legacy = await runProbeSet(probes, { workspaceRoot: dir, noBatch: true });
222
+ // Legacy spawns vitest per probe in the tmp workspace — the spawn fails,
223
+ // producing a fail verdict rather than the batched "unverified".
224
+ for (const r of legacy.results) {
225
+ expect(r.verdict).not.toBe("unverified");
226
+ expect(r.ok).toBe(false);
227
+ }
228
+ } finally {
229
+ rmSync(dir, { recursive: true, force: true });
230
+ }
231
+ }, 60_000);
232
+ });
233
+
234
+ describe("e2e — one instrumented Vitest run attributes two files", () => {
235
+ test(
236
+ "two real test files in one segment produce per-file verdicts (AC-1/AC-2)",
237
+ async () => {
238
+ const segment: ProbeSegment = { start: 0, members: [0, 1], boundMs: 120_000 };
239
+ const probes = [
240
+ testProbe("packages/forge/os/rfc/verification-normalize.test.ts"),
241
+ testProbe("packages/forge/os/rfc/frontmatter-io.test.ts"),
242
+ ];
243
+ const results = await runBatchedTestSegment(probes, segment, WORKSPACE_ROOT);
244
+ expect(results.size).toBe(2);
245
+ const a = results.get(0)!;
246
+ const b = results.get(1)!;
247
+ expect(a.verdict, `probe 0 must attribute its own file — ${a.detail}`).toBe("pass");
248
+ expect(b.verdict, `probe 1 must attribute its own file — ${b.detail}`).toBe("pass");
249
+ expect(a.detail).toContain("batched:");
250
+ },
251
+ 180_000,
252
+ );
253
+ });
@@ -0,0 +1,63 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Independent acceptance-verifier check for RFC-1391 (ac10-operating-model-policy) — authored inside
5
+ rfc.verify.workspace by the clean-context verifier, not by the implementer.
6
+ Derives its expectation from the RFC text and the observable behavior of the
7
+ real handlers/runner it exercises.
8
+ </purpose>
9
+ <non-goals>
10
+ <item>Do not treat as implementer-authored evidence — its expectationSource is independent.</item>
11
+ <item>Do not edit to fit the code — a failure here is a counterexample, fix the implementation.</item>
12
+ </non-goals>
13
+ </MODULE_CONTRACT>
14
+ <CHANGE_SUMMARY>
15
+ <item>RFC-1391 r1 verification: independent check ac10-operating-model-policy.</item>
16
+ <item>RFC-1391: commit independent verifier checks + independent probes + round-1 pass report
17
+
18
+ Round-0 verdict counterexamples (CX-1: emit dead for proof-probe RFCs),
19
+ fixed in 1342fe21a; round-1 verdict pass — 47/47 checks, AC-1..AC-10 all
20
+ verified on the real implementation surface, non-vacuity re-verified by
21
+ mutation.</item>
22
+ </CHANGE_SUMMARY>
23
+ */
24
+
25
+ // RFC-1391 AC-10 — "The agent operating model SHALL state that only a
26
+ // mechanical checker verdict counts as formal-tier evidence."
27
+ // RFC design: an agent-written argument, a random-sampling property test, or
28
+ // an unavailable checker must never be accepted as formal evidence — the
29
+ // operating model text is the enforcement surface agents read.
30
+ //
31
+ // Independent check: the canonical source file under packages/forge/skills/
32
+ // carries the policy, and the synced .agents mirror is byte-identical (the
33
+ // documented sync contract — drift would silently un-teach agents).
34
+
35
+ import { createHash } from "node:crypto";
36
+ import { readFileSync } from "node:fs";
37
+ import { join } from "node:path";
38
+ import { describe, expect, it } from "vitest";
39
+
40
+ import { EXPORT_ROOT, FORGE_ROOT } from "./support.ts";
41
+
42
+ const SRC = join(FORGE_ROOT, "skills/_shared/agent-operating-model.md");
43
+ const MIRROR = join(EXPORT_ROOT, ".agents/skills/_shared/agent-operating-model.md");
44
+
45
+ const sha = (p: string) => createHash("sha256").update(readFileSync(p)).digest("hex");
46
+
47
+ describe("AC-10: operating model binds formal evidence to a mechanical checker verdict", () => {
48
+ it("the source operating model states the policy", () => {
49
+ const text = readFileSync(SRC, "utf8");
50
+ // The load-bearing claim: mechanical-verdict-only formal evidence.
51
+ expect(text).toContain("Only a mechanical checker verdict");
52
+ // It must name the instrument and the bound spec schema.
53
+ expect(text).toContain("proof.check");
54
+ expect(text).toContain("proved");
55
+ expect(text).toContain("forge/proof-spec@1");
56
+ // And it must exclude the non-mechanical substitutes the RFC calls out.
57
+ expect(text).toMatch(/never does|never counts/i);
58
+ });
59
+
60
+ it("the .agents mirror is byte-identical to the source (sync contract)", () => {
61
+ expect(sha(MIRROR)).toBe(sha(SRC));
62
+ });
63
+ });
@@ -35,7 +35,7 @@ import {
35
35
  type SessionArchiveMove,
36
36
  type SessionArchiveSkip,
37
37
  } from "../types.ts";
38
- import { loadPinnedManifest, isPinned, isIntraDirMove } from "../../core/handlers/pinned-check.ts";
38
+ import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
39
39
 
40
40
  const DEFAULT_MAX_AGE_DAYS = 7;
41
41
 
@@ -118,11 +118,7 @@ export async function runSessionArchive(
118
118
 
119
119
  // RFC-0733: Check if file is pinned before moving
120
120
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
121
- if (
122
- pinnedManifest &&
123
- isPinned(pinnedManifest, relFile) &&
124
- !isIntraDirMove(pinnedManifest, relFile, targetRel)
125
- ) {
121
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
126
122
  skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
127
123
  if (outputFormat === "pretty") {
128
124
  logger.warn(` pinned: skipping ${relFile} (protected)`);
@@ -206,11 +202,7 @@ export async function runSessionArchive(
206
202
 
207
203
  // RFC-0733: Check if file is pinned before moving
208
204
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
209
- if (
210
- pinnedManifest &&
211
- isPinned(pinnedManifest, archRelFile) &&
212
- !isIntraDirMove(pinnedManifest, archRelFile, targetRel)
213
- ) {
205
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, archRelFile, targetRel)) {
214
206
  skipped.push({ id, file: archRelFile, reason: "pinned (protected by .forge/pinned.yaml)" });
215
207
  if (outputFormat === "pretty") {
216
208
  logger.warn(` pinned: skipping ${archRelFile} (protected)`);