@milkenjoyer/toolchain 0.12.0 → 0.14.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 +115 -6
- package/dist/arithmetic.d.mts +45 -0
- package/dist/arithmetic.mjs +25 -0
- package/dist/formal.mjs +369 -273
- package/dist/guard.d.mts +2 -2
- package/dist/guard.mjs +1 -46
- package/dist/knip.mjs +2 -1
- package/dist/manifest-xQwgnYI1.mjs +53 -0
- package/dist/specs-file-NsQF4V7X.mjs +135 -0
- package/dist/standard.d.mts +2 -0
- package/dist/standard.mjs +398 -0
- package/package.json +10 -2
- package/src/formal/arithmetic.ts +190 -0
- package/src/formal/checks.ts +19 -1
- package/src/formal/critical.ts +48 -0
- package/src/formal/proof-run.ts +77 -0
- package/src/formal/proofs.ts +2 -36
- package/src/formal/prover.ts +291 -0
- package/src/formal/specs-file.ts +119 -0
- package/src/formal/specs.ts +3 -87
- package/src/formal/tla.ts +36 -17
- package/src/formal/z3.ts +321 -0
- package/src/formal.ts +1 -1
- package/src/standard/agents.ts +44 -0
- package/src/standard/checks.ts +19 -0
- package/src/standard/config.ts +110 -0
- package/src/standard/formal.ts +93 -0
- package/src/standard/manifest.ts +102 -0
- package/src/standard/plugin-skills.ts +88 -0
- package/src/standard/repo.ts +69 -0
- package/src/standard/toolchain.ts +90 -0
- package/src/standard.ts +71 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkenjoyer/toolchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/birbprophet/agent-kit.git",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"formal": "./src/formal.ts",
|
|
11
11
|
"proof": "./src/proof.ts",
|
|
12
|
+
"standard": "./src/standard.ts",
|
|
12
13
|
"verdict": "./src/verdict.ts",
|
|
13
14
|
"verification": "./src/verification.ts"
|
|
14
15
|
},
|
|
@@ -20,6 +21,8 @@
|
|
|
20
21
|
"src/formal.ts",
|
|
21
22
|
"src/formal/",
|
|
22
23
|
"src/proof.ts",
|
|
24
|
+
"src/standard.ts",
|
|
25
|
+
"src/standard/",
|
|
23
26
|
"src/verdict.ts",
|
|
24
27
|
"src/verification.ts",
|
|
25
28
|
"tsconfig.base.json",
|
|
@@ -28,6 +31,10 @@
|
|
|
28
31
|
],
|
|
29
32
|
"type": "module",
|
|
30
33
|
"exports": {
|
|
34
|
+
"./arithmetic": {
|
|
35
|
+
"types": "./dist/arithmetic.d.mts",
|
|
36
|
+
"default": "./dist/arithmetic.mjs"
|
|
37
|
+
},
|
|
31
38
|
".": {
|
|
32
39
|
"types": "./dist/index.d.mts",
|
|
33
40
|
"default": "./dist/index.mjs"
|
|
@@ -108,7 +115,8 @@
|
|
|
108
115
|
"effect": "4.1.2",
|
|
109
116
|
"effect-oxlint": "0.4.0",
|
|
110
117
|
"semver": "7.8.6",
|
|
111
|
-
"ultracite": "8.1.1"
|
|
118
|
+
"ultracite": "8.1.1",
|
|
119
|
+
"z3-solver": "5.3.3"
|
|
112
120
|
},
|
|
113
121
|
"devDependencies": {
|
|
114
122
|
"@birbprophet/test-kit": "0.0.0",
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
import * as Console from "effect/Console";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { FileSystem } from "effect/FileSystem";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import { ChildProcess } from "effect/process";
|
|
9
|
+
import * as Result from "effect/Result";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Stream from "effect/Stream";
|
|
12
|
+
|
|
13
|
+
import type { Check } from "./checks.ts";
|
|
14
|
+
import { describe, Result as ProofResult } from "./proof-run.ts";
|
|
15
|
+
import { Request } from "./proof-run.ts";
|
|
16
|
+
import { FormalError } from "./tla.ts";
|
|
17
|
+
|
|
18
|
+
const matches = (glob: string, file: string) => new Bun.Glob(glob).match(file);
|
|
19
|
+
const moduleFile = /\.(?:[cm]?[jt]s|[jt]sx)$/u;
|
|
20
|
+
export const arithmetic: Check = (repo) =>
|
|
21
|
+
Effect.gen(function* () {
|
|
22
|
+
if (repo.file.arithmetic === undefined) {
|
|
23
|
+
yield* Console.log(
|
|
24
|
+
"arithmetic: specs.json lists no arithmetic globs; rule 16 is off"
|
|
25
|
+
);
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return repo.file.arithmetic.flatMap((glob) => {
|
|
29
|
+
const files = repo.tracked.filter((f) => matches(glob, f));
|
|
30
|
+
return files.length === 0
|
|
31
|
+
? [
|
|
32
|
+
{
|
|
33
|
+
file: "specs.json",
|
|
34
|
+
message: `arithmetic glob ${glob} matches no tracked file`,
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
: files
|
|
38
|
+
.filter(
|
|
39
|
+
(f) =>
|
|
40
|
+
!Object.values({ ...repo.file.proofs, ...repo.file.kani }).some(
|
|
41
|
+
(e) => e.covers.some((g) => matches(g, f))
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
.map((file) => ({
|
|
45
|
+
file,
|
|
46
|
+
message: `matches arithmetic glob ${glob} but no proof covers it`,
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const run = Effect.fn("formal.proof.run")(function* (request: Request) {
|
|
51
|
+
const fs = yield* FileSystem;
|
|
52
|
+
const child = yield* Effect.scoped(
|
|
53
|
+
Effect.gen(function* () {
|
|
54
|
+
const p = yield* ChildProcess.make(
|
|
55
|
+
"bun",
|
|
56
|
+
[fileURLToPath(new URL("./prover.ts", import.meta.url))],
|
|
57
|
+
{
|
|
58
|
+
cwd: request.root,
|
|
59
|
+
env: {
|
|
60
|
+
FORMAL_PROOF: yield* Schema.encodeEffect(
|
|
61
|
+
Schema.fromJsonString(Request)
|
|
62
|
+
)(request),
|
|
63
|
+
},
|
|
64
|
+
extendEnv: true,
|
|
65
|
+
stdin: "ignore",
|
|
66
|
+
killSignal: "SIGKILL",
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
return yield* Effect.all(
|
|
70
|
+
[
|
|
71
|
+
p.stdout.pipe(Stream.decodeText, Stream.mkString),
|
|
72
|
+
p.stderr.pipe(Stream.decodeText, Stream.mkString),
|
|
73
|
+
p.exitCode,
|
|
74
|
+
],
|
|
75
|
+
{ concurrency: "unbounded" }
|
|
76
|
+
);
|
|
77
|
+
}).pipe(Effect.timeoutOption(`${request.timeoutSeconds + 30} seconds`))
|
|
78
|
+
);
|
|
79
|
+
if (Option.isNone(child))
|
|
80
|
+
return `timed out after ${request.timeoutSeconds + 30} s`;
|
|
81
|
+
if (!(yield* fs.exists(request.result)))
|
|
82
|
+
return `the proof exited ${child.value[2]} without a result: ${child.value[1].trim().split("\n").at(-1) ?? ""}`;
|
|
83
|
+
const result = Schema.decodeResult(Schema.fromJsonString(ProofResult))(
|
|
84
|
+
yield* fs.readFileString(request.result),
|
|
85
|
+
{ onExcessProperty: "error" }
|
|
86
|
+
);
|
|
87
|
+
return Result.isSuccess(result)
|
|
88
|
+
? result.success
|
|
89
|
+
: "the proof wrote a malformed result";
|
|
90
|
+
});
|
|
91
|
+
export const proofs: Check = (repo) =>
|
|
92
|
+
Effect.scoped(
|
|
93
|
+
Effect.gen(function* () {
|
|
94
|
+
const fs = yield* FileSystem;
|
|
95
|
+
const dir = yield* fs.makeTempDirectoryScoped({
|
|
96
|
+
prefix: "formal-proofs-",
|
|
97
|
+
});
|
|
98
|
+
const problems: { file: string; message: string }[] = [];
|
|
99
|
+
let index = 0;
|
|
100
|
+
for (const [file, entry] of Object.entries(repo.file.proofs).toSorted(
|
|
101
|
+
([a], [b]) => a.localeCompare(b)
|
|
102
|
+
)) {
|
|
103
|
+
if (!repo.tracked.includes(file)) continue;
|
|
104
|
+
const add = (message: string) => problems.push({ file, message });
|
|
105
|
+
const covered = repo.tracked.filter((f) =>
|
|
106
|
+
entry.covers.some((g) => matches(g, f))
|
|
107
|
+
);
|
|
108
|
+
const before = problems.length;
|
|
109
|
+
for (const [i, edit] of entry.breaks.entries()) {
|
|
110
|
+
if (!covered.includes(edit.file)) {
|
|
111
|
+
add(`break ${i + 1}: ${edit.file} is not in this proof's covers`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const count =
|
|
115
|
+
(yield* fs.readFileString(join(repo.root, edit.file))).split(
|
|
116
|
+
edit.find
|
|
117
|
+
).length - 1;
|
|
118
|
+
if (count !== 1)
|
|
119
|
+
add(`break ${i + 1} find matches ${count} times in ${edit.file}`);
|
|
120
|
+
}
|
|
121
|
+
if (problems.length !== before) continue;
|
|
122
|
+
const covers = yield* Effect.forEach(
|
|
123
|
+
covered,
|
|
124
|
+
(f) => fs.realPath(join(repo.root, f)),
|
|
125
|
+
{ concurrency: 1 }
|
|
126
|
+
);
|
|
127
|
+
const request = {
|
|
128
|
+
root: repo.root,
|
|
129
|
+
proof: join(repo.root, file),
|
|
130
|
+
kind: entry.kind,
|
|
131
|
+
covers,
|
|
132
|
+
samples: entry.kind === "z3" ? entry.samples : 0,
|
|
133
|
+
timeoutSeconds: entry.timeoutSeconds,
|
|
134
|
+
result: join(dir, `${index++}.json`),
|
|
135
|
+
} satisfies Request;
|
|
136
|
+
const baseline = yield* run(request);
|
|
137
|
+
if (typeof baseline === "string") {
|
|
138
|
+
add(baseline);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (baseline.outcome._tag !== "Proved") {
|
|
142
|
+
add(describe(baseline.outcome));
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
covered.forEach((f, i) => {
|
|
146
|
+
if (moduleFile.test(f) && !baseline.loaded.includes(covers[i] ?? ""))
|
|
147
|
+
add(
|
|
148
|
+
`covers ${f} but never loads it; a proof covers only code it runs`
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
if (problems.length !== before) continue;
|
|
152
|
+
yield* Console.log(
|
|
153
|
+
`proofs: ${file}: ${baseline.outcome.detail} in ${baseline.outcome.seconds.toFixed(2)} s`
|
|
154
|
+
);
|
|
155
|
+
for (const [i, edit] of entry.breaks.entries()) {
|
|
156
|
+
const absolute = yield* fs.realPath(join(repo.root, edit.file));
|
|
157
|
+
const broken = yield* run({
|
|
158
|
+
...request,
|
|
159
|
+
result: join(dir, `${index++}.json`),
|
|
160
|
+
edit: { ...edit, file: absolute },
|
|
161
|
+
});
|
|
162
|
+
if (typeof broken === "string")
|
|
163
|
+
add(
|
|
164
|
+
`break ${i + 1} (${edit.file}): ${broken}; a break counts only as a counterexample, a mismatch or a throw`
|
|
165
|
+
);
|
|
166
|
+
else if (!broken.loaded.includes(absolute))
|
|
167
|
+
add(`break ${i + 1}: the proof never loads ${edit.file}`);
|
|
168
|
+
else if (broken.outcome._tag === "Proved")
|
|
169
|
+
add(
|
|
170
|
+
`break ${i + 1} (${edit.file}): the proof still holds after the edit`
|
|
171
|
+
);
|
|
172
|
+
else if (
|
|
173
|
+
["Counterexample", "Disagrees", "Throws"].includes(
|
|
174
|
+
broken.outcome._tag
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
yield* Console.log(
|
|
178
|
+
`proofs: ${file}: break ${i + 1} ${broken.outcome._tag}`
|
|
179
|
+
);
|
|
180
|
+
else
|
|
181
|
+
add(
|
|
182
|
+
`break ${i + 1} (${edit.file}): ${describe(broken.outcome)}; a break counts only as a counterexample, a mismatch or a throw`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return problems;
|
|
187
|
+
})
|
|
188
|
+
).pipe(
|
|
189
|
+
Effect.mapError((cause) => new FormalError({ message: String(cause) }))
|
|
190
|
+
);
|
package/src/formal/checks.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as Effect from "effect/Effect";
|
|
|
3
3
|
import { FileSystem } from "effect/FileSystem";
|
|
4
4
|
import { ChildProcessSpawner } from "effect/process";
|
|
5
5
|
|
|
6
|
+
import { arithmetic, proofs } from "./arithmetic.ts";
|
|
6
7
|
import { integer } from "./cfg.ts";
|
|
7
8
|
import { Gate } from "./gate.ts";
|
|
8
9
|
import {
|
|
@@ -50,7 +51,22 @@ const specs: Check = (repo) =>
|
|
|
50
51
|
"_tag" in c.cfg ? [{ file: c.path, message: c.cfg.message }] : []
|
|
51
52
|
),
|
|
52
53
|
]),
|
|
53
|
-
...
|
|
54
|
+
...repo.tracked
|
|
55
|
+
.filter(
|
|
56
|
+
(f) =>
|
|
57
|
+
f.endsWith(".proof.ts") &&
|
|
58
|
+
!repo.file.proofs[f] &&
|
|
59
|
+
repo.decodeErrors.length === 0
|
|
60
|
+
)
|
|
61
|
+
.map((file) => ({
|
|
62
|
+
file,
|
|
63
|
+
message: "tracked proof has no specs.json entry",
|
|
64
|
+
})),
|
|
65
|
+
...Object.keys({
|
|
66
|
+
...repo.file.specs,
|
|
67
|
+
...repo.file.kani,
|
|
68
|
+
...repo.file.proofs,
|
|
69
|
+
})
|
|
54
70
|
.filter((f) => !repo.tracked.includes(f))
|
|
55
71
|
.map((file) => ({ file, message: "entry names no tracked file" })),
|
|
56
72
|
...repo.orphans.map((file) => ({
|
|
@@ -176,6 +192,7 @@ const tlc: Check = (repo) =>
|
|
|
176
192
|
export const checks = {
|
|
177
193
|
specs,
|
|
178
194
|
critical,
|
|
195
|
+
arithmetic,
|
|
179
196
|
sany,
|
|
180
197
|
typeok,
|
|
181
198
|
deadlock,
|
|
@@ -187,4 +204,5 @@ export const checks = {
|
|
|
187
204
|
witnesses,
|
|
188
205
|
breaks,
|
|
189
206
|
traces,
|
|
207
|
+
proofs,
|
|
190
208
|
} satisfies Record<string, Check>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SpecsFile } from "./specs-file.ts";
|
|
2
|
+
const matches = (glob: string, file: string) => new Bun.Glob(glob).match(file);
|
|
3
|
+
export const criticalFindings = (repo: {
|
|
4
|
+
readonly tracked: ReadonlyArray<string>;
|
|
5
|
+
readonly file: SpecsFile;
|
|
6
|
+
}) => [
|
|
7
|
+
...repo.file.critical.flatMap((glob) =>
|
|
8
|
+
repo.tracked.some((f) => matches(glob, f))
|
|
9
|
+
? []
|
|
10
|
+
: [
|
|
11
|
+
{
|
|
12
|
+
file: "specs.json",
|
|
13
|
+
message: `critical glob ${glob} matches no tracked file`,
|
|
14
|
+
},
|
|
15
|
+
]
|
|
16
|
+
),
|
|
17
|
+
...Object.entries({
|
|
18
|
+
...repo.file.specs,
|
|
19
|
+
...repo.file.kani,
|
|
20
|
+
...repo.file.proofs,
|
|
21
|
+
}).flatMap(([file, e]) =>
|
|
22
|
+
e.covers.flatMap((glob) =>
|
|
23
|
+
repo.tracked.some((f) => matches(glob, f))
|
|
24
|
+
? []
|
|
25
|
+
: [{ file, message: `covers glob ${glob} matches no tracked file` }]
|
|
26
|
+
)
|
|
27
|
+
),
|
|
28
|
+
...repo.tracked.flatMap((file) => {
|
|
29
|
+
const glob = repo.file.critical.find((g) => matches(g, file));
|
|
30
|
+
return glob !== undefined &&
|
|
31
|
+
!Object.values({
|
|
32
|
+
...repo.file.specs,
|
|
33
|
+
...repo.file.kani,
|
|
34
|
+
...repo.file.proofs,
|
|
35
|
+
}).some(
|
|
36
|
+
(e) =>
|
|
37
|
+
(!("mode" in e) || e.mode !== "library") &&
|
|
38
|
+
e.covers.some((g) => matches(g, file))
|
|
39
|
+
)
|
|
40
|
+
? [
|
|
41
|
+
{
|
|
42
|
+
file,
|
|
43
|
+
message: `matches critical glob ${glob} but no spec covers it`,
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
: [];
|
|
47
|
+
}),
|
|
48
|
+
];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
|
|
3
|
+
const Edit = Schema.Struct({
|
|
4
|
+
file: Schema.String,
|
|
5
|
+
find: Schema.NonEmptyString,
|
|
6
|
+
replace: Schema.String,
|
|
7
|
+
});
|
|
8
|
+
export const Request = Schema.Struct({
|
|
9
|
+
root: Schema.String,
|
|
10
|
+
proof: Schema.String,
|
|
11
|
+
kind: Schema.Literals(["every", "z3"]),
|
|
12
|
+
covers: Schema.Array(Schema.String),
|
|
13
|
+
samples: Schema.Int,
|
|
14
|
+
timeoutSeconds: Schema.Int,
|
|
15
|
+
edit: Schema.optionalKey(Edit),
|
|
16
|
+
result: Schema.String,
|
|
17
|
+
});
|
|
18
|
+
export type Request = typeof Request.Type;
|
|
19
|
+
const At = Schema.Record(Schema.String, Schema.Number);
|
|
20
|
+
export const Outcome = Schema.Union([
|
|
21
|
+
Schema.TaggedStruct("Proved", {
|
|
22
|
+
detail: Schema.String,
|
|
23
|
+
seconds: Schema.Number,
|
|
24
|
+
}),
|
|
25
|
+
Schema.TaggedStruct("Counterexample", { at: At }),
|
|
26
|
+
Schema.TaggedStruct("Disagrees", {
|
|
27
|
+
at: At,
|
|
28
|
+
code: Schema.Unknown,
|
|
29
|
+
model: Schema.Unknown,
|
|
30
|
+
}),
|
|
31
|
+
Schema.TaggedStruct("Throws", { at: At, message: Schema.String }),
|
|
32
|
+
Schema.TaggedStruct("Unknown", {
|
|
33
|
+
reason: Schema.String,
|
|
34
|
+
seconds: Schema.Number,
|
|
35
|
+
}),
|
|
36
|
+
Schema.TaggedStruct("Invalid", { message: Schema.String }),
|
|
37
|
+
]);
|
|
38
|
+
export type Outcome = typeof Outcome.Type;
|
|
39
|
+
export const Result = Schema.Struct({
|
|
40
|
+
loaded: Schema.Array(Schema.String),
|
|
41
|
+
outcome: Outcome,
|
|
42
|
+
});
|
|
43
|
+
export type Result = typeof Result.Type;
|
|
44
|
+
export type Domain = {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly min: number;
|
|
47
|
+
readonly max: number;
|
|
48
|
+
} & (
|
|
49
|
+
| { readonly kind: "int" }
|
|
50
|
+
| { readonly kind: "uint"; readonly bits: number }
|
|
51
|
+
);
|
|
52
|
+
export const invalid = (message: string): Outcome => ({
|
|
53
|
+
_tag: "Invalid",
|
|
54
|
+
message,
|
|
55
|
+
});
|
|
56
|
+
export const message = (error: unknown) =>
|
|
57
|
+
error instanceof Error ? error.message : String(error);
|
|
58
|
+
export const describe = (outcome: Outcome): string => {
|
|
59
|
+
switch (outcome._tag) {
|
|
60
|
+
case "Proved":
|
|
61
|
+
return outcome.detail;
|
|
62
|
+
case "Counterexample":
|
|
63
|
+
return `counterexample at ${JSON.stringify(outcome.at)}`;
|
|
64
|
+
case "Disagrees":
|
|
65
|
+
return `code and model disagree at ${JSON.stringify(outcome.at)}: code ${JSON.stringify(outcome.code)}, model ${JSON.stringify(outcome.model)}`;
|
|
66
|
+
case "Throws":
|
|
67
|
+
return `throws at ${JSON.stringify(outcome.at)}: ${outcome.message}`;
|
|
68
|
+
case "Unknown":
|
|
69
|
+
return `z3 returned unknown: ${outcome.reason}`;
|
|
70
|
+
case "Invalid":
|
|
71
|
+
return outcome.message;
|
|
72
|
+
default: {
|
|
73
|
+
const exhaustive: never = outcome;
|
|
74
|
+
return exhaustive;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
package/src/formal/proofs.ts
CHANGED
|
@@ -5,46 +5,12 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import { FileSystem } from "effect/FileSystem";
|
|
6
6
|
|
|
7
7
|
import type { Check } from "./checks.ts";
|
|
8
|
+
import { criticalFindings } from "./critical.ts";
|
|
8
9
|
import { Gate } from "./gate.ts";
|
|
9
10
|
import { changes } from "./git.ts";
|
|
10
11
|
import { FormalError } from "./tla.ts";
|
|
11
12
|
import { held, violate } from "./violations.ts";
|
|
12
|
-
const
|
|
13
|
-
export const critical: Check = (repo) =>
|
|
14
|
-
Effect.succeed([
|
|
15
|
-
...repo.file.critical.flatMap((glob) =>
|
|
16
|
-
repo.tracked.some((f) => matches(glob, f))
|
|
17
|
-
? []
|
|
18
|
-
: [
|
|
19
|
-
{
|
|
20
|
-
file: "specs.json",
|
|
21
|
-
message: `critical glob ${glob} matches no tracked file`,
|
|
22
|
-
},
|
|
23
|
-
]
|
|
24
|
-
),
|
|
25
|
-
...Object.entries({ ...repo.file.specs, ...repo.file.kani }).flatMap(
|
|
26
|
-
([file, e]) =>
|
|
27
|
-
e.covers.flatMap((glob) =>
|
|
28
|
-
repo.tracked.some((f) => matches(glob, f))
|
|
29
|
-
? []
|
|
30
|
-
: [{ file, message: `covers glob ${glob} matches no tracked file` }]
|
|
31
|
-
)
|
|
32
|
-
),
|
|
33
|
-
...repo.tracked.flatMap((file) => {
|
|
34
|
-
const glob = repo.file.critical.find((g) => matches(g, file));
|
|
35
|
-
return glob !== undefined &&
|
|
36
|
-
!Object.values({ ...repo.file.specs, ...repo.file.kani }).some(
|
|
37
|
-
(e) => e.mode !== "library" && e.covers.some((g) => matches(g, file))
|
|
38
|
-
)
|
|
39
|
-
? [
|
|
40
|
-
{
|
|
41
|
-
file,
|
|
42
|
-
message: `matches critical glob ${glob} but no spec covers it`,
|
|
43
|
-
},
|
|
44
|
-
]
|
|
45
|
-
: [];
|
|
46
|
-
}),
|
|
47
|
-
]);
|
|
13
|
+
export const critical: Check = (repo) => Effect.succeed(criticalFindings(repo));
|
|
48
14
|
export const fairness: Check = (repo) =>
|
|
49
15
|
Effect.succeed(
|
|
50
16
|
repo.specs.flatMap((s) =>
|