@antelopejs/tooling-configs 0.7.4 → 0.7.5-next.356.g0d472b3
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 +32 -77
- package/dist/bin/api-diff.mjs +16 -36
- package/dist/bin/capture.mjs +4 -4
- package/dist/bin/check-size.mjs +12 -3
- package/dist/bin/checks.mjs +2 -2
- package/dist/bin/comment-proof.mjs +3 -4
- package/dist/bin/garden.mjs +45 -170
- package/dist/bin/readme-strip.mjs +2 -2
- package/dist/bin/suppressions.mjs +212 -9
- package/dist/bin/sync.mjs +284 -189
- package/dist/bin/tsc.mjs +1 -1
- package/dist/bin/verify.mjs +33 -613
- package/dist/{checks-BTFf0Evy.mjs → checks-C60vMFin.mjs} +130 -283
- package/dist/{docs-compat-BmczGA1d.mjs → docs-compat-CdgBviGf.mjs} +2 -2
- package/dist/eslint.mjs +1 -1
- package/dist/{files-C-JJhExM.mjs → files-BbzJEk-L.mjs} +5 -4
- package/dist/formal/index.mjs +1 -1
- package/dist/{guardrails-CNmSFSxO.mjs → guardrails-Dron1AbR.mjs} +5 -611
- package/dist/{map-BYkmnvNw.mjs → map-CbNbypUa.mjs} +2 -2
- package/dist/oxc/anti-slop/index.mjs +22 -964
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +1 -1
- package/dist/oxc/lint.d.mts +2 -14
- package/dist/oxc/lint.mjs +3 -20
- package/dist/{package-1pH5I0TF.mjs → package-7oylgBeT.mjs} +3 -12
- package/dist/{workflow-C-oBwL2H.mjs → renovate-D0su_v9p.mjs} +191 -91
- package/dist/{suppression-budget-BeJIgSTO.mjs → suppression-budget-De9nUzlD.mjs} +33 -13
- package/dist/{suppressions-BvWGA463.mjs → suppressions-CfJwL0fN.mjs} +1 -1
- package/dist/{templates-Df6SlGLA.mjs → templates-DLW0Ubfk.mjs} +26 -29
- package/dist/typescript-C7eU-cig.mjs +581 -0
- package/dist/verify/index.d.mts +5 -24
- package/package.json +1 -3
- package/dist/bin/body-check.d.mts +0 -1
- package/dist/bin/body-check.mjs +0 -350
- package/dist/bin/ratchet.d.mts +0 -1
- package/dist/bin/ratchet.mjs +0 -375
- package/dist/ceilings-B7KayYIG.mjs +0 -76
- package/dist/oxlint-CIeonWMB.mjs +0 -133
- package/dist/proof-stamp-Bg4ULLvr.mjs +0 -342
- package/dist/ratchet-CPpvIU6Y.mjs +0 -453
- package/dist/renames-L2owF5GD.mjs +0 -59
- package/dist/size-CCGLY4Ke.mjs +0 -18
- package/dist/suppression-base-CDiFJse2.mjs +0 -120
- package/dist/typescript-B0df00nl.mjs +0 -292
package/dist/bin/verify.mjs
CHANGED
|
@@ -4,15 +4,15 @@ import { t as typescript6_default } from "../typescript6-HdyOMBv3.mjs";
|
|
|
4
4
|
import { a as isString, c as object, f as parseJson, i as isObject, n as children, p as str, s as num, t as child, u as optStr } from "../json-CG2L7YFl.mjs";
|
|
5
5
|
import { a as exitIs, c as interrupted, i as exists, r as equal, u as refused } from "../checks-CxkSu2E6.mjs";
|
|
6
6
|
import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { s as repositoryRoot } from "../files-BbzJEk-L.mjs";
|
|
8
8
|
import { t as packSteps } from "../pack-tarball-Cn4zGKn7.mjs";
|
|
9
|
-
import { C as
|
|
9
|
+
import { C as matchesPath, S as pauseSync, _ as recordProcesses, a as readFeatures, b as withLocalBins, c as allocateRun, d as git, f as isolatedEnv, g as ownRun, h as operatorEnv, i as planFor, l as canonical, m as openWorkspace, n as SMOKE_FEATURE, o as CACHE_DIR, p as loadRun, r as checkMap, s as RUNS_DIR, u as commandRecords, v as removeTree, x as writeWhole, y as saveRun } from "../map-CbNbypUa.mjs";
|
|
10
10
|
import { t as relativeSlashed } from "../slash-BEgSnfYw.mjs";
|
|
11
11
|
import { n as launch, r as spawnLaunched, t as killTree } from "../launch-D5cylwvb.mjs";
|
|
12
12
|
import { accessSync, appendFileSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, symlinkSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";
|
|
13
|
-
import { basename, dirname, extname, isAbsolute, join,
|
|
14
|
-
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
13
|
+
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
15
14
|
import { pathToFileURL } from "node:url";
|
|
15
|
+
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
16
16
|
import { createHash, randomBytes } from "node:crypto";
|
|
17
17
|
import { availableParallelism, constants as constants$1 } from "node:os";
|
|
18
18
|
import { parseArgs, stripVTControlCharacters } from "node:util";
|
|
@@ -75,388 +75,6 @@ function doorLine(doors) {
|
|
|
75
75
|
return doors.length > 0 ? `One-way-door: ${doors.map((door) => door.kind).join(", ")}` : "";
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
|
-
//#region src/verify/emit.ts
|
|
79
|
-
const CODE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
80
|
-
".ts",
|
|
81
|
-
".mts",
|
|
82
|
-
".cts",
|
|
83
|
-
".tsx",
|
|
84
|
-
".js",
|
|
85
|
-
".mjs",
|
|
86
|
-
".cjs",
|
|
87
|
-
".jsx"
|
|
88
|
-
]);
|
|
89
|
-
const OUTPUT_LIMIT$2 = 67108864;
|
|
90
|
-
const TEXT_LENGTH = 160;
|
|
91
|
-
function fileAt(repo, sha, path) {
|
|
92
|
-
const shown = spawnSync("git", ["show", `${sha}:${path}`], {
|
|
93
|
-
cwd: repo,
|
|
94
|
-
encoding: "utf8",
|
|
95
|
-
maxBuffer: OUTPUT_LIMIT$2
|
|
96
|
-
});
|
|
97
|
-
return shown.status === 0 ? shown.stdout : null;
|
|
98
|
-
}
|
|
99
|
-
const MODULE_EXTENSION = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
100
|
-
function moduleKey(path, specifier) {
|
|
101
|
-
if (!specifier.startsWith(".")) return specifier;
|
|
102
|
-
return posix.join(dirname(path), specifier).replace(MODULE_EXTENSION, "");
|
|
103
|
-
}
|
|
104
|
-
function isPropertyName(node) {
|
|
105
|
-
const parent = node.parent;
|
|
106
|
-
return (typescript6_default.isPropertyAccessExpression(parent) || typescript6_default.isPropertyAssignment(parent) || typescript6_default.isMethodDeclaration(parent) || typescript6_default.isPropertyDeclaration(parent) || typescript6_default.isGetAccessor(parent) || typescript6_default.isSetAccessor(parent) || typescript6_default.isEnumMember(parent)) && parent.name === node;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* A binding is its name alone when that module declares it as a function
|
|
110
|
-
* declaration no other covered file declares, which may move between covered
|
|
111
|
-
* files, and `module#name` otherwise, so a variable or class of one file, or a
|
|
112
|
-
* function of the same name in another, never reads as it.
|
|
113
|
-
*/
|
|
114
|
-
function bindingOrigin(covered, module, name) {
|
|
115
|
-
return covered.functions.get(module)?.has(name) && !covered.duplicated.has(name) ? name : `${module}#${name}`;
|
|
116
|
-
}
|
|
117
|
-
function importedBindings(clause, module, covered) {
|
|
118
|
-
const named = clause.namedBindings;
|
|
119
|
-
const bindings = [];
|
|
120
|
-
if (clause.name) bindings.push([clause.name.text, bindingOrigin(covered, module, "default")]);
|
|
121
|
-
if (named && typescript6_default.isNamespaceImport(named)) bindings.push([named.name.text, bindingOrigin(covered, module, "*")]);
|
|
122
|
-
if (named && typescript6_default.isNamedImports(named)) for (const element of named.elements) bindings.push([element.name.text, bindingOrigin(covered, module, (element.propertyName ?? element.name).text)]);
|
|
123
|
-
return bindings;
|
|
124
|
-
}
|
|
125
|
-
function reexportTexts(statement, module, covered) {
|
|
126
|
-
const exported = statement.exportClause;
|
|
127
|
-
if (exported === void 0) return [`export * from ${module}`];
|
|
128
|
-
if (typescript6_default.isNamespaceExport(exported)) return [`export * as ${exported.name.text} from ${module}`];
|
|
129
|
-
return exported.elements.flatMap((element) => {
|
|
130
|
-
const origin = bindingOrigin(covered, module, (element.propertyName ?? element.name).text);
|
|
131
|
-
return origin === element.name.text ? [] : [`export ${origin} as ${element.name.text}`];
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* The exports of a file that name a local or imported binding, keyed by the
|
|
136
|
-
* origin of what they export. An export under its own name of a local needs no
|
|
137
|
-
* entry, the same as an `export` keyword, so only a renamed local and any
|
|
138
|
-
* imported binding does.
|
|
139
|
-
*/
|
|
140
|
-
function localExportTexts(statement, bindings, locals) {
|
|
141
|
-
const exported = statement.exportClause;
|
|
142
|
-
if (exported === void 0 || !typescript6_default.isNamedExports(exported)) return [];
|
|
143
|
-
return exported.elements.flatMap((element) => {
|
|
144
|
-
const name = (element.propertyName ?? element.name).text;
|
|
145
|
-
const imported = bindings.get(name);
|
|
146
|
-
const origin = imported ?? locals.get(name) ?? name;
|
|
147
|
-
return imported === void 0 && name === element.name.text || origin === element.name.text ? [] : [`export ${origin} as ${element.name.text}`];
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Where each value-imported binding of a file comes from: the resolved
|
|
152
|
-
* module and the imported name, so an alias or a swapped specifier changes
|
|
153
|
-
* what a use refers to. A binding from a covered module is its name alone
|
|
154
|
-
* when it is a function declaration, so moving the declaration between
|
|
155
|
-
* covered files keeps every use the same; any other binding is keyed by its
|
|
156
|
-
* module. A side-effect import keeps its order in the file relative to the binding imports before it, and `export *` is an entry like any re-export. Re-exports and
|
|
157
|
-
* renamed or imported exports become entries keyed by the origin they export.
|
|
158
|
-
*/
|
|
159
|
-
function originsOf(path, covered, file, locals) {
|
|
160
|
-
const bindings = /* @__PURE__ */ new Map();
|
|
161
|
-
const texts = [];
|
|
162
|
-
const ordered = [];
|
|
163
|
-
const earlier = [];
|
|
164
|
-
const exports = [];
|
|
165
|
-
for (const statement of file.statements) {
|
|
166
|
-
if (!(typescript6_default.isImportDeclaration(statement) || typescript6_default.isExportDeclaration(statement))) continue;
|
|
167
|
-
const specifier = statement.moduleSpecifier;
|
|
168
|
-
if (specifier === void 0 && typescript6_default.isExportDeclaration(statement)) exports.push(statement);
|
|
169
|
-
if (specifier === void 0 || !typescript6_default.isStringLiteral(specifier)) continue;
|
|
170
|
-
const module = moduleKey(path, specifier.text);
|
|
171
|
-
if (typescript6_default.isImportDeclaration(statement)) {
|
|
172
|
-
if (statement.importClause === void 0) {
|
|
173
|
-
ordered.push(`import ${module} after ${earlier.join(",")}`);
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
earlier.push(module);
|
|
177
|
-
for (const [name, origin] of importedBindings(statement.importClause, module, covered)) bindings.set(name, origin);
|
|
178
|
-
} else texts.push(...reexportTexts(statement, module, covered));
|
|
179
|
-
}
|
|
180
|
-
for (const statement of exports) texts.push(...localExportTexts(statement, bindings, locals));
|
|
181
|
-
const item = (text, hoisted) => ({
|
|
182
|
-
structure: text,
|
|
183
|
-
text,
|
|
184
|
-
hoisted
|
|
185
|
-
});
|
|
186
|
-
return {
|
|
187
|
-
bindings,
|
|
188
|
-
entries: texts.map((text) => item(text, true)),
|
|
189
|
-
ordered: ordered.map((text) => item(text, false))
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function leafOf(node, bindings) {
|
|
193
|
-
if (typescript6_default.isIdentifier(node)) return isPropertyName(node) ? node.text : bindings.get(node.text) ?? node.text;
|
|
194
|
-
if (typescript6_default.isPrivateIdentifier(node)) return node.text;
|
|
195
|
-
if (typescript6_default.isNumericLiteral(node)) return String(Number(node.text));
|
|
196
|
-
if (typescript6_default.isStringLiteralLike(node) || typescript6_default.isTemplateLiteralToken(node)) return JSON.stringify(node.text);
|
|
197
|
-
if (typescript6_default.isBigIntLiteral(node) || typescript6_default.isRegularExpressionLiteral(node)) return node.text;
|
|
198
|
-
if (typescript6_default.isPrefixUnaryExpression(node) || typescript6_default.isPostfixUnaryExpression(node)) return typescript6_default.SyntaxKind[node.operator];
|
|
199
|
-
if (typescript6_default.isVariableDeclarationList(node)) return String(node.flags & (typescript6_default.NodeFlags.Let | typescript6_default.NodeFlags.Const));
|
|
200
|
-
if (typescript6_default.isMetaProperty(node)) return typescript6_default.SyntaxKind[node.keywordToken];
|
|
201
|
-
return "";
|
|
202
|
-
}
|
|
203
|
-
function dropped(node) {
|
|
204
|
-
return node.kind === typescript6_default.SyntaxKind.ExportKeyword || node.kind === typescript6_default.SyntaxKind.DefaultKeyword;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* The structure of a node: its kind, its identifier name or literal value,
|
|
208
|
-
* and its children's structure, with parentheses, positions, trivia, quote
|
|
209
|
-
* style and line breaks left out, so formatting never changes it. An
|
|
210
|
-
* imported binding stands for its origin.
|
|
211
|
-
*/
|
|
212
|
-
function structureOf(node, bindings) {
|
|
213
|
-
if (typescript6_default.isParenthesizedExpression(node)) return structureOf(node.expression, bindings);
|
|
214
|
-
const children = [];
|
|
215
|
-
typescript6_default.forEachChild(node, (child) => {
|
|
216
|
-
if (!dropped(child)) children.push(structureOf(child, bindings));
|
|
217
|
-
});
|
|
218
|
-
return `${typescript6_default.SyntaxKind[node.kind]}(${leafOf(node, bindings)}|${children.join(",")})`;
|
|
219
|
-
}
|
|
220
|
-
function readable(text) {
|
|
221
|
-
const flat = text.replace(/\s+/g, " ").trim();
|
|
222
|
-
return flat.length > TEXT_LENGTH ? `${flat.slice(0, TEXT_LENGTH)}…` : flat;
|
|
223
|
-
}
|
|
224
|
-
function parseScript(path, source) {
|
|
225
|
-
const { outputText } = typescript6_default.transpileModule(source, {
|
|
226
|
-
fileName: path,
|
|
227
|
-
compilerOptions: {
|
|
228
|
-
target: typescript6_default.ScriptTarget.ES2022,
|
|
229
|
-
module: typescript6_default.ModuleKind.ESNext,
|
|
230
|
-
removeComments: true,
|
|
231
|
-
experimentalDecorators: true
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
return {
|
|
235
|
-
path,
|
|
236
|
-
file: typescript6_default.createSourceFile("emit.js", outputText, typescript6_default.ScriptTarget.ES2022, true, typescript6_default.ScriptKind.JS)
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function declaredNames$1(name) {
|
|
240
|
-
return typescript6_default.isIdentifier(name) ? [name.text] : name.elements.flatMap((element) => typescript6_default.isOmittedExpression(element) ? [] : declaredNames$1(element.name));
|
|
241
|
-
}
|
|
242
|
-
function isFunctionDeclaration(statement) {
|
|
243
|
-
return typescript6_default.isFunctionDeclaration(statement) && Boolean(statement.body) && statement.name !== void 0;
|
|
244
|
-
}
|
|
245
|
-
/** The top-level variables, classes and enums of a script, and its functions that another covered file also declares, each keyed by its file and name: what a function moved into another file must not pick up by name. */
|
|
246
|
-
function localsOf(script, covered) {
|
|
247
|
-
const file = script.path.replace(MODULE_EXTENSION, "");
|
|
248
|
-
const names = script.file.statements.flatMap((statement) => {
|
|
249
|
-
if (typescript6_default.isVariableStatement(statement)) return statement.declarationList.declarations.flatMap((declaration) => declaredNames$1(declaration.name));
|
|
250
|
-
return (typescript6_default.isClassDeclaration(statement) || typescript6_default.isEnumDeclaration(statement)) && statement.name ? [statement.name.text] : [];
|
|
251
|
-
});
|
|
252
|
-
const clashing = [...covered.functions.get(file) ?? []].filter((name) => covered.duplicated.has(name));
|
|
253
|
-
return new Map([...names, ...clashing].map((name) => [name, `${file}#${name}`]));
|
|
254
|
-
}
|
|
255
|
-
function scriptItems(script, covered) {
|
|
256
|
-
const locals = localsOf(script, covered);
|
|
257
|
-
const origins = originsOf(script.path, covered, script.file, locals);
|
|
258
|
-
const inFunctions = new Map([...locals, ...origins.bindings]);
|
|
259
|
-
const statements = script.file.statements.filter((statement) => !typescript6_default.isImportDeclaration(statement) && !typescript6_default.isExportDeclaration(statement)).map((statement) => {
|
|
260
|
-
const hoisted = typescript6_default.isFunctionDeclaration(statement) && Boolean(statement.body);
|
|
261
|
-
return {
|
|
262
|
-
structure: structureOf(statement, hoisted ? inFunctions : origins.bindings),
|
|
263
|
-
text: readable(statement.getText(script.file)),
|
|
264
|
-
hoisted
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
return [
|
|
268
|
-
...origins.entries,
|
|
269
|
-
...origins.ordered,
|
|
270
|
-
...statements
|
|
271
|
-
];
|
|
272
|
-
}
|
|
273
|
-
function parsedFile(path, source) {
|
|
274
|
-
if (path.endsWith(".vue")) {
|
|
275
|
-
const template = /<template\b[^>]*>([\s\S]*)<\/template>/.exec(source);
|
|
276
|
-
const markup = template ? template[1].replace(/\s+/g, " ").trim() : null;
|
|
277
|
-
return {
|
|
278
|
-
path,
|
|
279
|
-
scripts: [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/g)].map(([, body]) => parseScript(`${path}.ts`, body)),
|
|
280
|
-
others: markup === null ? [] : [{
|
|
281
|
-
structure: `template(${markup})`,
|
|
282
|
-
text: readable(`<template> ${markup}`),
|
|
283
|
-
hoisted: false
|
|
284
|
-
}]
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
if (CODE_EXTENSIONS.has(extname(path))) return {
|
|
288
|
-
path,
|
|
289
|
-
scripts: [parseScript(path, source)],
|
|
290
|
-
others: []
|
|
291
|
-
};
|
|
292
|
-
const flat = source.replace(/\s+/g, " ").trim();
|
|
293
|
-
return {
|
|
294
|
-
path,
|
|
295
|
-
scripts: [],
|
|
296
|
-
others: [{
|
|
297
|
-
structure: `file(${flat})`,
|
|
298
|
-
text: readable(flat),
|
|
299
|
-
hoisted: false
|
|
300
|
-
}]
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* What the covered code does at a commit, as structure rather than text:
|
|
305
|
-
* each covered file's top-level statements and side-effect imports in order,
|
|
306
|
-
* and, apart, the function declarations and exports keyed by origin of every
|
|
307
|
-
* covered file, which hoisting lets move freely. Each use of an imported
|
|
308
|
-
* binding stands for its origin (resolved module and imported name), and a
|
|
309
|
-
* function declaration refers to the top-level variables and classes of its
|
|
310
|
-
* own file by file and name, so retargeting an import, an alias or an export,
|
|
311
|
-
* or moving a function next to a different variable of the same name, changes
|
|
312
|
-
* the fingerprint. Types, comments, formatting and export keywords are left
|
|
313
|
-
* out, so a type-only edit, a reformat, or moving a function declaration to
|
|
314
|
-
* another covered file keeps the same fingerprint, while reordering or moving
|
|
315
|
-
* any other statement changes it.
|
|
316
|
-
*/
|
|
317
|
-
function emitFingerprint(repo, sha, files) {
|
|
318
|
-
const fingerprint = {
|
|
319
|
-
functions: [],
|
|
320
|
-
files: {}
|
|
321
|
-
};
|
|
322
|
-
const parsed = files.flatMap((path) => {
|
|
323
|
-
const source = fileAt(repo, sha, path);
|
|
324
|
-
return source === null ? [] : [parsedFile(path, source)];
|
|
325
|
-
});
|
|
326
|
-
const functions = new Map(parsed.map(({ path, scripts }) => [path.replace(MODULE_EXTENSION, ""), new Set(scripts.flatMap(({ file }) => file.statements.filter(isFunctionDeclaration).map(({ name }) => name.text)))]));
|
|
327
|
-
const declarations = [...functions.values()].flatMap((names) => [...names]);
|
|
328
|
-
const covered = {
|
|
329
|
-
modules: new Set(files.map((path) => path.replace(MODULE_EXTENSION, ""))),
|
|
330
|
-
functions,
|
|
331
|
-
duplicated: new Set(declarations.filter((name, index) => declarations.indexOf(name) !== index))
|
|
332
|
-
};
|
|
333
|
-
for (const { path, scripts, others } of parsed) {
|
|
334
|
-
const items = [...scripts.flatMap((script) => scriptItems(script, covered)), ...others];
|
|
335
|
-
fingerprint.functions.push(...items.filter((item) => item.hoisted));
|
|
336
|
-
fingerprint.files[path] = items.filter((item) => !item.hoisted);
|
|
337
|
-
}
|
|
338
|
-
return fingerprint;
|
|
339
|
-
}
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/verify/behaviour.ts
|
|
342
|
-
const DETAIL_LIMIT = 5;
|
|
343
|
-
const DETAIL_LENGTH = 160;
|
|
344
|
-
const OUTPUT_LIMIT$1 = 67108864;
|
|
345
|
-
/** Runs `action` in a throwaway worktree of `sha` whose `node_modules` links the checkout's, then removes it. */
|
|
346
|
-
function inWorktree(repo, sha, action) {
|
|
347
|
-
const dir = mkdtempSync(join(operatorTmpdir(), "antelopejs-verify-behaviour-"));
|
|
348
|
-
git(repo, [
|
|
349
|
-
"worktree",
|
|
350
|
-
"add",
|
|
351
|
-
"--quiet",
|
|
352
|
-
"--detach",
|
|
353
|
-
"--force",
|
|
354
|
-
dir,
|
|
355
|
-
sha
|
|
356
|
-
]);
|
|
357
|
-
try {
|
|
358
|
-
symlinkSync(join(repo, "node_modules"), join(dir, "node_modules"), "dir");
|
|
359
|
-
return action(dir);
|
|
360
|
-
} finally {
|
|
361
|
-
git(repo, [
|
|
362
|
-
"worktree",
|
|
363
|
-
"remove",
|
|
364
|
-
"--force",
|
|
365
|
-
dir
|
|
366
|
-
]);
|
|
367
|
-
rmSync(dir, {
|
|
368
|
-
recursive: true,
|
|
369
|
-
force: true
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function probeFingerprint(repo, command, sha) {
|
|
374
|
-
const [program, ...args] = command;
|
|
375
|
-
return inWorktree(repo, sha, (dir) => {
|
|
376
|
-
const run = spawnLaunched(program, [...args, dir], {
|
|
377
|
-
cwd: repo,
|
|
378
|
-
env: operatorEnv(),
|
|
379
|
-
encoding: "utf8",
|
|
380
|
-
maxBuffer: OUTPUT_LIMIT$1
|
|
381
|
-
});
|
|
382
|
-
if (run.status !== 0) throw new Error(`behaviour probe ${command.join(" ")} failed on ${sha}:\n${run.stderr}`);
|
|
383
|
-
return run.stdout.split("\n").filter(Boolean);
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
function difference(left, right, key) {
|
|
387
|
-
const counts = /* @__PURE__ */ new Map();
|
|
388
|
-
for (const item of right) counts.set(key(item), (counts.get(key(item)) ?? 0) + 1);
|
|
389
|
-
return left.filter((item) => {
|
|
390
|
-
const count = counts.get(key(item)) ?? 0;
|
|
391
|
-
if (count === 0) return true;
|
|
392
|
-
counts.set(key(item), count - 1);
|
|
393
|
-
return false;
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
function sample(lines) {
|
|
397
|
-
return lines.slice(0, DETAIL_LIMIT).map((line) => line.length > DETAIL_LENGTH ? `${line.slice(0, DETAIL_LENGTH)}…` : line);
|
|
398
|
-
}
|
|
399
|
-
function sequenceChanges(path, base, head) {
|
|
400
|
-
const length = Math.max(base.length, head.length);
|
|
401
|
-
for (let index = 0; index < length; index += 1) if (base[index]?.structure !== head[index]?.structure) return {
|
|
402
|
-
removed: [`${path} statement ${index + 1}: ${base[index]?.text ?? "(none)"}`],
|
|
403
|
-
added: [`${path} statement ${index + 1}: ${head[index]?.text ?? "(none)"}`]
|
|
404
|
-
};
|
|
405
|
-
return {
|
|
406
|
-
removed: [],
|
|
407
|
-
added: []
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function compareEmit(base, head) {
|
|
411
|
-
const structure = (item) => item.structure;
|
|
412
|
-
const removed = difference(base.functions, head.functions, structure).map((item) => `hoisted ${item.text}`);
|
|
413
|
-
const added = difference(head.functions, base.functions, structure).map((item) => `hoisted ${item.text}`);
|
|
414
|
-
for (const path of /* @__PURE__ */ new Set([...Object.keys(base.files), ...Object.keys(head.files)])) {
|
|
415
|
-
const change = sequenceChanges(path, base.files[path] ?? [], head.files[path] ?? []);
|
|
416
|
-
removed.push(...change.removed);
|
|
417
|
-
added.push(...change.added);
|
|
418
|
-
}
|
|
419
|
-
return {
|
|
420
|
-
removed,
|
|
421
|
-
added
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function compareProbe(base, head) {
|
|
425
|
-
if (JSON.stringify(base) === JSON.stringify(head)) return {
|
|
426
|
-
removed: [],
|
|
427
|
-
added: []
|
|
428
|
-
};
|
|
429
|
-
const line = (item) => item;
|
|
430
|
-
const removed = difference(base, head, line);
|
|
431
|
-
const added = difference(head, base, line);
|
|
432
|
-
return removed.length + added.length > 0 ? {
|
|
433
|
-
removed,
|
|
434
|
-
added
|
|
435
|
-
} : {
|
|
436
|
-
removed: ["(order)"],
|
|
437
|
-
added: ["(order)"]
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Whether a diff changed the behaviour of the code a formal check covers,
|
|
442
|
-
* decided without judgement. For `emit` (the default), each covered file
|
|
443
|
-
* keeps its top-level statements, in order, with the same structure, and the
|
|
444
|
-
* covered function declarations stay the same wherever they live; for
|
|
445
|
-
* `probe`, the check's probe prints the same lines on a checkout of the base
|
|
446
|
-
* and of HEAD. The check's own output never enters the decision, so a model
|
|
447
|
-
* that cannot see the code still gates it.
|
|
448
|
-
*/
|
|
449
|
-
function behaviourChange(repo, check, commits) {
|
|
450
|
-
const probe = check.behaviour?.kind === "probe" ? check.behaviour.command : void 0;
|
|
451
|
-
const change = probe === void 0 ? compareEmit(emitFingerprint(repo, commits.baseSha, check.covers), emitFingerprint(repo, commits.headSha, check.covers)) : compareProbe(probeFingerprint(repo, probe, commits.baseSha), probeFingerprint(repo, probe, commits.headSha));
|
|
452
|
-
return {
|
|
453
|
-
method: probe === void 0 ? "emit" : `probe ${probe.join(" ")}`,
|
|
454
|
-
changed: change.removed.length + change.added.length > 0,
|
|
455
|
-
removed: sample(change.removed),
|
|
456
|
-
added: sample(change.added)
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
//#endregion
|
|
460
78
|
//#region src/verify/timing.ts
|
|
461
79
|
/** Starts a clock; the returned function gives the whole milliseconds elapsed since. */
|
|
462
80
|
function stopwatch() {
|
|
@@ -525,33 +143,6 @@ function violatedRules(check, exitCode, output) {
|
|
|
525
143
|
if (check.violation) return [...new Set([...output.matchAll(check.violation)].map((match) => match[1]))];
|
|
526
144
|
return exitCode === 0 ? [] : ["property"];
|
|
527
145
|
}
|
|
528
|
-
function passingRules(check, exitCode, output) {
|
|
529
|
-
if (check.passing) return [...new Set([...output.matchAll(check.passing)].map((match) => match[1]))];
|
|
530
|
-
return !check.violation && exitCode === 0 ? ["property"] : [];
|
|
531
|
-
}
|
|
532
|
-
function withIndices(pattern) {
|
|
533
|
-
return pattern.hasIndices ? pattern : new RegExp(pattern.source, `${pattern.flags}d`);
|
|
534
|
-
}
|
|
535
|
-
function counterexampleLengths(check, output) {
|
|
536
|
-
if (!check.violation) return {};
|
|
537
|
-
const seen = /* @__PURE__ */ new Map();
|
|
538
|
-
for (const match of output.matchAll(withIndices(check.violation))) {
|
|
539
|
-
const states = match.groups?.states;
|
|
540
|
-
const rule = match[1];
|
|
541
|
-
const statesIsRule = match.indices?.[1]?.[0] === match.indices?.groups?.states?.[0];
|
|
542
|
-
const length = states === void 0 || !/^\d+$/.test(states) || statesIsRule ? null : Number(states);
|
|
543
|
-
seen.set(rule, seen.has(rule) && seen.get(rule) !== length ? null : length);
|
|
544
|
-
}
|
|
545
|
-
return Object.fromEntries([...seen].filter((entry) => entry[1] !== null && Number.isSafeInteger(entry[1])));
|
|
546
|
-
}
|
|
547
|
-
function rulesOf(check, run) {
|
|
548
|
-
return {
|
|
549
|
-
exitCode: run.status,
|
|
550
|
-
violated: violatedRules(check, run.status, run.stdout ?? ""),
|
|
551
|
-
passing: passingRules(check, run.status, run.stdout ?? ""),
|
|
552
|
-
lengths: counterexampleLengths(check, run.stdout ?? "")
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
146
|
function runCommand(command, cwd) {
|
|
556
147
|
const [program, ...args] = command;
|
|
557
148
|
return spawnLaunched(program, args, {
|
|
@@ -561,209 +152,45 @@ function runCommand(command, cwd) {
|
|
|
561
152
|
maxBuffer: OUTPUT_LIMIT
|
|
562
153
|
});
|
|
563
154
|
}
|
|
564
|
-
function writeRun(folder,
|
|
565
|
-
writeFileSync(join(folder,
|
|
566
|
-
writeFileSync(join(folder,
|
|
567
|
-
writeFileSync(join(folder,
|
|
568
|
-
writeFileSync(join(folder,
|
|
569
|
-
}
|
|
570
|
-
function baseRun(workspace, check, baseSha, folder) {
|
|
571
|
-
const command = check.baseCommand ?? check.command;
|
|
572
|
-
const run = inWorktree(workspace.root, baseSha, (dir) => runCommand(command, dir));
|
|
573
|
-
writeRun(folder, "base-", command, run);
|
|
574
|
-
return rulesOf(check, run);
|
|
575
|
-
}
|
|
576
|
-
function gitOutput(root, args) {
|
|
577
|
-
const run = spawnSync("git", args, {
|
|
578
|
-
cwd: root,
|
|
579
|
-
encoding: "utf8",
|
|
580
|
-
maxBuffer: OUTPUT_LIMIT
|
|
581
|
-
});
|
|
582
|
-
return run.status === 0 ? run.stdout : null;
|
|
583
|
-
}
|
|
584
|
-
function namedOnBase(workspace, check, baseSha) {
|
|
585
|
-
const config = relativeSlashed(workspace.root, join(workspace.skill, "verify.config.ts"));
|
|
586
|
-
const text = gitOutput(workspace.root, ["show", `${baseSha}:${config}`]);
|
|
587
|
-
if (text === null) return false;
|
|
588
|
-
return [
|
|
589
|
-
"\"",
|
|
590
|
-
"'",
|
|
591
|
-
"`"
|
|
592
|
-
].some((quote) => text.includes(`${quote}${check.name}${quote}`));
|
|
593
|
-
}
|
|
594
|
-
function renamedFromBase(root, check, diff) {
|
|
595
|
-
const fields = (gitOutput(root, [
|
|
596
|
-
"diff",
|
|
597
|
-
"-M",
|
|
598
|
-
"--name-status",
|
|
599
|
-
"-z",
|
|
600
|
-
diff.baseSha,
|
|
601
|
-
diff.headSha
|
|
602
|
-
]) ?? "").split("\0");
|
|
603
|
-
return fields.some((field, index) => field.startsWith("R") && (check.files ?? []).some((glob) => matchesPath(fields[index + 2] ?? "", glob)));
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Whether the diff adds the check: the base could not run it, its name
|
|
607
|
-
* appears nowhere in the base's verify.config.ts, and no file of its own
|
|
608
|
-
* `files` is a rename of a base file. A moved or renamed check, or one whose
|
|
609
|
-
* base ran, is a changed check, gated against the base.
|
|
610
|
-
*/
|
|
611
|
-
function addedByDiff(workspace, check, diff, base) {
|
|
612
|
-
return base.exitCode !== 0 && !namedOnBase(workspace, check, diff.baseSha) && !renamedFromBase(workspace.root, check, diff);
|
|
613
|
-
}
|
|
614
|
-
function gateFields(workspace, check, diff, folder, head) {
|
|
615
|
-
const behaviour = behaviourChange(workspace.root, check, diff);
|
|
616
|
-
const checkChanged = changesCheckFiles(check, diff.changed);
|
|
617
|
-
if (!behaviour.changed && !checkChanged) return {
|
|
618
|
-
behaviour,
|
|
619
|
-
checkChanged,
|
|
620
|
-
base: null,
|
|
621
|
-
fixed: [],
|
|
622
|
-
missing: []
|
|
623
|
-
};
|
|
624
|
-
const base = baseRun(workspace, check, diff.baseSha, folder);
|
|
625
|
-
const atHead = /* @__PURE__ */ new Set([...head.violated, ...head.passing]);
|
|
626
|
-
return {
|
|
627
|
-
behaviour,
|
|
628
|
-
checkChanged,
|
|
629
|
-
newCheck: checkChanged && addedByDiff(workspace, check, diff, base),
|
|
630
|
-
base,
|
|
631
|
-
fixed: base.violated.filter((rule) => head.passing.includes(rule) && !head.violated.includes(rule)),
|
|
632
|
-
missing: base.violated.filter((rule) => !atHead.has(rule))
|
|
633
|
-
};
|
|
155
|
+
function writeRun(folder, command, run) {
|
|
156
|
+
writeFileSync(join(folder, "command.txt"), `${command.join(" ")}\n`);
|
|
157
|
+
writeFileSync(join(folder, "stdout.txt"), run.stdout ?? "");
|
|
158
|
+
writeFileSync(join(folder, "stderr.txt"), `${run.stderr ?? ""}${run.error ? `\n${run.error.message}\n` : ""}`);
|
|
159
|
+
writeFileSync(join(folder, "exit-code.txt"), `${run.status}\n`);
|
|
634
160
|
}
|
|
635
161
|
/**
|
|
636
162
|
* Runs one formal check from the repository root and writes its command,
|
|
637
|
-
* output, exit code
|
|
638
|
-
* `evidence/formal/<name>/`.
|
|
639
|
-
* When the check covers the diff (`diff` given), it also records whether the
|
|
640
|
-
* diff changed the covered code's behaviour. When it did, or when the diff
|
|
641
|
-
* changed the check's own `files`, it runs the check on the base: `fixed`
|
|
642
|
-
* lists the rules the base broke that HEAD reports passing, and `missing`
|
|
643
|
-
* the rules the base broke that HEAD reports neither failing nor passing.
|
|
163
|
+
* output, exit code and violated rules under `evidence/formal/<name>/`.
|
|
644
164
|
*/
|
|
645
|
-
function runFormalCheck(workspace, state, check
|
|
165
|
+
function runFormalCheck(workspace, state, check) {
|
|
646
166
|
const elapsed = stopwatch();
|
|
647
167
|
const folder = join(state.evidence, "formal", check.name);
|
|
648
168
|
mkdirSync(folder, { recursive: true });
|
|
649
169
|
const run = runCommand(check.command, workspace.root);
|
|
650
|
-
writeRun(folder,
|
|
651
|
-
const head = rulesOf(check, run);
|
|
170
|
+
writeRun(folder, check.command, run);
|
|
652
171
|
const result = {
|
|
653
172
|
name: check.name,
|
|
654
173
|
exitCode: run.status,
|
|
655
|
-
violated:
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
folder: relativeSlashed(state.evidence, folder)
|
|
174
|
+
violated: violatedRules(check, run.status, run.stdout ?? ""),
|
|
175
|
+
folder: relativeSlashed(state.evidence, folder),
|
|
176
|
+
ms: elapsed()
|
|
659
177
|
};
|
|
660
|
-
if (diff !== null) Object.assign(result, { commits: {
|
|
661
|
-
baseSha: diff.baseSha,
|
|
662
|
-
headSha: diff.headSha
|
|
663
|
-
} }, gateFields(workspace, check, diff, folder, head));
|
|
664
|
-
result.ms = elapsed();
|
|
665
178
|
writeFileSync(join(folder, "result.json"), `${JSON.stringify(result, null, 2)}\n`);
|
|
666
179
|
return result;
|
|
667
180
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
if (!base || base.exitCode !== 0) return false;
|
|
674
|
-
const atHead = new Set(result.violated);
|
|
675
|
-
const fixed = new Set(result.fixed ?? []);
|
|
676
|
-
return base.violated.every((rule) => atHead.has(rule) || fixed.has(rule)) && result.violated.every((rule) => {
|
|
677
|
-
const length = lengthOf(result.lengths, rule);
|
|
678
|
-
return base.violated.includes(rule) && length !== void 0 && length === lengthOf(base.lengths, rule);
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* The outcome a result's base run forces before the findings are weighed: a
|
|
683
|
-
* check the diff adds, on a diff that leaves the covered behaviour unchanged,
|
|
684
|
-
* passes its recorded findings, since its record is reviewed with it and the
|
|
685
|
-
* base has nothing to compare, and fails with the advice to land it alone when
|
|
686
|
-
* the covered code changed too; otherwise a failure
|
|
687
|
-
* for a changed check with no base run recorded, a base run that exited non-zero
|
|
688
|
-
* while HEAD breaks rules, or, when the covered behaviour is unchanged, a rule
|
|
689
|
-
* HEAD breaks that the base did not. `null` when the base decides nothing.
|
|
690
|
-
*/
|
|
691
|
-
function baseGate(result) {
|
|
692
|
-
const { base, behaviour } = result;
|
|
693
|
-
if (result.newCheck === true && base && base.exitCode !== 0 && behaviour?.changed === false) return {
|
|
694
|
-
fails: false,
|
|
695
|
-
outcome: `new check, absent from the base: ${result.violated.length > 0 ? `recorded findings ${result.violated.join(", ")}` : "no violated rule"}`
|
|
696
|
-
};
|
|
697
|
-
if (result.newCheck === true && behaviour?.changed === true && result.violated.length > 0) return {
|
|
698
|
-
fails: true,
|
|
699
|
-
outcome: "new check with a covered-code change: land the check in its own PR first"
|
|
181
|
+
/** Reads a recorded result as HOLDS, VIOLATED or ERROR. */
|
|
182
|
+
function formalOutcome(result) {
|
|
183
|
+
if (result.violated.length > 0) return {
|
|
184
|
+
status: "VIOLATED",
|
|
185
|
+
outcome: `violated ${result.violated.join(", ")} (exit ${result.exitCode})`
|
|
700
186
|
};
|
|
701
|
-
if (result.checkChanged === true && !base) return {
|
|
702
|
-
fails: true,
|
|
703
|
-
outcome: "the check's own files changed but no base run was recorded"
|
|
704
|
-
};
|
|
705
|
-
if (!base) return null;
|
|
706
|
-
if (base.exitCode !== 0 && result.violated.length > 0) return {
|
|
707
|
-
fails: true,
|
|
708
|
-
outcome: `the base run exited ${base.exitCode}, so ${result.violated.join(", ")} cannot be compared with the base`
|
|
709
|
-
};
|
|
710
|
-
const added = result.violated.filter((rule) => !base.violated.includes(rule));
|
|
711
|
-
if (behaviour?.changed === false && added.length > 0) return {
|
|
712
|
-
fails: true,
|
|
713
|
-
outcome: `covered behaviour unchanged (${behaviour.method}), but the check breaks rules the base did not: ${added.join(", ")}`
|
|
714
|
-
};
|
|
715
|
-
return null;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* How a formal check's result weighs on a verdict whose diff it covers. A
|
|
719
|
-
* non-zero exit (a tool error, or a check that no longer matches its record)
|
|
720
|
-
* fails, so every violated rule of a result that reaches the rest of the gate
|
|
721
|
-
* is a recorded finding. A rule the base broke that HEAD does not report at
|
|
722
|
-
* all fails. A base run that exited non-zero cannot vouch for HEAD's findings,
|
|
723
|
-
* and a changed check with no base run recorded fails. A check the diff adds
|
|
724
|
-
* (the base could not run it, never names it and holds none of its files
|
|
725
|
-
* under another path) passes its recorded findings when the covered
|
|
726
|
-
* behaviour is unchanged. Otherwise, when the covered behaviour is unchanged,
|
|
727
|
-
* recorded findings are known, except a rule HEAD breaks that the base run
|
|
728
|
-
* did not, which fails whatever the diff touched. When the behaviour
|
|
729
|
-
* changed, they are known only when the base run exited 0 and broke every
|
|
730
|
-
* one of them, each with the same counterexample length at HEAD as on the
|
|
731
|
-
* base, and every other rule the base broke is fixed at HEAD; a new rule, a
|
|
732
|
-
* changed length, or a length either run did not report fails. A rule the
|
|
733
|
-
* base broke and HEAD reports passing is reported as fixed.
|
|
734
|
-
*/
|
|
735
|
-
function formalGate(result) {
|
|
736
187
|
if (result.exitCode !== 0) return {
|
|
737
|
-
|
|
738
|
-
outcome:
|
|
739
|
-
};
|
|
740
|
-
if ((result.missing ?? []).length > 0) return {
|
|
741
|
-
fails: true,
|
|
742
|
-
outcome: `rules the base broke are absent at HEAD: ${(result.missing ?? []).join(", ")}`
|
|
743
|
-
};
|
|
744
|
-
if (result.behaviour === void 0) return {
|
|
745
|
-
fails: result.violated.length > 0,
|
|
746
|
-
outcome: `violated ${result.violated.join(", ") || "nothing"}`
|
|
747
|
-
};
|
|
748
|
-
const how = result.behaviour.method;
|
|
749
|
-
const againstBase = baseGate(result);
|
|
750
|
-
if (againstBase) return againstBase;
|
|
751
|
-
if (!result.behaviour.changed) return {
|
|
752
|
-
fails: false,
|
|
753
|
-
outcome: `covered behaviour unchanged (${how}): ${result.violated.length > 0 ? `known findings ${result.violated.join(", ")}` : "no violated rule"}`
|
|
754
|
-
};
|
|
755
|
-
const fixed = (result.fixed ?? []).length > 0 ? `; fixed: ${(result.fixed ?? []).join(", ")}` : "";
|
|
756
|
-
if (result.violated.length === 0) return {
|
|
757
|
-
fails: false,
|
|
758
|
-
outcome: `covered behaviour changed (${how}), no violated rule${fixed}`
|
|
759
|
-
};
|
|
760
|
-
if (knownFindingsOfBase(result)) return {
|
|
761
|
-
fails: false,
|
|
762
|
-
outcome: `covered behaviour changed (${how}), same known findings as base: ${result.violated.join(", ")}${fixed}`
|
|
188
|
+
status: "ERROR",
|
|
189
|
+
outcome: `tool error (exit ${result.exitCode})`
|
|
763
190
|
};
|
|
764
191
|
return {
|
|
765
|
-
|
|
766
|
-
outcome:
|
|
192
|
+
status: "HOLDS",
|
|
193
|
+
outcome: "no violated rule (exit 0)"
|
|
767
194
|
};
|
|
768
195
|
}
|
|
769
196
|
/** The recorded result of a formal check in a run, if it ran. */
|
|
@@ -4832,11 +4259,9 @@ function formalSection(workspace, state, plan) {
|
|
|
4832
4259
|
continue;
|
|
4833
4260
|
}
|
|
4834
4261
|
ran.push(result);
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
const summary = gate ? weight.outcome : result.violated.length > 0 ? `violated: ${result.violated.join(", ")}` : `exit ${result.exitCode}, no violated rule`;
|
|
4839
|
-
lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${summary}. [evidence](${result.folder})`);
|
|
4262
|
+
const { status, outcome } = formalOutcome(result);
|
|
4263
|
+
if (gate && status !== "HOLDS") reasons.push(`formal check ${check.name}: ${status} ${outcome}`);
|
|
4264
|
+
lines.push(`\`${check.name}\` (${gate ? "covers the diff, gates the verdict" : "does not cover the diff, informational"}): ${status} ${outcome}. [evidence](${result.folder})`);
|
|
4840
4265
|
}
|
|
4841
4266
|
return {
|
|
4842
4267
|
reasons,
|
|
@@ -4901,7 +4326,7 @@ function renderVerdict(workspace, state, pr, judgement) {
|
|
|
4901
4326
|
"### One-way doors",
|
|
4902
4327
|
...doorsSection(judgement),
|
|
4903
4328
|
"",
|
|
4904
|
-
`**Head** \`${short(plan.headSha)}\` · **Skill** \`verify-${workspace.kind}\` @ \`${short(skillSha)}\`
|
|
4329
|
+
`**Head** \`${short(plan.headSha)}\` · **Skill** \`verify-${workspace.kind}\` @ \`${short(skillSha)}\` · **Verifier** ${judgement.verifier}`,
|
|
4905
4330
|
"",
|
|
4906
4331
|
"### Touched features",
|
|
4907
4332
|
...bullets(touched, "none"),
|
|
@@ -4969,7 +4394,7 @@ const USAGE = `Usage: antelopejs-verify <command>
|
|
|
4969
4394
|
run the named features, each whole, in that order;
|
|
4970
4395
|
--jobs runs up to n features at once, each in its own process,
|
|
4971
4396
|
at most half the cores, never with services
|
|
4972
|
-
formal <run> [--all] run the formal checks that cover the diff and
|
|
4397
|
+
formal <run> [--all] run the formal checks that cover the diff and print HOLDS, VIOLATED or ERROR for each
|
|
4973
4398
|
doors [patch] [--base <ref>] print the One-way-door line for a patch, or for the diff
|
|
4974
4399
|
clean <run> stop what the run started, keep only the evidence
|
|
4975
4400
|
verdict <run> --pr <n> [--judgement <file>]
|
|
@@ -5104,19 +4529,14 @@ function jobsFor(workspace, runs, flags) {
|
|
|
5104
4529
|
}
|
|
5105
4530
|
function runFormal(workspace, dir, all) {
|
|
5106
4531
|
const state = loadRun(dir);
|
|
5107
|
-
const
|
|
5108
|
-
const touched = touchedFormalChecks(workspace, plan.changed);
|
|
4532
|
+
const touched = touchedFormalChecks(workspace, planFor(workspace, state.baseRef).changed);
|
|
5109
4533
|
const checks = all ? workspace.config.formal ?? [] : touched;
|
|
5110
4534
|
let fails = false;
|
|
5111
4535
|
for (const check of checks) {
|
|
4536
|
+
const { status, outcome } = formalOutcome(runFormalCheck(workspace, state, check));
|
|
5112
4537
|
const gates = touched.includes(check);
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
headSha: plan.headSha,
|
|
5116
|
-
changed: plan.changed
|
|
5117
|
-
} : null));
|
|
5118
|
-
fails ||= gates && weight.fails;
|
|
5119
|
-
print(`${gates ? weight.fails ? "FAIL" : "PASS" : "INFO"} ${check.name}: ${weight.outcome}`);
|
|
4538
|
+
fails ||= gates && status !== "HOLDS";
|
|
4539
|
+
print(`${status} ${check.name}: ${outcome}${gates ? "" : ", informational: does not cover the diff"}`);
|
|
5120
4540
|
}
|
|
5121
4541
|
if (checks.length === 0) print("no formal check covers the diff");
|
|
5122
4542
|
return fails ? 1 : 0;
|