@milkenjoyer/toolchain 0.11.0 → 0.12.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 +98 -14
- package/dist/conformance.d.mts +18 -0
- package/dist/conformance.mjs +31 -0
- package/dist/effect-plugin.mjs +1 -1
- package/dist/exceptions-Dybl9xpc.mjs +11 -0
- package/dist/exceptions.mjs +1 -1
- package/dist/foldkit-plugin.mjs +1 -1
- package/dist/formal.d.mts +131 -3
- package/dist/formal.mjs +716 -65
- package/dist/guard.mjs +2 -2
- package/dist/{lint-JSnPsGO1.mjs → lint-IhmtnBbx.mjs} +3 -3
- package/dist/lint.mjs +1 -1
- package/dist/plugin.mjs +1 -1
- package/dist/proof.mjs +1 -1
- package/dist/trace-file-KuPRWgwt.mjs +17 -0
- package/dist/verdict.d.mts +1 -1
- package/dist/verdict.mjs +1 -1
- package/dist/{verification-p2rSx5lc.d.mts → verification-FgQFU1YN.d.mts} +1 -1
- package/dist/verification.d.mts +1 -1
- package/dist/verification.mjs +1 -1
- package/package.json +6 -2
- package/src/formal/cfg.ts +58 -1
- package/src/formal/checks.ts +39 -52
- package/src/formal/coverage.ts +79 -0
- package/src/formal/gate.ts +74 -0
- package/src/formal/git.ts +38 -0
- package/src/formal/proofs.ts +217 -0
- package/src/formal/semantics.ts +110 -0
- package/src/formal/specs.ts +80 -34
- package/src/formal/tla.ts +24 -2
- package/src/formal/trace-file.ts +35 -0
- package/src/formal/traces.ts +293 -0
- package/src/formal/violations.ts +76 -0
- package/src/formal.ts +9 -2
- package/dist/exceptions-Bq-9MxoR.mjs +0 -3
- package/dist/{effect-plugin-kYxB-5LJ.mjs → effect-plugin-BXUx9PPu.mjs} +1 -1
- package/dist/{plugin-BoBRGtGf.mjs → plugin-CwxhPtui.mjs} +1 -1
- package/dist/{verification-6s2chr4X.mjs → verification-oAc1Q6I9.mjs} +1 -1
package/README.md
CHANGED
|
@@ -46,33 +46,117 @@ In the PR job, set `permissions: contents: read` and `GH_TOKEN: ${{ github.token
|
|
|
46
46
|
|
|
47
47
|
## Formal check
|
|
48
48
|
|
|
49
|
-
`vp exec formal` checks every TLA+
|
|
49
|
+
`vp exec formal` checks every tracked TLA+ module against the standard in agent-kit#276. Run it from anywhere in the repository with no arguments. It exits 0 when every check passes. Each finding goes to stderr as `<file>: <check>: <message>`, sorted by file and then by check order, and the command exits 1. Each passing step logs one line to stdout.
|
|
50
50
|
|
|
51
51
|
It needs Java 17 on `PATH`. In CI, add `actions/setup-java` with `distribution: temurin` and `java-version: "17"` before the step that runs it. The first run downloads TLC 1.8.0 (`tla2tools-1.8.0.jar`) and CommunityModules 202611060952 (`CommunityModules-deps-202611060952.jar`) into `$XDG_CACHE_HOME/tla`, or `~/.cache/tla`. Every run checks both jars against their pinned SHA-256 digests. A cached jar with the wrong digest stops the run, and deleting it makes the next run fetch it again.
|
|
52
52
|
|
|
53
|
-
`specs.json`
|
|
53
|
+
### `specs.json`
|
|
54
|
+
|
|
55
|
+
The root `specs.json` is decoded strictly, so an unknown key fails.
|
|
54
56
|
|
|
55
57
|
```json
|
|
56
58
|
{
|
|
57
|
-
"apps/indexer/
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
"critical": ["apps/indexer/src/pass.ts"],
|
|
60
|
+
"specs": {
|
|
61
|
+
"apps/indexer/formal/IndexerPass.tla": {
|
|
62
|
+
"synced": "<40-hex commit>",
|
|
63
|
+
"covers": ["apps/indexer/src/pass.ts"],
|
|
64
|
+
"mode": "gate",
|
|
65
|
+
"timeoutSeconds": 120,
|
|
66
|
+
"witnesses": ["NoCommitLands"],
|
|
67
|
+
"breaks": [
|
|
68
|
+
{
|
|
69
|
+
"violates": "TypeOK",
|
|
70
|
+
"find": "cursorSlot' = c.upTo",
|
|
71
|
+
"replace": "cursorSlot' = -1"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"violates": "NoDuplicate",
|
|
75
|
+
"find": "applied \\o c.batch",
|
|
76
|
+
"replace": "applied \\o c.batch \\o c.batch"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"traces": {
|
|
80
|
+
"seed": 7,
|
|
81
|
+
"depth": 100,
|
|
82
|
+
"count": 500,
|
|
83
|
+
"steer": { "Crash": 8 },
|
|
84
|
+
"conformance": "apps/indexer/formal/indexer-pass.conformance.test.ts"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"apps/house/formal/Rounds.tla": {
|
|
88
|
+
"synced": "<40-hex commit>",
|
|
89
|
+
"covers": ["apps/house/src/rounds.ts"],
|
|
90
|
+
"mode": "library"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"kani": {
|
|
94
|
+
"apps/house/core/src/legs.rs": {
|
|
95
|
+
"synced": "<40-hex commit>",
|
|
96
|
+
"covers": ["apps/house/core/src/legs.rs"],
|
|
97
|
+
"mode": "manual",
|
|
98
|
+
"timeoutSeconds": 300
|
|
99
|
+
}
|
|
62
100
|
}
|
|
63
101
|
}
|
|
64
102
|
```
|
|
65
103
|
|
|
66
|
-
`
|
|
104
|
+
- `critical` lists globs for the repo's money, auth, concurrency, retry, lifecycle and protocol code. Each one must match a tracked file, and every tracked file it matches must match the `covers` of some gate, manual or Kani entry.
|
|
105
|
+
- `specs` maps each tracked `.tla` path to its entry. `covers` is a non-empty list of globs, each matching a tracked file. `synced` is a 40-hex commit.
|
|
106
|
+
- `mode` is `gate`, `manual` or `library`.
|
|
107
|
+
- A `gate` or `manual` spec `X.tla` has exactly one config, `X.cfg`, beside it. It names at least one witness and one break for every `INVARIANT` and `PROPERTY` in `X.cfg`, `TypeOK` included. Only a gate spec runs TLC.
|
|
108
|
+
- A `library` module has no config and no witnesses, breaks or traces. Other specs extend it.
|
|
109
|
+
- Any other config, such as `X.fast.cfg`, fails. Give a variant its own module that `EXTENDS X`.
|
|
110
|
+
- `timeoutSeconds` defaults to 60 and allows up to 1800. It bounds each TLC run and the conformance run.
|
|
111
|
+
- `witnesses` lists operators that must be violated: a state or behavior the spec claims to reach.
|
|
112
|
+
- Each break is `{ violates, find, replace, file? }`. `file` defaults to the spec and may name a tracked `.tla` in the spec's directory or the spec's `X.cfg`.
|
|
113
|
+
- `traces` is optional on a gate spec. `steer` maps an action to n (2 to 1000) and keeps a step by that action with probability 1/n, so runs reach rare paths. A second constant set needs a second module.
|
|
114
|
+
- `kani` maps each tracked `.rs` harness to `synced`, `covers`, `mode` (`gate` or `manual`) and `timeoutSeconds`. The command doesn't run Kani, but its `covers` count for `critical`.
|
|
115
|
+
|
|
116
|
+
### Checks
|
|
67
117
|
|
|
68
|
-
The checks:
|
|
118
|
+
The checks run in this order:
|
|
69
119
|
|
|
70
|
-
- `specs`: every tracked `.tla` has an entry, every
|
|
120
|
+
- `specs`: `specs.json` decodes, every tracked `.tla` has an entry, every entry names a tracked file, and the configs follow the one-config layout.
|
|
121
|
+
- `critical`: every `critical` and `covers` glob matches a tracked file, and every tracked file a `critical` glob matches is covered.
|
|
71
122
|
- `sany`: SANY parses every `.tla` with no error and no warning.
|
|
72
|
-
- `typeok`: every config lists `TypeOK` under `INVARIANT`, and each module's `TypeOK` types every variable, including variables from modules it extends. A variable counts as typed when a conjunct of `TypeOK`, or of an operator without arguments that it names, reads `v \in S` or `v \subseteq S` and `S` doesn't mention `v`.
|
|
73
|
-
- `deadlock`: no config sets `CHECK_DEADLOCK FALSE`. Give a bounded spec an explicit finished step instead.
|
|
123
|
+
- `typeok`: every config lists `TypeOK` under `INVARIANT`, and each module's `TypeOK` types every variable, including variables from modules it extends. A variable counts as typed when a conjunct of `TypeOK`, or of an operator without arguments that it names, reads `v \in S` or `v \subseteq S` and `S` doesn't mention `v`.
|
|
124
|
+
- `deadlock`: no config sets `CHECK_DEADLOCK FALSE`. Give a bounded spec an explicit finished step instead.
|
|
125
|
+
- `fairness`: every `WF_` and `SF_` uses `vars` as its subscript.
|
|
74
126
|
- `constants`: no two integer constants in one config share a value.
|
|
75
127
|
- `format`: every `.tla` matches `formatter.Main`'s output byte for byte. The finding prints the command that rewrites the file.
|
|
76
|
-
- `tlc`: TLC runs each gate spec's `X.cfg` within its `timeoutSeconds`. Any TLC warning or error fails the run, and so do a nonzero exit, a missing success message
|
|
128
|
+
- `tlc`: TLC runs each gate spec's `X.cfg` once, with `-coverage` and `-lncheck final`, within its `timeoutSeconds`. Any TLC warning or error fails the run, and so do a nonzero exit, a missing success message, a zero distinct-state count and a missing or unreadable coverage report.
|
|
129
|
+
- `coverage`: the gate run enables every action, and every expression under the init predicate and the enabled actions runs at least once. The finding quotes the source that never runs.
|
|
130
|
+
- `witnesses`: each witness is a defined operator without arguments that isn't an action and that `X.cfg` doesn't already check. TLC checks it alone and must exit 12 or 13 with a violation. The config checks nothing else, so the violation is the witness's, even when TLC names an operator inside it.
|
|
131
|
+
- `breaks`: each break's `find` occurs exactly once in its file. TLC checks the edited copy with only `violates` checked and must report a violation.
|
|
132
|
+
- `traces`: the command generates the seeded traces and runs the conformance test.
|
|
133
|
+
|
|
134
|
+
When a gate run fails, its spec's `coverage`, `witnesses`, `breaks` and `traces` don't run; the `tlc` finding already fails the command.
|
|
135
|
+
|
|
136
|
+
Breaks run only for a gate spec that changed since the base. The base is `git merge-base $BASE HEAD`, with `BASE` defaulting to `origin/main`. A change to `specs.json` reruns every break. A change to any tracked `.tla` or `.cfg` in a spec's directory, or to a break's `file`, reruns that spec's breaks. Uncommitted edits count. When the base doesn't resolve, every break runs.
|
|
137
|
+
|
|
138
|
+
### Traces
|
|
139
|
+
|
|
140
|
+
For a gate spec with `traces`, the command runs TLC in simulation mode with `-simulate num=<count> -depth <depth> -seed <seed> -workers 1`. Each behavior is serialized with `IOUtils!Serialize` and `TLCExt!Trace`, once per behavior. The actions are the ones TLC reports in the gate's coverage, including quantified actions with arguments. The init and next operators come from `INIT` and `NEXT`, or from a `SPECIFICATION` that conjoins one named init predicate with one `[][Next]_vars`.
|
|
141
|
+
|
|
142
|
+
`TLCExt!Trace` drops each step whose state equals the one before it, such as a no-op retry, so a serialized behavior can hold fewer states than `TLCGet("level")`. The generated wrapper adds a counter that every action increments, so no step is dropped. The command then requires exactly `count` behaviors of exactly `depth` states, known actions with the right number of arguments, and exactly the spec's variables.
|
|
143
|
+
|
|
144
|
+
The conformance test replays the traces through `replayTraces`, which registers one test per trace. For each trace it calls your function once to start the real code, then drives that code one step at a time:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { replayTraces } from "@milkenjoyer/toolchain/conformance";
|
|
148
|
+
|
|
149
|
+
replayTraces("indexer pass", async (trace) => {
|
|
150
|
+
const pass = await startPass(trace.constants);
|
|
151
|
+
return {
|
|
152
|
+
step: (step) => pass.apply(step.action, step.args),
|
|
153
|
+
observe: () => ({ cursorSlot: pass.cursor(), applied: pass.applied() }),
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`step` runs each model step after the init state through the code. After the init state and after every step, `replayTraces` calls `observe` and compares what it returns with the model state on those variables. `observe` must return at least one of the spec's variables and nothing else, and every value must equal the model's.
|
|
159
|
+
|
|
160
|
+
A `Trace` has `index`, `constants` (the config's value constants, integers as numbers and other values as their config text) and `steps`. `steps[0]` is the init state. Each step has `action`, `args` (the action's arguments by parameter name) and `state` (every variable). The same seed gives byte-identical traces, and the passing log line prints their SHA-256.
|
|
77
161
|
|
|
78
|
-
|
|
162
|
+
The command runs `vp test run` on the conformance file from the package that holds it (the nearest directory with a tracked `package.json`), with `FORMAL_TRACES` set to the trace file. The file must match that package's vitest `include`. The conformance check passes only when vitest exits 0 and `replayTraces` reports that every trace replayed to its last step. Under a plain `vp test`, `FORMAL_TRACES` is unset and `replayTraces` registers one skipped test.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
declare const Trace: Schema.Struct<{
|
|
3
|
+
readonly index: Schema.Int;
|
|
4
|
+
readonly constants: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
5
|
+
readonly steps: Schema.NonEmptyArray<Schema.Struct<{
|
|
6
|
+
readonly action: Schema.NonEmptyString;
|
|
7
|
+
readonly args: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
8
|
+
readonly state: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
9
|
+
}>>;
|
|
10
|
+
}>;
|
|
11
|
+
type Trace = typeof Trace.Type;
|
|
12
|
+
type Step = Trace["steps"][number];
|
|
13
|
+
export type Replay = {
|
|
14
|
+
readonly step: (step: Step) => void | Promise<void>;
|
|
15
|
+
readonly observe: () => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
|
|
16
|
+
};
|
|
17
|
+
export declare const replayTraces: (name: string, start: (trace: Trace) => Replay | Promise<Replay>) => void;
|
|
18
|
+
export type { Trace };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { n as readTraces, r as receiptPath, t as FORMAL_TRACES } from "./trace-file-KuPRWgwt.mjs";
|
|
2
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import * as Config from "effect/Config";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { afterAll, expect, test } from "vite-plus/test";
|
|
6
|
+
// src/conformance.ts
|
|
7
|
+
const replayTraces = (name, start) => {
|
|
8
|
+
const file = Effect.runSync(Config.String(FORMAL_TRACES).pipe(Config.withDefault("")));
|
|
9
|
+
if (file === "") {
|
|
10
|
+
test.skip(`${name}: run vp exec formal to replay traces`, () => {});
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const traces = readTraces(readFileSync(file, "utf8"));
|
|
14
|
+
let passed = 0;
|
|
15
|
+
for (const trace of traces) test(`${name} #${trace.index}`, async () => {
|
|
16
|
+
const replay = await start(trace);
|
|
17
|
+
for (const [index, step] of trace.steps.entries()) {
|
|
18
|
+
if (index > 0) await replay.step(step);
|
|
19
|
+
const observed = await replay.observe();
|
|
20
|
+
const keys = Object.keys(observed);
|
|
21
|
+
expect(keys, `step ${index} observes no model variable`).not.toEqual([]);
|
|
22
|
+
expect(keys.filter((key) => !Object.hasOwn(step.state, key)), `step ${index} observes variables the model doesn't have`).toEqual([]);
|
|
23
|
+
expect(observed, `step ${index} (${step.action}) differs from the model`).toEqual(Object.fromEntries(keys.map((key) => [key, step.state[key]])));
|
|
24
|
+
}
|
|
25
|
+
passed++;
|
|
26
|
+
});
|
|
27
|
+
afterAll(() => {
|
|
28
|
+
writeFileSync(receiptPath(file), String(passed));
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export { replayTraces };
|
package/dist/effect-plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "./effect-plugin-
|
|
1
|
+
export { t as default } from "./effect-plugin-BXUx9PPu.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/exceptions.ts
|
|
2
|
+
const exceptions = [{
|
|
3
|
+
files: ["packages/toolchain/src/conformance.ts"],
|
|
4
|
+
rules: [
|
|
5
|
+
"eslint/no-restricted-imports",
|
|
6
|
+
"vitest/no-disabled-tests",
|
|
7
|
+
"vitest/no-conditional-tests"
|
|
8
|
+
],
|
|
9
|
+
issue: "https://github.com/birbprophet/agent-kit/issues/278"
|
|
10
|
+
}];
|
|
11
|
+
export { exceptions as t };
|
package/dist/exceptions.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as exceptions } from "./exceptions-
|
|
1
|
+
export { t as exceptions } from "./exceptions-Dybl9xpc.mjs";
|
package/dist/foldkit-plugin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Arr from "effect/Array";
|
|
2
2
|
import * as R from "effect/Record";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import upstream from "@foldkit/oxlint-plugin";
|
|
8
8
|
// src/foldkit-plugin.ts
|
package/dist/formal.d.mts
CHANGED
|
@@ -1,14 +1,88 @@
|
|
|
1
|
-
import "effect/Schema";
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
3
4
|
import { ChildProcessSpawner } from "effect/process";
|
|
4
5
|
import { FileSystem } from "effect/FileSystem";
|
|
5
6
|
import * as Context from "effect/Context";
|
|
6
|
-
import * as Layer from "effect/Layer";
|
|
7
7
|
import { Path } from "effect/Path";
|
|
8
|
+
type CfgConstant = {
|
|
9
|
+
readonly _tag: "Value";
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly value: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly _tag: "Substitution";
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly by: string;
|
|
16
|
+
};
|
|
17
|
+
type Cfg = {
|
|
18
|
+
readonly constants: ReadonlyArray<CfgConstant>;
|
|
19
|
+
readonly sections: ReadonlyArray<{
|
|
20
|
+
readonly keyword: string;
|
|
21
|
+
readonly text: string;
|
|
22
|
+
}>;
|
|
23
|
+
readonly properties: ReadonlyArray<string>;
|
|
24
|
+
readonly invariants: ReadonlyArray<string>;
|
|
25
|
+
readonly checkDeadlock: ReadonlyArray<boolean>;
|
|
26
|
+
};
|
|
27
|
+
type Operator = {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly level: number;
|
|
30
|
+
readonly params: ReadonlyArray<{
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly arity: number;
|
|
33
|
+
}>;
|
|
34
|
+
readonly module: string;
|
|
35
|
+
};
|
|
8
36
|
type Semantics = {
|
|
37
|
+
readonly operators: ReadonlyMap<string, Operator>;
|
|
38
|
+
readonly fairness: ReadonlyArray<{
|
|
39
|
+
readonly kind: string;
|
|
40
|
+
readonly line: string;
|
|
41
|
+
readonly valid: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
readonly specifications: ReadonlyMap<string, {
|
|
44
|
+
readonly init: string;
|
|
45
|
+
readonly next: string;
|
|
46
|
+
}>;
|
|
9
47
|
readonly variables: ReadonlyArray<string>;
|
|
10
48
|
readonly typeOK: ReadonlySet<string> | undefined;
|
|
11
49
|
};
|
|
50
|
+
declare const Entry: Schema.Union<readonly [Schema.Struct<{
|
|
51
|
+
readonly synced: Schema.String;
|
|
52
|
+
readonly covers: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
53
|
+
readonly timeoutSeconds: Schema.withDecodingDefaultKey<Schema.Int, never>;
|
|
54
|
+
readonly witnesses: Schema.NonEmptyArray<Schema.String>;
|
|
55
|
+
readonly breaks: Schema.withDecodingDefaultKey<Schema.$Array<Schema.Struct<{
|
|
56
|
+
readonly violates: Schema.String;
|
|
57
|
+
readonly find: Schema.NonEmptyString;
|
|
58
|
+
readonly replace: Schema.String;
|
|
59
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
60
|
+
}>>, never>;
|
|
61
|
+
readonly mode: Schema.Literal<"gate">;
|
|
62
|
+
readonly traces: Schema.optionalKey<Schema.Struct<{
|
|
63
|
+
readonly seed: Schema.Int;
|
|
64
|
+
readonly depth: Schema.Int;
|
|
65
|
+
readonly count: Schema.Int;
|
|
66
|
+
readonly steer: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Int>>;
|
|
67
|
+
readonly conformance: Schema.String;
|
|
68
|
+
}>>;
|
|
69
|
+
}>, Schema.Struct<{
|
|
70
|
+
readonly synced: Schema.String;
|
|
71
|
+
readonly covers: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
72
|
+
readonly timeoutSeconds: Schema.withDecodingDefaultKey<Schema.Int, never>;
|
|
73
|
+
readonly witnesses: Schema.NonEmptyArray<Schema.String>;
|
|
74
|
+
readonly breaks: Schema.withDecodingDefaultKey<Schema.$Array<Schema.Struct<{
|
|
75
|
+
readonly violates: Schema.String;
|
|
76
|
+
readonly find: Schema.NonEmptyString;
|
|
77
|
+
readonly replace: Schema.String;
|
|
78
|
+
readonly file: Schema.optionalKey<Schema.String>;
|
|
79
|
+
}>>, never>;
|
|
80
|
+
readonly mode: Schema.Literal<"manual">;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly synced: Schema.String;
|
|
83
|
+
readonly covers: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
84
|
+
readonly mode: Schema.Literal<"library">;
|
|
85
|
+
}>]>;
|
|
12
86
|
type Analysis = {
|
|
13
87
|
readonly _tag: "Parsed";
|
|
14
88
|
readonly semantics: Semantics;
|
|
@@ -16,6 +90,18 @@ type Analysis = {
|
|
|
16
90
|
readonly _tag: "Unparsed";
|
|
17
91
|
readonly output: string;
|
|
18
92
|
};
|
|
93
|
+
type Model = {
|
|
94
|
+
readonly root: string;
|
|
95
|
+
readonly path: string;
|
|
96
|
+
readonly entry: Exclude<typeof Entry.Type, {
|
|
97
|
+
readonly mode: "library";
|
|
98
|
+
}>;
|
|
99
|
+
readonly semantics: Semantics;
|
|
100
|
+
readonly config: {
|
|
101
|
+
readonly path: string;
|
|
102
|
+
readonly cfg: Cfg;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
19
105
|
declare const FormalError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
20
106
|
readonly _tag: "FormalError";
|
|
21
107
|
} & Readonly<A>;
|
|
@@ -36,6 +122,15 @@ type TlcRun = {
|
|
|
36
122
|
readonly _tag: "TimedOut";
|
|
37
123
|
};
|
|
38
124
|
type TlcInput = {
|
|
125
|
+
readonly mode: {
|
|
126
|
+
readonly _tag: "Check";
|
|
127
|
+
readonly coverage: boolean;
|
|
128
|
+
} | {
|
|
129
|
+
readonly _tag: "Simulate";
|
|
130
|
+
readonly num: number;
|
|
131
|
+
readonly depth: number;
|
|
132
|
+
readonly seed: number;
|
|
133
|
+
};
|
|
39
134
|
readonly spec: string;
|
|
40
135
|
readonly config: string;
|
|
41
136
|
readonly timeoutSeconds: number;
|
|
@@ -56,5 +151,38 @@ declare const Tla_base: Context.ServiceClass<Tla, "formal/Tla", {
|
|
|
56
151
|
declare class Tla extends Tla_base {
|
|
57
152
|
static readonly layer: Layer.Layer<Tla, FormalError, ChildProcessSpawner.ChildProcessSpawner | FileSystem | Path>;
|
|
58
153
|
}
|
|
59
|
-
|
|
154
|
+
type Span = {
|
|
155
|
+
readonly module: string;
|
|
156
|
+
readonly line: number;
|
|
157
|
+
readonly col: number;
|
|
158
|
+
readonly endLine: number;
|
|
159
|
+
readonly endCol: number;
|
|
160
|
+
};
|
|
161
|
+
type Coverage = {
|
|
162
|
+
readonly actions: ReadonlyArray<{
|
|
163
|
+
readonly name: string;
|
|
164
|
+
readonly span: Span;
|
|
165
|
+
readonly generated: bigint;
|
|
166
|
+
}>;
|
|
167
|
+
readonly zeros: ReadonlyArray<{
|
|
168
|
+
readonly scope: string;
|
|
169
|
+
readonly span: Span;
|
|
170
|
+
}>;
|
|
171
|
+
};
|
|
172
|
+
type GateResult = {
|
|
173
|
+
readonly _tag: "Passed";
|
|
174
|
+
readonly states: string;
|
|
175
|
+
readonly seconds: number;
|
|
176
|
+
readonly coverage: Coverage;
|
|
177
|
+
} | {
|
|
178
|
+
readonly _tag: "Failed";
|
|
179
|
+
readonly message: string;
|
|
180
|
+
};
|
|
181
|
+
declare const Gate_base: Context.ServiceClass<Gate, "formal/Gate", {
|
|
182
|
+
run: (model: Model) => Effect.Effect<GateResult, FormalError, never>;
|
|
183
|
+
}>;
|
|
184
|
+
declare class Gate extends Gate_base {
|
|
185
|
+
static readonly layer: Layer.Layer<Gate, never, Tla>;
|
|
186
|
+
}
|
|
187
|
+
export declare const formal: (root: string) => Effect.Effect<0 | 1, FormalError | import("effect/PlatformError").PlatformError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | Gate | import("effect/Path").Path | import("effect/Scope").Scope | Tla>;
|
|
60
188
|
export {};
|