@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.
- package/README.md +91 -704
- package/dist/adapter-audit.d.ts +208 -0
- package/dist/adapter-audit.d.ts.map +1 -0
- package/dist/adapter-audit.js +579 -0
- package/dist/adapter-audit.js.map +1 -0
- package/dist/adapter-scaffold.d.ts +91 -0
- package/dist/adapter-scaffold.d.ts.map +1 -0
- package/dist/adapter-scaffold.js +474 -0
- package/dist/adapter-scaffold.js.map +1 -0
- package/dist/adopted-baseline.d.ts +10 -0
- package/dist/adopted-baseline.d.ts.map +1 -1
- package/dist/adopted-baseline.js +18 -1
- package/dist/adopted-baseline.js.map +1 -1
- package/dist/args.d.ts +15 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +61 -2
- package/dist/args.js.map +1 -1
- package/dist/behavior-setup.d.ts +239 -0
- package/dist/behavior-setup.d.ts.map +1 -0
- package/dist/behavior-setup.js +751 -0
- package/dist/behavior-setup.js.map +1 -0
- package/dist/broker.d.ts.map +1 -1
- package/dist/broker.js +28 -2
- package/dist/broker.js.map +1 -1
- package/dist/cache-exclusions.d.ts +45 -0
- package/dist/cache-exclusions.d.ts.map +1 -0
- package/dist/cache-exclusions.js +205 -0
- package/dist/cache-exclusions.js.map +1 -0
- package/dist/candidate-tree.d.ts +86 -14
- package/dist/candidate-tree.d.ts.map +1 -1
- package/dist/candidate-tree.js +236 -62
- package/dist/candidate-tree.js.map +1 -1
- package/dist/ci-witnessed-template.d.ts +43 -0
- package/dist/ci-witnessed-template.d.ts.map +1 -0
- package/dist/ci-witnessed-template.js +283 -0
- package/dist/ci-witnessed-template.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/adapters.d.ts +15 -0
- package/dist/commands/adapters.d.ts.map +1 -0
- package/dist/commands/adapters.js +355 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/adopt.d.ts +7 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +44 -2
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +42 -1
- package/dist/commands/baseline.js.map +1 -1
- package/dist/commands/blocking.d.ts +105 -2
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +395 -53
- package/dist/commands/blocking.js.map +1 -1
- package/dist/commands/check.d.ts +36 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1068 -64
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/classify.d.ts +2 -1
- package/dist/commands/classify.d.ts.map +1 -1
- package/dist/commands/classify.js +188 -5
- package/dist/commands/classify.js.map +1 -1
- package/dist/commands/enforce.d.ts +4 -4
- package/dist/commands/enforce.d.ts.map +1 -1
- package/dist/commands/enforce.js +41 -9
- package/dist/commands/enforce.js.map +1 -1
- package/dist/commands/enforcement.d.ts +13 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +880 -33
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/explain.d.ts +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +162 -3
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/history.d.ts +12 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +45 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init-presets.d.ts +155 -0
- package/dist/commands/init-presets.d.ts.map +1 -0
- package/dist/commands/init-presets.js +203 -0
- package/dist/commands/init-presets.js.map +1 -0
- package/dist/commands/init.d.ts +7 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +987 -99
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +29 -13
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +846 -19
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/pre-commit.d.ts +25 -0
- package/dist/commands/pre-commit.d.ts.map +1 -1
- package/dist/commands/pre-commit.js +91 -6
- package/dist/commands/pre-commit.js.map +1 -1
- package/dist/commands/quarantine.d.ts +16 -0
- package/dist/commands/quarantine.d.ts.map +1 -0
- package/dist/commands/quarantine.js +213 -0
- package/dist/commands/quarantine.js.map +1 -0
- package/dist/commands/run.d.ts +39 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +196 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/test-gates.d.ts +284 -2
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +3620 -187
- package/dist/commands/test-gates.js.map +1 -1
- package/dist/commands/tests.d.ts +1 -1
- package/dist/commands/tests.d.ts.map +1 -1
- package/dist/commands/tests.js +264 -29
- package/dist/commands/tests.js.map +1 -1
- package/dist/docs-exclusions.d.ts.map +1 -1
- package/dist/docs-exclusions.js +18 -3
- package/dist/docs-exclusions.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +78 -9
- package/dist/endpoint-compiler.js.map +1 -1
- package/dist/engine-browser.d.ts +183 -0
- package/dist/engine-browser.d.ts.map +1 -0
- package/dist/engine-browser.js +381 -0
- package/dist/engine-browser.js.map +1 -0
- package/dist/engine-identity.d.ts +100 -0
- package/dist/engine-identity.d.ts.map +1 -0
- package/dist/engine-identity.js +182 -0
- package/dist/engine-identity.js.map +1 -0
- package/dist/evaluate.d.ts +105 -1
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +149 -18
- package/dist/evaluate.js.map +1 -1
- package/dist/execution.d.ts +253 -9
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +309 -12
- package/dist/execution.js.map +1 -1
- package/dist/gateforge-owned.d.ts +78 -0
- package/dist/gateforge-owned.d.ts.map +1 -0
- package/dist/gateforge-owned.js +254 -0
- package/dist/gateforge-owned.js.map +1 -0
- package/dist/git-hooks.d.ts +35 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +140 -1
- package/dist/git-hooks.js.map +1 -1
- package/dist/git-ignored.d.ts +27 -0
- package/dist/git-ignored.d.ts.map +1 -0
- package/dist/git-ignored.js +102 -0
- package/dist/git-ignored.js.map +1 -0
- package/dist/git-objects.d.ts +60 -0
- package/dist/git-objects.d.ts.map +1 -0
- package/dist/git-objects.js +152 -0
- package/dist/git-objects.js.map +1 -0
- package/dist/glob.d.ts +33 -14
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +96 -5
- package/dist/glob.js.map +1 -1
- package/dist/history.d.ts +52 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +116 -0
- package/dist/history.js.map +1 -0
- package/dist/host-load.d.ts +49 -0
- package/dist/host-load.d.ts.map +1 -0
- package/dist/host-load.js +78 -0
- package/dist/host-load.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/input-snapshot.d.ts +63 -9
- package/dist/input-snapshot.d.ts.map +1 -1
- package/dist/input-snapshot.js +195 -17
- package/dist/input-snapshot.js.map +1 -1
- package/dist/io.d.ts +49 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +22 -0
- package/dist/io.js.map +1 -1
- package/dist/mapping.d.ts +84 -1
- package/dist/mapping.d.ts.map +1 -1
- package/dist/mapping.js +276 -5
- package/dist/mapping.js.map +1 -1
- package/dist/native-freeze.d.ts +217 -0
- package/dist/native-freeze.d.ts.map +1 -0
- package/dist/native-freeze.js +332 -0
- package/dist/native-freeze.js.map +1 -0
- package/dist/pipeline.d.ts +67 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +164 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/planes-inference.d.ts +12 -5
- package/dist/planes-inference.d.ts.map +1 -1
- package/dist/planes-inference.js +13 -15
- package/dist/planes-inference.js.map +1 -1
- package/dist/playwright-browsers.d.ts +210 -0
- package/dist/playwright-browsers.d.ts.map +1 -0
- package/dist/playwright-browsers.js +364 -0
- package/dist/playwright-browsers.js.map +1 -0
- package/dist/plugins.d.ts +15 -5
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +59 -9
- package/dist/plugins.js.map +1 -1
- package/dist/progress.d.ts +148 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +263 -0
- package/dist/progress.js.map +1 -0
- package/dist/providers.d.ts +26 -1
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +39 -0
- package/dist/providers.js.map +1 -1
- package/dist/receipts.d.ts +1 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/receipts.js +35 -7
- package/dist/receipts.js.map +1 -1
- package/dist/repo-scan.d.ts +15 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +329 -34
- package/dist/repo-scan.js.map +1 -1
- package/dist/reseal-chain.d.ts +184 -0
- package/dist/reseal-chain.d.ts.map +1 -0
- package/dist/reseal-chain.js +735 -0
- package/dist/reseal-chain.js.map +1 -0
- package/dist/reseal-evidence.d.ts +241 -0
- package/dist/reseal-evidence.d.ts.map +1 -0
- package/dist/reseal-evidence.js +319 -0
- package/dist/reseal-evidence.js.map +1 -0
- package/dist/reseal.d.ts +181 -0
- package/dist/reseal.d.ts.map +1 -0
- package/dist/reseal.js +1620 -0
- package/dist/reseal.js.map +1 -0
- package/dist/response-field-guidance.d.ts +82 -0
- package/dist/response-field-guidance.d.ts.map +1 -0
- package/dist/response-field-guidance.js +184 -0
- package/dist/response-field-guidance.js.map +1 -0
- package/dist/route-plane-proposals.d.ts +100 -0
- package/dist/route-plane-proposals.d.ts.map +1 -0
- package/dist/route-plane-proposals.js +213 -0
- package/dist/route-plane-proposals.js.map +1 -0
- package/dist/run-cache.d.ts +260 -0
- package/dist/run-cache.d.ts.map +1 -0
- package/dist/run-cache.js +771 -0
- package/dist/run-cache.js.map +1 -0
- package/dist/run-preflight.d.ts +77 -0
- package/dist/run-preflight.d.ts.map +1 -0
- package/dist/run-preflight.js +774 -0
- package/dist/run-preflight.js.map +1 -0
- package/dist/run-recipe.d.ts +107 -0
- package/dist/run-recipe.d.ts.map +1 -0
- package/dist/run-recipe.js +295 -0
- package/dist/run-recipe.js.map +1 -0
- package/dist/run-reliability.d.ts +126 -0
- package/dist/run-reliability.d.ts.map +1 -0
- package/dist/run-reliability.js +221 -0
- package/dist/run-reliability.js.map +1 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +11 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scope.d.ts +20 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +26 -5
- package/dist/scope.js.map +1 -1
- package/dist/secret-guard.d.ts +36 -0
- package/dist/secret-guard.d.ts.map +1 -0
- package/dist/secret-guard.js +63 -0
- package/dist/secret-guard.js.map +1 -0
- package/dist/singleton-guidance.d.ts +82 -0
- package/dist/singleton-guidance.d.ts.map +1 -0
- package/dist/singleton-guidance.js +138 -0
- package/dist/singleton-guidance.js.map +1 -0
- package/dist/staged-candidate.d.ts +17 -0
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +50 -0
- package/dist/staged-candidate.js.map +1 -1
- package/dist/state-artifacts.d.ts +70 -0
- package/dist/state-artifacts.d.ts.map +1 -0
- package/dist/state-artifacts.js +215 -0
- package/dist/state-artifacts.js.map +1 -0
- package/dist/state.d.ts +170 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +248 -8
- package/dist/state.js.map +1 -1
- package/dist/unmatched-routes.d.ts +60 -0
- package/dist/unmatched-routes.d.ts.map +1 -0
- package/dist/unmatched-routes.js +131 -0
- package/dist/unmatched-routes.js.map +1 -0
- package/dist/verifier-keys.d.ts +33 -2
- package/dist/verifier-keys.d.ts.map +1 -1
- package/dist/verifier-keys.js +95 -9
- package/dist/verifier-keys.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +425 -0
- package/guides/QUICKSTART.md +306 -26
- package/guides/REFERENCE.md +1710 -0
- package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
- package/guides/TEST-ENVIRONMENT.md +1044 -6
- package/guides/UPGRADE-0.6-to-0.7.md +3 -3
- package/guides/UPGRADE-0.7-to-0.8.md +114 -0
- package/guides/UPGRADE-0.8-to-0.9.md +104 -0
- package/package.json +10 -9
package/dist/commands/tests.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `gateforge tests`:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `gateforge tests`: seven subcommands for test inventory, annotation sync,
|
|
3
|
+
* mapping, and diagnostic workflows.
|
|
5
4
|
* - `discover` — inventory the repository's tests into the derived
|
|
6
5
|
* run-state catalog (Phase 2).
|
|
7
6
|
* - `suggest` — resolve mappings for the run's obligations and produce
|
|
@@ -13,6 +12,8 @@
|
|
|
13
12
|
* obligation registry, then write/update `.gateforge/test-map.yml`
|
|
14
13
|
* ATOMICALLY and idempotently, printing the exact diff. Never edits
|
|
15
14
|
* test files, never adds waivers, refuses contradictions.
|
|
15
|
+
* - `sync` — regenerate only annotation-sourced entries from an AST-only
|
|
16
|
+
* scan; hand-written sidecar entries are never modified.
|
|
16
17
|
* - `explain` — the per-test §4 report: requirements, existing-test
|
|
17
18
|
* identity, mapping origin, honest execution status, next action, and
|
|
18
19
|
* `New test needed`. Exit 2 for an unknown key.
|
|
@@ -31,31 +32,37 @@
|
|
|
31
32
|
* contract: 0 ok, 2 config/usage errors (including unknown keys/ids and
|
|
32
33
|
* failed native enumeration).
|
|
33
34
|
*/
|
|
34
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
35
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
35
36
|
import { join } from 'node:path';
|
|
36
|
-
import { canonicalJson, compareStrings, mappingSuggestions, TestKindSchema, } from '@gate-forge/core';
|
|
37
|
-
import { discoverTestCatalog, TestDiscoveryError, } from '@gate-forge/pack-playwright';
|
|
37
|
+
import { canonicalJson, compareStrings, mappingSuggestions, TestKindSchema, TestMapSchema, } from '@gate-forge/core';
|
|
38
|
+
import { discoverTestCatalog, TestDiscoveryError, scanTestFiles, } from '@gate-forge/pack-playwright';
|
|
38
39
|
import { parseArgs, stringFlag } from '../args.js';
|
|
39
40
|
import { diagnosticsJson, renderDiagnosticsText, runDiagnosticSuites } from '../diagnostics.js';
|
|
40
41
|
import { UsageError } from '../errors.js';
|
|
41
42
|
import { writeLine } from '../io.js';
|
|
42
43
|
import { collectInputFiles, computeInputSnapshot, diffInputFiles, SnapshotUnavailableError, UnsupportedSnapshotError, } from '../input-snapshot.js';
|
|
43
|
-
import { diffLines, loadOptionalTestMap, relativeToRepo, resolveRepositoryMappings, serializeTestMap, TEST_MAP_RELATIVE, writeTestMapAtomic, } from '../mapping.js';
|
|
44
|
+
import { diffLines, loadOptionalTestMap, relativeToRepo, resolveRepositoryMappings, nativeInventoryBlocking, serializeTestMap, TEST_MAP_RELATIVE, annotationTestMapEntries, writeTestMapAtomic, } from '../mapping.js';
|
|
44
45
|
import { runPipeline, sourcesByResourceId } from '../pipeline.js';
|
|
45
46
|
import { resolveProvider } from '../providers.js';
|
|
46
47
|
import { httpRoutesView, resolveStateDir } from '../state.js';
|
|
48
|
+
import { engineGeneratedStateFileFilter } from '../state-artifacts.js';
|
|
47
49
|
import { loadConfigAt, rejectUnknownFlags } from './common.js';
|
|
48
50
|
import { installedPlaywrightCompatibilityError } from '../package-compatibility.js';
|
|
51
|
+
import { loadCacheExclusions } from '../cache-exclusions.js';
|
|
49
52
|
export const TESTS_USAGE = `\
|
|
50
53
|
usage: gateforge tests discover [--json] [--pytest]
|
|
54
|
+
gateforge tests catalog [--json]
|
|
51
55
|
gateforge tests surface-doctor [--json]
|
|
52
56
|
gateforge tests suggest [--changed] [--json]
|
|
53
57
|
gateforge tests mark --test <key> --kind <kind> [--category <c>]... \\
|
|
54
58
|
--obligation <id>... --reason "<text>"
|
|
59
|
+
gateforge tests sync [--json]
|
|
55
60
|
gateforge tests explain --test <key> [--json]
|
|
56
61
|
gateforge tests diagnose [--suite <name>] [--json]`;
|
|
57
62
|
/** The derived catalog file under the run-state directory. */
|
|
58
63
|
export const CATALOG_FILE_NAME = 'test-catalog.json';
|
|
64
|
+
/** How many ranked candidates the text surface prints per obligation. */
|
|
65
|
+
const SUGGESTED_CANDIDATE_LIMIT = 5;
|
|
59
66
|
/**
|
|
60
67
|
* Runs the `tests` command family (discover/suggest/mark/explain).
|
|
61
68
|
*
|
|
@@ -81,12 +88,16 @@ export async function testsCommand(io, argv) {
|
|
|
81
88
|
switch (subcommand) {
|
|
82
89
|
case 'discover':
|
|
83
90
|
return discoverSubcommand(io, options);
|
|
91
|
+
case 'catalog':
|
|
92
|
+
return catalogSubcommand(io, options);
|
|
84
93
|
case 'surface-doctor':
|
|
85
94
|
return surfaceDoctorSubcommand(io, options);
|
|
86
95
|
case 'suggest':
|
|
87
96
|
return suggestSubcommand(io, options);
|
|
88
97
|
case 'mark':
|
|
89
98
|
return markSubcommand(io, options);
|
|
99
|
+
case 'sync':
|
|
100
|
+
return syncSubcommand(io, options);
|
|
90
101
|
case 'explain':
|
|
91
102
|
return explainSubcommand(io, options);
|
|
92
103
|
case 'diagnose':
|
|
@@ -129,7 +140,12 @@ async function surfaceDoctorSubcommand(io, options) {
|
|
|
129
140
|
async function runDiscovery(cwd, config, stateDir, collectPytest) {
|
|
130
141
|
let discovered;
|
|
131
142
|
try {
|
|
132
|
-
discovered = await discoverTestCatalog({
|
|
143
|
+
discovered = await discoverTestCatalog({
|
|
144
|
+
cwd,
|
|
145
|
+
config,
|
|
146
|
+
collectPytest,
|
|
147
|
+
excludeFile: engineGeneratedStateFileFilter(cwd, stateDir),
|
|
148
|
+
});
|
|
133
149
|
}
|
|
134
150
|
catch (error) {
|
|
135
151
|
// A failed native enumeration is a config/environment problem
|
|
@@ -144,6 +160,76 @@ async function runDiscovery(cwd, config, stateDir, collectPytest) {
|
|
|
144
160
|
writeFileSync(join(stateDir, CATALOG_FILE_NAME), `${discovered.json}\n`, 'utf8');
|
|
145
161
|
return discovered;
|
|
146
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Builds a derived test catalog with mapped claims and related HTTP routes.
|
|
165
|
+
*
|
|
166
|
+
* Args:
|
|
167
|
+
* io: repository context and output streams.
|
|
168
|
+
* options: parsed catalog flags.
|
|
169
|
+
*
|
|
170
|
+
* Returns:
|
|
171
|
+
* Promise<number>: zero when discovery completes, two for usage or discovery errors.
|
|
172
|
+
*/
|
|
173
|
+
async function catalogSubcommand(io, options) {
|
|
174
|
+
rejectUnknownFlags(options, ['json', 'help'], TESTS_USAGE);
|
|
175
|
+
const config = loadConfigAt(io.cwd);
|
|
176
|
+
const stateDir = resolveStateDir(io.cwd);
|
|
177
|
+
const discovered = await runDiscovery(io.cwd, config, stateDir, false);
|
|
178
|
+
const sidecar = loadOptionalTestMap(io.cwd);
|
|
179
|
+
const entries = discovered.catalog.entries.map((entry) => {
|
|
180
|
+
const claims = new Set(sidecar?.tests.find((declaration) => declaration.key === entry.logicalKey)?.claims ?? []);
|
|
181
|
+
for (const claim of discovered.nativeClaims) {
|
|
182
|
+
if (claim.testFile === entry.file && (claim.testId === entry.logicalKey || claim.testId === entry.title)) {
|
|
183
|
+
claims.add(claim.obligationId);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const sortedClaims = [...claims].sort(compareStrings);
|
|
187
|
+
const source = readFileSync(join(io.cwd, entry.file), 'utf8');
|
|
188
|
+
const routePattern = /(?:goto|route|url|path)\s*\(\s*(['"`])(\/[^'"`]*?)\1/g;
|
|
189
|
+
const routeMatches = [];
|
|
190
|
+
for (const match of source.matchAll(routePattern)) {
|
|
191
|
+
const route = match[2];
|
|
192
|
+
if (route !== undefined)
|
|
193
|
+
routeMatches.push(route);
|
|
194
|
+
}
|
|
195
|
+
const routes = [...new Set(routeMatches)].sort(compareStrings);
|
|
196
|
+
return { file: entry.file, title: entry.title, claims: sortedClaims, routes };
|
|
197
|
+
});
|
|
198
|
+
if (options['json'] === true) {
|
|
199
|
+
writeLine(io.stdout, canonicalJson({ schemaVersion: 1, entries }));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
writeLine(io.stdout, `tests catalog: ${entries.length} test(s)`);
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
writeLine(io.stdout, ` ${entry.file}: ${entry.title}`);
|
|
205
|
+
if (entry.claims.length > 0)
|
|
206
|
+
writeLine(io.stdout, ` claims: ${entry.claims.join(', ')}`);
|
|
207
|
+
if (entry.routes.length > 0)
|
|
208
|
+
writeLine(io.stdout, ` routes: ${entry.routes.join(', ')}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
writeRegistrationWarnings(io, discovered.registrationWarnings, 'tests catalog');
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Prints static warnings for test registrations controlled by Gateforge
|
|
216
|
+
* environment state without changing the machine-readable catalog.
|
|
217
|
+
*
|
|
218
|
+
* Args:
|
|
219
|
+
* io: command output streams.
|
|
220
|
+
* warnings: registration warnings from static discovery.
|
|
221
|
+
* command: command label used to identify the advisory.
|
|
222
|
+
*
|
|
223
|
+
* Returns:
|
|
224
|
+
* void.
|
|
225
|
+
*/
|
|
226
|
+
function writeRegistrationWarnings(io, warnings, command) {
|
|
227
|
+
for (const warning of warnings) {
|
|
228
|
+
writeLine(io.stderr, `${command}: registration warning ${warning.file}:${String(warning.location.line)}: ` +
|
|
229
|
+
`${warning.titlePath.join(' > ')} is conditional on ${warning.environmentVariable}; ` +
|
|
230
|
+
'keep test registration independent of Gateforge run variables');
|
|
231
|
+
}
|
|
232
|
+
}
|
|
147
233
|
// ---------------------------------------------------------------------------
|
|
148
234
|
// tests discover (Phase 2 surface, unchanged behavior)
|
|
149
235
|
// ---------------------------------------------------------------------------
|
|
@@ -153,13 +239,15 @@ async function discoverSubcommand(io, options) {
|
|
|
153
239
|
const asJson = options['json'] === true;
|
|
154
240
|
const config = loadConfigAt(io.cwd);
|
|
155
241
|
const stateDir = resolveStateDir(io.cwd);
|
|
156
|
-
const
|
|
242
|
+
const discovered = await runDiscovery(io.cwd, config, stateDir, options['pytest'] === true);
|
|
243
|
+
const { catalog, json } = discovered;
|
|
157
244
|
if (asJson) {
|
|
158
245
|
writeLine(io.stdout, json);
|
|
246
|
+
writeRegistrationWarnings(io, discovered.registrationWarnings, 'tests discover');
|
|
159
247
|
return 0;
|
|
160
248
|
}
|
|
161
|
-
const
|
|
162
|
-
writeLine(io.stdout, `test catalog: discovered=${String(
|
|
249
|
+
const discoveredCount = catalog.entries.filter((entry) => entry.discoveryStatus === 'discovered').length;
|
|
250
|
+
writeLine(io.stdout, `test catalog: discovered=${String(discoveredCount)}` +
|
|
163
251
|
` unresolved=${String(catalog.unresolved.length)}` +
|
|
164
252
|
` parseErrors=${String(catalog.parseErrors.length)}` +
|
|
165
253
|
` inventoryComplete=${catalog.inventoryComplete ? 'true' : 'false'}`);
|
|
@@ -172,6 +260,16 @@ async function discoverSubcommand(io, options) {
|
|
|
172
260
|
for (const summary of catalog.runnerSummaries) {
|
|
173
261
|
writeLine(io.stdout, `runner ${summary.runner}/${summary.name}: ${summary.status} — ${summary.detail}`);
|
|
174
262
|
}
|
|
263
|
+
const edges = Object.entries(discovered.projectDependencies ?? {})
|
|
264
|
+
.filter(([, dependencies]) => dependencies.length > 0)
|
|
265
|
+
.map(([name, dependencies]) => `${name} → ${dependencies.join(', ')}`)
|
|
266
|
+
.sort();
|
|
267
|
+
if (edges.length > 0) {
|
|
268
|
+
// The runner's OWN resolved graph, not a reading of the consumer
|
|
269
|
+
// config: a supervised run orders its projects by exactly these edges.
|
|
270
|
+
writeLine(io.stdout, `project dependencies: ${edges.join('; ')}`);
|
|
271
|
+
}
|
|
272
|
+
writeRegistrationWarnings(io, discovered.registrationWarnings, 'tests discover');
|
|
175
273
|
if (catalog.unresolved.length > 0) {
|
|
176
274
|
writeLine(io.stdout, `unresolved (${String(catalog.unresolved.length)}):`);
|
|
177
275
|
for (const gap of catalog.unresolved) {
|
|
@@ -200,12 +298,15 @@ async function suggestSubcommand(io, options) {
|
|
|
200
298
|
const provider = diffScoped ? resolveProvider(config.changed.provider, io.cwd, io.env).provider : 'all-files';
|
|
201
299
|
const pipeline = await runPipeline({ cwd: io.cwd, env: io.env, config, provider, stateDir });
|
|
202
300
|
const discovered = await runDiscovery(io.cwd, config, stateDir, true);
|
|
301
|
+
writeRegistrationWarnings(io, discovered.registrationWarnings, 'tests suggest');
|
|
203
302
|
const mapped = await resolveRepositoryMappings({
|
|
204
303
|
cwd: io.cwd,
|
|
205
304
|
config,
|
|
206
305
|
obligations: pipeline.policy.obligations,
|
|
207
306
|
catalog: discovered.catalog,
|
|
208
307
|
nativeClaims: discovered.nativeClaims,
|
|
308
|
+
nativeErrors: discovered.nativeErrors,
|
|
309
|
+
nativeInstances: discovered.nativeInstances,
|
|
209
310
|
behaviorCatalog: pipeline.behaviorCatalog,
|
|
210
311
|
});
|
|
211
312
|
// `--changed` narrows the SUGGESTED obligations to the changed scope
|
|
@@ -220,11 +321,46 @@ async function suggestSubcommand(io, options) {
|
|
|
220
321
|
const sources = sourcesByResourceId(pipeline.graph, pipeline.behaviorCatalog);
|
|
221
322
|
scoped = pipeline.policy.obligations.filter((obligation) => (sources.get(obligation.resourceId) ?? []).some((source) => changedSet.has(source)));
|
|
222
323
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
324
|
+
// Route hints rank candidates by route evidence ("this test talks to
|
|
325
|
+
// the obligation's route"). They only ADD a ranking signal; without
|
|
326
|
+
// them the same candidates come back in token order.
|
|
327
|
+
const routesByResource = new Map();
|
|
328
|
+
for (const route of httpRoutesView(pipeline.graph)) {
|
|
329
|
+
const hints = routesByResource.get(route.resourceId) ?? [];
|
|
330
|
+
hints.push(`${route.method} ${route.canonicalPath}`);
|
|
331
|
+
routesByResource.set(route.resourceId, hints);
|
|
332
|
+
}
|
|
333
|
+
const routeHints = new Map();
|
|
334
|
+
for (const obligation of pipeline.policy.obligations) {
|
|
335
|
+
const hints = routesByResource.get(obligation.resourceId);
|
|
336
|
+
if (hints !== undefined)
|
|
337
|
+
routeHints.set(obligation.id, [...hints]);
|
|
338
|
+
}
|
|
339
|
+
// A COMPLETE enumeration failure of the CONFIGURED runner hides the
|
|
340
|
+
// suggestions (an empty inventory would read as "no candidates"
|
|
341
|
+
// instead of "the runner could not enumerate"). The runner is
|
|
342
|
+
// `config.runner` — absent means playwright, the historical behavior.
|
|
343
|
+
const enumerationFailedCompletely = mapped.nativeErrors.length > 0 &&
|
|
344
|
+
!discovered.catalog.entries.some((entry) => entry.runner === config.runner);
|
|
345
|
+
const suggestions = enumerationFailedCompletely
|
|
346
|
+
? []
|
|
347
|
+
: mappingSuggestions({
|
|
348
|
+
catalog: discovered.catalog,
|
|
349
|
+
obligationIds: scoped.map((obligation) => obligation.id),
|
|
350
|
+
resolution: mapped.resolution,
|
|
351
|
+
routeHints,
|
|
352
|
+
});
|
|
353
|
+
const mappingProblems = [
|
|
354
|
+
...mapped.resolution.problems,
|
|
355
|
+
...(mapped.nativeLoadProblem === null
|
|
356
|
+
? []
|
|
357
|
+
: [
|
|
358
|
+
{
|
|
359
|
+
...mapped.nativeLoadProblem,
|
|
360
|
+
nextAction: nativeInventoryBlocking(mapped.nativeLoadProblem)[0]?.nextAction ?? '',
|
|
361
|
+
},
|
|
362
|
+
]),
|
|
363
|
+
];
|
|
228
364
|
// Required-case hints (plan 2026-09-19 Phase 6 item 6): candidates
|
|
229
365
|
// come from the current inventory (resolver suggestions above); the
|
|
230
366
|
// unmapped required cases name what final approval still needs —
|
|
@@ -248,6 +384,19 @@ async function suggestSubcommand(io, options) {
|
|
|
248
384
|
.filter((caseId) => !mapped.has(caseId))
|
|
249
385
|
.map((caseId) => pipeline.behaviorCatalog?.cases.find((item) => item.caseId === caseId)?.definition.id ?? caseId);
|
|
250
386
|
};
|
|
387
|
+
// "already declared for" is about DECLARATIONS: a `test-map.yml` entry
|
|
388
|
+
// or an `@gateforge` annotation. An inferred or prior-run binding is a
|
|
389
|
+
// suggestion and never a declaration.
|
|
390
|
+
const obligationsByTestKey = new Map();
|
|
391
|
+
for (const group of mapped.resolution.obligations) {
|
|
392
|
+
for (const binding of group.bindings) {
|
|
393
|
+
if (binding.origin !== 'native' && binding.origin !== 'sidecar')
|
|
394
|
+
continue;
|
|
395
|
+
const obligations = obligationsByTestKey.get(binding.logicalKey) ?? [];
|
|
396
|
+
obligations.push(group.obligationId);
|
|
397
|
+
obligationsByTestKey.set(binding.logicalKey, obligations);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
251
400
|
const suggestionJson = suggestions.map((suggestion) => ({
|
|
252
401
|
obligationId: suggestion.obligationId,
|
|
253
402
|
cause: suggestion.cause,
|
|
@@ -255,6 +404,11 @@ async function suggestSubcommand(io, options) {
|
|
|
255
404
|
logicalKey: candidate.logicalKey,
|
|
256
405
|
file: candidate.file,
|
|
257
406
|
why: [...candidate.why],
|
|
407
|
+
overlaps: [...new Set(obligationsByTestKey.get(candidate.logicalKey) ?? [])]
|
|
408
|
+
.filter((obligationId) => obligationId !== suggestion.obligationId)
|
|
409
|
+
.sort(compareStrings),
|
|
410
|
+
score: candidate.score,
|
|
411
|
+
rank: candidate.rank,
|
|
258
412
|
})),
|
|
259
413
|
missingEvidence: suggestion.missingEvidence,
|
|
260
414
|
nextAction: suggestion.nextAction,
|
|
@@ -269,18 +423,20 @@ async function suggestSubcommand(io, options) {
|
|
|
269
423
|
changedFiles: [...pipeline.changedFiles].sort(compareStrings),
|
|
270
424
|
obligationsInScope: scoped.length,
|
|
271
425
|
},
|
|
272
|
-
problems:
|
|
426
|
+
problems: mappingProblems,
|
|
273
427
|
suggestions: suggestionJson,
|
|
274
428
|
}));
|
|
275
429
|
return 0;
|
|
276
430
|
}
|
|
277
431
|
writeLine(io.stdout, `suggest: ${String(pipeline.policy.obligations.length)} obligation(s) considered` +
|
|
278
432
|
` (${String(scoped.length)} in ${scopeMode} scope),` +
|
|
279
|
-
` ${String(
|
|
433
|
+
` ${String(mappingProblems.length)} mapping problem(s),` +
|
|
280
434
|
` ${String(suggestions.length)} suggestion(s)`);
|
|
281
|
-
for (const problem of
|
|
435
|
+
for (const problem of mappingProblems) {
|
|
282
436
|
const where = problem.obligationId === null ? '' : ` for '${problem.obligationId}'`;
|
|
283
437
|
writeLine(io.stdout, `problem [${problem.cause}]${where}: ${problem.detail}`);
|
|
438
|
+
if ('nextAction' in problem)
|
|
439
|
+
writeLine(io.stdout, ` next action: ${problem.nextAction}`);
|
|
284
440
|
}
|
|
285
441
|
for (const suggestion of suggestions) {
|
|
286
442
|
writeLine(io.stdout, `[${suggestion.cause}] ${suggestion.obligationId}`);
|
|
@@ -292,12 +448,26 @@ async function suggestSubcommand(io, options) {
|
|
|
292
448
|
writeLine(io.stdout, ` unmapped cases: ${unmapped.join(', ')} (map with tests mark --case, then prove with witnessed execution)`);
|
|
293
449
|
}
|
|
294
450
|
if (suggestion.candidates.length > 0) {
|
|
295
|
-
writeLine(io.stdout, ' candidates:');
|
|
296
|
-
|
|
297
|
-
|
|
451
|
+
writeLine(io.stdout, ' candidates (ranked by evidence):');
|
|
452
|
+
// The printed list is capped so one weakly-matching repository
|
|
453
|
+
// cannot bury the answer; `--json` keeps every ranked candidate.
|
|
454
|
+
const printed = suggestion.candidates.slice(0, SUGGESTED_CANDIDATE_LIMIT);
|
|
455
|
+
for (const candidate of printed) {
|
|
456
|
+
writeLine(io.stdout, ` - #${String(candidate.rank)} ${candidate.logicalKey} (${candidate.file})`);
|
|
298
457
|
for (const why of candidate.why) {
|
|
299
458
|
writeLine(io.stdout, ` why: ${why}`);
|
|
300
459
|
}
|
|
460
|
+
const overlaps = obligationsByTestKey.get(candidate.logicalKey) ?? [];
|
|
461
|
+
const otherObligations = [...new Set(overlaps)]
|
|
462
|
+
.filter((obligationId) => obligationId !== suggestion.obligationId)
|
|
463
|
+
.sort(compareStrings);
|
|
464
|
+
if (otherObligations.length > 0) {
|
|
465
|
+
writeLine(io.stdout, ` already declared for: ${otherObligations.join(', ')}`);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
const hidden = suggestion.candidates.length - printed.length;
|
|
469
|
+
if (hidden > 0) {
|
|
470
|
+
writeLine(io.stdout, ` ... and ${String(hidden)} more candidate(s) — run \`gateforge tests suggest --json\` for the full ranked list`);
|
|
301
471
|
}
|
|
302
472
|
}
|
|
303
473
|
}
|
|
@@ -485,6 +655,68 @@ function assertKindDeclarationAllowed(entry, kind, key) {
|
|
|
485
655
|
// ---------------------------------------------------------------------------
|
|
486
656
|
// tests explain (Phase 3)
|
|
487
657
|
// ---------------------------------------------------------------------------
|
|
658
|
+
/**
|
|
659
|
+
* Synchronizes generated test-map declarations without changing handwritten entries.
|
|
660
|
+
*
|
|
661
|
+
* Args:
|
|
662
|
+
* io: process context.
|
|
663
|
+
* options: parsed command flags.
|
|
664
|
+
*
|
|
665
|
+
* Returns:
|
|
666
|
+
* number: 0 when the static scan is complete, 1 when unresolved rows
|
|
667
|
+
* need owner review, or 2 for invalid configuration or sidecar data.
|
|
668
|
+
*/
|
|
669
|
+
async function syncSubcommand(io, options) {
|
|
670
|
+
rejectUnknownFlags(options, ['json'], TESTS_USAGE);
|
|
671
|
+
const config = loadConfigAt(io.cwd);
|
|
672
|
+
const stateDir = resolveStateDir(io.cwd);
|
|
673
|
+
const scan = scanTestFiles({
|
|
674
|
+
cwd: io.cwd,
|
|
675
|
+
include: config.project.paths.include,
|
|
676
|
+
exclude: config.project.paths.exclude,
|
|
677
|
+
excludeFile: engineGeneratedStateFileFilter(io.cwd, stateDir),
|
|
678
|
+
});
|
|
679
|
+
const generated = annotationTestMapEntries(scan);
|
|
680
|
+
const previous = loadOptionalTestMap(io.cwd);
|
|
681
|
+
const handwritten = (previous?.tests ?? []).filter((entry) => entry.source !== 'annotation');
|
|
682
|
+
const candidate = { schemaVersion: 1, tests: [...handwritten, ...generated] };
|
|
683
|
+
const parsed = TestMapSchema.safeParse(candidate);
|
|
684
|
+
if (!parsed.success) {
|
|
685
|
+
const issue = parsed.error.issues[0];
|
|
686
|
+
const path = issue === undefined ? '' : ` at '${issue.path.map(String).join('.')}':`;
|
|
687
|
+
throw new UsageError(`annotation sync produced an invalid test map${path} ${issue?.message ?? 'unknown schema error'}`);
|
|
688
|
+
}
|
|
689
|
+
const previousContent = serializeTestMap(previous ?? { schemaVersion: 1, tests: [] });
|
|
690
|
+
const nextContent = serializeTestMap(parsed.data);
|
|
691
|
+
const changed = previousContent !== nextContent;
|
|
692
|
+
if (changed)
|
|
693
|
+
writeTestMapAtomic(io.cwd, parsed.data);
|
|
694
|
+
const unresolved = [
|
|
695
|
+
...scan.parseErrors.map((entry) => `UNRESOLVED ${entry.file}:${entry.location.line}:${entry.location.col}: ${entry.message}`),
|
|
696
|
+
...scan.unresolved.map((entry) => `UNRESOLVED ${entry.file}:${entry.location.line}:${entry.location.col}: ` +
|
|
697
|
+
`${entry.titlePath.join(' > ')} — ${entry.code}: ${entry.detail}`),
|
|
698
|
+
...scan.entries
|
|
699
|
+
.filter((entry) => entry.annotationIssue !== undefined)
|
|
700
|
+
.map((entry) => `UNRESOLVED ${entry.file}:${entry.location.line}:${entry.location.col}: ` +
|
|
701
|
+
`${entry.titlePath.join(' > ')} — ${entry.annotationIssue}`),
|
|
702
|
+
].sort(compareStrings);
|
|
703
|
+
const asJson = options['json'] === true;
|
|
704
|
+
if (asJson) {
|
|
705
|
+
writeLine(io.stdout, canonicalJson({
|
|
706
|
+
schemaVersion: 1,
|
|
707
|
+
generatedEntries: generated.length,
|
|
708
|
+
changed,
|
|
709
|
+
unresolved,
|
|
710
|
+
nextAction: unresolved.length > 0 ? 'Review unresolved static test annotations.' : null,
|
|
711
|
+
}));
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
writeLine(io.stdout, `tests sync: ${generated.length} annotation mapping(s) ${changed ? 'updated' : 'unchanged'}`);
|
|
715
|
+
for (const row of unresolved)
|
|
716
|
+
writeLine(io.stdout, row);
|
|
717
|
+
}
|
|
718
|
+
return unresolved.length > 0 ? 1 : 0;
|
|
719
|
+
}
|
|
488
720
|
/** Implements `tests explain --test <key>`. */
|
|
489
721
|
async function explainSubcommand(io, options) {
|
|
490
722
|
rejectUnknownFlags(options, ['test', 'json', 'help'], TESTS_USAGE);
|
|
@@ -510,7 +742,8 @@ async function explainSubcommand(io, options) {
|
|
|
510
742
|
obligations: pipeline.policy.obligations,
|
|
511
743
|
catalog: discovered.catalog,
|
|
512
744
|
nativeClaims: discovered.nativeClaims,
|
|
513
|
-
|
|
745
|
+
nativeErrors: discovered.nativeErrors,
|
|
746
|
+
nativeInstances: discovered.nativeInstances,
|
|
514
747
|
});
|
|
515
748
|
const entry = discovered.catalog.entries.find((candidate) => candidate.logicalKey === testKey);
|
|
516
749
|
if (entry === undefined) {
|
|
@@ -592,13 +825,13 @@ function explainReport(testKey, entry, mapped, obligations, behaviorCatalog) {
|
|
|
592
825
|
let mapping;
|
|
593
826
|
let nextAction;
|
|
594
827
|
if (sidecarDeclares) {
|
|
595
|
-
mapping = `declared
|
|
828
|
+
mapping = `declared in test-map.yml${caseSuffix}`;
|
|
596
829
|
nextAction =
|
|
597
830
|
missingCases.length > 0
|
|
598
831
|
? `map the missing cases (${missingCases
|
|
599
832
|
.map((caseId) => behaviorCatalog?.cases.find((item) => item.caseId === caseId)?.definition.id ?? caseId)
|
|
600
833
|
.join(', ')}) with tests mark --case; then run the test with the required channel`
|
|
601
|
-
: 'run the existing test with the
|
|
834
|
+
: 'run the existing test with the witness: `gateforge test-gates --changed` executes the suite and collects the witnessed evidence that must cover this change';
|
|
602
835
|
}
|
|
603
836
|
else if (nativeDeclares) {
|
|
604
837
|
mapping = `declared by native annotation${caseSuffix}`;
|
|
@@ -607,7 +840,7 @@ function explainReport(testKey, entry, mapped, obligations, behaviorCatalog) {
|
|
|
607
840
|
? `native annotations never implicitly claim behavior cases — add an explicit sidecar entry with tests mark --case for: ${missingCases
|
|
608
841
|
.map((caseId) => behaviorCatalog?.cases.find((item) => item.caseId === caseId)?.definition.id ?? caseId)
|
|
609
842
|
.join(', ')}`
|
|
610
|
-
: 'run the existing test with the
|
|
843
|
+
: 'run the existing test with the witness: `gateforge test-gates --changed` executes the suite and collects the witnessed evidence that must cover this change';
|
|
611
844
|
}
|
|
612
845
|
else if (binding?.origin === 'prior-run') {
|
|
613
846
|
mapping = 'prior run (suggestion only — never satisfies a new run)';
|
|
@@ -654,7 +887,7 @@ function explainReport(testKey, entry, mapped, obligations, behaviorCatalog) {
|
|
|
654
887
|
titlePath: [...entry.titlePath],
|
|
655
888
|
inferredKind: entry.inferredKind,
|
|
656
889
|
},
|
|
657
|
-
execution: 'not run for this change (
|
|
890
|
+
execution: 'not run for this change (`tests explain` is inspection only — run `gateforge test-gates --changed` to execute the suite with the witness)',
|
|
658
891
|
blocks,
|
|
659
892
|
};
|
|
660
893
|
}
|
|
@@ -667,6 +900,7 @@ async function diagnoseSubcommand(io, options) {
|
|
|
667
900
|
const asJson = options['json'] === true;
|
|
668
901
|
const suiteName = stringFlag(options, 'suite');
|
|
669
902
|
const config = loadConfigAt(io.cwd);
|
|
903
|
+
const cacheExclusions = loadCacheExclusions(io.cwd, config);
|
|
670
904
|
const stateDir = resolveStateDir(io.cwd);
|
|
671
905
|
// The alarm runs WITHOUT a browser or witness (§3.5), but it still
|
|
672
906
|
// binds results to the current input identity: the same pipeline +
|
|
@@ -674,7 +908,7 @@ async function diagnoseSubcommand(io, options) {
|
|
|
674
908
|
let preFiles = null;
|
|
675
909
|
let snapshotUnavailable = false;
|
|
676
910
|
try {
|
|
677
|
-
preFiles = collectInputFiles(io.cwd, config, stateDir);
|
|
911
|
+
preFiles = collectInputFiles(io.cwd, config, stateDir, [], [], cacheExclusions);
|
|
678
912
|
}
|
|
679
913
|
catch (error) {
|
|
680
914
|
if (error instanceof SnapshotUnavailableError) {
|
|
@@ -696,7 +930,7 @@ async function diagnoseSubcommand(io, options) {
|
|
|
696
930
|
});
|
|
697
931
|
let inputDigest = null;
|
|
698
932
|
if (!snapshotUnavailable) {
|
|
699
|
-
const postDiscovery = collectInputFiles(io.cwd, config, stateDir);
|
|
933
|
+
const postDiscovery = collectInputFiles(io.cwd, config, stateDir, [], [], cacheExclusions);
|
|
700
934
|
const drift = preFiles === null ? [] : diffInputFiles(preFiles, postDiscovery);
|
|
701
935
|
if (drift.length > 0) {
|
|
702
936
|
throw new UsageError(`input tree changed around discovery (${drift.slice(0, 3).join('; ')}); no reliable input identity — refusing the diagnostic run`);
|
|
@@ -709,6 +943,7 @@ async function diagnoseSubcommand(io, options) {
|
|
|
709
943
|
obligations: pipeline.policy.obligations,
|
|
710
944
|
httpRoutes: httpRoutesView(pipeline.graph),
|
|
711
945
|
plugins: pipeline.manifest.plugins.map((plugin) => ({ id: plugin.id, version: plugin.version })),
|
|
946
|
+
cacheExclusions,
|
|
712
947
|
}).inputDigest;
|
|
713
948
|
}
|
|
714
949
|
const run = await runDiagnosticSuites({
|