@gate-forge/core 0.1.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 (242) hide show
  1. package/LICENSE +202 -0
  2. package/dist/baselines/adoption.d.ts +76 -0
  3. package/dist/baselines/adoption.d.ts.map +1 -0
  4. package/dist/baselines/adoption.js +163 -0
  5. package/dist/baselines/adoption.js.map +1 -0
  6. package/dist/baselines/index.d.ts +102 -0
  7. package/dist/baselines/index.d.ts.map +1 -0
  8. package/dist/baselines/index.js +186 -0
  9. package/dist/baselines/index.js.map +1 -0
  10. package/dist/canonical-json.d.ts +51 -0
  11. package/dist/canonical-json.d.ts.map +1 -0
  12. package/dist/canonical-json.js +112 -0
  13. package/dist/canonical-json.js.map +1 -0
  14. package/dist/classifier/bind.d.ts +64 -0
  15. package/dist/classifier/bind.d.ts.map +1 -0
  16. package/dist/classifier/bind.js +188 -0
  17. package/dist/classifier/bind.js.map +1 -0
  18. package/dist/classifier/classify.d.ts +154 -0
  19. package/dist/classifier/classify.d.ts.map +1 -0
  20. package/dist/classifier/classify.js +1207 -0
  21. package/dist/classifier/classify.js.map +1 -0
  22. package/dist/classifier/glob.d.ts +48 -0
  23. package/dist/classifier/glob.d.ts.map +1 -0
  24. package/dist/classifier/glob.js +104 -0
  25. package/dist/classifier/glob.js.map +1 -0
  26. package/dist/classifier/index.d.ts +10 -0
  27. package/dist/classifier/index.d.ts.map +1 -0
  28. package/dist/classifier/index.js +21 -0
  29. package/dist/classifier/index.js.map +1 -0
  30. package/dist/classifier/schema.d.ts +150 -0
  31. package/dist/classifier/schema.d.ts.map +1 -0
  32. package/dist/classifier/schema.js +139 -0
  33. package/dist/classifier/schema.js.map +1 -0
  34. package/dist/config/index.d.ts +259 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +523 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/fingerprints.d.ts +56 -0
  39. package/dist/fingerprints.d.ts.map +1 -0
  40. package/dist/fingerprints.js +59 -0
  41. package/dist/fingerprints.js.map +1 -0
  42. package/dist/graph/build.d.ts +16 -0
  43. package/dist/graph/build.d.ts.map +1 -0
  44. package/dist/graph/build.js +423 -0
  45. package/dist/graph/build.js.map +1 -0
  46. package/dist/graph/index.d.ts +12 -0
  47. package/dist/graph/index.d.ts.map +1 -0
  48. package/dist/graph/index.js +10 -0
  49. package/dist/graph/index.js.map +1 -0
  50. package/dist/graph/schema.d.ts +448 -0
  51. package/dist/graph/schema.d.ts.map +1 -0
  52. package/dist/graph/schema.js +237 -0
  53. package/dist/graph/schema.js.map +1 -0
  54. package/dist/graph/symbols.d.ts +129 -0
  55. package/dist/graph/symbols.d.ts.map +1 -0
  56. package/dist/graph/symbols.js +177 -0
  57. package/dist/graph/symbols.js.map +1 -0
  58. package/dist/graph/util.d.ts +40 -0
  59. package/dist/graph/util.d.ts.map +1 -0
  60. package/dist/graph/util.js +41 -0
  61. package/dist/graph/util.js.map +1 -0
  62. package/dist/index.d.ts +683 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +563 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/mapping/resolve.d.ts +177 -0
  67. package/dist/mapping/resolve.d.ts.map +1 -0
  68. package/dist/mapping/resolve.js +523 -0
  69. package/dist/mapping/resolve.js.map +1 -0
  70. package/dist/policy/coverage.d.ts +79 -0
  71. package/dist/policy/coverage.d.ts.map +1 -0
  72. package/dist/policy/coverage.js +119 -0
  73. package/dist/policy/coverage.js.map +1 -0
  74. package/dist/policy/evaluate.d.ts +275 -0
  75. package/dist/policy/evaluate.d.ts.map +1 -0
  76. package/dist/policy/evaluate.js +382 -0
  77. package/dist/policy/evaluate.js.map +1 -0
  78. package/dist/policy/index.d.ts +15 -0
  79. package/dist/policy/index.d.ts.map +1 -0
  80. package/dist/policy/index.js +14 -0
  81. package/dist/policy/index.js.map +1 -0
  82. package/dist/policy/trusted.d.ts +59 -0
  83. package/dist/policy/trusted.d.ts.map +1 -0
  84. package/dist/policy/trusted.js +96 -0
  85. package/dist/policy/trusted.js.map +1 -0
  86. package/dist/provenance.d.ts +170 -0
  87. package/dist/provenance.d.ts.map +1 -0
  88. package/dist/provenance.js +306 -0
  89. package/dist/provenance.js.map +1 -0
  90. package/dist/receipt/index.d.ts +74 -0
  91. package/dist/receipt/index.d.ts.map +1 -0
  92. package/dist/receipt/index.js +154 -0
  93. package/dist/receipt/index.js.map +1 -0
  94. package/dist/report/index.d.ts +100 -0
  95. package/dist/report/index.d.ts.map +1 -0
  96. package/dist/report/index.js +355 -0
  97. package/dist/report/index.js.map +1 -0
  98. package/dist/schemas/adoption.d.ts +40 -0
  99. package/dist/schemas/adoption.d.ts.map +1 -0
  100. package/dist/schemas/adoption.js +87 -0
  101. package/dist/schemas/adoption.js.map +1 -0
  102. package/dist/schemas/baseline.d.ts +19 -0
  103. package/dist/schemas/baseline.d.ts.map +1 -0
  104. package/dist/schemas/baseline.js +45 -0
  105. package/dist/schemas/baseline.js.map +1 -0
  106. package/dist/schemas/claim.d.ts +32 -0
  107. package/dist/schemas/claim.d.ts.map +1 -0
  108. package/dist/schemas/claim.js +34 -0
  109. package/dist/schemas/claim.js.map +1 -0
  110. package/dist/schemas/classification-policy.d.ts +84 -0
  111. package/dist/schemas/classification-policy.d.ts.map +1 -0
  112. package/dist/schemas/classification-policy.js +130 -0
  113. package/dist/schemas/classification-policy.js.map +1 -0
  114. package/dist/schemas/classification-signal.d.ts +125 -0
  115. package/dist/schemas/classification-signal.d.ts.map +1 -0
  116. package/dist/schemas/classification-signal.js +126 -0
  117. package/dist/schemas/classification-signal.js.map +1 -0
  118. package/dist/schemas/classification.d.ts +120 -0
  119. package/dist/schemas/classification.d.ts.map +1 -0
  120. package/dist/schemas/classification.js +154 -0
  121. package/dist/schemas/classification.js.map +1 -0
  122. package/dist/schemas/common.d.ts +73 -0
  123. package/dist/schemas/common.d.ts.map +1 -0
  124. package/dist/schemas/common.js +60 -0
  125. package/dist/schemas/common.js.map +1 -0
  126. package/dist/schemas/coverage-policy.d.ts +89 -0
  127. package/dist/schemas/coverage-policy.d.ts.map +1 -0
  128. package/dist/schemas/coverage-policy.js +81 -0
  129. package/dist/schemas/coverage-policy.js.map +1 -0
  130. package/dist/schemas/evidence.d.ts +65 -0
  131. package/dist/schemas/evidence.d.ts.map +1 -0
  132. package/dist/schemas/evidence.js +64 -0
  133. package/dist/schemas/evidence.js.map +1 -0
  134. package/dist/schemas/execution-result.d.ts +214 -0
  135. package/dist/schemas/execution-result.d.ts.map +1 -0
  136. package/dist/schemas/execution-result.js +240 -0
  137. package/dist/schemas/execution-result.js.map +1 -0
  138. package/dist/schemas/gate-receipt.d.ts +86 -0
  139. package/dist/schemas/gate-receipt.d.ts.map +1 -0
  140. package/dist/schemas/gate-receipt.js +193 -0
  141. package/dist/schemas/gate-receipt.js.map +1 -0
  142. package/dist/schemas/index.d.ts +22 -0
  143. package/dist/schemas/index.d.ts.map +1 -0
  144. package/dist/schemas/index.js +22 -0
  145. package/dist/schemas/index.js.map +1 -0
  146. package/dist/schemas/obligation.d.ts +37 -0
  147. package/dist/schemas/obligation.d.ts.map +1 -0
  148. package/dist/schemas/obligation.js +46 -0
  149. package/dist/schemas/obligation.js.map +1 -0
  150. package/dist/schemas/plugin.d.ts +19 -0
  151. package/dist/schemas/plugin.d.ts.map +1 -0
  152. package/dist/schemas/plugin.js +20 -0
  153. package/dist/schemas/plugin.js.map +1 -0
  154. package/dist/schemas/policy.d.ts +73 -0
  155. package/dist/schemas/policy.d.ts.map +1 -0
  156. package/dist/schemas/policy.js +46 -0
  157. package/dist/schemas/policy.js.map +1 -0
  158. package/dist/schemas/resource.d.ts +26 -0
  159. package/dist/schemas/resource.d.ts.map +1 -0
  160. package/dist/schemas/resource.js +29 -0
  161. package/dist/schemas/resource.js.map +1 -0
  162. package/dist/schemas/run-manifest.d.ts +72 -0
  163. package/dist/schemas/run-manifest.d.ts.map +1 -0
  164. package/dist/schemas/run-manifest.js +125 -0
  165. package/dist/schemas/run-manifest.js.map +1 -0
  166. package/dist/schemas/runner-adapter.d.ts +169 -0
  167. package/dist/schemas/runner-adapter.d.ts.map +1 -0
  168. package/dist/schemas/runner-adapter.js +2 -0
  169. package/dist/schemas/runner-adapter.js.map +1 -0
  170. package/dist/schemas/test-catalog.d.ts +472 -0
  171. package/dist/schemas/test-catalog.d.ts.map +1 -0
  172. package/dist/schemas/test-catalog.js +311 -0
  173. package/dist/schemas/test-catalog.js.map +1 -0
  174. package/dist/schemas/test-map.d.ts +99 -0
  175. package/dist/schemas/test-map.d.ts.map +1 -0
  176. package/dist/schemas/test-map.js +103 -0
  177. package/dist/schemas/test-map.js.map +1 -0
  178. package/dist/schemas/verdict.d.ts +73 -0
  179. package/dist/schemas/verdict.d.ts.map +1 -0
  180. package/dist/schemas/verdict.js +92 -0
  181. package/dist/schemas/verdict.js.map +1 -0
  182. package/dist/schemas/waiver.d.ts +36 -0
  183. package/dist/schemas/waiver.d.ts.map +1 -0
  184. package/dist/schemas/waiver.js +42 -0
  185. package/dist/schemas/waiver.js.map +1 -0
  186. package/dist/supervision/index.d.ts +170 -0
  187. package/dist/supervision/index.d.ts.map +1 -0
  188. package/dist/supervision/index.js +354 -0
  189. package/dist/supervision/index.js.map +1 -0
  190. package/dist/testing/clock.d.ts +50 -0
  191. package/dist/testing/clock.d.ts.map +1 -0
  192. package/dist/testing/clock.js +75 -0
  193. package/dist/testing/clock.js.map +1 -0
  194. package/dist/testing/env.d.ts +66 -0
  195. package/dist/testing/env.d.ts.map +1 -0
  196. package/dist/testing/env.js +106 -0
  197. package/dist/testing/env.js.map +1 -0
  198. package/dist/testing/gate-runner.d.ts +141 -0
  199. package/dist/testing/gate-runner.d.ts.map +1 -0
  200. package/dist/testing/gate-runner.js +173 -0
  201. package/dist/testing/gate-runner.js.map +1 -0
  202. package/dist/testing/gf19.d.ts +106 -0
  203. package/dist/testing/gf19.d.ts.map +1 -0
  204. package/dist/testing/gf19.js +282 -0
  205. package/dist/testing/gf19.js.map +1 -0
  206. package/dist/testing/index.d.ts +20 -0
  207. package/dist/testing/index.d.ts.map +1 -0
  208. package/dist/testing/index.js +14 -0
  209. package/dist/testing/index.js.map +1 -0
  210. package/dist/testing/red-probe.d.ts +138 -0
  211. package/dist/testing/red-probe.d.ts.map +1 -0
  212. package/dist/testing/red-probe.js +251 -0
  213. package/dist/testing/red-probe.js.map +1 -0
  214. package/dist/testing/temp-repo.d.ts +126 -0
  215. package/dist/testing/temp-repo.d.ts.map +1 -0
  216. package/dist/testing/temp-repo.js +214 -0
  217. package/dist/testing/temp-repo.js.map +1 -0
  218. package/dist/verdict/cause.d.ts +99 -0
  219. package/dist/verdict/cause.d.ts.map +1 -0
  220. package/dist/verdict/cause.js +206 -0
  221. package/dist/verdict/cause.js.map +1 -0
  222. package/dist/verdict/evaluate.d.ts +135 -0
  223. package/dist/verdict/evaluate.d.ts.map +1 -0
  224. package/dist/verdict/evaluate.js +1513 -0
  225. package/dist/verdict/evaluate.js.map +1 -0
  226. package/dist/verdict/index.d.ts +21 -0
  227. package/dist/verdict/index.d.ts.map +1 -0
  228. package/dist/verdict/index.js +20 -0
  229. package/dist/verdict/index.js.map +1 -0
  230. package/dist/verdict/pack-verifiers.d.ts +97 -0
  231. package/dist/verdict/pack-verifiers.d.ts.map +1 -0
  232. package/dist/verdict/pack-verifiers.js +763 -0
  233. package/dist/verdict/pack-verifiers.js.map +1 -0
  234. package/dist/verdict/registry.d.ts +180 -0
  235. package/dist/verdict/registry.d.ts.map +1 -0
  236. package/dist/verdict/registry.js +67 -0
  237. package/dist/verdict/registry.js.map +1 -0
  238. package/dist/waivers/index.d.ts +103 -0
  239. package/dist/waivers/index.d.ts.map +1 -0
  240. package/dist/waivers/index.js +192 -0
  241. package/dist/waivers/index.js.map +1 -0
  242. package/package.json +40 -0
@@ -0,0 +1,282 @@
1
+ /**
2
+ * GF-19 harness rule (fixture harness, G7): a malformed source file must
3
+ * surface as a `PARSE_ERROR` finding with a line number, must never crash
4
+ * the run, and must never contribute silent resources.
5
+ *
6
+ * The rule is detector-agnostic: a detector hands the harness its output
7
+ * plus a per-file parse audit ({@link ParseAudit}); the rule guarantees
8
+ * the finding exists (synthesizing it when the detector failed to emit
9
+ * one), strips resources sourced from malformed files, and records every
10
+ * detector misbehavior as an explicit violation. G5's SQLAlchemy detector
11
+ * reuses this rule with its real audit.
12
+ */
13
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
14
+ import { compareStrings } from '../graph/index.js';
15
+ import { GATEFORGE_SCHEMA_VERSION } from '../schemas/common.js';
16
+ /** The canonical finding code for malformed source files. */
17
+ export const PARSE_ERROR_FINDING = 'PARSE_ERROR';
18
+ /**
19
+ * Normalizes a detector-supplied path for audit comparisons: posix
20
+ * separators, no leading `./`.
21
+ *
22
+ * Args:
23
+ * raw: detector-supplied path.
24
+ *
25
+ * Returns:
26
+ * string: canonical comparison key.
27
+ */
28
+ function normalizePath(raw) {
29
+ let path = raw.split('\\').join('/');
30
+ while (path.startsWith('./')) {
31
+ path = path.slice(2);
32
+ }
33
+ return path;
34
+ }
35
+ /**
36
+ * Applies the GF-19 rule to one detector contribution.
37
+ *
38
+ * Args:
39
+ * input: detector identity, parse audit, and raw output.
40
+ *
41
+ * Returns:
42
+ * ParseErrorRuleResult: guaranteed findings, vetted resources, and the
43
+ * detector's violations (empty when the detector behaved).
44
+ */
45
+ export function applyParseErrorRule(input) {
46
+ const violations = [];
47
+ const malformed = new Map();
48
+ for (const entry of input.audit) {
49
+ if (entry.ok)
50
+ continue;
51
+ let line = entry.line ?? 0;
52
+ if (!Number.isInteger(line) || line < 1) {
53
+ violations.push(`parse audit for '${entry.file}' lacks a valid 1-based line; failing closed at line 1`);
54
+ line = 1;
55
+ }
56
+ malformed.set(normalizePath(entry.file), {
57
+ line,
58
+ detail: entry.detail ?? `file failed to parse: ${entry.file}`,
59
+ });
60
+ }
61
+ const findings = input.output.findings.map((finding) => ({
62
+ ...finding,
63
+ detectorId: input.detectorId,
64
+ }));
65
+ const parseErrors = [];
66
+ for (const [file, malformedAt] of malformed) {
67
+ const existing = findings.find((finding) => finding.code === PARSE_ERROR_FINDING &&
68
+ finding.locations.some((location) => location.file === file && location.line === malformedAt.line));
69
+ if (existing !== undefined) {
70
+ parseErrors.push(existing);
71
+ continue;
72
+ }
73
+ const synthesized = {
74
+ code: PARSE_ERROR_FINDING,
75
+ detail: malformedAt.detail,
76
+ locations: [{ file, line: malformedAt.line, col: 0 }],
77
+ detectorId: input.detectorId,
78
+ };
79
+ findings.push(synthesized);
80
+ parseErrors.push(synthesized);
81
+ violations.push(`detector emitted no ${PARSE_ERROR_FINDING} finding for '${file}'; the harness rule synthesized it`);
82
+ }
83
+ const resources = [];
84
+ for (const resource of input.output.resources) {
85
+ if (malformed.has(normalizePath(resource.source))) {
86
+ violations.push(`dropped silent resource '${resource.id}' sourced from malformed file '${resource.source}'`);
87
+ continue;
88
+ }
89
+ resources.push(resource);
90
+ }
91
+ findings.sort((a, b) => {
92
+ const byCode = compareStrings(a.code, b.code);
93
+ if (byCode !== 0)
94
+ return byCode;
95
+ const firstA = a.locations[0];
96
+ const firstB = b.locations[0];
97
+ if (firstA === undefined)
98
+ return -1;
99
+ if (firstB === undefined)
100
+ return 1;
101
+ return compareStrings(`${firstA.file}:${firstA.line}`, `${firstB.file}:${firstB.line}`);
102
+ });
103
+ return { findings, parseErrors, resources, violations };
104
+ }
105
+ /**
106
+ * Whether a finding list contains at least one `PARSE_ERROR` — the
107
+ * fail-closed signal that a source file could not be read.
108
+ *
109
+ * Args:
110
+ * findings: graph or rule findings.
111
+ *
112
+ * Returns:
113
+ * boolean: true when malformed source is in play.
114
+ */
115
+ export function hasParseErrors(findings) {
116
+ return findings.some((finding) => finding.code === PARSE_ERROR_FINDING);
117
+ }
118
+ /**
119
+ * The toy declaration grammar the stub detector parses: blank lines,
120
+ * `# comments`, and `name = value` declarations. Anything else is a
121
+ * syntax error at that line.
122
+ */
123
+ const STUB_DECLARATION = /^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*\S.*$/;
124
+ /**
125
+ * Sorted directory entry names of a directory.
126
+ *
127
+ * Args:
128
+ * absolute: absolute directory path.
129
+ *
130
+ * Returns:
131
+ * string[]: entry names, codepoint-sorted.
132
+ */
133
+ function readdirSorted(absolute) {
134
+ return readdirSync(absolute).sort(compareStrings);
135
+ }
136
+ /**
137
+ * Directory check that never throws on missing paths.
138
+ *
139
+ * Args:
140
+ * absolute: candidate path.
141
+ *
142
+ * Returns:
143
+ * boolean: true when the path is an existing directory.
144
+ */
145
+ function isDirectory(absolute) {
146
+ try {
147
+ return statSync(absolute).isDirectory();
148
+ }
149
+ catch {
150
+ return false;
151
+ }
152
+ }
153
+ /**
154
+ * Reads a UTF-8 file, failing loud with path context on error.
155
+ *
156
+ * Args:
157
+ * absolute: file path.
158
+ *
159
+ * Returns:
160
+ * string: file content.
161
+ */
162
+ function readTextFile(absolute) {
163
+ return readFileSync(absolute, 'utf8');
164
+ }
165
+ /**
166
+ * Lists candidate source files under a repository root, deterministically
167
+ * sorted, skipping `.git` and `.gateforge` trees.
168
+ *
169
+ * Args:
170
+ * root: absolute repository root.
171
+ * suffixes: optional suffix filter.
172
+ *
173
+ * Returns:
174
+ * string[]: repo-root-relative posix paths.
175
+ */
176
+ function listSourceFiles(root, suffixes) {
177
+ const files = [];
178
+ const visit = (absolute, relative) => {
179
+ for (const entry of readdirSorted(absolute)) {
180
+ if (entry === '.git' || entry === '.gateforge')
181
+ continue;
182
+ const childRelative = relative === '' ? entry : `${relative}/${entry}`;
183
+ const childAbsolute = `${absolute}/${entry}`;
184
+ if (isDirectory(childAbsolute)) {
185
+ visit(childAbsolute, childRelative);
186
+ continue;
187
+ }
188
+ if (suffixes !== undefined && !suffixes.some((suffix) => entry.endsWith(suffix))) {
189
+ continue;
190
+ }
191
+ files.push(childRelative);
192
+ }
193
+ };
194
+ visit(root, '');
195
+ files.sort(compareStrings);
196
+ return files;
197
+ }
198
+ /**
199
+ * Detects resources in a fixture repository with a deliberately trivial
200
+ * in-process parser: every top-level `name = value` line becomes a
201
+ * resource (`kind: 'stub.declaration'`, `resourceName` attribute), any
202
+ * other non-comment/non-blank line is a syntax error, and a file with a
203
+ * syntax error yields a `PARSE_ERROR` finding at that line and no
204
+ * resources. Malformed files never crash the scan.
205
+ *
206
+ * Args:
207
+ * repo: the fixture repository to scan.
208
+ * options: detector identity and optional suffix filter.
209
+ *
210
+ * Returns:
211
+ * StubDetectorResult: discovery output plus the parse audit for the
212
+ * GF-19 rule.
213
+ */
214
+ export function stubDetector(repo, options = {}) {
215
+ const detectorId = options.id ?? 'gateforge.stub-detector';
216
+ const detectorVersion = options.version ?? '0.0.0';
217
+ const resources = [];
218
+ const findings = [];
219
+ const audit = [];
220
+ for (const relative of listSourceFiles(repo.root, options.suffixes)) {
221
+ const text = readTextFile(`${repo.root}/${relative}`);
222
+ const lines = text.split(/\r?\n/);
223
+ // Resources are buffered per file: a file with ANY syntax error
224
+ // contributes zero resources (GF-19 — a partial parse can't be
225
+ // trusted, so nothing from a malformed file may leak through).
226
+ const fileResources = [];
227
+ let errorLine = 0;
228
+ let errorText = '';
229
+ for (let index = 0; index < lines.length; index += 1) {
230
+ const rawLine = lines[index] ?? '';
231
+ const trimmed = rawLine.trim();
232
+ if (trimmed === '' || trimmed.startsWith('#'))
233
+ continue;
234
+ const match = STUB_DECLARATION.exec(trimmed);
235
+ if (match === null) {
236
+ errorLine = index + 1;
237
+ errorText = trimmed;
238
+ break;
239
+ }
240
+ const name = match[1];
241
+ if (name === undefined) {
242
+ errorLine = index + 1;
243
+ errorText = trimmed;
244
+ break;
245
+ }
246
+ fileResources.push({
247
+ schemaVersion: GATEFORGE_SCHEMA_VERSION,
248
+ id: name,
249
+ kind: 'stub.declaration',
250
+ source: relative,
251
+ location: { file: relative, line: index + 1, col: 0 },
252
+ detectorVersion,
253
+ attributes: { resourceName: name },
254
+ });
255
+ }
256
+ if (errorLine === 0) {
257
+ resources.push(...fileResources);
258
+ audit.push({ file: relative, ok: true });
259
+ }
260
+ else {
261
+ const detail = `stub parse error in '${relative}' at line ${errorLine}: ${JSON.stringify(errorText)}`;
262
+ findings.push({
263
+ code: PARSE_ERROR_FINDING,
264
+ detail,
265
+ locations: [{ file: relative, line: errorLine, col: 0 }],
266
+ });
267
+ audit.push({ file: relative, ok: false, line: errorLine, detail });
268
+ }
269
+ }
270
+ return {
271
+ output: {
272
+ detectorId,
273
+ detectorVersion,
274
+ resources,
275
+ unresolved: [],
276
+ findings,
277
+ classificationSignals: [],
278
+ },
279
+ audit,
280
+ };
281
+ }
282
+ //# sourceMappingURL=gf19.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gf19.js","sourceRoot":"","sources":["../../src/testing/gf19.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAIhE,6DAA6D;AAC7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAmDjD;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA0B;IAC5D,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4C,CAAC;IACtE,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,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,eAAe;gBACf,UAAU,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;aACnC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;YACpB,SAAS,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,wBAAwB,QAAQ,aAAa,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YACtG,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,mBAAmB;gBACzB,MAAM;gBACN,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;aACzD,CAAC,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,UAAU;YACV,eAAe;YACf,SAAS;YACT,UAAU,EAAE,EAAE;YACd,QAAQ;YACR,qBAAqB,EAAE,EAAE;SAC1B;QACD,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Fixture harness (G7): deterministic temporary git repositories,
3
+ * injected clocks and environments, the gate-runner pipeline, the GF-19
4
+ * malformed-source rule, and the RED-PROBE discipline. Everything here is
5
+ * offline and wall-clock-free; the public surface is re-exported from
6
+ * `@gate-forge/core`.
7
+ */
8
+ export { FIXED_GIT_DATE, TempRepo, withTempRepo, } from './temp-repo.js';
9
+ export type { GitResult, TempRepoOptions } from './temp-repo.js';
10
+ export { makeClock, toIso } from './clock.js';
11
+ export type { ClockSpec, TestClock } from './clock.js';
12
+ export { fakeProvider, localStagedProvider, normalizeChangedFiles, withEnv, } from './env.js';
13
+ export type { ChangedFileProvider } from './env.js';
14
+ export { PARSE_ERROR_FINDING, applyParseErrorRule, hasParseErrors, stubDetector, } from './gf19.js';
15
+ export type { ParseAudit, ParseAuditEntry, ParseErrorRuleInput, ParseErrorRuleResult, StubDetectorOptions, StubDetectorResult, } from './gf19.js';
16
+ export { runGates } from './gate-runner.js';
17
+ export type { DetectorContribution, EvaluatorVerdict, GateRunResult, ObligationEvaluator, ObligationEvaluatorInput, GateRunVerdict, RunGatesInput, } from './gate-runner.js';
18
+ export { RedProbeFailure, RedProbeSuiteError, cleanupProbeSuite, formatProbeRecords, runRedProbe, runRedProbes, spawnVitest, writeProbeRecords, writeProbeSuite, } from './red-probe.js';
19
+ export type { RedProbe, RedProbeRecord, VitestRunOptions, VitestRunResult, } from './red-probe.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,OAAO,GACR,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Fixture harness (G7): deterministic temporary git repositories,
3
+ * injected clocks and environments, the gate-runner pipeline, the GF-19
4
+ * malformed-source rule, and the RED-PROBE discipline. Everything here is
5
+ * offline and wall-clock-free; the public surface is re-exported from
6
+ * `@gate-forge/core`.
7
+ */
8
+ export { FIXED_GIT_DATE, TempRepo, withTempRepo, } from './temp-repo.js';
9
+ export { makeClock, toIso } from './clock.js';
10
+ export { fakeProvider, localStagedProvider, normalizeChangedFiles, withEnv, } from './env.js';
11
+ export { PARSE_ERROR_FINDING, applyParseErrorRule, hasParseErrors, stubDetector, } from './gf19.js';
12
+ export { runGates } from './gate-runner.js';
13
+ export { RedProbeFailure, RedProbeSuiteError, cleanupProbeSuite, formatProbeRecords, runRedProbe, runRedProbes, spawnVitest, writeProbeRecords, writeProbeSuite, } from './red-probe.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,OAAO,GACR,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,WAAW,CAAC;AAUnB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,138 @@
1
+ /** One red-probe pair: the same guard, correct vs deliberately broken. */
2
+ export interface RedProbe {
3
+ /** Stable probe name (appears in the run record). */
4
+ name: string;
5
+ /** Guard run against correct behavior — must pass. */
6
+ green: () => void | Promise<void>;
7
+ /** Identical guard run against deliberately broken behavior — must fail. */
8
+ broken: () => void | Promise<void>;
9
+ }
10
+ /** Outcome of one probe. `ok` is true only for an honest guard. */
11
+ export interface RedProbeRecord {
12
+ /** Probe name. */
13
+ name: string;
14
+ /** The guard passed against correct behavior. */
15
+ greenPassed: boolean;
16
+ /** The guard failed against deliberately broken behavior. */
17
+ brokenFailed: boolean;
18
+ /** greenPassed && brokenFailed — the probe proved something. */
19
+ ok: boolean;
20
+ /** Human cause when not ok (fake green vs broken guard). */
21
+ failure?: string;
22
+ }
23
+ /** Thrown by {@link runRedProbe} when a probe is not honest. */
24
+ export declare class RedProbeFailure extends Error {
25
+ /** The failing record. */
26
+ readonly record: RedProbeRecord;
27
+ constructor(record: RedProbeRecord);
28
+ }
29
+ /**
30
+ * Runs one probe pair and classifies the outcome.
31
+ *
32
+ * Args:
33
+ * probe: the green/broken guard pair.
34
+ *
35
+ * Returns:
36
+ * RedProbeRecord: the classified outcome (never throws).
37
+ */
38
+ export declare function runRedProbe(probe: RedProbe): Promise<RedProbeRecord>;
39
+ /** Thrown by {@link runRedProbes} when any probe is not honest. */
40
+ export declare class RedProbeSuiteError extends Error {
41
+ /** All records, honest or not. */
42
+ readonly records: RedProbeRecord[];
43
+ constructor(records: RedProbeRecord[]);
44
+ }
45
+ /**
46
+ * Runs probes sequentially and throws {@link RedProbeSuiteError} when any
47
+ * is not honest (pass `{throwOnFailure: false}` to only collect).
48
+ *
49
+ * Args:
50
+ * probes: probe pairs, run in order.
51
+ * options: `throwOnFailure` default true.
52
+ *
53
+ * Returns:
54
+ * RedProbeRecord[]: one record per probe, in order.
55
+ */
56
+ export declare function runRedProbes(probes: RedProbe[], { throwOnFailure }?: {
57
+ throwOnFailure?: boolean;
58
+ }): Promise<RedProbeRecord[]>;
59
+ /**
60
+ * Renders probe records as a markdown table — the body of a run record.
61
+ *
62
+ * Args:
63
+ * records: probe outcomes.
64
+ *
65
+ * Returns:
66
+ * string: markdown table (probe / green passed / broken failed / verdict).
67
+ */
68
+ export declare function formatProbeRecords(records: RedProbeRecord[]): string;
69
+ /**
70
+ * Writes a red-probe run record (markdown) to an explicit file path,
71
+ * creating parent directories. The path is caller-owned so the harness
72
+ * never writes outside its permission.
73
+ *
74
+ * Args:
75
+ * path: destination file path.
76
+ * records: probe outcomes to record.
77
+ */
78
+ export declare function writeProbeRecords(path: string, records: RedProbeRecord[]): void;
79
+ /** Result of one spawned vitest run. */
80
+ export interface VitestRunResult {
81
+ /** Process exit code (-1 when killed before exit). */
82
+ exitCode: number;
83
+ /** Captured stdout. */
84
+ stdout: string;
85
+ /** Captured stderr. */
86
+ stderr: string;
87
+ /** True when the child was terminated by a timeout signal. */
88
+ timedOut: boolean;
89
+ }
90
+ /** Options for {@link spawnVitest}. */
91
+ export interface VitestRunOptions {
92
+ /** Working directory (defaults to process cwd). */
93
+ cwd?: string;
94
+ /** Extra environment variables layered over `process.env`. */
95
+ env?: Record<string, string | undefined>;
96
+ /** Kill timeout in milliseconds. Default 120000. */
97
+ timeoutMs?: number;
98
+ }
99
+ /**
100
+ * Runs the workspace's vitest suite as a child process (`vitest run`),
101
+ * fully offline. CI-proof mode runs a probe suite twice — normal vs
102
+ * deliberately-broken sources — and requires the broken run to exit
103
+ * non-zero.
104
+ *
105
+ * Args:
106
+ * args: extra CLI arguments (file filters, --config, …).
107
+ * options: cwd, env additions, timeout.
108
+ *
109
+ * Returns:
110
+ * VitestRunResult: exit code and captured output.
111
+ */
112
+ export declare function spawnVitest(args: string[], options?: VitestRunOptions): VitestRunResult;
113
+ /**
114
+ * Materializes a probe suite in a directory and symlinks the workspace's
115
+ * `node_modules` into it, so probe files can `import ... from 'vitest'`
116
+ * even though the directory lives in the OS tmpdir. Clean up with
117
+ * `rmSync(dir, {recursive: true, force: true})` — removing the symlink
118
+ * never traverses into the real node_modules.
119
+ *
120
+ * Args:
121
+ * dir: target directory (created recursively).
122
+ * files: file-tree spec relative to `dir` (e.g. a `vitest.config.mjs`
123
+ * exporting a plain object and one or more `*.test.mjs` probes).
124
+ *
125
+ * Returns:
126
+ * string: the directory, ready for {@link spawnVitest} with `cwd: dir`.
127
+ */
128
+ export declare function writeProbeSuite(dir: string, files: Record<string, string>): string;
129
+ /** Test-only: drops the cached vitest CLI path (path resolution tests). */
130
+ export declare function resetVitestCliCache(): void;
131
+ /**
132
+ * Removes a probe-suite directory created by {@link writeProbeSuite}.
133
+ *
134
+ * Args:
135
+ * dir: directory to remove.
136
+ */
137
+ export declare function cleanupProbeSuite(dir: string): void;
138
+ //# sourceMappingURL=red-probe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"red-probe.d.ts","sourceRoot":"","sources":["../../src/testing/red-probe.ts"],"names":[],"mappings":"AAkBA,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,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