@descryy/mcp 0.4.0 → 0.6.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/dist/bin/descry-mcp.js +16 -2
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/driver.d.ts +105 -6
- package/dist/browser/driver.d.ts.map +1 -1
- package/dist/browser/driver.js +17 -3
- package/dist/browser/driver.js.map +1 -1
- package/dist/browser/evidence.d.ts +11 -0
- package/dist/browser/evidence.d.ts.map +1 -1
- package/dist/browser/evidence.js +64 -8
- package/dist/browser/evidence.js.map +1 -1
- package/dist/browser/fake-driver.d.ts +8 -0
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +26 -3
- package/dist/browser/fake-driver.js.map +1 -1
- package/dist/browser/playwright-driver.d.ts +68 -14
- package/dist/browser/playwright-driver.d.ts.map +1 -1
- package/dist/browser/playwright-driver.js +318 -38
- package/dist/browser/playwright-driver.js.map +1 -1
- package/dist/browser/provider.d.ts +10 -4
- package/dist/browser/provider.d.ts.map +1 -1
- package/dist/browser/provider.js +10 -4
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/scenario-runner.d.ts +9 -0
- package/dist/browser/scenario-runner.d.ts.map +1 -1
- package/dist/browser/scenario-runner.js +32 -2
- package/dist/browser/scenario-runner.js.map +1 -1
- package/dist/browser/tool-support.js +1 -1
- package/dist/browser/tool-support.js.map +1 -1
- package/dist/cancellation.d.ts +55 -0
- package/dist/cancellation.d.ts.map +1 -0
- package/dist/cancellation.js +76 -0
- package/dist/cancellation.js.map +1 -0
- package/dist/capped.d.ts +41 -0
- package/dist/capped.d.ts.map +1 -0
- package/dist/capped.js +35 -0
- package/dist/capped.js.map +1 -0
- package/dist/registry.d.ts +20 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +71 -4
- package/dist/registry.js.map +1 -1
- package/dist/render.d.ts +92 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +250 -5
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +19 -1
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +88 -4
- package/dist/runtime-registry.js.map +1 -1
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +135 -11
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +22 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +27 -1
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +23 -3
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +35 -3
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-click.d.ts.map +1 -1
- package/dist/tools/browser-click.js +14 -0
- package/dist/tools/browser-click.js.map +1 -1
- package/dist/tools/browser-fill.d.ts.map +1 -1
- package/dist/tools/browser-fill.js +14 -0
- package/dist/tools/browser-fill.js.map +1 -1
- package/dist/tools/browser-navigate.d.ts.map +1 -1
- package/dist/tools/browser-navigate.js +14 -0
- package/dist/tools/browser-navigate.js.map +1 -1
- package/dist/tools/browser-run-scenario.d.ts.map +1 -1
- package/dist/tools/browser-run-scenario.js +12 -3
- package/dist/tools/browser-run-scenario.js.map +1 -1
- package/dist/tools/browser-save-scenario.d.ts.map +1 -1
- package/dist/tools/browser-save-scenario.js +109 -3
- package/dist/tools/browser-save-scenario.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +43 -0
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/browser-type.d.ts.map +1 -1
- package/dist/tools/browser-type.js +14 -0
- package/dist/tools/browser-type.js.map +1 -1
- package/dist/tools/contracts.d.ts +41 -10
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +117 -17
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts +39 -10
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +113 -29
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +30 -2
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +50 -2
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/observe-runtime.d.ts.map +1 -1
- package/dist/tools/observe-runtime.js +84 -4
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe-tests.d.ts +12 -0
- package/dist/tools/observe-tests.d.ts.map +1 -1
- package/dist/tools/observe-tests.js +92 -8
- package/dist/tools/observe-tests.js.map +1 -1
- package/dist/tools/pre-push.d.ts +40 -7
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +65 -23
- package/dist/tools/pre-push.js.map +1 -1
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +20 -4
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/validate.d.ts +40 -1
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +150 -27
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/verification-status.d.ts.map +1 -1
- package/dist/tools/verification-status.js +3 -3
- package/dist/tools/verification-status.js.map +1 -1
- package/dist/transport.d.ts +12 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +30 -16
- package/dist/transport.js.map +1 -1
- package/package.json +22 -13
|
@@ -42,6 +42,18 @@
|
|
|
42
42
|
* the same two-call `confirmToken` handshake `observe_runtime` and `questions`
|
|
43
43
|
* use.
|
|
44
44
|
*
|
|
45
|
+
* ## The handshake validates the command before minting, not after
|
|
46
|
+
*
|
|
47
|
+
* A UAT caught the unconfirmed call minting a token that promised to run a
|
|
48
|
+
* command the confirmed call would go on to refuse by name — validation had
|
|
49
|
+
* moved to the wrong side of the two-call gate. `describeAction` now calls
|
|
50
|
+
* `discoverRunner` (imported from `@descryy/runtime-test-runner`, the same
|
|
51
|
+
* predicate `collector.start()` calls internally) before returning a
|
|
52
|
+
* `willDo`, so an unsupported command is refused at the first call, with the
|
|
53
|
+
* exact reason text the confirmed call would otherwise have produced — see
|
|
54
|
+
* `describeAction`'s own doc comment for why no second copy of the runner
|
|
55
|
+
* table exists here.
|
|
56
|
+
*
|
|
45
57
|
* `evidence` — it reports what ran. It draws no conclusion about the code and
|
|
46
58
|
* writes no finding or hypothesis.
|
|
47
59
|
*
|
|
@@ -70,8 +82,9 @@
|
|
|
70
82
|
import { isAbsolute, join } from "node:path";
|
|
71
83
|
import { randomBytes } from "node:crypto";
|
|
72
84
|
import { applyObservedTests, counts } from "@descryy/core";
|
|
85
|
+
import { cancellationHeadline, cancellationNotes, whenAborted } from "../cancellation.js";
|
|
73
86
|
import { witnessedSignalTypes } from "./observe-runtime.js";
|
|
74
|
-
import { createTestRunnerCollector } from "@descryy/runtime-test-runner";
|
|
87
|
+
import { createTestRunnerCollector, discoverRunner } from "@descryy/runtime-test-runner";
|
|
75
88
|
import { resolveObservedTestCase } from "@descryy/runtime-test-runner";
|
|
76
89
|
import { answer, optionalInteger, optionalString, requiredString, ToolInputError, } from "./kit.js";
|
|
77
90
|
const DEFAULT_TIMEOUT_MS = 600_000;
|
|
@@ -80,10 +93,11 @@ const SCHEMA = {
|
|
|
80
93
|
properties: {
|
|
81
94
|
command: {
|
|
82
95
|
type: "string",
|
|
83
|
-
description: "The command that runs this project's test suite, exactly as you would type it in a terminal
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
96
|
+
description: "The command that runs this project's test suite, exactly as you would type it in a terminal. " +
|
|
97
|
+
"This observes ten declared runner families, never a runner sniffed from package.json or a " +
|
|
98
|
+
"lockfile -- a refusal names the ones it knows. It is run in the repository and it executes " +
|
|
99
|
+
"your code, which is why the call takes a two-step confirmation. The runner is identified from " +
|
|
100
|
+
"the command itself; a command naming none of the ten is refused by name rather than run blind.",
|
|
87
101
|
},
|
|
88
102
|
cwd: {
|
|
89
103
|
type: "string",
|
|
@@ -169,7 +183,7 @@ async function run(args, ctx) {
|
|
|
169
183
|
"Read every count against testsReported. A recorded count on its own cannot distinguish a fully " +
|
|
170
184
|
"mapped suite from a mostly unmapped one.",
|
|
171
185
|
];
|
|
172
|
-
const refuse = (headline, data = {}) => answer({
|
|
186
|
+
const refuse = (headline, data = {}, extraNotes = []) => answer({
|
|
173
187
|
headline,
|
|
174
188
|
state: "refused",
|
|
175
189
|
nameLevel: true,
|
|
@@ -181,7 +195,7 @@ async function run(args, ctx) {
|
|
|
181
195
|
graphBuiltAt: base.graphBuiltAt,
|
|
182
196
|
irSchemaVersion: base.irSchemaVersion,
|
|
183
197
|
commitSpread: base.commitSpread,
|
|
184
|
-
notes,
|
|
198
|
+
notes: [...notes, ...extraNotes],
|
|
185
199
|
data: {
|
|
186
200
|
runId: null,
|
|
187
201
|
testsReported: 0,
|
|
@@ -207,6 +221,14 @@ async function run(args, ctx) {
|
|
|
207
221
|
const collector = createTestRunnerCollector({
|
|
208
222
|
configuration: { command, cwd },
|
|
209
223
|
});
|
|
224
|
+
// Before the spawn. A cancelled call that started the repository's own test
|
|
225
|
+
// suite anyway would run the user's code for nobody — and this tool's own
|
|
226
|
+
// schema calls that an action for exactly that reason.
|
|
227
|
+
if (ctx.signal.aborted) {
|
|
228
|
+
return refuse(cancellationHeadline("no test runner was started") +
|
|
229
|
+
" " +
|
|
230
|
+
cancellationNotes("Nothing was spawned and nothing was written.")[0]);
|
|
231
|
+
}
|
|
210
232
|
ctx.progress(`Running ${command}`);
|
|
211
233
|
const started = await collector.start({
|
|
212
234
|
executionId: `observe-tests-${Date.now()}`,
|
|
@@ -224,8 +246,29 @@ async function run(args, ctx) {
|
|
|
224
246
|
if (!started.available) {
|
|
225
247
|
return refuse(`The test command could not be run: ${started.reason} Nothing was started and nothing was written.`);
|
|
226
248
|
}
|
|
227
|
-
|
|
249
|
+
// The long wait. A test suite runs for minutes, and a cancellation that only
|
|
250
|
+
// stopped the *reply* would leave that suite running against the developer's
|
|
251
|
+
// repository — writing files, holding ports, occupying the machine — for as
|
|
252
|
+
// long as it takes, with nothing left that would ever read its output.
|
|
253
|
+
//
|
|
254
|
+
// `stop()` kills the runner's process group, so the cancelled path and the
|
|
255
|
+
// ordinary path release the same way; the difference is only whether the
|
|
256
|
+
// process had finished on its own first.
|
|
257
|
+
const abort = whenAborted(ctx.signal);
|
|
258
|
+
try {
|
|
259
|
+
await Promise.race([collector.waitForCompletion(), abort.promise]);
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
abort.dispose();
|
|
263
|
+
}
|
|
228
264
|
await collector.stop();
|
|
265
|
+
if (ctx.signal.aborted) {
|
|
266
|
+
// Nothing is written. Half a suite recorded as coverage is worse than none
|
|
267
|
+
// of it: the rows that never ran would read as tested, and coverage is the
|
|
268
|
+
// one axis this tool exists to make honest.
|
|
269
|
+
return refuse(cancellationHeadline("the test runner was stopped"), {}, cancellationNotes("The runner's process group was killed, so nothing it started is still running.", "No result was recorded against any node — a partial suite written as coverage would make the " +
|
|
270
|
+
"tests that never ran look tested."));
|
|
271
|
+
}
|
|
229
272
|
const coverage = collector.traceCoverage();
|
|
230
273
|
const { observations, unresolved } = observationsFromEvidence(driver, collected, root.repo, {
|
|
231
274
|
repoRoot: root.absolutePath,
|
|
@@ -285,10 +328,51 @@ async function run(args, ctx) {
|
|
|
285
328
|
notes,
|
|
286
329
|
});
|
|
287
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* B4's other half. The old bug: the unconfirmed call minted a token
|
|
333
|
+
* describing exactly what the confirmed call would go on to refuse --
|
|
334
|
+
* "Confirmation required: Run '.venv/bin/python -m unittest…'" followed by
|
|
335
|
+
* "names no runner this collector observes" a call later. Validation had
|
|
336
|
+
* moved to the wrong side of the handshake.
|
|
337
|
+
*
|
|
338
|
+
* `discoverRunner` is the fix, imported rather than re-derived: it is the
|
|
339
|
+
* same pure, side-effect-free "would this command be matched, and by which
|
|
340
|
+
* profile" predicate `collector.start()` already calls internally on the
|
|
341
|
+
* confirmed side (`test-runner-collector.ts`'s own `start()` calls it first,
|
|
342
|
+
* before anything is spawned, and returns `{available:false,
|
|
343
|
+
* reason: discovery.reason}` verbatim on a miss). Calling it here, before a
|
|
344
|
+
* token is ever minted, means an unsupported command is refused at the
|
|
345
|
+
* *first* call, and with the exact same reason text the confirmed call would
|
|
346
|
+
* have produced -- not a second, hand-copied version of it that could say
|
|
347
|
+
* something different. A second implementation of the runner table is
|
|
348
|
+
* exactly what B4 already was (a hardcoded three-runner refusal that fell out
|
|
349
|
+
* of step with `PROFILES`), so nothing here re-derives which commands match;
|
|
350
|
+
* it only asks the one function that knows.
|
|
351
|
+
*
|
|
352
|
+
* `supportedRunnerExamples` -- the derived-from-`PROFILES` runner list that
|
|
353
|
+
* fixes `discoverRunner`'s *own* refusal text from a stale hardcoded three
|
|
354
|
+
* up to the real ten -- is not yet part of the published
|
|
355
|
+
* `@descryy/runtime-test-runner` this repo depends on (pinned at 0.2.1 --
|
|
356
|
+
* DEC-395, exact cross-repo pins while the engine is on 0.x). It lives on
|
|
357
|
+
* the coordinated, unpublished `descry-runtime` branch alongside that same
|
|
358
|
+
* text fix, in the same commit. That is why no second lookup for it is
|
|
359
|
+
* added here: by the time a published version exports it, `discoverRunner`'s
|
|
360
|
+
* own `reason` will already have been regenerated from it (same release),
|
|
361
|
+
* so a parallel check here would only ever reproduce a string
|
|
362
|
+
* `discovery.reason` already carries -- dead weight, not a second fix. Until
|
|
363
|
+
* that coordinated release lands, this refuses with whatever text
|
|
364
|
+
* `discoverRunner` gives it -- correct in substance (it refuses exactly the
|
|
365
|
+
* commands the confirmed side would refuse), stale only in which runners the
|
|
366
|
+
* message names as supported.
|
|
367
|
+
*/
|
|
288
368
|
function describeAction(args) {
|
|
289
369
|
const command = args["command"];
|
|
290
370
|
if (typeof command !== "string")
|
|
291
371
|
throw new ToolInputError('"command" must be a string');
|
|
372
|
+
const discovery = discoverRunner(command);
|
|
373
|
+
if (!discovery.ok) {
|
|
374
|
+
throw new ToolInputError(`The test command could not be run: ${discovery.reason} Nothing was started and nothing was written.`);
|
|
375
|
+
}
|
|
292
376
|
const cwd = args["cwd"];
|
|
293
377
|
return (`Run "${command}"${typeof cwd === "string" ? ` in ${cwd}` : ""} and record which tests executed. ` +
|
|
294
378
|
"This executes your repository's own code. It writes to the graph's earned ledger; it changes no " +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe-tests.js","sourceRoot":"","sources":["../../src/tools/observe-tests.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"observe-tests.js","sourceRoot":"","sources":["../../src/tools/observe-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAA0E,MAAM,eAAe,CAAC;AAGnI,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EACL,MAAM,EACN,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,GAGf,MAAM,UAAU,CAAC;AAGlB,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAUnC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,+FAA+F;gBAC/F,4F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AoG;QACpG,oGAAoG;QACpG,oGAAoG;QACpG,kGAAkG;QAClG,wGAAwG;IAC1G,WAAW,EAAE,MAA4C;IACzD,cAAc;IACd,GAAG;CACJ,CAAC"}
|
package/dist/tools/pre-push.d.ts
CHANGED
|
@@ -38,12 +38,28 @@
|
|
|
38
38
|
*
|
|
39
39
|
* ## Blocking versus informational
|
|
40
40
|
*
|
|
41
|
-
* `blockingTotal` counts `contracts` and `validate` findings only
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* `blockingTotal` counts `contracts` and `validate` findings only, and — since
|
|
42
|
+
* UAT round 3, Suggestion 6 — only the ones each tool's own `claim` field
|
|
43
|
+
* marks a `defect`. `scope` and `pr_analysis` answer "what does this change
|
|
44
|
+
* touch" — real, useful, and not a defect, so counting them would make every
|
|
45
|
+
* change with a blast radius look like a failure. A `lead` (`ROUTE_NOT_CALLED`,
|
|
46
|
+
* `SET_BUT_UNDOCUMENTED`) is worth a look but is not provable from the graph
|
|
47
|
+
* alone, so it is counted separately in `leadTotal` rather than folded into
|
|
48
|
+
* the number a git hook branches on. `descry check` exits non-zero on
|
|
49
|
+
* `blockingTotal`, which is why the line has to be drawn here rather than
|
|
50
|
+
* left to the caller.
|
|
51
|
+
*
|
|
52
|
+
* ## Scoped to what you are pushing
|
|
53
|
+
*
|
|
54
|
+
* UAT round 3, B11. `contracts` did not receive the `files` this tool was
|
|
55
|
+
* called with, so `blockingTotal` counted the repository's entire standing
|
|
56
|
+
* backlog rather than the change being pushed — 15 pre-existing
|
|
57
|
+
* `ROUTE_NOT_CALLED` findings for unrelated paths, on a push touching three
|
|
58
|
+
* unrelated files. `contracts` now takes the same `files` this tool was
|
|
59
|
+
* given (it already accepted `paths`, a different axis — a URL template
|
|
60
|
+
* substring, not a source file), so both blocking sources answer about the
|
|
61
|
+
* files in front of the developer. `validate` already took `files`; only the
|
|
62
|
+
* threading into `contracts` was missing.
|
|
47
63
|
*
|
|
48
64
|
* ## Class and tier
|
|
49
65
|
*
|
|
@@ -58,6 +74,12 @@ export interface PrePushSection {
|
|
|
58
74
|
readonly state: string;
|
|
59
75
|
/** How many items this source found in total, before this tool took its top few. */
|
|
60
76
|
readonly total: number;
|
|
77
|
+
/**
|
|
78
|
+
* Of `total`, how many are `claim: "defect"` — provable from the graph
|
|
79
|
+
* alone. Zero for `scope` and `pr_analysis`, which report no claims at all.
|
|
80
|
+
* `total - defects` is this section's contribution to `leadTotal`.
|
|
81
|
+
*/
|
|
82
|
+
readonly defects: number;
|
|
61
83
|
/** The top few, in the order that source reported them. */
|
|
62
84
|
readonly shown: readonly unknown[];
|
|
63
85
|
/** True when this source's findings count toward `blockingTotal`. */
|
|
@@ -68,8 +90,19 @@ export interface PrePushSection {
|
|
|
68
90
|
export interface PrePushData {
|
|
69
91
|
readonly files: readonly string[];
|
|
70
92
|
readonly sections: readonly PrePushSection[];
|
|
71
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Contract and environment **defects** only — see the module header on why
|
|
95
|
+
* scope is not counted and why a lead is not either. What a git hook
|
|
96
|
+
* should branch on.
|
|
97
|
+
*/
|
|
72
98
|
readonly blockingTotal: number;
|
|
99
|
+
/**
|
|
100
|
+
* Contract and environment **leads** — worth a look, never blocking. Kept
|
|
101
|
+
* under its own key rather than folded into `blockingTotal`, per this
|
|
102
|
+
* tool's own rule that a repo-wide or non-defect count never hides inside
|
|
103
|
+
* the number a hook branches on.
|
|
104
|
+
*/
|
|
105
|
+
readonly leadTotal: number;
|
|
73
106
|
/** The node budget actually applied to the traversing constituents. */
|
|
74
107
|
readonly nodeBudget: number;
|
|
75
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-push.d.ts","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pre-push.d.ts","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAKH,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAuClB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAwOD,eAAO,MAAM,WAAW,EAAE,cAiBzB,CAAC"}
|
package/dist/tools/pre-push.js
CHANGED
|
@@ -38,12 +38,28 @@
|
|
|
38
38
|
*
|
|
39
39
|
* ## Blocking versus informational
|
|
40
40
|
*
|
|
41
|
-
* `blockingTotal` counts `contracts` and `validate` findings only
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* `blockingTotal` counts `contracts` and `validate` findings only, and — since
|
|
42
|
+
* UAT round 3, Suggestion 6 — only the ones each tool's own `claim` field
|
|
43
|
+
* marks a `defect`. `scope` and `pr_analysis` answer "what does this change
|
|
44
|
+
* touch" — real, useful, and not a defect, so counting them would make every
|
|
45
|
+
* change with a blast radius look like a failure. A `lead` (`ROUTE_NOT_CALLED`,
|
|
46
|
+
* `SET_BUT_UNDOCUMENTED`) is worth a look but is not provable from the graph
|
|
47
|
+
* alone, so it is counted separately in `leadTotal` rather than folded into
|
|
48
|
+
* the number a git hook branches on. `descry check` exits non-zero on
|
|
49
|
+
* `blockingTotal`, which is why the line has to be drawn here rather than
|
|
50
|
+
* left to the caller.
|
|
51
|
+
*
|
|
52
|
+
* ## Scoped to what you are pushing
|
|
53
|
+
*
|
|
54
|
+
* UAT round 3, B11. `contracts` did not receive the `files` this tool was
|
|
55
|
+
* called with, so `blockingTotal` counted the repository's entire standing
|
|
56
|
+
* backlog rather than the change being pushed — 15 pre-existing
|
|
57
|
+
* `ROUTE_NOT_CALLED` findings for unrelated paths, on a push touching three
|
|
58
|
+
* unrelated files. `contracts` now takes the same `files` this tool was
|
|
59
|
+
* given (it already accepted `paths`, a different axis — a URL template
|
|
60
|
+
* substring, not a source file), so both blocking sources answer about the
|
|
61
|
+
* files in front of the developer. `validate` already took `files`; only the
|
|
62
|
+
* threading into `contracts` was missing.
|
|
47
63
|
*
|
|
48
64
|
* ## Class and tier
|
|
49
65
|
*
|
|
@@ -97,6 +113,10 @@ function listOf(data, key) {
|
|
|
97
113
|
const value = data[key];
|
|
98
114
|
return Array.isArray(value) ? value : [];
|
|
99
115
|
}
|
|
116
|
+
/** How many of `items` carry `claim: "defect"`. Items with no `claim` at all (scope, pr_analysis) count as zero. */
|
|
117
|
+
function defectsIn(items) {
|
|
118
|
+
return items.filter((item) => item.claim === "defect").length;
|
|
119
|
+
}
|
|
100
120
|
async function run(args, ctx) {
|
|
101
121
|
const files = optionalStringArray(args, "files") ?? [];
|
|
102
122
|
const perSource = optionalInteger(args, "perSource", 1) ?? PER_SOURCE;
|
|
@@ -110,9 +130,10 @@ async function run(args, ctx) {
|
|
|
110
130
|
"Sources are NOT ranked against each other. Whether a contract mismatch outranks an unset " +
|
|
111
131
|
"environment variable is a judgement Descry has no model for, so each source contributes its " +
|
|
112
132
|
"own top few and the totals say what they were selected from.",
|
|
113
|
-
"blockingTotal counts contracts and validate findings
|
|
114
|
-
"change touches, which is not a defect
|
|
115
|
-
"
|
|
133
|
+
"blockingTotal counts contracts and validate findings claimed as defects only — see claim on " +
|
|
134
|
+
"each finding. scope and pr_analysis answer what a change touches, which is not a defect, and " +
|
|
135
|
+
"a lead (worth a look, not provable from the graph alone) is counted separately in leadTotal " +
|
|
136
|
+
"rather than folded into the number a hook branches on.",
|
|
116
137
|
];
|
|
117
138
|
if (files.length === 0) {
|
|
118
139
|
return answer({
|
|
@@ -125,7 +146,7 @@ async function run(args, ctx) {
|
|
|
125
146
|
irSchemaVersion: base.irSchemaVersion,
|
|
126
147
|
commitSpread: base.commitSpread,
|
|
127
148
|
notes,
|
|
128
|
-
data: { files: [], sections: [], blockingTotal: 0, nodeBudget },
|
|
149
|
+
data: { files: [], sections: [], blockingTotal: 0, leadTotal: 0, nodeBudget },
|
|
129
150
|
});
|
|
130
151
|
}
|
|
131
152
|
// Sequential rather than concurrent, deliberately: these share one SQLite
|
|
@@ -152,6 +173,7 @@ async function run(args, ctx) {
|
|
|
152
173
|
source,
|
|
153
174
|
state: "failed",
|
|
154
175
|
total: 0,
|
|
176
|
+
defects: 0,
|
|
155
177
|
shown: [],
|
|
156
178
|
blocking,
|
|
157
179
|
headline: `${source} failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -164,6 +186,9 @@ async function run(args, ctx) {
|
|
|
164
186
|
source,
|
|
165
187
|
state: sub.state,
|
|
166
188
|
total: items.length,
|
|
189
|
+
// scope and pr_analysis carry no `claim` at all — `defectsIn` reads 0 for
|
|
190
|
+
// them, which is correct: neither reports a claim that something is wrong.
|
|
191
|
+
defects: defectsIn(items),
|
|
167
192
|
shown: items.slice(0, perSource),
|
|
168
193
|
blocking,
|
|
169
194
|
headline: sub.headline,
|
|
@@ -181,6 +206,7 @@ async function run(args, ctx) {
|
|
|
181
206
|
source: "pr_analysis",
|
|
182
207
|
state: "refused",
|
|
183
208
|
total: 0,
|
|
209
|
+
defects: 0,
|
|
184
210
|
shown: [],
|
|
185
211
|
blocking: false,
|
|
186
212
|
headline: "pr_analysis needs a base ref to diff against and has no default. Pass \"base\" to include it.",
|
|
@@ -201,12 +227,21 @@ async function run(args, ctx) {
|
|
|
201
227
|
}
|
|
202
228
|
await runOne("contracts", contractsTool,
|
|
203
229
|
// pathsOnly is what the pre-push tier means for a tool with no traversal to
|
|
204
|
-
// budget — see the module header.
|
|
205
|
-
|
|
230
|
+
// budget — see the module header. `files` is UAT round 3, B11: without it,
|
|
231
|
+
// contracts compared the whole graph and this section's total was the
|
|
232
|
+
// repository's standing backlog, not the change being pushed.
|
|
233
|
+
{ pathsOnly: true, files },
|
|
234
|
+
// shapeMismatches is always empty under pathsOnly, but folded in anyway
|
|
235
|
+
// rather than assumed empty — a future call that drops pathsOnly should
|
|
236
|
+
// not silently under-count defects here.
|
|
237
|
+
(data) => [...listOf(data, "findings"), ...listOf(data, "shapeMismatches")], true);
|
|
206
238
|
await runOne("validate", validateTool, { files, maxFindings: VALIDATE_MAX_FINDINGS }, (data) => listOf(data, "findings"), true);
|
|
207
239
|
const blockingTotal = sections
|
|
208
240
|
.filter((section) => section.blocking)
|
|
209
|
-
.reduce((sum, section) => sum + section.
|
|
241
|
+
.reduce((sum, section) => sum + section.defects, 0);
|
|
242
|
+
const leadTotal = sections
|
|
243
|
+
.filter((section) => section.blocking)
|
|
244
|
+
.reduce((sum, section) => sum + (section.total - section.defects), 0);
|
|
210
245
|
const failed = sections.filter((section) => section.state === "failed");
|
|
211
246
|
if (failed.length > 0) {
|
|
212
247
|
notes.push(`${failed.length} of 4 constituent(s) failed and contributed nothing: ` +
|
|
@@ -214,15 +249,20 @@ async function run(args, ctx) {
|
|
|
214
249
|
"reply is not.");
|
|
215
250
|
}
|
|
216
251
|
return answer({
|
|
217
|
-
headline: blockingTotal
|
|
218
|
-
?
|
|
219
|
-
|
|
220
|
-
"contracts and validate sections."
|
|
252
|
+
headline: blockingTotal > 0
|
|
253
|
+
? `${blockingTotal} defect(s) blocking across ${files.length} changed file(s)` +
|
|
254
|
+
(leadTotal > 0 ? `, plus ${leadTotal} lead(s) to review` : "") +
|
|
255
|
+
" — see the contracts and validate sections."
|
|
256
|
+
: leadTotal > 0
|
|
257
|
+
? `No blocking defects across ${files.length} changed file(s); ${leadTotal} lead(s) to ` +
|
|
258
|
+
"review — see the contracts and validate sections."
|
|
259
|
+
: `No contract or environment findings across ${files.length} changed file(s).`,
|
|
221
260
|
// `empty` is earned here: all four ran against a real graph and found
|
|
222
|
-
// nothing blocking. A constituent that refused makes that
|
|
223
|
-
// state follows the weakest link rather than the happy
|
|
224
|
-
|
|
225
|
-
|
|
261
|
+
// nothing at all, blocking or not. A constituent that refused makes that
|
|
262
|
+
// untrue, so the state follows the weakest link rather than the happy
|
|
263
|
+
// path — and a lead is still something found, so it is `ok`, not `empty`.
|
|
264
|
+
state: failed.length > 0 ? "failed" : blockingTotal > 0 || leadTotal > 0 ? "ok" : "empty",
|
|
265
|
+
data: { files, sections, blockingTotal, leadTotal, nodeBudget },
|
|
226
266
|
resolutionFloor: (floors.length === 0 ? 0 : Math.min(...floors)),
|
|
227
267
|
nameLevel: true,
|
|
228
268
|
commitSha: base.commitSha,
|
|
@@ -242,8 +282,10 @@ export const prePushTool = {
|
|
|
242
282
|
"returns one short envelope: what your change touches, what it touches that has no test, which " +
|
|
243
283
|
"API contracts break, and which environment claims do not hold. Each source contributes its own " +
|
|
244
284
|
"top few — they are deliberately not ranked against each other, because Descry has no model for " +
|
|
245
|
-
"whether a contract mismatch outranks an unset variable.
|
|
246
|
-
"
|
|
285
|
+
"whether a contract mismatch outranks an unset variable. Both are scoped to the files you pass, " +
|
|
286
|
+
"not the repository's whole backlog. blockingTotal counts only defects (provable from the graph " +
|
|
287
|
+
"alone) from the two sources that report them, and is what a git hook should branch on; leads " +
|
|
288
|
+
"(worth a look, not provable alone) are counted separately in leadTotal.",
|
|
247
289
|
inputSchema: SCHEMA,
|
|
248
290
|
run,
|
|
249
291
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-push.js","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pre-push.js","sourceRoot":"","sources":["../../src/tools/pre-push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,MAAM,EACN,eAAe,EACf,cAAc,EACd,mBAAmB,GAGpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,gGAAgG;AAChG,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,2EAA2E;AAC3E,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EACT,yFAAyF;gBACzF,uFAAuF;SAC1F;QACD,IAAI,EAAE;YACJ,I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AiG;QACjG,iGAAiG;QACjG,+FAA+F;QAC/F,yEAAyE;IAC3E,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAOL,KAAK,SAAS,EAEd,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAIlB,iDAAiD;AACjD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;AA0KrD,eAAO,MAAM,SAAS,EAAE,cAavB,CAAC"}
|
package/dist/tools/scope.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { nodesInFiles, scopeChange } from "@descryy/core";
|
|
19
19
|
import { answer, briefNode, optionalEnum, optionalInteger, optionalStringArray, ToolInputError, } from "./kit.js";
|
|
20
|
+
import { capped } from "../capped.js";
|
|
20
21
|
const TRIGGERS = ["pre-push", "pr", "nightly"];
|
|
21
22
|
const SCHEMA = {
|
|
22
23
|
type: "object",
|
|
@@ -113,9 +114,15 @@ async function run(args, ctx) {
|
|
|
113
114
|
...(budget === undefined ? {} : { budget }),
|
|
114
115
|
});
|
|
115
116
|
const affected = scoped.data.affected;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// B6 — `capped()` produces the slice and its shown/total detail together,
|
|
118
|
+
// so this reply cannot cap without carrying what it capped. Previously this
|
|
119
|
+
// sliced by hand and only ever updated the prose note (below); `truncated`
|
|
120
|
+
// and `truncatedDetail` were never set, so `render.ts` reported `null` —
|
|
121
|
+
// this tool's reply was shorter than the scope it computed and nothing on
|
|
122
|
+
// the wire said so.
|
|
123
|
+
const cap = capped(affected, limit);
|
|
124
|
+
if (cap.detail !== null) {
|
|
125
|
+
notes.push(`${cap.detail.total - cap.detail.shown} lower-scoring affected node(s) are in the scope but not ` +
|
|
119
126
|
`listed here — the reply is capped at ${limit}. Raise "limit" to see them; they were ` +
|
|
120
127
|
"analysed either way.");
|
|
121
128
|
}
|
|
@@ -130,15 +137,24 @@ async function run(args, ctx) {
|
|
|
130
137
|
...scoped,
|
|
131
138
|
data: {
|
|
132
139
|
changed: scoped.data.changed.map(shape),
|
|
133
|
-
affected: shown.map(shape),
|
|
140
|
+
affected: cap.shown.map(shape),
|
|
134
141
|
affectedTotal: affected.length,
|
|
135
142
|
droppedForBudget: scoped.data.dropped.length,
|
|
136
143
|
budget: scoped.data.budget,
|
|
137
144
|
budgetUsed: scoped.data.budgetUsed,
|
|
138
145
|
byTier,
|
|
139
146
|
},
|
|
147
|
+
// Deliberately not `scoped.truncated` (`traverse.ts`'s own flag for
|
|
148
|
+
// nodes the node *budget* dropped before they ever reached `affected`).
|
|
149
|
+
// That is a different fact — fully disclosed on its own via
|
|
150
|
+
// `droppedForBudget` and `scoped.notes` — from "this reply is shorter
|
|
151
|
+
// than the scope this tool computed," which is what `truncated` here
|
|
152
|
+
// means. Conflating the two would make `total` claim a count this tool
|
|
153
|
+
// never actually reached.
|
|
154
|
+
truncated: cap.detail !== null,
|
|
140
155
|
notes: [...scoped.notes, ...notes],
|
|
141
156
|
},
|
|
157
|
+
...(cap.detail === null ? {} : { truncatedDetail: cap.detail }),
|
|
142
158
|
...(affected.length === 0 ? { state: "empty" } : {}),
|
|
143
159
|
nameLevel: true,
|
|
144
160
|
headline: `${scoped.data.changed.length} changed symbol(s) reach ${affected.length} other node(s) ` +
|
package/dist/tools/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mapp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,CAAC;QAC7D,SAAS,EAAE,IAAI;QACf,QAAQ,EACN,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,4BAA4B,QAAQ,CAAC,MAAM,iBAAiB;YACzF,yCAAyC,OAAO,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG;KACtF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAmB;IACvC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,8FAA8F;QAC9F,yFAAyF;QACzF,8FAA8F;QAC9F,0EAA0E;IAC5E,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
|
package/dist/tools/validate.d.ts
CHANGED
|
@@ -20,8 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
* The declaration half runs regardless: configuration files are read straight
|
|
22
22
|
* from the repository, which needs no adapter and no resolution.
|
|
23
|
+
*
|
|
24
|
+
* ## "By default" above is load-bearing: pass `files` and a second rule runs
|
|
25
|
+
*
|
|
26
|
+
* UAT round 3, Suggestion 4. Rule 1's own precondition — the accessor has to
|
|
27
|
+
* fail on absence — made this check structurally silent on real work: a
|
|
28
|
+
* Python feature read two new third-party API keys through
|
|
29
|
+
* `os.environ.get()`, declared nowhere, and this tool said "Clean" because
|
|
30
|
+
* nothing anywhere asserted requirement. Pass `files` (the diff you are
|
|
31
|
+
* about to push, exactly the same scope `contracts`' `paths` and this tool's
|
|
32
|
+
* own `files` already narrow to elsewhere) and a second rule, gated only on
|
|
33
|
+
* "new in this diff" rather than on accessor shape, reports
|
|
34
|
+
* `NEW_READ_UNDECLARED` for any such read regardless of whether it would
|
|
35
|
+
* fail on absence — see `validation/env.ts`'s own header for why that
|
|
36
|
+
* substitution keeps precision high without an extra guard.
|
|
23
37
|
*/
|
|
24
|
-
import type { ConfigGraph, ConfigReadSite, EnvClaim, EnvEvidence, EnvFindingKind, EnvReport, RollbackFinding, RollbackReport } from "@descryy/core";
|
|
38
|
+
import type { AttributeFinding, AttributeReport, ConfigGraph, ConfigReadSite, EnvClaim, EnvEvidence, EnvFindingKind, EnvReport, MigrationIntegrityFinding, MigrationIntegrityReport, RollbackFinding, RollbackReport } from "@descryy/core";
|
|
25
39
|
import type { ResolutionLevel } from "@descryy/ir";
|
|
26
40
|
import { type ToolDefinition } from "./kit.ts";
|
|
27
41
|
/**
|
|
@@ -98,6 +112,31 @@ export interface ValidateData {
|
|
|
98
112
|
/** Named in plain words when `ran` is false. */
|
|
99
113
|
readonly blockers: readonly string[];
|
|
100
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* §"an attribute is read, and the type does not declare it" — always a
|
|
117
|
+
* defect, never a lead: this is a contradiction between two producers that
|
|
118
|
+
* must agree, provable from the graph alone.
|
|
119
|
+
*/
|
|
120
|
+
readonly attributeExistence: {
|
|
121
|
+
readonly findings: readonly AttributeFinding[];
|
|
122
|
+
readonly findingsTotal: number;
|
|
123
|
+
readonly examined: AttributeReport["examined"];
|
|
124
|
+
/** False when no READS edge onto a type-like node carried field-existence info at all. */
|
|
125
|
+
readonly ran: boolean;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* §"a migration outside the migrations directory, or a broken revision
|
|
129
|
+
* chain" — both always defects, both provable from the graph alone.
|
|
130
|
+
*/
|
|
131
|
+
readonly migrationIntegrity: {
|
|
132
|
+
readonly findings: readonly MigrationIntegrityFinding[];
|
|
133
|
+
readonly findingsTotal: number;
|
|
134
|
+
readonly examined: MigrationIntegrityReport["examined"];
|
|
135
|
+
readonly migrationsDirectory: string | null;
|
|
136
|
+
/** False when no module in the graph carried migration revision attrs. */
|
|
137
|
+
readonly ran: boolean;
|
|
138
|
+
readonly withheld: MigrationIntegrityReport["withheld"];
|
|
139
|
+
};
|
|
101
140
|
}
|
|
102
141
|
export declare const validateTool: ToolDefinition;
|
|
103
142
|
//# sourceMappingURL=validate.d.ts.map
|