@sublang/spex 6.0.0 → 7.0.0-beta.2
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 +419 -12
- package/dist/cli.js +12 -1
- package/dist/commands/add.d.ts +1 -1
- package/dist/commands/add.js +2 -2
- package/dist/commands/environment.d.ts +3 -3
- package/dist/commands/environment.js +5 -7
- package/dist/commands/export.js +2 -2
- package/dist/commands/home.d.ts +2 -2
- package/dist/commands/home.js +3 -3
- package/dist/commands/list.js +1 -1
- package/dist/commands/login.js +12 -7
- package/dist/commands/logout.js +2 -3
- package/dist/commands/publish.js +1 -1
- package/dist/commands/remove.js +1 -1
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.js +16 -0
- package/dist/commands/settle.d.ts +1 -1
- package/dist/commands/settle.js +1 -1
- package/dist/guards/approval.d.ts +56 -0
- package/dist/guards/approval.js +158 -0
- package/dist/guards/checks.d.ts +207 -0
- package/dist/guards/checks.js +681 -0
- package/dist/guards/commands.d.ts +15 -0
- package/dist/guards/commands.js +313 -0
- package/dist/guards/copy.d.ts +67 -0
- package/dist/guards/copy.js +306 -0
- package/dist/guards/declaration.d.ts +45 -0
- package/dist/guards/declaration.js +224 -0
- package/dist/guards/files.d.ts +137 -0
- package/dist/guards/files.js +544 -0
- package/dist/guards/harness.d.ts +58 -0
- package/dist/guards/harness.js +420 -0
- package/dist/guards/items.d.ts +61 -0
- package/dist/guards/items.js +161 -0
- package/dist/guards/patch.d.ts +55 -0
- package/dist/guards/patch.js +258 -0
- package/dist/guards/processes.d.ts +49 -0
- package/dist/guards/processes.js +233 -0
- package/dist/guards/proofs.d.ts +88 -0
- package/dist/guards/proofs.js +503 -0
- package/dist/guards/records.d.ts +176 -0
- package/dist/guards/records.js +513 -0
- package/dist/guards/report.d.ts +26 -0
- package/dist/guards/report.js +492 -0
- package/dist/guards/runner.d.ts +42 -0
- package/dist/guards/runner.js +167 -0
- package/dist/guards/tla.d.ts +51 -0
- package/dist/guards/tla.js +352 -0
- package/dist/guards/tlapm.d.ts +81 -0
- package/dist/guards/tlapm.js +172 -0
- package/dist/guards/tlc.d.ts +191 -0
- package/dist/guards/tlc.js +457 -0
- package/dist/guards/translation.d.ts +66 -0
- package/dist/guards/translation.js +202 -0
- package/dist/guards/types.d.ts +185 -0
- package/dist/guards/types.js +437 -0
- package/dist/guards/verify.d.ts +290 -0
- package/dist/guards/verify.js +1191 -0
- package/dist/guards/xml.d.ts +18 -0
- package/dist/guards/xml.js +105 -0
- package/dist/lib/environment/archive.d.ts +2 -2
- package/dist/lib/environment/archive.js +1 -1
- package/dist/lib/environment/builtins.d.ts +10 -12
- package/dist/lib/environment/builtins.js +17 -19
- package/dist/lib/environment/exports.d.ts +14 -13
- package/dist/lib/environment/exports.js +31 -16
- package/dist/lib/environment/format.d.ts +2 -2
- package/dist/lib/environment/format.js +3 -3
- package/dist/lib/environment/git-source.js +6 -3
- package/dist/lib/environment/install.d.ts +14 -16
- package/dist/lib/environment/install.js +66 -61
- package/dist/lib/environment/lock.d.ts +4 -3
- package/dist/lib/environment/lock.js +6 -5
- package/dist/lib/environment/marker.js +1 -2
- package/dist/lib/environment/own-paths.d.ts +7 -10
- package/dist/lib/environment/own-paths.js +10 -13
- package/dist/lib/environment/placed-record.d.ts +3 -2
- package/dist/lib/environment/placed-record.js +5 -4
- package/dist/lib/environment/registry.d.ts +1 -1
- package/dist/lib/environment/registry.js +1 -1
- package/dist/lib/environment/requests.d.ts +2 -2
- package/dist/lib/environment/requests.js +2 -2
- package/dist/lib/environment/resolve.d.ts +4 -4
- package/dist/lib/environment/resolve.js +3 -4
- package/dist/lib/environment/store.d.ts +34 -8
- package/dist/lib/environment/store.js +138 -43
- package/dist/lib/files.d.ts +72 -12
- package/dist/lib/files.js +200 -65
- package/dist/lib/git-host.d.ts +52 -258
- package/dist/lib/git-host.js +52 -265
- package/dist/lib/home-file.d.ts +13 -10
- package/dist/lib/home-file.js +28 -18
- package/dist/lib/instance.d.ts +1 -1
- package/dist/lib/instance.js +1 -1
- package/dist/lint.d.ts +22 -0
- package/dist/lint.js +36 -0
- package/dist/testing/standin-registry.js +1 -1
- package/package.json +7 -3
- package/scaffold/.file-history.json +14 -7
- package/scaffold/i18n/zh/source-pins.json +41 -0
- package/scaffold/i18n/zh/specs/decisions/000-spec-structure-format.md +0 -1
- package/scaffold/i18n/zh/specs/intents/000-spdx-headers.md +0 -1
- package/scaffold/i18n/zh/specs/map.md +0 -1
- package/scaffold/i18n/zh/specs/meta.md +18 -35
- package/scaffold/i18n/zh/specs/packages/git.md +0 -1
- package/scaffold/i18n/zh/specs/packages/licensing.md +0 -1
- package/scaffold/specs/meta.md +18 -3
- package/scripts/test-exit-guard.mjs +28 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { type ApprovalState } from "./approval.js";
|
|
2
|
+
import { type Cannot, type CaseFailure, type Comparison, type Shown } from "./checks.js";
|
|
3
|
+
import { type ProofCheck } from "./proofs.js";
|
|
4
|
+
import { type BindingKind, type Limits } from "./files.js";
|
|
5
|
+
import type { ItemIndex } from "./items.js";
|
|
6
|
+
import { type Judged } from "./records.js";
|
|
7
|
+
import type { Tools } from "./tlc.js";
|
|
8
|
+
import { type Call, type Value } from "./types.js";
|
|
9
|
+
/** The results a guard can have (guards-23), the highest first. */
|
|
10
|
+
export type Result = "Conflict in the items" | "Violated on the code" | "Code differs from the model" | "Case failed" | "Inconclusive" | "Model proved, code tested";
|
|
11
|
+
/** The result of a guard that passes. */
|
|
12
|
+
export declare const PASSING: Result;
|
|
13
|
+
/** A record the code gave that the model does not match, with the
|
|
14
|
+
* records before it in its sequence: where it was found, the nearest
|
|
15
|
+
* records before it with their effects, its own event, the model's
|
|
16
|
+
* effect, or null where the model does not find the event legal, and
|
|
17
|
+
* the code's. */
|
|
18
|
+
export type Finding = {
|
|
19
|
+
/** The tests' sequence it was found in, by its name; null for a
|
|
20
|
+
* sequence the module caused. */
|
|
21
|
+
sequence: string | null;
|
|
22
|
+
/** The permitted case the module caused it in, or null. */
|
|
23
|
+
case: string | null;
|
|
24
|
+
/** Its place in the sequence, from 1. */
|
|
25
|
+
at: number;
|
|
26
|
+
/** The records before it that are not shown. */
|
|
27
|
+
earlier: number;
|
|
28
|
+
/** The records shown before it. */
|
|
29
|
+
steps: Shown[];
|
|
30
|
+
last: Call;
|
|
31
|
+
model: string | null;
|
|
32
|
+
gave: string;
|
|
33
|
+
/** The translation whose model's effect `model` is, where another
|
|
34
|
+
* translation that judged the sequence gives another there; null
|
|
35
|
+
* where every translation that judged it gives this one. */
|
|
36
|
+
by: string | null;
|
|
37
|
+
};
|
|
38
|
+
/** What one translation says of the record at which the translations
|
|
39
|
+
* part: it is matched, or it is the first this translation does not
|
|
40
|
+
* match, with its model's effect there, or null where its model does
|
|
41
|
+
* not find the event legal. */
|
|
42
|
+
export type Answer = {
|
|
43
|
+
translation: string;
|
|
44
|
+
said: Judged["said"];
|
|
45
|
+
model: string | null;
|
|
46
|
+
};
|
|
47
|
+
/** A sequence of records the translations judge differently, as a
|
|
48
|
+
* report shows it (guards-61): the records every translation matched,
|
|
49
|
+
* the nearest of them, the record at which they part with the effect
|
|
50
|
+
* the code gave, and each translation's answer there. */
|
|
51
|
+
export type Dispute = {
|
|
52
|
+
earlier: number;
|
|
53
|
+
steps: Shown[];
|
|
54
|
+
last: Call;
|
|
55
|
+
gave: string;
|
|
56
|
+
answers: Answer[];
|
|
57
|
+
};
|
|
58
|
+
/** A stated effect field of a permitted case the code did not give;
|
|
59
|
+
* `sequence` names the tests' sequence it opened, or is null where
|
|
60
|
+
* the module caused it. */
|
|
61
|
+
export type CaseEffect = {
|
|
62
|
+
case: string;
|
|
63
|
+
step: number;
|
|
64
|
+
field: string;
|
|
65
|
+
stated: Value;
|
|
66
|
+
observed: Value;
|
|
67
|
+
sequence: string | null;
|
|
68
|
+
};
|
|
69
|
+
/** What left the checks short of a result, in the order found. */
|
|
70
|
+
export type Cause = {
|
|
71
|
+
kind: "cases";
|
|
72
|
+
} | {
|
|
73
|
+
kind: "differ";
|
|
74
|
+
} | {
|
|
75
|
+
kind: "not compared";
|
|
76
|
+
cause: string;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "stopped";
|
|
79
|
+
cause: string;
|
|
80
|
+
} | {
|
|
81
|
+
kind: "never applied";
|
|
82
|
+
} | {
|
|
83
|
+
kind: "binding";
|
|
84
|
+
cause: string;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "outside";
|
|
87
|
+
file: string;
|
|
88
|
+
} | {
|
|
89
|
+
kind: "timeout";
|
|
90
|
+
seconds: number;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "not repeated";
|
|
93
|
+
steps: Shown[];
|
|
94
|
+
last: Call;
|
|
95
|
+
gave: string;
|
|
96
|
+
other: string;
|
|
97
|
+
} | {
|
|
98
|
+
kind: "said";
|
|
99
|
+
text: string;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "judged differently";
|
|
102
|
+
text: string;
|
|
103
|
+
shown: Dispute;
|
|
104
|
+
} | {
|
|
105
|
+
kind: "proofs";
|
|
106
|
+
reason: string;
|
|
107
|
+
};
|
|
108
|
+
/** What TLC found on the model of the judging translation. */
|
|
109
|
+
export type OnModel = {
|
|
110
|
+
kind: "checked";
|
|
111
|
+
states: number;
|
|
112
|
+
steps: number;
|
|
113
|
+
applied: number;
|
|
114
|
+
collision: string | null;
|
|
115
|
+
} | {
|
|
116
|
+
kind: "conflict";
|
|
117
|
+
steps: Shown[];
|
|
118
|
+
last: Call;
|
|
119
|
+
effect: string;
|
|
120
|
+
} | {
|
|
121
|
+
kind: "not checked";
|
|
122
|
+
cause: string;
|
|
123
|
+
};
|
|
124
|
+
/** The records of one copy, the module's and the tests', as TLC
|
|
125
|
+
* judged them. `matched`, `forbidden`, `differs` and `notJudged` add
|
|
126
|
+
* up to `records`; `differs` counts the records not the model's and
|
|
127
|
+
* those whose event the model does not find legal. */
|
|
128
|
+
export type Counts = {
|
|
129
|
+
records: number;
|
|
130
|
+
sequences: number;
|
|
131
|
+
matched: number;
|
|
132
|
+
forbidden: number;
|
|
133
|
+
differs: number;
|
|
134
|
+
notJudged: number;
|
|
135
|
+
/** The records at which the rule applied. */
|
|
136
|
+
applied: number;
|
|
137
|
+
/** The model's steps the matched records reached, of `steps`. */
|
|
138
|
+
reached: number;
|
|
139
|
+
steps: number;
|
|
140
|
+
/** The matched records beyond the declared values. */
|
|
141
|
+
beyond: number;
|
|
142
|
+
/** The translation these counts are as judged by, where another
|
|
143
|
+
* translation judged a sequence otherwise, applied the rule at
|
|
144
|
+
* another number of its records or did not judge one, so that they
|
|
145
|
+
* are no finding of all; null where they are. */
|
|
146
|
+
by: string | null;
|
|
147
|
+
};
|
|
148
|
+
/** What the tests on the unpatched copy found. */
|
|
149
|
+
export type OnCode = {
|
|
150
|
+
/** What the binding has: a module, probes or both. */
|
|
151
|
+
kind: Exclude<BindingKind, "neither">;
|
|
152
|
+
/** The steps of the model, and how many of them the module caused. */
|
|
153
|
+
steps: number;
|
|
154
|
+
tested: number;
|
|
155
|
+
/** Of those caused: the code gave the model's effect, an effect
|
|
156
|
+
* the rule forbids or another effect, an earlier step of the
|
|
157
|
+
* sequence had already differed, or TLC judged no record of the
|
|
158
|
+
* sequence. The five add up to `tested`. */
|
|
159
|
+
same: number;
|
|
160
|
+
forbidden: number;
|
|
161
|
+
differs: number;
|
|
162
|
+
notReached: number;
|
|
163
|
+
notJudged: number;
|
|
164
|
+
/** The permitted cases, how many were caused by the module or opened
|
|
165
|
+
* a sequence of the tests, and how many went as their steps state. */
|
|
166
|
+
cases: number;
|
|
167
|
+
casesCaused: number;
|
|
168
|
+
casesAsStated: number;
|
|
169
|
+
/** The tests' sequences and how many are whole; null where the
|
|
170
|
+
* tests were not run. */
|
|
171
|
+
tests: {
|
|
172
|
+
sequences: number;
|
|
173
|
+
whole: number;
|
|
174
|
+
} | null;
|
|
175
|
+
counts: Counts;
|
|
176
|
+
/** The first record the rule forbids and the first other record the
|
|
177
|
+
* model does not match, in the order of sequences. */
|
|
178
|
+
violation: Finding | null;
|
|
179
|
+
difference: Finding | null;
|
|
180
|
+
failed: CaseEffect[];
|
|
181
|
+
};
|
|
182
|
+
/** One kept fault: caught, with the forbidden record's sequence, or
|
|
183
|
+
* not, with why. `tried` is false where no copy was made for it, so
|
|
184
|
+
* its patch was never tried. */
|
|
185
|
+
export type FaultCheck = {
|
|
186
|
+
name: string;
|
|
187
|
+
tried: boolean;
|
|
188
|
+
caught: Finding | null;
|
|
189
|
+
reason: string | null;
|
|
190
|
+
/** The sequence the reason names, where the translations judge it
|
|
191
|
+
* differently. */
|
|
192
|
+
dispute?: Dispute | null;
|
|
193
|
+
};
|
|
194
|
+
/** How a guard's inputs stand; `unreadable` is why its record could
|
|
195
|
+
* not be read. */
|
|
196
|
+
export type Approval = ApprovalState & {
|
|
197
|
+
unreadable: string | null;
|
|
198
|
+
};
|
|
199
|
+
/** Everything found for one guard that could be checked. */
|
|
200
|
+
export type Checked = {
|
|
201
|
+
name: string;
|
|
202
|
+
behavior: string;
|
|
203
|
+
/** The behavior item's statement. */
|
|
204
|
+
statement: string;
|
|
205
|
+
approval: Approval;
|
|
206
|
+
cases: {
|
|
207
|
+
count: number;
|
|
208
|
+
permitted: number;
|
|
209
|
+
forbidden: number;
|
|
210
|
+
translations: string[];
|
|
211
|
+
failures: CaseFailure[];
|
|
212
|
+
};
|
|
213
|
+
/** How the translations compare; null for a guard with one. */
|
|
214
|
+
compared: Comparison | null;
|
|
215
|
+
/** The translation whose model was checked and judges the code. */
|
|
216
|
+
judging: string;
|
|
217
|
+
model: OnModel | null;
|
|
218
|
+
/** How the proofs stand, or why they were not checked. */
|
|
219
|
+
proofs: ProofCheck | {
|
|
220
|
+
kind: "not checked";
|
|
221
|
+
cause: string;
|
|
222
|
+
};
|
|
223
|
+
/** The tests on the code, or why there were none. */
|
|
224
|
+
code: OnCode | null;
|
|
225
|
+
notTested: string | null;
|
|
226
|
+
result: Result;
|
|
227
|
+
/** What left the checks short, in the order they print. */
|
|
228
|
+
causes: Cause[];
|
|
229
|
+
/** What the result rests on (guards-23). */
|
|
230
|
+
assumes: string[];
|
|
231
|
+
versions: {
|
|
232
|
+
spex: string;
|
|
233
|
+
node: string;
|
|
234
|
+
tlc: string | null;
|
|
235
|
+
pinned: boolean;
|
|
236
|
+
java: string;
|
|
237
|
+
/** The proof system found, with the variable that named it; null
|
|
238
|
+
* where none was found. */
|
|
239
|
+
proof: {
|
|
240
|
+
version: string;
|
|
241
|
+
solvers: string[];
|
|
242
|
+
variable: string | null;
|
|
243
|
+
pinned: boolean;
|
|
244
|
+
} | null;
|
|
245
|
+
};
|
|
246
|
+
revision: string;
|
|
247
|
+
/** The digest of the copied files; null where no copy was made. */
|
|
248
|
+
digest: string | null;
|
|
249
|
+
limits: Limits;
|
|
250
|
+
faults: FaultCheck[];
|
|
251
|
+
/** Why it does not pass; empty where it passes. */
|
|
252
|
+
reasons: string[];
|
|
253
|
+
};
|
|
254
|
+
/** What begins the cause of a guard that an error Spex did not expect
|
|
255
|
+
* left not checked (guards-18). */
|
|
256
|
+
export declare const UNEXPECTED = "an error Spex did not expect: ";
|
|
257
|
+
/** One guard's part of the report. */
|
|
258
|
+
export type GuardReport = {
|
|
259
|
+
name: string;
|
|
260
|
+
cannot: Cannot[];
|
|
261
|
+
} | Checked;
|
|
262
|
+
/** Whether a guard's report is one that passes. */
|
|
263
|
+
export declare function passes(report: GuardReport): boolean;
|
|
264
|
+
/**
|
|
265
|
+
* What a result rests on (guards-23), as DR-244 lists it: that the
|
|
266
|
+
* translations say what the items say, that the declaration says what
|
|
267
|
+
* the rule is about, that a proof rests on nothing beyond the
|
|
268
|
+
* declaration's assumptions, that the proof system and its solvers
|
|
269
|
+
* are sound, that values outside the declared ones are given to TLC
|
|
270
|
+
* in the declared order, that the module and the probes report every
|
|
271
|
+
* event truly and in order, and that the tests reach the behavior that
|
|
272
|
+
* matters. Each is said with how it is held; the last two by what the
|
|
273
|
+
* binding has, and the one on the order only where a record can hold
|
|
274
|
+
* such a value of a set with an order: the binding has probes, and
|
|
275
|
+
* `ordered` says its declaration gives a set an order.
|
|
276
|
+
*/
|
|
277
|
+
export declare function assumptions(proof: Checked["versions"]["proof"], kind?: BindingKind, ordered?: boolean): string[];
|
|
278
|
+
/** What a run of `spex verify` shares between its guards. */
|
|
279
|
+
export type Run = {
|
|
280
|
+
/** The tree's items, read once. */
|
|
281
|
+
index: () => ItemIndex;
|
|
282
|
+
/** Java and the jar, found once; a GuardError where they are not. */
|
|
283
|
+
tools: () => Promise<Tools>;
|
|
284
|
+
/** The folder of `--keep`, or null. */
|
|
285
|
+
keep: string | null;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Check one guard (guards-17).
|
|
289
|
+
*/
|
|
290
|
+
export declare function checkGuard(root: string, name: string, run: Run): Promise<GuardReport>;
|