@gate-forge/cli 0.7.1 → 0.9.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 (296) hide show
  1. package/README.md +91 -704
  2. package/dist/adapter-audit.d.ts +208 -0
  3. package/dist/adapter-audit.d.ts.map +1 -0
  4. package/dist/adapter-audit.js +579 -0
  5. package/dist/adapter-audit.js.map +1 -0
  6. package/dist/adapter-scaffold.d.ts +91 -0
  7. package/dist/adapter-scaffold.d.ts.map +1 -0
  8. package/dist/adapter-scaffold.js +474 -0
  9. package/dist/adapter-scaffold.js.map +1 -0
  10. package/dist/adopted-baseline.d.ts +10 -0
  11. package/dist/adopted-baseline.d.ts.map +1 -1
  12. package/dist/adopted-baseline.js +18 -1
  13. package/dist/adopted-baseline.js.map +1 -1
  14. package/dist/args.d.ts +15 -0
  15. package/dist/args.d.ts.map +1 -1
  16. package/dist/args.js +61 -2
  17. package/dist/args.js.map +1 -1
  18. package/dist/behavior-setup.d.ts +239 -0
  19. package/dist/behavior-setup.d.ts.map +1 -0
  20. package/dist/behavior-setup.js +751 -0
  21. package/dist/behavior-setup.js.map +1 -0
  22. package/dist/broker.d.ts.map +1 -1
  23. package/dist/broker.js +28 -2
  24. package/dist/broker.js.map +1 -1
  25. package/dist/cache-exclusions.d.ts +45 -0
  26. package/dist/cache-exclusions.d.ts.map +1 -0
  27. package/dist/cache-exclusions.js +205 -0
  28. package/dist/cache-exclusions.js.map +1 -0
  29. package/dist/candidate-tree.d.ts +86 -14
  30. package/dist/candidate-tree.d.ts.map +1 -1
  31. package/dist/candidate-tree.js +236 -62
  32. package/dist/candidate-tree.js.map +1 -1
  33. package/dist/ci-witnessed-template.d.ts +43 -0
  34. package/dist/ci-witnessed-template.d.ts.map +1 -0
  35. package/dist/ci-witnessed-template.js +283 -0
  36. package/dist/ci-witnessed-template.js.map +1 -0
  37. package/dist/cli.d.ts +1 -1
  38. package/dist/cli.d.ts.map +1 -1
  39. package/dist/cli.js +31 -4
  40. package/dist/cli.js.map +1 -1
  41. package/dist/commands/adapters.d.ts +15 -0
  42. package/dist/commands/adapters.d.ts.map +1 -0
  43. package/dist/commands/adapters.js +355 -0
  44. package/dist/commands/adapters.js.map +1 -0
  45. package/dist/commands/adopt.d.ts +7 -0
  46. package/dist/commands/adopt.d.ts.map +1 -1
  47. package/dist/commands/adopt.js +44 -2
  48. package/dist/commands/adopt.js.map +1 -1
  49. package/dist/commands/baseline.d.ts.map +1 -1
  50. package/dist/commands/baseline.js +42 -1
  51. package/dist/commands/baseline.js.map +1 -1
  52. package/dist/commands/blocking.d.ts +105 -2
  53. package/dist/commands/blocking.d.ts.map +1 -1
  54. package/dist/commands/blocking.js +395 -53
  55. package/dist/commands/blocking.js.map +1 -1
  56. package/dist/commands/check.d.ts +36 -0
  57. package/dist/commands/check.d.ts.map +1 -1
  58. package/dist/commands/check.js +1068 -64
  59. package/dist/commands/check.js.map +1 -1
  60. package/dist/commands/classify.d.ts +2 -1
  61. package/dist/commands/classify.d.ts.map +1 -1
  62. package/dist/commands/classify.js +188 -5
  63. package/dist/commands/classify.js.map +1 -1
  64. package/dist/commands/enforce.d.ts +4 -4
  65. package/dist/commands/enforce.d.ts.map +1 -1
  66. package/dist/commands/enforce.js +41 -9
  67. package/dist/commands/enforce.js.map +1 -1
  68. package/dist/commands/enforcement.d.ts +13 -1
  69. package/dist/commands/enforcement.d.ts.map +1 -1
  70. package/dist/commands/enforcement.js +880 -33
  71. package/dist/commands/enforcement.js.map +1 -1
  72. package/dist/commands/explain.d.ts +1 -1
  73. package/dist/commands/explain.d.ts.map +1 -1
  74. package/dist/commands/explain.js +162 -3
  75. package/dist/commands/explain.js.map +1 -1
  76. package/dist/commands/history.d.ts +12 -0
  77. package/dist/commands/history.d.ts.map +1 -0
  78. package/dist/commands/history.js +45 -0
  79. package/dist/commands/history.js.map +1 -0
  80. package/dist/commands/init-presets.d.ts +155 -0
  81. package/dist/commands/init-presets.d.ts.map +1 -0
  82. package/dist/commands/init-presets.js +203 -0
  83. package/dist/commands/init-presets.js.map +1 -0
  84. package/dist/commands/init.d.ts +7 -12
  85. package/dist/commands/init.d.ts.map +1 -1
  86. package/dist/commands/init.js +987 -99
  87. package/dist/commands/init.js.map +1 -1
  88. package/dist/commands/keys.d.ts.map +1 -1
  89. package/dist/commands/keys.js +29 -13
  90. package/dist/commands/keys.js.map +1 -1
  91. package/dist/commands/next.d.ts.map +1 -1
  92. package/dist/commands/next.js +846 -19
  93. package/dist/commands/next.js.map +1 -1
  94. package/dist/commands/pre-commit.d.ts +25 -0
  95. package/dist/commands/pre-commit.d.ts.map +1 -1
  96. package/dist/commands/pre-commit.js +91 -6
  97. package/dist/commands/pre-commit.js.map +1 -1
  98. package/dist/commands/quarantine.d.ts +16 -0
  99. package/dist/commands/quarantine.d.ts.map +1 -0
  100. package/dist/commands/quarantine.js +213 -0
  101. package/dist/commands/quarantine.js.map +1 -0
  102. package/dist/commands/run.d.ts +39 -0
  103. package/dist/commands/run.d.ts.map +1 -0
  104. package/dist/commands/run.js +196 -0
  105. package/dist/commands/run.js.map +1 -0
  106. package/dist/commands/test-gates.d.ts +284 -2
  107. package/dist/commands/test-gates.d.ts.map +1 -1
  108. package/dist/commands/test-gates.js +3620 -187
  109. package/dist/commands/test-gates.js.map +1 -1
  110. package/dist/commands/tests.d.ts +1 -1
  111. package/dist/commands/tests.d.ts.map +1 -1
  112. package/dist/commands/tests.js +264 -29
  113. package/dist/commands/tests.js.map +1 -1
  114. package/dist/docs-exclusions.d.ts.map +1 -1
  115. package/dist/docs-exclusions.js +18 -3
  116. package/dist/docs-exclusions.js.map +1 -1
  117. package/dist/endpoint-compiler.d.ts.map +1 -1
  118. package/dist/endpoint-compiler.js +78 -9
  119. package/dist/endpoint-compiler.js.map +1 -1
  120. package/dist/engine-browser.d.ts +183 -0
  121. package/dist/engine-browser.d.ts.map +1 -0
  122. package/dist/engine-browser.js +381 -0
  123. package/dist/engine-browser.js.map +1 -0
  124. package/dist/engine-identity.d.ts +100 -0
  125. package/dist/engine-identity.d.ts.map +1 -0
  126. package/dist/engine-identity.js +182 -0
  127. package/dist/engine-identity.js.map +1 -0
  128. package/dist/evaluate.d.ts +105 -1
  129. package/dist/evaluate.d.ts.map +1 -1
  130. package/dist/evaluate.js +149 -18
  131. package/dist/evaluate.js.map +1 -1
  132. package/dist/execution.d.ts +253 -9
  133. package/dist/execution.d.ts.map +1 -1
  134. package/dist/execution.js +309 -12
  135. package/dist/execution.js.map +1 -1
  136. package/dist/gateforge-owned.d.ts +78 -0
  137. package/dist/gateforge-owned.d.ts.map +1 -0
  138. package/dist/gateforge-owned.js +254 -0
  139. package/dist/gateforge-owned.js.map +1 -0
  140. package/dist/git-hooks.d.ts +35 -0
  141. package/dist/git-hooks.d.ts.map +1 -1
  142. package/dist/git-hooks.js +140 -1
  143. package/dist/git-hooks.js.map +1 -1
  144. package/dist/git-ignored.d.ts +27 -0
  145. package/dist/git-ignored.d.ts.map +1 -0
  146. package/dist/git-ignored.js +102 -0
  147. package/dist/git-ignored.js.map +1 -0
  148. package/dist/git-objects.d.ts +60 -0
  149. package/dist/git-objects.d.ts.map +1 -0
  150. package/dist/git-objects.js +152 -0
  151. package/dist/git-objects.js.map +1 -0
  152. package/dist/glob.d.ts +33 -14
  153. package/dist/glob.d.ts.map +1 -1
  154. package/dist/glob.js +96 -5
  155. package/dist/glob.js.map +1 -1
  156. package/dist/history.d.ts +52 -0
  157. package/dist/history.d.ts.map +1 -0
  158. package/dist/history.js +116 -0
  159. package/dist/history.js.map +1 -0
  160. package/dist/host-load.d.ts +49 -0
  161. package/dist/host-load.d.ts.map +1 -0
  162. package/dist/host-load.js +78 -0
  163. package/dist/host-load.js.map +1 -0
  164. package/dist/index.d.ts +4 -1
  165. package/dist/index.d.ts.map +1 -1
  166. package/dist/index.js +2 -1
  167. package/dist/index.js.map +1 -1
  168. package/dist/input-snapshot.d.ts +63 -9
  169. package/dist/input-snapshot.d.ts.map +1 -1
  170. package/dist/input-snapshot.js +195 -17
  171. package/dist/input-snapshot.js.map +1 -1
  172. package/dist/io.d.ts +49 -0
  173. package/dist/io.d.ts.map +1 -1
  174. package/dist/io.js +22 -0
  175. package/dist/io.js.map +1 -1
  176. package/dist/mapping.d.ts +84 -1
  177. package/dist/mapping.d.ts.map +1 -1
  178. package/dist/mapping.js +276 -5
  179. package/dist/mapping.js.map +1 -1
  180. package/dist/native-freeze.d.ts +217 -0
  181. package/dist/native-freeze.d.ts.map +1 -0
  182. package/dist/native-freeze.js +332 -0
  183. package/dist/native-freeze.js.map +1 -0
  184. package/dist/pipeline.d.ts +67 -1
  185. package/dist/pipeline.d.ts.map +1 -1
  186. package/dist/pipeline.js +164 -6
  187. package/dist/pipeline.js.map +1 -1
  188. package/dist/planes-inference.d.ts +12 -5
  189. package/dist/planes-inference.d.ts.map +1 -1
  190. package/dist/planes-inference.js +13 -15
  191. package/dist/planes-inference.js.map +1 -1
  192. package/dist/playwright-browsers.d.ts +210 -0
  193. package/dist/playwright-browsers.d.ts.map +1 -0
  194. package/dist/playwright-browsers.js +364 -0
  195. package/dist/playwright-browsers.js.map +1 -0
  196. package/dist/plugins.d.ts +15 -5
  197. package/dist/plugins.d.ts.map +1 -1
  198. package/dist/plugins.js +59 -9
  199. package/dist/plugins.js.map +1 -1
  200. package/dist/progress.d.ts +148 -0
  201. package/dist/progress.d.ts.map +1 -0
  202. package/dist/progress.js +263 -0
  203. package/dist/progress.js.map +1 -0
  204. package/dist/providers.d.ts +26 -1
  205. package/dist/providers.d.ts.map +1 -1
  206. package/dist/providers.js +39 -0
  207. package/dist/providers.js.map +1 -1
  208. package/dist/receipts.d.ts +1 -0
  209. package/dist/receipts.d.ts.map +1 -1
  210. package/dist/receipts.js +35 -7
  211. package/dist/receipts.js.map +1 -1
  212. package/dist/repo-scan.d.ts +15 -1
  213. package/dist/repo-scan.d.ts.map +1 -1
  214. package/dist/repo-scan.js +329 -34
  215. package/dist/repo-scan.js.map +1 -1
  216. package/dist/reseal-chain.d.ts +184 -0
  217. package/dist/reseal-chain.d.ts.map +1 -0
  218. package/dist/reseal-chain.js +735 -0
  219. package/dist/reseal-chain.js.map +1 -0
  220. package/dist/reseal-evidence.d.ts +241 -0
  221. package/dist/reseal-evidence.d.ts.map +1 -0
  222. package/dist/reseal-evidence.js +319 -0
  223. package/dist/reseal-evidence.js.map +1 -0
  224. package/dist/reseal.d.ts +181 -0
  225. package/dist/reseal.d.ts.map +1 -0
  226. package/dist/reseal.js +1620 -0
  227. package/dist/reseal.js.map +1 -0
  228. package/dist/response-field-guidance.d.ts +82 -0
  229. package/dist/response-field-guidance.d.ts.map +1 -0
  230. package/dist/response-field-guidance.js +184 -0
  231. package/dist/response-field-guidance.js.map +1 -0
  232. package/dist/route-plane-proposals.d.ts +100 -0
  233. package/dist/route-plane-proposals.d.ts.map +1 -0
  234. package/dist/route-plane-proposals.js +213 -0
  235. package/dist/route-plane-proposals.js.map +1 -0
  236. package/dist/run-cache.d.ts +260 -0
  237. package/dist/run-cache.d.ts.map +1 -0
  238. package/dist/run-cache.js +771 -0
  239. package/dist/run-cache.js.map +1 -0
  240. package/dist/run-preflight.d.ts +77 -0
  241. package/dist/run-preflight.d.ts.map +1 -0
  242. package/dist/run-preflight.js +774 -0
  243. package/dist/run-preflight.js.map +1 -0
  244. package/dist/run-recipe.d.ts +107 -0
  245. package/dist/run-recipe.d.ts.map +1 -0
  246. package/dist/run-recipe.js +295 -0
  247. package/dist/run-recipe.js.map +1 -0
  248. package/dist/run-reliability.d.ts +126 -0
  249. package/dist/run-reliability.d.ts.map +1 -0
  250. package/dist/run-reliability.js +221 -0
  251. package/dist/run-reliability.js.map +1 -0
  252. package/dist/runtime.d.ts +15 -0
  253. package/dist/runtime.d.ts.map +1 -1
  254. package/dist/runtime.js +11 -1
  255. package/dist/runtime.js.map +1 -1
  256. package/dist/scope.d.ts +20 -0
  257. package/dist/scope.d.ts.map +1 -1
  258. package/dist/scope.js +26 -5
  259. package/dist/scope.js.map +1 -1
  260. package/dist/secret-guard.d.ts +36 -0
  261. package/dist/secret-guard.d.ts.map +1 -0
  262. package/dist/secret-guard.js +63 -0
  263. package/dist/secret-guard.js.map +1 -0
  264. package/dist/singleton-guidance.d.ts +82 -0
  265. package/dist/singleton-guidance.d.ts.map +1 -0
  266. package/dist/singleton-guidance.js +138 -0
  267. package/dist/singleton-guidance.js.map +1 -0
  268. package/dist/staged-candidate.d.ts +17 -0
  269. package/dist/staged-candidate.d.ts.map +1 -1
  270. package/dist/staged-candidate.js +50 -0
  271. package/dist/staged-candidate.js.map +1 -1
  272. package/dist/state-artifacts.d.ts +70 -0
  273. package/dist/state-artifacts.d.ts.map +1 -0
  274. package/dist/state-artifacts.js +215 -0
  275. package/dist/state-artifacts.js.map +1 -0
  276. package/dist/state.d.ts +170 -2
  277. package/dist/state.d.ts.map +1 -1
  278. package/dist/state.js +248 -8
  279. package/dist/state.js.map +1 -1
  280. package/dist/unmatched-routes.d.ts +60 -0
  281. package/dist/unmatched-routes.d.ts.map +1 -0
  282. package/dist/unmatched-routes.js +131 -0
  283. package/dist/unmatched-routes.js.map +1 -0
  284. package/dist/verifier-keys.d.ts +33 -2
  285. package/dist/verifier-keys.d.ts.map +1 -1
  286. package/dist/verifier-keys.js +95 -9
  287. package/dist/verifier-keys.js.map +1 -1
  288. package/guides/CONNECT-YOUR-PROJECT.md +425 -0
  289. package/guides/QUICKSTART.md +306 -26
  290. package/guides/REFERENCE.md +1710 -0
  291. package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
  292. package/guides/TEST-ENVIRONMENT.md +1044 -6
  293. package/guides/UPGRADE-0.6-to-0.7.md +3 -3
  294. package/guides/UPGRADE-0.7-to-0.8.md +114 -0
  295. package/guides/UPGRADE-0.8-to-0.9.md +104 -0
  296. package/package.json +10 -9
@@ -0,0 +1,217 @@
1
+ /**
2
+ * The trusted CLI's half of the GLOBAL native preparation freeze.
3
+ *
4
+ * The pack (`@gate-forge/pack-playwright`) owns the barrier's runner-side
5
+ * shape — the controller project, the request/release documents, the
6
+ * per-invocation Ed25519 signature and the environment projection. This
7
+ * module owns the AUTHORITY half, and every one of its decisions is made
8
+ * here, in the one process that holds the witness credentials, the frozen
9
+ * baseline and the input snapshot:
10
+ *
11
+ * 1. {@link planNativeFreeze} classifies the PLANNED captured graph into
12
+ * the full upstream prerequisite closure and the bodies, and refuses an
13
+ * unavailable or ambiguous graph BEFORE anything is spawned — a
14
+ * half-known graph would order the run wrongly while looking complete.
15
+ * 2. {@link classifyGeneratedTargets} decides which paths native
16
+ * preparation may legitimately create or modify. A declared
17
+ * `use.storageState` is a READ declaration first: it only becomes a
18
+ * generated-output target when it is also untracked and outside the
19
+ * input inventory. A tracked or input-bound state stays a perfectly
20
+ * valid read declaration and stays IMMUTABLE — changing it is refused
21
+ * at the freeze, by name, exactly like any other unsafe write.
22
+ * 3. {@link preparedCandidateViolations} runs the raw symmetric diff
23
+ * baseline → prepared and admits nothing but admissible target
24
+ * additions and modifications. Removals, non-target writes, tracked
25
+ * writes, input writes and excluded writes all fail, naming the path.
26
+ * 4. {@link unfrozenPrerequisiteState} proves, from the AUTHENTICATED
27
+ * witness execution trace, that every prerequisite identity really
28
+ * passed under supervision — exactly one sealed session, no retry, no
29
+ * duplicate, no confused identity — and separates what is still
30
+ * PENDING from what is TERMINAL, so a permanent refusal fails at once
31
+ * instead of waiting out the barrier's bound.
32
+ *
33
+ * None of this weakens a binding: the input digest, the trusted policy,
34
+ * the catalog and the witness context stay the ones the run pinned, and
35
+ * the prepared candidate identity never leaves this process.
36
+ */
37
+ import type { TracedTestInput } from '@gate-forge/core';
38
+ import type { CandidateTreeEntry } from './candidate-tree.js';
39
+ import { type FreezeRequest, type ProjectScope } from '@gate-forge/pack-playwright';
40
+ /** The prepared candidate identity — CLI memory, never a state document. */
41
+ export interface PreparedCandidateIdentity {
42
+ /** The immutable tree the prepared candidate froze at. */
43
+ preparedTreeId: string;
44
+ /** The run identity this freeze belongs to. */
45
+ runId: string;
46
+ /** The invocation identity this freeze belongs to. */
47
+ invocationId: string;
48
+ /** The per-invocation nonce a replayed release can never match. */
49
+ nonce: string;
50
+ /** ISO timestamp of the freeze (diagnostic, inside the signature). */
51
+ sealedAt: string;
52
+ }
53
+ /** How the planned captured graph splits into prerequisites and bodies. */
54
+ export interface NativeFreezePlan {
55
+ /** The engine-owned controller project name. */
56
+ controllerProject: string;
57
+ /**
58
+ * The FULL upstream closure of the planned captured graph — every
59
+ * project a planned project transitively depends on, never just the
60
+ * roots. These keep their captured edges exactly as they were.
61
+ */
62
+ prerequisiteProjects: string[];
63
+ bodyProjects: string[];
64
+ }
65
+ /**
66
+ * Splits the planned project scopes into prerequisites and bodies, or
67
+ * explains why the captured graph cannot be trusted to order this run.
68
+ *
69
+ * The closure is walked from every PLANNED project (not from the
70
+ * dependency roots the plan happens to reach): a body project with no
71
+ * edges of its own still has to be frozen, which is why the barrier also
72
+ * arms for an independent, empty-edge project.
73
+ *
74
+ * @param projectScopes: the planned per-project file selection.
75
+ * @param projectDependencies: the graph the RUNNER resolved, or undefined
76
+ * when the enumeration could not read it.
77
+ *
78
+ * @returns
79
+ * `{plan}` | `{problem}`: the split, or one plain refusal.
80
+ */
81
+ export declare function planNativeFreeze(input: {
82
+ projectScopes: readonly ProjectScope[];
83
+ projectDependencies: Record<string, string[]> | undefined;
84
+ }): {
85
+ plan: NativeFreezePlan;
86
+ } | {
87
+ problem: string;
88
+ };
89
+ /** Which paths native preparation may write, and why the others may not. */
90
+ export interface GeneratedTargetClass {
91
+ /** Repo-relative posix paths preparation may add or modify. */
92
+ eligible: ReadonlySet<string>;
93
+ /** Repo-relative posix path → the plain reason it stays immutable. */
94
+ refused: ReadonlyMap<string, string>;
95
+ }
96
+ /**
97
+ * Decides, per captured `use.storageState` declaration, whether native
98
+ * preparation may CREATE or MODIFY that path.
99
+ *
100
+ * The declaration itself is only a READ path — it says where a project
101
+ * reads browser state, not which bytes preparation owns. A declaration
102
+ * therefore becomes a generated-output target only when all of these hold:
103
+ *
104
+ * - it resolves inside the candidate root (already enforced physically by
105
+ * {@link resolveProjectStorageState}, repeated here so the classification
106
+ * can never disagree with the containment rule);
107
+ * - it is NOT tracked by git — a tracked file is source, and no setup may
108
+ * redefine it as "generated";
109
+ * - it is NOT part of the input inventory — a file the run's digest binds
110
+ * is authority, not output;
111
+ * - it is not an owner-approved excluded documentation or cache path.
112
+ *
113
+ * Everything else stays a valid, immutable read declaration. This is what
114
+ * keeps a repository that ships a committed fixture session working: its
115
+ * state is read, unchanged, and any actual write to it is refused by name
116
+ * at the global diff.
117
+ *
118
+ * @param root: the absolute candidate root (containment boundary).
119
+ * @param nativeConfigDir: the directory relative declarations resolve from.
120
+ * @param storageStates: project → declared `use.storageState`, as captured.
121
+ * @param tracked: repo-relative paths git tracks.
122
+ * @param inputFiles: repo-relative paths the run's input snapshot binds.
123
+ * @param docsExclusions: approved documentation folders.
124
+ * @param cacheExclusions: approved bytecode files.
125
+ *
126
+ * @returns
127
+ * GeneratedTargetClass: the writable set and the named refusals.
128
+ */
129
+ export declare function classifyGeneratedTargets(input: {
130
+ root: string;
131
+ nativeConfigDir: string;
132
+ storageStates: Readonly<Record<string, string>>;
133
+ tracked: ReadonlySet<string>;
134
+ inputFiles: ReadonlySet<string>;
135
+ docsExclusions: readonly string[];
136
+ cacheExclusions: readonly string[];
137
+ }): GeneratedTargetClass;
138
+ /**
139
+ * The RAW symmetric difference between the frozen baseline candidate tree
140
+ * and the prepared one, reduced to the writes that must fail.
141
+ *
142
+ * An entry that exists in both trees with the same blob and mode is not a
143
+ * change at all. Anything else must be an admissible generated target
144
+ * ADDITION or MODIFICATION; a REMOVAL always fails, eligible target or
145
+ * not — deleting the artifact a body needs is never preparation.
146
+ *
147
+ * @param baseline: the frozen pre-run candidate tree entries.
148
+ * @param prepared: the candidate tree entries at the freeze.
149
+ * @param targets: the writable classification (see
150
+ * {@link classifyGeneratedTargets}).
151
+ *
152
+ * @returns
153
+ * string[]: one refusal per offending path, naming the path, sorted.
154
+ */
155
+ export declare function preparedCandidateViolations(input: {
156
+ /** Absolute candidate root: the physical containment boundary. */
157
+ root: string;
158
+ baseline: readonly CandidateTreeEntry[];
159
+ prepared: readonly CandidateTreeEntry[];
160
+ targets: GeneratedTargetClass;
161
+ }): string[];
162
+ /** One prerequisite identity the freeze must find passed under supervision. */
163
+ export interface PrerequisiteIdentity {
164
+ /** Repo-relative posix file (identity join key). */
165
+ file: string;
166
+ /** Full catalog-identity title path. */
167
+ titlePath: string[];
168
+ }
169
+ /**
170
+ * Proves, from the AUTHENTICATED witness execution trace, that every
171
+ * prerequisite identity really passed before the candidate is frozen.
172
+ *
173
+ * The trace is the supervisor's own record, not the suite's: a
174
+ * prerequisite counts only when the witness minted EXACTLY ONE session
175
+ * for it, sealed that session, and recorded `passed` on it.
176
+ *
177
+ * The distinction that matters is PENDING versus TERMINAL. A
178
+ * prerequisite with no session YET is pending: the runner may still be
179
+ * executing it, so the trusted side waits. A prerequisite that already
180
+ * sealed as anything but `passed`, that opened more than one session
181
+ * (a retry or a confused lifecycle), or whose trace is unreadable, is
182
+ * TERMINAL — waiting cannot change it, so waiting would only turn a
183
+ * permanent refusal into a slow one.
184
+ *
185
+ * @param trace: the witness execution trace, or null when it is unreadable.
186
+ * @param prerequisites: every prerequisite identity the plan executed.
187
+ *
188
+ * @returns
189
+ * {pending, refused}: pending reasons worth waiting for (empty when
190
+ * everything passed), and terminal reasons that end the wait at once.
191
+ */
192
+ export declare function unfrozenPrerequisiteState(input: {
193
+ trace: readonly TracedTestInput[] | null;
194
+ prerequisites: readonly PrerequisiteIdentity[];
195
+ }): {
196
+ pending: string[];
197
+ refused: string[];
198
+ };
199
+ /**
200
+ * Checks the controller's request against the identities THIS run armed.
201
+ * A request is data the controller wrote into a file the suite can also
202
+ * write, so it is only accepted when it names this run, this invocation
203
+ * and this exact per-invocation nonce.
204
+ *
205
+ * @param request: the parsed controller request (unknown shape allowed).
206
+ * @param armed: the identities the CLI minted for this invocation.
207
+ *
208
+ * @returns
209
+ * FreezeRequest | string: the accepted request, or the plain refusal.
210
+ */
211
+ export declare function acceptedFreezeRequest(request: unknown, armed: {
212
+ runId: string;
213
+ invocationId: string;
214
+ nonce: string;
215
+ project: string;
216
+ }): FreezeRequest | string;
217
+ //# sourceMappingURL=native-freeze.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-freeze.d.ts","sourceRoot":"","sources":["../src/native-freeze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AAErC,4EAA4E;AAC5E,MAAM,WAAW,yBAAyB;IACxC,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,aAAa,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC;CAC3D,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG;IAAE,OA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oBAAoB,EAAE,CAAC;CAChD,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CA8C3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC7E,aAAa,GAAG,MAAM,CAexB"}
@@ -0,0 +1,332 @@
1
+ import { lstatSync, readlinkSync, realpathSync } from 'node:fs';
2
+ import { relative, resolve, sep } from 'node:path';
3
+ import { FREEZE_CONTROLLER_PROJECT, resolveProjectStorageState, } from '@gate-forge/pack-playwright';
4
+ /**
5
+ * Splits the planned project scopes into prerequisites and bodies, or
6
+ * explains why the captured graph cannot be trusted to order this run.
7
+ *
8
+ * The closure is walked from every PLANNED project (not from the
9
+ * dependency roots the plan happens to reach): a body project with no
10
+ * edges of its own still has to be frozen, which is why the barrier also
11
+ * arms for an independent, empty-edge project.
12
+ *
13
+ * @param projectScopes: the planned per-project file selection.
14
+ * @param projectDependencies: the graph the RUNNER resolved, or undefined
15
+ * when the enumeration could not read it.
16
+ *
17
+ * @returns
18
+ * `{plan}` | `{problem}`: the split, or one plain refusal.
19
+ */
20
+ export function planNativeFreeze(input) {
21
+ const { projectScopes, projectDependencies } = input;
22
+ if (projectScopes.length === 0) {
23
+ return { problem: 'this run planned no project scope, so there is nothing to freeze before' };
24
+ }
25
+ if (projectDependencies === undefined) {
26
+ return {
27
+ problem: 'the runner\'s resolved project graph could not be read, so the prerequisite stage cannot be ' +
28
+ 'ordered against the bodies — a global freeze is only honest on a known graph',
29
+ };
30
+ }
31
+ const planned = [];
32
+ for (const scope of projectScopes) {
33
+ if (planned.includes(scope.name)) {
34
+ return { problem: `project '${scope.name}' was planned twice, so its execution order is ambiguous` };
35
+ }
36
+ if (scope.name === FREEZE_CONTROLLER_PROJECT) {
37
+ return {
38
+ problem: `a project is named '${FREEZE_CONTROLLER_PROJECT}', which the engine reserves for its own ` +
39
+ 'preparation-freeze controller',
40
+ };
41
+ }
42
+ if (!Object.prototype.hasOwnProperty.call(projectDependencies, scope.name)) {
43
+ return {
44
+ problem: `project '${scope.name}' was planned but the runner's own resolved graph never recorded it — the ` +
45
+ 'captured graph and the captured tests disagree, so no ordering may be derived from either',
46
+ };
47
+ }
48
+ planned.push(scope.name);
49
+ }
50
+ const prerequisites = new Set();
51
+ const queue = [...planned];
52
+ while (queue.length > 0) {
53
+ const current = queue.shift();
54
+ for (const dependency of projectDependencies[current] ?? []) {
55
+ if (prerequisites.has(dependency))
56
+ continue;
57
+ prerequisites.add(dependency);
58
+ queue.push(dependency);
59
+ }
60
+ }
61
+ return {
62
+ plan: {
63
+ controllerProject: FREEZE_CONTROLLER_PROJECT,
64
+ prerequisiteProjects: [...prerequisites].sort(),
65
+ bodyProjects: planned.filter((name) => !prerequisites.has(name)),
66
+ },
67
+ };
68
+ }
69
+ /**
70
+ * Decides, per captured `use.storageState` declaration, whether native
71
+ * preparation may CREATE or MODIFY that path.
72
+ *
73
+ * The declaration itself is only a READ path — it says where a project
74
+ * reads browser state, not which bytes preparation owns. A declaration
75
+ * therefore becomes a generated-output target only when all of these hold:
76
+ *
77
+ * - it resolves inside the candidate root (already enforced physically by
78
+ * {@link resolveProjectStorageState}, repeated here so the classification
79
+ * can never disagree with the containment rule);
80
+ * - it is NOT tracked by git — a tracked file is source, and no setup may
81
+ * redefine it as "generated";
82
+ * - it is NOT part of the input inventory — a file the run's digest binds
83
+ * is authority, not output;
84
+ * - it is not an owner-approved excluded documentation or cache path.
85
+ *
86
+ * Everything else stays a valid, immutable read declaration. This is what
87
+ * keeps a repository that ships a committed fixture session working: its
88
+ * state is read, unchanged, and any actual write to it is refused by name
89
+ * at the global diff.
90
+ *
91
+ * @param root: the absolute candidate root (containment boundary).
92
+ * @param nativeConfigDir: the directory relative declarations resolve from.
93
+ * @param storageStates: project → declared `use.storageState`, as captured.
94
+ * @param tracked: repo-relative paths git tracks.
95
+ * @param inputFiles: repo-relative paths the run's input snapshot binds.
96
+ * @param docsExclusions: approved documentation folders.
97
+ * @param cacheExclusions: approved bytecode files.
98
+ *
99
+ * @returns
100
+ * GeneratedTargetClass: the writable set and the named refusals.
101
+ */
102
+ export function classifyGeneratedTargets(input) {
103
+ const eligible = new Set();
104
+ const refused = new Map();
105
+ const root = resolve(input.root);
106
+ const excluded = (relativePath) => input.docsExclusions.some((folder) => relativePath === folder || relativePath.startsWith(`${folder}/`)) ||
107
+ input.cacheExclusions.includes(relativePath);
108
+ for (const [project, declared] of Object.entries(input.storageStates)) {
109
+ let absolute;
110
+ try {
111
+ absolute = resolveProjectStorageState(declared, root, project, input.nativeConfigDir);
112
+ }
113
+ catch (error) {
114
+ refused.set(declared, error.message);
115
+ continue;
116
+ }
117
+ const relativePath = relative(root, absolute).split(sep).join('/');
118
+ if (relativePath.length === 0 || relativePath.startsWith('..')) {
119
+ refused.set(relativePath, 'the declared state resolves outside the candidate root');
120
+ continue;
121
+ }
122
+ if (excluded(relativePath)) {
123
+ refused.set(relativePath, 'it is an owner-approved excluded path, which no run may write');
124
+ continue;
125
+ }
126
+ if (input.tracked.has(relativePath)) {
127
+ refused.set(relativePath, 'it is tracked by git, so it is source: a declared storage state is a READ path and never a ' +
128
+ 'write permission over tracked bytes');
129
+ continue;
130
+ }
131
+ if (input.inputFiles.has(relativePath)) {
132
+ refused.set(relativePath, 'it is bound by this run\'s input snapshot, so preparation may not redefine what the run tested');
133
+ continue;
134
+ }
135
+ eligible.add(relativePath);
136
+ }
137
+ return { eligible, refused };
138
+ }
139
+ /**
140
+ * The RAW symmetric difference between the frozen baseline candidate tree
141
+ * and the prepared one, reduced to the writes that must fail.
142
+ *
143
+ * An entry that exists in both trees with the same blob and mode is not a
144
+ * change at all. Anything else must be an admissible generated target
145
+ * ADDITION or MODIFICATION; a REMOVAL always fails, eligible target or
146
+ * not — deleting the artifact a body needs is never preparation.
147
+ *
148
+ * @param baseline: the frozen pre-run candidate tree entries.
149
+ * @param prepared: the candidate tree entries at the freeze.
150
+ * @param targets: the writable classification (see
151
+ * {@link classifyGeneratedTargets}).
152
+ *
153
+ * @returns
154
+ * string[]: one refusal per offending path, naming the path, sorted.
155
+ */
156
+ export function preparedCandidateViolations(input) {
157
+ const before = new Map(input.baseline.map((entry) => [entry.path, entry]));
158
+ const after = new Map(input.prepared.map((entry) => [entry.path, entry]));
159
+ const violations = [];
160
+ for (const path of [...after.keys()].sort()) {
161
+ const now = after.get(path);
162
+ const then = before.get(path);
163
+ const change = then === undefined ? 'created' : `${then.sha} → ${now.sha}`;
164
+ if (then !== undefined && then.sha === now.sha && then.mode === now.mode)
165
+ continue;
166
+ if (input.targets.eligible.has(path)) {
167
+ // An admissible target is admitted as an ORDINARY FILE INSIDE THE
168
+ // CANDIDATE, re-checked HERE and not at nomination time. The
169
+ // nomination happened before the prerequisites ran, so a setup test
170
+ // could replace its own state file with a symbolic link in between;
171
+ // the snapshot records links as `120000` entries rather than
172
+ // rejecting them. An admitted write that is a link, or whose real
173
+ // path leaves the candidate, is refused BY NAME here.
174
+ if (now.mode === SYMLINK_MODE) {
175
+ violations.push(`native preparation ${change} '${path}' into a symbolic link — a generated target must be an ` +
176
+ 'ordinary file inside the candidate, never a link');
177
+ continue;
178
+ }
179
+ const escape = physicalEscapeOf(input.root, path);
180
+ if (escape !== null) {
181
+ violations.push(`native preparation ${change} '${path}', which reaches outside the candidate ('${escape}') — ` +
182
+ 'a generated target is admitted only while it physically stays inside');
183
+ }
184
+ continue;
185
+ }
186
+ violations.push(`native preparation ${change} '${path}', which is not an admissible generated target` +
187
+ (input.targets.refused.has(path) ? ` (${input.targets.refused.get(path)})` : ''));
188
+ }
189
+ for (const path of [...before.keys()].sort()) {
190
+ if (after.has(path))
191
+ continue;
192
+ violations.push(`native preparation removed '${path}' — a removal is never admissible, whatever the path is`);
193
+ }
194
+ return violations;
195
+ }
196
+ /** The Git mode a recorded symbolic link carries in a candidate tree. */
197
+ const SYMLINK_MODE = '120000';
198
+ /**
199
+ * Whether a repo-relative path is not an ordinary file inside the
200
+ * candidate once links are followed. Null means it is (or no longer
201
+ * exists on disk, which the seal-time drift check settles separately).
202
+ *
203
+ * This answers the PHYSICAL question the lexical one cannot: a link, or a
204
+ * chain of links, that leaves the tree — exactly the shape a setup test
205
+ * could produce after its target was nominated.
206
+ *
207
+ * @param root: absolute candidate root.
208
+ * @param path: repo-relative posix path.
209
+ *
210
+ * @returns
211
+ * string | null: what escapes, or null.
212
+ */
213
+ function physicalEscapeOf(root, path) {
214
+ const base = resolve(root);
215
+ const absolute = resolve(base, path);
216
+ let stats;
217
+ try {
218
+ stats = lstatSync(absolute);
219
+ }
220
+ catch {
221
+ return null;
222
+ }
223
+ if (stats.isSymbolicLink())
224
+ return readlinkSync(absolute);
225
+ if (!stats.isFile())
226
+ return `${path} is not an ordinary file`;
227
+ let real;
228
+ let realBase;
229
+ try {
230
+ real = realpathSync(absolute);
231
+ realBase = realpathSync(base);
232
+ }
233
+ catch {
234
+ return `${path} cannot be resolved on this host`;
235
+ }
236
+ if (real === realBase || real.startsWith(realBase + sep))
237
+ return null;
238
+ return real;
239
+ }
240
+ /**
241
+ * Proves, from the AUTHENTICATED witness execution trace, that every
242
+ * prerequisite identity really passed before the candidate is frozen.
243
+ *
244
+ * The trace is the supervisor's own record, not the suite's: a
245
+ * prerequisite counts only when the witness minted EXACTLY ONE session
246
+ * for it, sealed that session, and recorded `passed` on it.
247
+ *
248
+ * The distinction that matters is PENDING versus TERMINAL. A
249
+ * prerequisite with no session YET is pending: the runner may still be
250
+ * executing it, so the trusted side waits. A prerequisite that already
251
+ * sealed as anything but `passed`, that opened more than one session
252
+ * (a retry or a confused lifecycle), or whose trace is unreadable, is
253
+ * TERMINAL — waiting cannot change it, so waiting would only turn a
254
+ * permanent refusal into a slow one.
255
+ *
256
+ * @param trace: the witness execution trace, or null when it is unreadable.
257
+ * @param prerequisites: every prerequisite identity the plan executed.
258
+ *
259
+ * @returns
260
+ * {pending, refused}: pending reasons worth waiting for (empty when
261
+ * everything passed), and terminal reasons that end the wait at once.
262
+ */
263
+ export function unfrozenPrerequisiteState(input) {
264
+ if (input.trace === null) {
265
+ return {
266
+ pending: [],
267
+ refused: [
268
+ 'the witness execution trace could not be read, so no prerequisite can be proven to have passed ' +
269
+ 'before the candidate is frozen',
270
+ ],
271
+ };
272
+ }
273
+ const pending = [];
274
+ const refused = [];
275
+ for (const prerequisite of input.prerequisites) {
276
+ const key = prerequisite.titlePath.join('>');
277
+ const matches = input.trace.filter((traced) => traced.file === prerequisite.file && traced.titlePath.join('>') === key);
278
+ if (matches.length === 0) {
279
+ pending.push(`prerequisite '${prerequisite.file}#${key}' has no witness session yet`);
280
+ continue;
281
+ }
282
+ const sessions = matches.flatMap((traced) => traced.sessions);
283
+ if (sessions.length === 0) {
284
+ pending.push(`prerequisite '${prerequisite.file}#${key}' recorded no session yet`);
285
+ continue;
286
+ }
287
+ if (sessions.length > 1) {
288
+ refused.push(`prerequisite '${prerequisite.file}#${key}' opened ${String(sessions.length)} sessions — a retry or a ` +
289
+ 'duplicated lifecycle is never a prerequisite this run may freeze over');
290
+ continue;
291
+ }
292
+ const session = sessions[0];
293
+ if (session === undefined || session.sealedTick === null) {
294
+ pending.push(`prerequisite '${prerequisite.file}#${key}' has not sealed its session yet`);
295
+ continue;
296
+ }
297
+ if (session.outcome !== 'passed') {
298
+ refused.push(`prerequisite '${prerequisite.file}#${key}' sealed as '${session.outcome ?? 'unknown'}' — only a ` +
299
+ 'genuine pass may precede a frozen candidate');
300
+ }
301
+ }
302
+ return { pending, refused };
303
+ }
304
+ /**
305
+ * Checks the controller's request against the identities THIS run armed.
306
+ * A request is data the controller wrote into a file the suite can also
307
+ * write, so it is only accepted when it names this run, this invocation
308
+ * and this exact per-invocation nonce.
309
+ *
310
+ * @param request: the parsed controller request (unknown shape allowed).
311
+ * @param armed: the identities the CLI minted for this invocation.
312
+ *
313
+ * @returns
314
+ * FreezeRequest | string: the accepted request, or the plain refusal.
315
+ */
316
+ export function acceptedFreezeRequest(request, armed) {
317
+ if (typeof request !== 'object' || request === null) {
318
+ return 'the controller request is not an object';
319
+ }
320
+ const row = request;
321
+ if (row['project'] !== armed.project) {
322
+ return `the controller request names project '${String(row['project'])}', not this run's controller`;
323
+ }
324
+ if (row['runId'] !== armed.runId || row['invocationId'] !== armed.invocationId) {
325
+ return 'the controller request belongs to another run or invocation';
326
+ }
327
+ if (row['nonce'] !== armed.nonce) {
328
+ return 'the controller request carries another nonce (a replayed or forged request)';
329
+ }
330
+ return row;
331
+ }
332
+ //# sourceMappingURL=native-freeze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-freeze.js","sourceRoot":"","sources":["../src/native-freeze.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAG3B,MAAM,6BAA6B,CAAC;AA6BrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAGhC;IACC,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IACrD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,OAAO,EAAE,yEAAyE,EAAE,CAAC;IAChG,CAAC;IACD,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO;YACL,OAAO,EACL,8FAA8F;gBAC9F,8EAA8E;SACjF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,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