@milkenjoyer/toolchain 0.10.0 → 0.11.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 +33 -0
- package/dist/formal.d.mts +60 -0
- package/dist/formal.mjs +628 -0
- package/dist/hooks.mjs +2 -2
- package/dist/proof.mjs +6 -6
- package/dist/verdict.d.mts +1 -1
- package/dist/verdict.mjs +2 -2
- package/dist/{verification-MNG9WKEH.d.mts → verification-p2rSx5lc.d.mts} +2 -2
- package/dist/verification.d.mts +1 -1
- package/dist/verification.mjs +1 -1
- package/package.json +4 -1
- package/src/formal/cfg.ts +111 -0
- package/src/formal/checks.ts +203 -0
- package/src/formal/semantics.ts +145 -0
- package/src/formal/specs.ts +166 -0
- package/src/formal/tla.ts +284 -0
- package/src/formal.ts +75 -0
- package/dist/{verification-2bhNnJr-.mjs → verification-6s2chr4X.mjs} +4 -4
package/README.md
CHANGED
|
@@ -43,3 +43,36 @@ On `pull_request`, run this before any docs-only scope skip. Give the job `permi
|
|
|
43
43
|
The `verification` check requires a code-tier PR body to contain a `## Verification` section naming at least one real run in backticks. Record each command or verifier recipe and its outcome. Renovate PRs and PRs changing only Markdown, MDX, LICENSE files, art, media or fonts outside `skills/` directories are exempt. Changeset-only PRs are exempt. An unknown or truncated file list requires verification. HTML comments do not count as runs.
|
|
44
44
|
|
|
45
45
|
In the PR job, set `permissions: contents: read` and `GH_TOKEN: ${{ github.token }}`, then run `vp exec verification`. The check reads the original pull request event and compares its base and head through the GitHub API. After editing a failing body, push again because a rerun reads the body from the original event.
|
|
46
|
+
|
|
47
|
+
## Formal check
|
|
48
|
+
|
|
49
|
+
`vp exec formal` checks every TLA+ spec in the repository against the standard in agent-kit#276. Run it from anywhere in the repository with no arguments. It reads `specs.json` at the repository root and the tracked `.tla` and `.cfg` files.
|
|
50
|
+
|
|
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
|
+
|
|
53
|
+
`specs.json` maps each spec's path to its entry. Unknown keys fail. Kani entries (`.rs`) decode with the same schema and are left to the repository's own guard.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"apps/indexer/formal/IndexerPass.tla": {
|
|
58
|
+
"synced": "<40-hex commit>",
|
|
59
|
+
"covers": ["apps/indexer/src/pass.ts"],
|
|
60
|
+
"mode": "gate",
|
|
61
|
+
"timeoutSeconds": 60
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`mode` is `gate` or `manual`. `timeoutSeconds` defaults to 60 and allows up to 1800. The command also decodes `witnesses` (operator names), `breaks` (`{ violates, find, replace, file? }`), `traces` (`{ seed, depth, count }`) and `conformance` (a test file, set together with `traces`). It doesn't run them yet; agent-kit#278 adds that.
|
|
67
|
+
|
|
68
|
+
The checks:
|
|
69
|
+
|
|
70
|
+
- `specs`: every tracked `.tla` has an entry, every `.tla` entry names a tracked file, every gate spec `X.tla` has `X.cfg`, every config beside a spec pairs with a module (`X.cfg` or `X.<variant>.cfg`) and parses, and `specs.json` decodes.
|
|
71
|
+
- `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`. A clause such as `v = v` or a quantified clause about `v` doesn't count.
|
|
73
|
+
- `deadlock`: no config sets `CHECK_DEADLOCK FALSE`. Give a bounded spec an explicit finished step instead. The command never passes `-deadlock`.
|
|
74
|
+
- `constants`: no two integer constants in one config share a value.
|
|
75
|
+
- `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 and a zero distinct-state count. Manual specs don't run.
|
|
77
|
+
|
|
78
|
+
Each passing TLC run prints its distinct-state count. The command exits 0 when nothing is found. It prints each finding to stderr as `<file>: <check>: <message>` and exits 1. It also exits 1 when it can't run, for example without Java 17 or with a bad jar.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "effect/Schema";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
4
|
+
import { FileSystem } from "effect/FileSystem";
|
|
5
|
+
import * as Context from "effect/Context";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import { Path } from "effect/Path";
|
|
8
|
+
type Semantics = {
|
|
9
|
+
readonly variables: ReadonlyArray<string>;
|
|
10
|
+
readonly typeOK: ReadonlySet<string> | undefined;
|
|
11
|
+
};
|
|
12
|
+
type Analysis = {
|
|
13
|
+
readonly _tag: "Parsed";
|
|
14
|
+
readonly semantics: Semantics;
|
|
15
|
+
} | {
|
|
16
|
+
readonly _tag: "Unparsed";
|
|
17
|
+
readonly output: string;
|
|
18
|
+
};
|
|
19
|
+
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
|
+
readonly _tag: "FormalError";
|
|
21
|
+
} & Readonly<A>;
|
|
22
|
+
declare class FormalError extends FormalError_base<{
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}> {}
|
|
25
|
+
type ToolMessage = {
|
|
26
|
+
readonly code: number;
|
|
27
|
+
readonly severity: number;
|
|
28
|
+
readonly text: string;
|
|
29
|
+
};
|
|
30
|
+
type TlcRun = {
|
|
31
|
+
readonly _tag: "Exited";
|
|
32
|
+
readonly code: number;
|
|
33
|
+
readonly messages: ReadonlyArray<ToolMessage>;
|
|
34
|
+
readonly seconds: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly _tag: "TimedOut";
|
|
37
|
+
};
|
|
38
|
+
type TlcInput = {
|
|
39
|
+
readonly spec: string;
|
|
40
|
+
readonly config: string;
|
|
41
|
+
readonly timeoutSeconds: number;
|
|
42
|
+
};
|
|
43
|
+
type Formatted = {
|
|
44
|
+
readonly _tag: "Formatted";
|
|
45
|
+
readonly text: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly _tag: "Failed";
|
|
48
|
+
readonly output: string;
|
|
49
|
+
};
|
|
50
|
+
declare const Tla_base: Context.ServiceClass<Tla, "formal/Tla", {
|
|
51
|
+
fixCommand: (file: string) => string;
|
|
52
|
+
analyze: (file: string) => Effect.Effect<Analysis, FormalError, never>;
|
|
53
|
+
format: (file: string) => Effect.Effect<Formatted, FormalError, never>;
|
|
54
|
+
tlc: (input: TlcInput) => Effect.Effect<TlcRun, FormalError, never>;
|
|
55
|
+
}>;
|
|
56
|
+
declare class Tla extends Tla_base {
|
|
57
|
+
static readonly layer: Layer.Layer<Tla, FormalError, ChildProcessSpawner.ChildProcessSpawner | FileSystem | Path>;
|
|
58
|
+
}
|
|
59
|
+
export declare const formal: (root: string) => Effect.Effect<0 | 1, FormalError | import("effect/PlatformError").PlatformError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/Scope").Scope | Tla>;
|
|
60
|
+
export {};
|