tla-ts 0.0.8-dev.d9bffda → 0.0.9-dev.0dd11f695
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 +30 -0
- package/dist/compile.cjs +23 -0
- package/dist/compile.js +23 -0
- package/dist/deciders.cjs +15 -15
- package/dist/deciders.js +40 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +80 -10
- package/dist/index.d.ts +80 -10
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +116 -36
- package/dist/prove.js +116 -36
- package/dist/run.cjs +143 -31
- package/dist/run.js +143 -31
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +1 -1
- package/dist/transfer.cjs +128 -103
- package/dist/transfer.js +128 -103
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +3 -1
- package/src/ast.ts +7 -21
- package/src/bags.ts +99 -99
- package/src/builtins.ts +44 -75
- package/src/bundled-modules.ts +1 -8
- package/src/check.ts +605 -311
- package/src/cli/options.ts +12 -3
- package/src/cli/run.ts +2 -2
- package/src/cli/runtime-invariants.ts +135 -0
- package/src/cli/shared.ts +20 -9
- package/src/cli/tlc-arguments.ts +646 -0
- package/src/cli/tlc-usage.ts +362 -0
- package/src/cli/tlc.ts +571 -185
- package/src/cli/typescript.ts +26 -0
- package/src/cli/xml-exporter.ts +4 -10
- package/src/codegen.ts +190 -46
- package/src/config.ts +101 -68
- package/src/coverage.ts +855 -0
- package/src/dependencies.ts +20 -28
- package/src/dfid.ts +636 -0
- package/src/environment.ts +266 -98
- package/src/errors.ts +142 -45
- package/src/evaluate.ts +632 -298
- package/src/exit-codes.ts +37 -1
- package/src/index.ts +3 -0
- package/src/instances.ts +85 -9
- package/src/java-overrides.ts +2 -12
- package/src/json-reader.ts +456 -0
- package/src/json.ts +262 -139
- package/src/levels.ts +2 -3
- package/src/lexer.ts +17 -26
- package/src/liveness-checker.ts +10 -18
- package/src/liveness.ts +121 -49
- package/src/parallel-worker.ts +14 -10
- package/src/parallel.ts +41 -17
- package/src/parser.ts +436 -90
- package/src/pcal/ast.ts +7 -28
- package/src/pcal/parse.ts +11 -39
- package/src/pcal/tokenize.ts +4 -20
- package/src/pcal/translate.ts +10 -42
- package/src/pcal/validate.ts +3 -21
- package/src/pretty-print.ts +1 -2
- package/src/prover/smt/solver/solver.ts +31 -27
- package/src/randomization.ts +84 -35
- package/src/resolve.ts +18 -60
- package/src/runtime.ts +11 -4
- package/src/sany/builtins.ts +3 -4
- package/src/sany/generator.ts +128 -176
- package/src/sany/levels.ts +6 -30
- package/src/sany/lexer.ts +7 -23
- package/src/sany/linter.ts +31 -29
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +4 -28
- package/src/sany/parse-error.ts +44 -100
- package/src/sany/report.ts +25 -40
- package/src/sany/selectors.ts +8 -22
- package/src/sany/source.ts +8 -15
- package/src/sany/xml.ts +11 -42
- package/src/search.ts +547 -144
- package/src/simulate.ts +694 -0
- package/src/spec-description.ts +166 -48
- package/src/standard-definitions.ts +2 -3
- package/src/standard-modules.ts +264 -68
- package/src/state-graph.ts +51 -18
- package/src/subexpressions.ts +31 -5
- package/src/successors.ts +267 -77
- package/src/symmetry.ts +31 -8
- package/src/tableau.ts +1 -2
- package/src/tlc/fingerprint.ts +183 -61
- package/src/tlc/jar-data.ts +113 -6
- package/src/tlc/messages.ts +122 -37
- package/src/tlc/order.ts +33 -38
- package/src/tlc/random.ts +16 -16
- package/src/tlc/replay.ts +563 -211
- package/src/tlc/summary.ts +2 -4
- package/src/tlc/tlc-operators.ts +81 -36
- package/src/tlc/tlcext-operators.ts +138 -117
- package/src/tlc/trace-spec.ts +273 -0
- package/src/tlc/value-stream.ts +143 -0
- package/src/tlc/version.ts +2 -4
- package/src/typescript/actions.ts +494 -0
- package/src/typescript/collections.ts +615 -0
- package/src/typescript/compile.ts +70 -0
- package/src/typescript/context.ts +106 -0
- package/src/typescript/emit.ts +122 -0
- package/src/typescript/expressions.ts +508 -0
- package/src/typescript/formula.ts +160 -0
- package/src/typescript/functions.ts +295 -0
- package/src/typescript/model.ts +164 -0
- package/src/typescript/names.ts +116 -0
- package/src/typescript/program.ts +51 -0
- package/src/typescript/properties.ts +148 -0
- package/src/typescript/scope.ts +117 -0
- package/src/typescript/steps.ts +175 -0
- package/src/typescript/types.ts +178 -0
- package/src/values.ts +832 -255
package/src/check.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { Expression } from "./ast";
|
|
2
2
|
import { parseConfig, type ModelConfig } from "./config";
|
|
3
|
+
import {
|
|
4
|
+
addCoverageRelation,
|
|
5
|
+
buildCoverage,
|
|
6
|
+
countCoverageVariables,
|
|
7
|
+
createCoverage,
|
|
8
|
+
getCoverageLabel,
|
|
9
|
+
getCoverageReport,
|
|
10
|
+
type CoverageReport,
|
|
11
|
+
} from "./coverage";
|
|
3
12
|
import { createEnvironment } from "./environment";
|
|
4
13
|
import {
|
|
5
14
|
createStackOverflowError,
|
|
6
15
|
getErrorExitCode,
|
|
7
16
|
isStackOverflow,
|
|
8
|
-
TlaConfigError,
|
|
9
17
|
TlaEvaluationError,
|
|
10
18
|
TlaIllegalStateError,
|
|
11
19
|
TlaIncompleteSuccessorError,
|
|
@@ -16,7 +24,7 @@ import {
|
|
|
16
24
|
} from "./errors";
|
|
17
25
|
import {
|
|
18
26
|
createTracingEnvironment,
|
|
19
|
-
|
|
27
|
+
describeRange,
|
|
20
28
|
formatRange,
|
|
21
29
|
getDefinition,
|
|
22
30
|
isImpure,
|
|
@@ -24,7 +32,13 @@ import {
|
|
|
24
32
|
type Environment,
|
|
25
33
|
type FingerprintFailure,
|
|
26
34
|
} from "./evaluate";
|
|
27
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
EXIT_STATUS,
|
|
37
|
+
getExitCode,
|
|
38
|
+
getMessageExitStatus,
|
|
39
|
+
setExitCode,
|
|
40
|
+
withLivenessExitCode,
|
|
41
|
+
} from "./exit-codes";
|
|
28
42
|
import type { JavaOverride } from "./java-overrides";
|
|
29
43
|
import {
|
|
30
44
|
createLivenessChecker,
|
|
@@ -33,11 +47,10 @@ import {
|
|
|
33
47
|
type LiveSuccessor,
|
|
34
48
|
} from "./liveness-checker";
|
|
35
49
|
import {
|
|
36
|
-
|
|
50
|
+
createMissingOperatorError,
|
|
37
51
|
createSearch,
|
|
52
|
+
getIncompleteSuccessorMessage,
|
|
38
53
|
findAssumptionViolation,
|
|
39
|
-
getConfigDefinition,
|
|
40
|
-
getContext,
|
|
41
54
|
reportInitialStatesProgress,
|
|
42
55
|
reportStartup,
|
|
43
56
|
withNextStateExitCode,
|
|
@@ -62,10 +75,10 @@ import {
|
|
|
62
75
|
forEachSuccessor,
|
|
63
76
|
getInitialStates,
|
|
64
77
|
getSuccessors,
|
|
78
|
+
hasIncompleteSuccessor,
|
|
65
79
|
type Successor,
|
|
66
80
|
} from "./successors";
|
|
67
81
|
import {
|
|
68
|
-
formatNestedMessage,
|
|
69
82
|
getCodedMessage,
|
|
70
83
|
getFailureMessage,
|
|
71
84
|
getWrappedException,
|
|
@@ -75,8 +88,17 @@ import {
|
|
|
75
88
|
withUnexpectedException,
|
|
76
89
|
type FailureMessage,
|
|
77
90
|
} from "./tlc/messages";
|
|
91
|
+
import { createTautologyError } from "./liveness";
|
|
92
|
+
import { KEY_SEPARATOR } from "./resolve";
|
|
93
|
+
import { setFingerprintPolynomial } from "./tlc/fingerprint";
|
|
94
|
+
import { writeTraceSpec } from "./tlc/trace-spec";
|
|
78
95
|
import { createTlcOrder } from "./tlc/order";
|
|
79
|
-
import {
|
|
96
|
+
import {
|
|
97
|
+
getPrimedRanges,
|
|
98
|
+
replayInitialStates,
|
|
99
|
+
replaySuccessors,
|
|
100
|
+
walkSuccessors,
|
|
101
|
+
} from "./tlc/replay";
|
|
80
102
|
import { getFingerprintDistance, OUT_DEGREE_BUCKETS } from "./tlc/summary";
|
|
81
103
|
import { createActionRecord, createCounterExample } from "./tlc/tlcext-operators";
|
|
82
104
|
import type { TlcVersion } from "./tlc/version";
|
|
@@ -87,13 +109,12 @@ import {
|
|
|
87
109
|
formatState,
|
|
88
110
|
getFingerprintError,
|
|
89
111
|
getHeldValues,
|
|
112
|
+
getModelValues,
|
|
90
113
|
getValueHash,
|
|
91
|
-
isFunctionValue,
|
|
92
114
|
isSameValue,
|
|
93
115
|
markFingerprinted,
|
|
94
116
|
setStringOrder,
|
|
95
|
-
|
|
96
|
-
toFiniteFunction,
|
|
117
|
+
setValueOptions,
|
|
97
118
|
type Value,
|
|
98
119
|
} from "./values";
|
|
99
120
|
|
|
@@ -105,34 +126,57 @@ export interface CheckOptions {
|
|
|
105
126
|
onPrint?: (text: string) => void;
|
|
106
127
|
onPause?: () => void;
|
|
107
128
|
readFile?: (path: string) => string | undefined;
|
|
108
|
-
writeFile?: (path: string, content: string) => void;
|
|
129
|
+
writeFile?: (path: string, content: string | Uint8Array) => void;
|
|
130
|
+
makeDirectory?: (path: string) => void;
|
|
109
131
|
seed?: bigint;
|
|
110
132
|
workers?: number;
|
|
111
|
-
// TLC's -lncheck: "final" checks liveness only on the complete
|
|
112
|
-
livenessCheck?: "default" | "final";
|
|
133
|
+
// TLC's -lncheck: "final" checks liveness only on the complete graph, "off" never looks for a cycle.
|
|
134
|
+
livenessCheck?: "default" | "final" | "off";
|
|
135
|
+
// TLC's -fp: the index of the polynomial in TLC's FP64.Polys that fingerprints states.
|
|
136
|
+
fingerprintPolynomial?: number;
|
|
137
|
+
// False for TLC's -terse, which prints a lazy value, such as SUBSET S, without enumerating it.
|
|
138
|
+
isLazyValueExpanded?: boolean;
|
|
139
|
+
// TLC's -view: prints each state as the value of the configuration's VIEW.
|
|
140
|
+
isViewPrinted?: boolean;
|
|
141
|
+
// TLC's -maxSetSize: the most elements TLC enumerates into a set, or states into a list of them.
|
|
142
|
+
maxSetSize?: number;
|
|
113
143
|
// TLC's -dump: writes the reachable states, or with `dot` the state graph, through writeFile.
|
|
114
144
|
dump?: StateDump;
|
|
115
145
|
// TLC's -tool, which changes the messages of TLC's errors.
|
|
116
146
|
isTool?: boolean;
|
|
117
|
-
//
|
|
118
|
-
|
|
147
|
+
// TLC's -continue: reports each violation through onProgress and goes on.
|
|
148
|
+
isContinued?: boolean;
|
|
149
|
+
moduleOperators?: ModuleOperator[];
|
|
150
|
+
// TLC's trace exploration spec, and the binary trace TLC records for it unless -noTEBin.
|
|
151
|
+
traceSpec?: TraceSpecOptions;
|
|
119
152
|
// Whether the caller printed SANY's report, its warnings included, before the check.
|
|
120
153
|
isSanyReported?: boolean;
|
|
121
|
-
// False for TLC's -nowarning, which changes how TLC computes
|
|
154
|
+
// False for TLC's -nowarning, which changes how TLC computes some successors.
|
|
122
155
|
isWarningEnabled?: boolean;
|
|
123
|
-
//
|
|
156
|
+
// TLC's -coverage, in minutes.
|
|
157
|
+
coverage?: number;
|
|
124
158
|
version?: TlcVersion;
|
|
125
|
-
// Reports the points of the search at which TLC prints a message.
|
|
126
159
|
onProgress?: (progress: CheckProgress) => void;
|
|
127
160
|
}
|
|
128
161
|
|
|
162
|
+
export interface TraceSpecOptions {
|
|
163
|
+
module: string;
|
|
164
|
+
traceFile?: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface ModuleOperator {
|
|
168
|
+
kind: "postcondition" | "constraint" | "view";
|
|
169
|
+
module: string;
|
|
170
|
+
operator: string;
|
|
171
|
+
constants?: Record<string, string>;
|
|
172
|
+
}
|
|
173
|
+
|
|
129
174
|
export interface InitialStatesProgress {
|
|
130
175
|
kind: "initial-states-progress";
|
|
131
176
|
count: number;
|
|
132
177
|
}
|
|
133
178
|
|
|
134
|
-
// A check
|
|
135
|
-
// states.
|
|
179
|
+
// A check TLC reports as violated before it stops replaying the initial states.
|
|
136
180
|
export interface InitialStateViolation {
|
|
137
181
|
kind: "initial-state-violation";
|
|
138
182
|
status: "invariant-violation" | "liveness-violation";
|
|
@@ -143,7 +187,6 @@ export interface InitialStateViolation {
|
|
|
143
187
|
// A line the spec prints, or what TLC reports as it replays the initial states.
|
|
144
188
|
export type OutputLine = string | InitialStatesProgress | InitialStateViolation;
|
|
145
189
|
|
|
146
|
-
// The points of the search at which TLC prints a message.
|
|
147
190
|
export type CheckProgress =
|
|
148
191
|
| { kind: "parsed" }
|
|
149
192
|
| { kind: "constant-level-invariant"; name: string }
|
|
@@ -163,14 +206,16 @@ export type CheckProgress =
|
|
|
163
206
|
statistics: SearchStatistics;
|
|
164
207
|
}
|
|
165
208
|
| { kind: "liveness-finished" }
|
|
166
|
-
|
|
209
|
+
| { kind: "sequential-fallback"; string: string }
|
|
167
210
|
| { kind: "warning"; code: number; text: string }
|
|
211
|
+
// A violation that the search goes on past with -continue.
|
|
212
|
+
| { kind: "violation"; status: CheckStatus; violation: Violation }
|
|
168
213
|
// A method of the class named after a module, which TLC reports as it loads the class.
|
|
169
214
|
| ({ kind: "java-override" } & JavaOverride);
|
|
170
215
|
|
|
171
216
|
export interface SearchStatistics extends Pick<
|
|
172
217
|
CheckResult,
|
|
173
|
-
"generatedStates" | "distinctStates" | "queuedStates" | "depth"
|
|
218
|
+
"generatedStates" | "distinctStates" | "queuedStates" | "depth" | "coverage"
|
|
174
219
|
> {}
|
|
175
220
|
|
|
176
221
|
export type CheckStatus =
|
|
@@ -188,8 +233,7 @@ export interface TraceStep {
|
|
|
188
233
|
// TLC's name, parameters and location for the action that took this step.
|
|
189
234
|
label: string | undefined;
|
|
190
235
|
state: Record<string, Value>;
|
|
191
|
-
// What the spec prints
|
|
192
|
-
// trace. The first step has what TLC prints before the trace.
|
|
236
|
+
// What the spec prints before this step as TLC rebuilds the trace, and before it for the first.
|
|
193
237
|
output?: OutputLine[];
|
|
194
238
|
}
|
|
195
239
|
|
|
@@ -198,16 +242,16 @@ export interface Violation {
|
|
|
198
242
|
// Every temporal property that a liveness counterexample violates, in the configuration's order.
|
|
199
243
|
properties?: string[];
|
|
200
244
|
trace: TraceStep[];
|
|
201
|
-
// What the spec prints after
|
|
202
|
-
// the cycle of a lasso or rebuilds the trace once more.
|
|
245
|
+
// What the spec prints after the trace, as TLC finds the lasso's step back or rebuilds the trace.
|
|
203
246
|
traceOutput?: OutputLine[];
|
|
247
|
+
// What the postconditions print, which TLC checks after the lasso's step back.
|
|
248
|
+
postconditionOutput?: OutputLine[];
|
|
204
249
|
loopStart: number | undefined;
|
|
205
250
|
loopLabel?: string;
|
|
206
251
|
message?: string;
|
|
207
252
|
counts?: string;
|
|
208
253
|
unwitnessed?: Postcondition;
|
|
209
|
-
// A POSTCONDITION that is false or fails
|
|
210
|
-
// prints one.
|
|
254
|
+
// A POSTCONDITION that is false or fails, which TLC checks as it prints the counterexample.
|
|
211
255
|
postcondition?: Postcondition;
|
|
212
256
|
// What TLC warns about after a counterexample, with its code.
|
|
213
257
|
warning?: { code: number; text: string };
|
|
@@ -215,7 +259,6 @@ export interface Violation {
|
|
|
215
259
|
|
|
216
260
|
export interface Postcondition {
|
|
217
261
|
name: string;
|
|
218
|
-
// TLC's message code.
|
|
219
262
|
code: number;
|
|
220
263
|
message: string;
|
|
221
264
|
counts?: string;
|
|
@@ -223,7 +266,6 @@ export interface Postcondition {
|
|
|
223
266
|
|
|
224
267
|
// An evaluation that failed during the search, with the behavior up to the state TLC was working on.
|
|
225
268
|
export interface EvaluationFailure {
|
|
226
|
-
// TLC's code for the message, and its text with and without -tool.
|
|
227
269
|
code: number;
|
|
228
270
|
message: string;
|
|
229
271
|
toolMessage: string;
|
|
@@ -231,15 +273,13 @@ export interface EvaluationFailure {
|
|
|
231
273
|
traceOutput?: OutputLine[];
|
|
232
274
|
initialState: Record<string, Value> | undefined;
|
|
233
275
|
exitCode: number;
|
|
234
|
-
// The expressions TLC was evaluating
|
|
235
|
-
// them by replaying the failure.
|
|
276
|
+
// The expressions TLC was evaluating, outermost first, when its replay finds them.
|
|
236
277
|
callStack: Expression[] | undefined;
|
|
237
278
|
// Whether TLC prints the call stack before the error, as it does for a failed liveness check.
|
|
238
279
|
isCallStackFirst?: boolean;
|
|
239
280
|
// The FingerprintException the replay raises, which TLC reports in place of the call stack.
|
|
240
281
|
fingerprint?: FingerprintFailure;
|
|
241
|
-
// How TLC reports failing again as it prints the trace, since it can't fingerprint the state
|
|
242
|
-
// failure occurred in.
|
|
282
|
+
// How TLC reports failing again as it prints the trace, since it can't fingerprint the state.
|
|
243
283
|
traceFailure?: FailureMessage;
|
|
244
284
|
// A POSTCONDITION that is false or fails after the trace, which TLC checks as it prints one.
|
|
245
285
|
postcondition?: Postcondition;
|
|
@@ -247,10 +287,10 @@ export interface EvaluationFailure {
|
|
|
247
287
|
isWithoutStatistics?: boolean;
|
|
248
288
|
}
|
|
249
289
|
|
|
250
|
-
// Where TLC's replay of a failure fails.
|
|
251
290
|
interface ReplayFailure {
|
|
252
291
|
callStack: Expression[];
|
|
253
292
|
fingerprint: FingerprintFailure | undefined;
|
|
293
|
+
replayError?: TlaEvaluationError;
|
|
254
294
|
}
|
|
255
295
|
|
|
256
296
|
export interface InitialStates {
|
|
@@ -266,23 +306,24 @@ export interface CheckResult {
|
|
|
266
306
|
distinctStates: number;
|
|
267
307
|
queuedStates: number;
|
|
268
308
|
depth: number;
|
|
269
|
-
//
|
|
270
|
-
// them all without a violation or an error.
|
|
309
|
+
// Once TLC computed all the initial states without a violation or an error.
|
|
271
310
|
initialStates: InitialStates | undefined;
|
|
272
|
-
// How many states
|
|
273
|
-
// the outdegree of the state graph.
|
|
311
|
+
// How many expanded states found each number of new states, when TLC prints the outdegree.
|
|
274
312
|
outDegrees: number[] | undefined;
|
|
275
|
-
// The smallest distance between
|
|
276
|
-
// collision from the actual fingerprints.
|
|
313
|
+
// The smallest distance between two fingerprints, when TLC estimates a collision from them.
|
|
277
314
|
fingerprintDistance: bigint | undefined;
|
|
278
|
-
// A temporal property TLC finds violated as it adds a deadlocked state
|
|
279
|
-
// which it reports after the deadlock.
|
|
315
|
+
// A temporal property TLC finds violated as it adds a deadlocked state, reported after.
|
|
280
316
|
additionalViolation?: Violation;
|
|
281
317
|
// Where TLC's worker fails to add the state to the behavior graph after it reports a violation.
|
|
282
318
|
liveCallStack?: Expression[];
|
|
283
|
-
//
|
|
284
|
-
// stop on a violation without an error code, which TLC 1.7.4 reports as a successful search.
|
|
319
|
+
// The outdegrees when TLC's workers stop on a violation that TLC 1.7.4 reports as a success.
|
|
285
320
|
violationOutDegrees?: number[];
|
|
321
|
+
traceSpec?: string;
|
|
322
|
+
coverage?: CoverageReport;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
interface CoveredAction extends SpecAction {
|
|
326
|
+
node: number;
|
|
286
327
|
}
|
|
287
328
|
|
|
288
329
|
interface Behavior {
|
|
@@ -301,15 +342,14 @@ interface FailureOptions {
|
|
|
301
342
|
outDegrees?: number[];
|
|
302
343
|
callStack?: Expression[];
|
|
303
344
|
fingerprint?: FingerprintFailure;
|
|
345
|
+
replayError?: TlaEvaluationError;
|
|
304
346
|
isNextState?: boolean;
|
|
305
347
|
isCallStackFirst?: boolean;
|
|
306
348
|
traceFailure?: FailureMessage;
|
|
307
|
-
// Whether the call stack
|
|
308
|
-
// of replaying the error.
|
|
349
|
+
// Whether TLC prints the call stack of adding the state to the behavior graph, not a replay.
|
|
309
350
|
isLiveCallStack?: boolean;
|
|
310
351
|
}
|
|
311
352
|
|
|
312
|
-
// TLC prints what the spec prints as it replays a failure after the trace.
|
|
313
353
|
const appendTraceOutput = <Traced extends Behavior>(behavior: Traced, lines: OutputLine[]) => ({
|
|
314
354
|
...behavior,
|
|
315
355
|
traceOutput: [...(behavior.traceOutput ?? []), ...lines],
|
|
@@ -318,45 +358,22 @@ const appendTraceOutput = <Traced extends Behavior>(behavior: Traced, lines: Out
|
|
|
318
358
|
const INITIAL_RECOVERY_FAILURE = "Failed to recover the initial state from its fingerprint.";
|
|
319
359
|
const NEXT_RECOVERY_FAILURE = "Failed to recover the next state from its fingerprint.";
|
|
320
360
|
|
|
321
|
-
const toAliasRecord = (value: Value, fieldOrder: string[]) => {
|
|
322
|
-
if (!isFunctionValue(value)) return undefined;
|
|
323
|
-
const record = toFiniteFunction(value);
|
|
324
|
-
if (!record.domain.every((key) => typeof key === "string")) return undefined;
|
|
325
|
-
const entries = record.domain.map((key, index): [string, Value] => [
|
|
326
|
-
String(key),
|
|
327
|
-
record.range[index],
|
|
328
|
-
]);
|
|
329
|
-
return Object.fromEntries(
|
|
330
|
-
entries.sort((left, right) => fieldOrder.indexOf(left[0]) - fieldOrder.indexOf(right[0])),
|
|
331
|
-
);
|
|
332
|
-
};
|
|
333
|
-
|
|
334
361
|
// Stops a replay where TLC stops it without a failure, as at a violated invariant.
|
|
335
362
|
const STOP_REPLAY = new Error("The replay stopped");
|
|
363
|
+
const STOP_WALK = new Error("The walk stopped");
|
|
336
364
|
|
|
337
|
-
//
|
|
338
|
-
// configuration error.
|
|
339
|
-
const CONFIG_ERROR_CODES = new Set([
|
|
340
|
-
...Array.from({ length: 24 }, (_, index) => 2222 + index),
|
|
341
|
-
2272,
|
|
342
|
-
2273,
|
|
343
|
-
2274,
|
|
344
|
-
2280,
|
|
345
|
-
2281,
|
|
346
|
-
]);
|
|
347
|
-
|
|
348
|
-
// When TLC's replay of the initial states doesn't fail again, it exits with the code of the
|
|
349
|
-
// TLCRuntimeException it reported.
|
|
365
|
+
// When TLC's replay of the initial states doesn't fail again, it exits with the error's code.
|
|
350
366
|
const getInitialExitCode = (error: TlaEvaluationError) => {
|
|
351
367
|
const coded = getCodedMessage(error.message);
|
|
352
|
-
return coded &&
|
|
368
|
+
return coded &&
|
|
369
|
+
!coded.isEvalException &&
|
|
370
|
+
getMessageExitStatus(coded.code) === EXIT_STATUS.configParseError
|
|
353
371
|
? EXIT_STATUS.configParseError
|
|
354
372
|
: getErrorExitCode(error);
|
|
355
373
|
};
|
|
356
374
|
|
|
357
|
-
// When
|
|
358
|
-
//
|
|
359
|
-
// that heads or wraps another exits as the other.
|
|
375
|
+
// When the replay fails again, a standard module's EvalException decides the exit status, and
|
|
376
|
+
// any other failure exits as a nested expression failure. A heading or wrapping error defers.
|
|
360
377
|
const getReplayExitCode = (error: TlaEvaluationError): number => {
|
|
361
378
|
const inner = error.cause;
|
|
362
379
|
if (inner instanceof TlaEvaluationError) return getReplayExitCode(inner);
|
|
@@ -376,8 +393,8 @@ export const checkSequentially = (options: CheckOptions): CheckResult => {
|
|
|
376
393
|
}
|
|
377
394
|
};
|
|
378
395
|
|
|
379
|
-
// TLC checks liveness on the graph so far 3 seconds
|
|
380
|
-
//
|
|
396
|
+
// TLC checks liveness on the graph so far after 3 seconds and then every minute, once the graph
|
|
397
|
+
// has grown by a tenth and liveness checking has taken at most a fifth of the time.
|
|
381
398
|
const PERIODIC_START = 3000;
|
|
382
399
|
const PROGRESS_INTERVAL = 60_000;
|
|
383
400
|
const LIVENESS_GROWTH = 0.1;
|
|
@@ -389,8 +406,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
389
406
|
? parseConfig(options.config, options.version)
|
|
390
407
|
: options.config;
|
|
391
408
|
const onPrint = options.onPrint ?? console.log;
|
|
392
|
-
// TLC prints again while it rebuilds a trace,
|
|
393
|
-
// keeps what it prints for the trace.
|
|
409
|
+
// TLC prints again while it rebuilds a trace, so rebuilding keeps what it prints for the trace.
|
|
394
410
|
const capturedOutput = { lines: undefined as OutputLine[] | undefined };
|
|
395
411
|
const print = (text: string) => {
|
|
396
412
|
if (capturedOutput.lines) capturedOutput.lines.push(text);
|
|
@@ -408,23 +424,41 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
408
424
|
};
|
|
409
425
|
const order = createTlcOrder(options.source, options.loadModule);
|
|
410
426
|
setStringOrder(order.getStringOrder(config));
|
|
411
|
-
|
|
427
|
+
setValueOptions(options);
|
|
428
|
+
setFingerprintPolynomial(options.fingerprintPolynomial ?? 0);
|
|
412
429
|
const specification = createEnvironment(config, {
|
|
413
430
|
source: options.source,
|
|
414
431
|
loadModule: options.loadModule,
|
|
415
432
|
order,
|
|
416
433
|
loadClass: options.loadClass,
|
|
417
434
|
print,
|
|
418
|
-
files: {
|
|
435
|
+
files: {
|
|
436
|
+
readFile: options.readFile,
|
|
437
|
+
writeFile: options.writeFile,
|
|
438
|
+
makeDirectory: options.makeDirectory,
|
|
439
|
+
},
|
|
419
440
|
seed: options.seed,
|
|
420
441
|
isTool: options.isTool,
|
|
421
|
-
|
|
442
|
+
traceFile: options.traceSpec?.traceFile,
|
|
422
443
|
isSanyReported: options.isSanyReported,
|
|
423
444
|
isWarningEnabled: options.isWarningEnabled,
|
|
424
445
|
version: options.version,
|
|
446
|
+
moduleOperators: options.moduleOperators,
|
|
425
447
|
});
|
|
426
448
|
reportStartup(specification, config, options.onProgress);
|
|
427
|
-
const
|
|
449
|
+
const coverage =
|
|
450
|
+
options.coverage === undefined
|
|
451
|
+
? undefined
|
|
452
|
+
: createCoverage(specification.environment.variables.length);
|
|
453
|
+
const environment: Environment = coverage
|
|
454
|
+
? {
|
|
455
|
+
...specification.environment,
|
|
456
|
+
evaluators: new WeakMap(),
|
|
457
|
+
entryEvaluators: new WeakMap(),
|
|
458
|
+
definitionEvaluators: new WeakMap(),
|
|
459
|
+
coverage,
|
|
460
|
+
}
|
|
461
|
+
: specification.environment;
|
|
428
462
|
const runtime = environment.runtime;
|
|
429
463
|
const is174 = runtime.version === "1.7.4";
|
|
430
464
|
runtime.pause = options.onPause ?? (() => {});
|
|
@@ -436,27 +470,58 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
436
470
|
specification.instanceActions,
|
|
437
471
|
);
|
|
438
472
|
const statistics = { depth: 0, initialStates: undefined as InitialStates | undefined };
|
|
473
|
+
const getTraceSpec = (trace: TraceStep[], loopStart: number | undefined) =>
|
|
474
|
+
options.traceSpec &&
|
|
475
|
+
writeTraceSpec({
|
|
476
|
+
module: options.traceSpec.module,
|
|
477
|
+
specName: specification.rootName,
|
|
478
|
+
rawConstants: config.rawConstants,
|
|
479
|
+
states: trace.map((step) => getStepState(step)),
|
|
480
|
+
loopStart,
|
|
481
|
+
modelValues: getModelValues().map((value) => value.name),
|
|
482
|
+
isDefined: (name) =>
|
|
483
|
+
environment.definitions.has(name) ||
|
|
484
|
+
environment.constants.has(name) ||
|
|
485
|
+
[...environment.definitions.keys()].some((key) =>
|
|
486
|
+
key.startsWith(`${name}${KEY_SEPARATOR}`),
|
|
487
|
+
),
|
|
488
|
+
});
|
|
439
489
|
const createResult = (
|
|
440
490
|
status: CheckStatus,
|
|
441
491
|
violation?: Omit<Violation, "loopStart"> & { loopStart?: number },
|
|
442
492
|
failure?: EvaluationFailure,
|
|
443
|
-
): CheckResult =>
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
493
|
+
): CheckResult => {
|
|
494
|
+
// TLC writes the trace it printed, and a safety property's counterexample doesn't loop back.
|
|
495
|
+
const traceSpec = getTraceSpec(
|
|
496
|
+
violation?.trace ?? failure?.trace ?? [],
|
|
497
|
+
status === "property-violation" ? undefined : violation?.loopStart,
|
|
498
|
+
);
|
|
499
|
+
return {
|
|
500
|
+
status,
|
|
501
|
+
violation: violation && { ...violation, loopStart: violation.loopStart },
|
|
502
|
+
failure,
|
|
503
|
+
generatedStates: runtime.generatedStates,
|
|
504
|
+
distinctStates: runtime.distinctStates,
|
|
505
|
+
queuedStates: runtime.queueSize,
|
|
506
|
+
depth: runtime.generatedStates === 0 ? 0 : Math.max(statistics.depth, 1),
|
|
507
|
+
initialStates: statistics.initialStates,
|
|
508
|
+
outDegrees: undefined,
|
|
509
|
+
fingerprintDistance: undefined,
|
|
510
|
+
coverage: coverage?.relations.some((relation) => relation.kind === "next")
|
|
511
|
+
? getCoverageReport(
|
|
512
|
+
coverage,
|
|
513
|
+
environment,
|
|
514
|
+
specification.variableLocations,
|
|
515
|
+
search?.getTlcOrder() ?? [],
|
|
516
|
+
)
|
|
517
|
+
: undefined,
|
|
518
|
+
...(traceSpec !== undefined && { traceSpec }),
|
|
519
|
+
};
|
|
520
|
+
};
|
|
455
521
|
const outDegrees = Array.from({ length: OUT_DEGREE_BUCKETS }, () => 0);
|
|
456
522
|
const expansion = { newStates: 0 };
|
|
457
523
|
const getOutDegreeBucket = () => Math.min(expansion.newStates, OUT_DEGREE_BUCKETS - 1);
|
|
458
|
-
// TLC counts the state it was expanding when an evaluation failed, except TLC 1.7.4
|
|
459
|
-
// worker stops before it counts the state.
|
|
524
|
+
// TLC counts the state it was expanding when an evaluation failed, except TLC 1.7.4.
|
|
460
525
|
const getPartialOutDegrees = () =>
|
|
461
526
|
outDegrees.map((count, degree) => (degree === getOutDegreeBucket() ? count + 1 : count));
|
|
462
527
|
const getFailureOutDegrees = () => (is174 ? [...outDegrees] : getPartialOutDegrees());
|
|
@@ -484,8 +549,10 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
484
549
|
const search = createSearch(
|
|
485
550
|
config,
|
|
486
551
|
environment,
|
|
552
|
+
specification.variableLocations,
|
|
487
553
|
() => order.getDeclarationOrder("variable"),
|
|
488
554
|
options.onProgress,
|
|
555
|
+
specification.moduleOperators,
|
|
489
556
|
);
|
|
490
557
|
const findViolatedAssumption = () =>
|
|
491
558
|
findAssumptionViolation(specification.assumptions, environment);
|
|
@@ -502,9 +569,11 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
502
569
|
});
|
|
503
570
|
return createSuccess();
|
|
504
571
|
}
|
|
505
|
-
const hasPostconditions =
|
|
506
|
-
|
|
507
|
-
|
|
572
|
+
const hasPostconditions =
|
|
573
|
+
config.postconditions.length > 0 ||
|
|
574
|
+
config.possible.length > 0 ||
|
|
575
|
+
specification.moduleOperators.some((operator) => operator.kind === "postcondition");
|
|
576
|
+
// The state of each step without the alias, and its action, which CounterExample records.
|
|
508
577
|
const traceSteps = new WeakMap<
|
|
509
578
|
TraceStep,
|
|
510
579
|
{ state: Record<string, Value>; action: SpecAction | undefined }
|
|
@@ -514,8 +583,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
514
583
|
const action = traceSteps.get(step)?.action;
|
|
515
584
|
return action ? toActionValue(action) : createActionRecord(step.action);
|
|
516
585
|
};
|
|
517
|
-
//
|
|
518
|
-
// what they print follows the trace.
|
|
586
|
+
// TLC checks the postconditions on each trace it prints, so what they print follows the trace.
|
|
519
587
|
const checkTracePostconditions = (
|
|
520
588
|
trace: TraceStep[],
|
|
521
589
|
loop: { start: number; action: Value } | undefined,
|
|
@@ -543,19 +611,103 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
543
611
|
violation.trace,
|
|
544
612
|
start === undefined || !getLoopAction ? undefined : { start, action: getLoopAction() },
|
|
545
613
|
);
|
|
546
|
-
const traceOutput = [...(violation.traceOutput ?? []), ...checked.lines];
|
|
547
614
|
return createResult(status, {
|
|
548
615
|
...violation,
|
|
549
|
-
...(
|
|
616
|
+
...(checked.lines.length > 0 && { postconditionOutput: checked.lines }),
|
|
550
617
|
...(checked.unwitnessed && { unwitnessed: checked.unwitnessed }),
|
|
551
618
|
...(checked.postcondition && { postcondition: checked.postcondition }),
|
|
552
619
|
});
|
|
553
620
|
};
|
|
621
|
+
// With -continue, TLC prints the trace of a violation without checking the postconditions. It
|
|
622
|
+
// never records the violation, and reports a success at the end, where tla-ts ends with the
|
|
623
|
+
// status of the first violation, as -dfid and -simulate do.
|
|
624
|
+
const continued = { status: undefined as CheckStatus | undefined };
|
|
625
|
+
const reportContinuedViolation = (
|
|
626
|
+
status: CheckStatus,
|
|
627
|
+
violation: Omit<Violation, "loopStart">,
|
|
628
|
+
) => {
|
|
629
|
+
continued.status ??= status;
|
|
630
|
+
options.onProgress?.({
|
|
631
|
+
kind: "violation",
|
|
632
|
+
status,
|
|
633
|
+
violation: { ...violation, loopStart: undefined },
|
|
634
|
+
});
|
|
635
|
+
};
|
|
554
636
|
const spec = search.spec;
|
|
555
637
|
const getFingerprintState = search.getFingerprintState;
|
|
556
638
|
const specNextActions = { value: undefined as SpecAction[] | undefined };
|
|
557
639
|
const getSpecNextActions = () =>
|
|
558
640
|
(specNextActions.value ??= getNextActions(config, environment, specification.instanceActions));
|
|
641
|
+
// Tool's constructor splits the next-state relation into actions before TLC checks anything.
|
|
642
|
+
getSpecNextActions();
|
|
643
|
+
runtime.getSuccessorAction = (state, next) =>
|
|
644
|
+
getSpecNextActions().find((action) =>
|
|
645
|
+
getSuccessors(action.expression, state, environment, action.scope).some((successor) =>
|
|
646
|
+
successor.state.every((value, index) => isSameValue(value, next[index])),
|
|
647
|
+
),
|
|
648
|
+
);
|
|
649
|
+
const addCoverageRelations = (kind: "init" | "next", actions: SpecAction[]) =>
|
|
650
|
+
actions.map((action): CoveredAction => ({
|
|
651
|
+
...action,
|
|
652
|
+
node: coverage
|
|
653
|
+
? addCoverageRelation(
|
|
654
|
+
coverage,
|
|
655
|
+
kind,
|
|
656
|
+
getCoverageLabel(action.name, action.expression, environment),
|
|
657
|
+
action.expression,
|
|
658
|
+
action.scope,
|
|
659
|
+
)
|
|
660
|
+
: -1,
|
|
661
|
+
}));
|
|
662
|
+
const coverageInits = addCoverageRelations(
|
|
663
|
+
"init",
|
|
664
|
+
coverage ? getInitActions(config, environment, specification.instanceActions) : [],
|
|
665
|
+
);
|
|
666
|
+
const coverageActions = addCoverageRelations("next", coverage ? getSpecNextActions() : []);
|
|
667
|
+
if (coverage) buildCoverage(coverage, environment, getPrimedRanges(coverageActions, environment));
|
|
668
|
+
const walkCoveredSuccessors = (
|
|
669
|
+
action: CoveredAction,
|
|
670
|
+
state: Value[],
|
|
671
|
+
onState: (successor: Value[]) => void,
|
|
672
|
+
) =>
|
|
673
|
+
walkSuccessors(
|
|
674
|
+
action,
|
|
675
|
+
action.node,
|
|
676
|
+
state,
|
|
677
|
+
environment,
|
|
678
|
+
(successor) => {
|
|
679
|
+
if (coverage) coverage.primary[action.node]++;
|
|
680
|
+
onState(successor);
|
|
681
|
+
},
|
|
682
|
+
(partial) => {
|
|
683
|
+
const missing = environment.variables.filter((_, index) => partial[index] === undefined);
|
|
684
|
+
throw new TlaIncompleteSuccessorError(
|
|
685
|
+
`Successor state is not completely specified by action ${action.name}. The following variables are not assigned: ${missing.join(", ")}`,
|
|
686
|
+
partial,
|
|
687
|
+
action.name,
|
|
688
|
+
missing,
|
|
689
|
+
);
|
|
690
|
+
},
|
|
691
|
+
);
|
|
692
|
+
const getCoveredSuccessors = (action: CoveredAction, state: Value[]) => {
|
|
693
|
+
const successors: Successor[] = [];
|
|
694
|
+
walkCoveredSuccessors(action, state, (successor) =>
|
|
695
|
+
successors.push({ state: successor, action: action.name }),
|
|
696
|
+
);
|
|
697
|
+
return successors;
|
|
698
|
+
};
|
|
699
|
+
const getCoveredInitialStates = () => {
|
|
700
|
+
const initialStates: Value[][] = [];
|
|
701
|
+
replayInitialStates(
|
|
702
|
+
coverageInits,
|
|
703
|
+
environment,
|
|
704
|
+
(state) => initialStates.push(state),
|
|
705
|
+
(partial) => {
|
|
706
|
+
throw setExitCode(new TlaIllegalStateError([...partial]), EXIT_STATUS.error);
|
|
707
|
+
},
|
|
708
|
+
);
|
|
709
|
+
return initialStates;
|
|
710
|
+
};
|
|
559
711
|
const getReplayFailure = (replay: (tracing: Environment) => void): ReplayFailure | undefined => {
|
|
560
712
|
const tracing = createTracingEnvironment(environment);
|
|
561
713
|
const callStack = tracing.callStack;
|
|
@@ -566,11 +718,14 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
566
718
|
// A replay that overflows the stack again has an empty call stack.
|
|
567
719
|
if (isStackOverflow(error)) return { callStack: [], fingerprint: undefined };
|
|
568
720
|
if (!(error instanceof TlaEvaluationError) || !callStack) return undefined;
|
|
569
|
-
return {
|
|
721
|
+
return {
|
|
722
|
+
callStack: callStack.expressions,
|
|
723
|
+
fingerprint: callStack.fingerprint,
|
|
724
|
+
replayError: error,
|
|
725
|
+
};
|
|
570
726
|
}
|
|
571
727
|
};
|
|
572
|
-
//
|
|
573
|
-
// fingerprints a value it holds.
|
|
728
|
+
// Outermost first: each value fails as it fingerprints a value it holds.
|
|
574
729
|
const findFailedSources = (value: Value, sources: CallStack["sources"]): Expression[] => {
|
|
575
730
|
if (typeof value !== "object") return [];
|
|
576
731
|
const source = sources.get(value);
|
|
@@ -580,8 +735,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
580
735
|
...(failed === undefined ? [] : findFailedSources(failed, sources)),
|
|
581
736
|
];
|
|
582
737
|
};
|
|
583
|
-
//
|
|
584
|
-
// FingerprintException when it fails to.
|
|
738
|
+
// A value the replay built raises a FingerprintException when TLC fails to fingerprint it.
|
|
585
739
|
const fingerprintReplayed = (state: Value[], callStack: CallStack | undefined) => {
|
|
586
740
|
for (const value of getFingerprintState(state)) {
|
|
587
741
|
const error = getFingerprintError(value);
|
|
@@ -597,8 +751,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
597
751
|
}
|
|
598
752
|
state.forEach(markFingerprinted);
|
|
599
753
|
};
|
|
600
|
-
//
|
|
601
|
-
// that failed after TLC added it.
|
|
754
|
+
// TLC's set of states already holds the state that failed.
|
|
602
755
|
const createReplayedStates = () => {
|
|
603
756
|
const replayed = unstoredState.fingerprint ? [unstoredState.fingerprint] : [];
|
|
604
757
|
return (state: Value[], callStack: CallStack | undefined) => {
|
|
@@ -613,12 +766,11 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
613
766
|
return true;
|
|
614
767
|
};
|
|
615
768
|
};
|
|
616
|
-
// TLC
|
|
617
|
-
//
|
|
618
|
-
// states left, then throws the exception.
|
|
769
|
+
// TLC reports its progress again as it replays the initial states. After a FingerprintException
|
|
770
|
+
// or a StackOverflowError, it only counts the states left, then throws the error.
|
|
619
771
|
const replayInit = () => {
|
|
620
772
|
const replayed = { count: 0 };
|
|
621
|
-
const deferred:
|
|
773
|
+
const deferred: unknown[] = [];
|
|
622
774
|
const addReplayed = createReplayedStates();
|
|
623
775
|
return getReplayFailure((tracing) => {
|
|
624
776
|
replayInitialStates(
|
|
@@ -648,9 +800,9 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
648
800
|
throw STOP_REPLAY;
|
|
649
801
|
}
|
|
650
802
|
} catch (error) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
803
|
+
const isFingerprintFailure =
|
|
804
|
+
error instanceof TlaEvaluationError && tracing.callStack?.fingerprint !== undefined;
|
|
805
|
+
if (!isFingerprintFailure && !isStackOverflow(error)) throw error;
|
|
654
806
|
deferred.push(error);
|
|
655
807
|
}
|
|
656
808
|
},
|
|
@@ -658,8 +810,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
658
810
|
if (deferred.length > 0) throw deferred[0];
|
|
659
811
|
});
|
|
660
812
|
};
|
|
661
|
-
// TLC
|
|
662
|
-
// the model to the -dump state graph again.
|
|
813
|
+
// TLC's replay writes each successor in the model to the -dump state graph again.
|
|
663
814
|
const replayNext = (index: number) =>
|
|
664
815
|
getReplayFailure((tracing) => {
|
|
665
816
|
const state = states[index];
|
|
@@ -673,9 +824,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
673
824
|
source,
|
|
674
825
|
getGraphState(next, depths[index] + 1),
|
|
675
826
|
!isUnseen,
|
|
676
|
-
isNamingEdges
|
|
677
|
-
? { name: action.name, signature: getActionSignature(action) }
|
|
678
|
-
: undefined,
|
|
827
|
+
isNamingEdges ? getGraphAction(action) : undefined,
|
|
679
828
|
);
|
|
680
829
|
}
|
|
681
830
|
return isUnseen;
|
|
@@ -703,33 +852,37 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
703
852
|
getSuccessors: (source, state) => {
|
|
704
853
|
const successors: LiveSuccessor[] = [];
|
|
705
854
|
if (spec.next === undefined) return successors;
|
|
706
|
-
// The constraints read the level of the state whose successors they check
|
|
707
|
-
// explored it.
|
|
855
|
+
// The constraints read the level of the state whose successors they check.
|
|
708
856
|
const livenessSource = current.livenessSource;
|
|
709
857
|
current.livenessSource = source;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
858
|
+
try {
|
|
859
|
+
forEachSuccessor(
|
|
860
|
+
spec.next,
|
|
861
|
+
state,
|
|
862
|
+
environment,
|
|
863
|
+
(successor) => {
|
|
864
|
+
canonicalizeState(successor.state);
|
|
865
|
+
const isInModel =
|
|
866
|
+
search.satisfiesConstraints(successor.state, state) &&
|
|
867
|
+
search.satisfiesActionConstraints(state, successor.state);
|
|
868
|
+
if (!isInModel) return false;
|
|
869
|
+
const fingerprintState = getFingerprintState(successor.state);
|
|
870
|
+
const index = findStateIndex(getStateHash(fingerprintState), fingerprintState);
|
|
871
|
+
successors.push({ index, state: successor.state });
|
|
872
|
+
return false;
|
|
873
|
+
},
|
|
874
|
+
spec.scope,
|
|
875
|
+
);
|
|
876
|
+
} finally {
|
|
877
|
+
current.livenessSource = livenessSource;
|
|
878
|
+
}
|
|
728
879
|
return successors;
|
|
729
880
|
},
|
|
730
881
|
}),
|
|
731
882
|
),
|
|
732
883
|
);
|
|
884
|
+
// ModelChecker rejects a temporal property whose negation has no solution.
|
|
885
|
+
if (liveness?.branches === 0) throw createTautologyError();
|
|
733
886
|
// TLC 1.7.4 creates its model checker, which TLCGet reads, once it has built the liveness checker.
|
|
734
887
|
runtime.isStarted = true;
|
|
735
888
|
const isCanonicalizedFirst = search.isSymmetric || liveness !== undefined;
|
|
@@ -739,64 +892,68 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
739
892
|
const parents: number[] = [];
|
|
740
893
|
const actions: (string | undefined)[] = [];
|
|
741
894
|
const depths: number[] = [];
|
|
742
|
-
// A Map holds at most 2^24 entries, so an open-addressing table keeps each
|
|
743
|
-
// and its index plus one side by side, probed by the hash.
|
|
895
|
+
// A Map holds at most 2^24 entries, so an open-addressing table keeps each hash and index + 1.
|
|
744
896
|
const seenStates = { slots: new Int32Array(1 << 17), size: 0, shift: 16 };
|
|
745
897
|
const canonicalizeState = createCanonicalizer();
|
|
746
898
|
|
|
747
|
-
const toRecord =
|
|
748
|
-
Object.fromEntries(
|
|
749
|
-
search.getTlcOrder().map((index) => [environment.variables[index], state[index]]),
|
|
750
|
-
);
|
|
899
|
+
const toRecord = search.toRecord;
|
|
751
900
|
const getAliasState = (
|
|
752
901
|
alias: string,
|
|
753
902
|
steps: Successor[],
|
|
754
903
|
position: number,
|
|
755
904
|
loopStart: number | undefined,
|
|
756
905
|
) => {
|
|
757
|
-
// TLC evaluates TLCGet("level") and Trace in an alias at the state's position in the trace.
|
|
906
|
+
// TLC evaluates TLCGet("level") and Trace in an alias at the state's position in the trace. The
|
|
907
|
+
// search reads them again once the alias is evaluated, as it goes on with -continue.
|
|
908
|
+
const searchLevel = runtime.getLevel;
|
|
909
|
+
const searchBehavior = runtime.getBehavior;
|
|
758
910
|
runtime.getLevel = () => position + 1;
|
|
759
911
|
runtime.getBehavior = () => steps.slice(0, position + 1).map((step) => step.state);
|
|
760
|
-
return evaluateAlias(
|
|
761
|
-
alias,
|
|
762
|
-
steps[position].state,
|
|
763
|
-
(steps[position + 1] ?? steps[loopStart ?? position]).state,
|
|
764
|
-
);
|
|
765
|
-
};
|
|
766
|
-
const evaluateAlias = (alias: string, state: Value[], next: Value[] | undefined) => {
|
|
767
912
|
try {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
_ALIASEvalError: formatNestedMessage(error.message, options.isTool ?? false),
|
|
777
|
-
};
|
|
913
|
+
return evaluateAlias(
|
|
914
|
+
alias,
|
|
915
|
+
steps[position].state,
|
|
916
|
+
(steps[position + 1] ?? steps[loopStart ?? position]).state,
|
|
917
|
+
);
|
|
918
|
+
} finally {
|
|
919
|
+
runtime.getLevel = searchLevel;
|
|
920
|
+
runtime.getBehavior = searchBehavior;
|
|
778
921
|
}
|
|
779
922
|
};
|
|
780
|
-
|
|
781
|
-
|
|
923
|
+
const evaluateAlias = (alias: string, state: Value[], next: Value[] | undefined) =>
|
|
924
|
+
search.evaluateAlias(alias, state, next, options.isTool ?? false);
|
|
925
|
+
// TLC finds the action of a step as the first that takes it, evaluated as when the search
|
|
926
|
+
// expanded the previous state, by a held successor's values and otherwise by fingerprint.
|
|
782
927
|
const findStepAction = (index: number, previous: Value[], state: Value[], isHeld: boolean) => {
|
|
783
928
|
const actions = getSpecNextActions();
|
|
784
929
|
const expanding = { ...current };
|
|
785
|
-
Object.assign(current, {
|
|
930
|
+
Object.assign(current, {
|
|
931
|
+
index,
|
|
932
|
+
isExpanding: true,
|
|
933
|
+
candidate: undefined,
|
|
934
|
+
rebuilt: { state: previous, level: depths[index] },
|
|
935
|
+
});
|
|
786
936
|
const getKey = isHeld ? (values: Value[]) => values : getFingerprintState;
|
|
787
937
|
const key = getKey(state);
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
938
|
+
try {
|
|
939
|
+
return coverage
|
|
940
|
+
? coverageActions.find((item) =>
|
|
941
|
+
getCoveredSuccessors(item, previous).some((successor) =>
|
|
942
|
+
isSameState(getKey(successor.state), key),
|
|
943
|
+
),
|
|
944
|
+
)
|
|
945
|
+
: actions.find((item) =>
|
|
946
|
+
getSuccessors(item.expression, previous, environment, item.scope).some((successor) =>
|
|
947
|
+
isSameState(getKey(successor.state), key),
|
|
948
|
+
),
|
|
949
|
+
);
|
|
950
|
+
} finally {
|
|
951
|
+
Object.assign(current, expanding);
|
|
952
|
+
}
|
|
795
953
|
};
|
|
796
|
-
//
|
|
797
|
-
//
|
|
798
|
-
//
|
|
799
|
-
// or TLC is 1.7.4.
|
|
954
|
+
// TLC rebuilds the states it doesn't keep, all but the last `known`, from the initial predicate,
|
|
955
|
+
// finds the action of each later step, and then rebuilds the trace once more, unless it is a
|
|
956
|
+
// liveness counterexample or TLC is 1.7.4.
|
|
800
957
|
const toTrace = (
|
|
801
958
|
steps: Successor[],
|
|
802
959
|
path: number[],
|
|
@@ -821,9 +978,26 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
821
978
|
);
|
|
822
979
|
const outputs = stepActions.map((step) => step.lines);
|
|
823
980
|
const loopStart = traceOptions.loopStart;
|
|
824
|
-
// 1.7.4
|
|
825
|
-
// each state of the cycle as it prints it.
|
|
981
|
+
// TLC 1.7.4 rebuilds a lasso up to its cycle at once, then each cycle state as it prints it.
|
|
826
982
|
const rebuilt = is174 && loopStart !== undefined ? loopStart + 1 : steps.length - known;
|
|
983
|
+
// What the trace prints once comes from each time TLC rebuilds it, which coverage counts.
|
|
984
|
+
if (coverage && steps.length > 1) {
|
|
985
|
+
const isRebuiltAgain = known > 0 && !is174;
|
|
986
|
+
if (rebuilt > 0 && isRebuiltAgain) captureOutput(getSpecInitialStates);
|
|
987
|
+
if (isRebuiltAgain) {
|
|
988
|
+
steps.slice(1).forEach((step, position) => {
|
|
989
|
+
if (step.action === "Stuttering") return;
|
|
990
|
+
captureOutput(() =>
|
|
991
|
+
findStepAction(
|
|
992
|
+
path[position],
|
|
993
|
+
steps[position].state,
|
|
994
|
+
step.state,
|
|
995
|
+
known === 2 && position === steps.length - 2,
|
|
996
|
+
),
|
|
997
|
+
);
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
827
1001
|
const prefixOutput = rebuilt > 0 ? [initialOutput, ...outputs.slice(1, rebuilt)].flat() : [];
|
|
828
1002
|
return {
|
|
829
1003
|
trace: steps.map((step, position) => {
|
|
@@ -845,11 +1019,12 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
845
1019
|
traceOutput: known > 0 && !is174 ? [initialOutput, ...outputs].flat() : [],
|
|
846
1020
|
};
|
|
847
1021
|
};
|
|
848
|
-
const getSpecInitialStates = () =>
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
//
|
|
1022
|
+
const getSpecInitialStates = () => {
|
|
1023
|
+
if (coverage) return getCoveredInitialStates();
|
|
1024
|
+
return spec.init === undefined ? [] : getInitialStates(spec.init, environment, spec.scope);
|
|
1025
|
+
};
|
|
1026
|
+
// TLC rebuilds a successor action by action, up to the first that generates it. A trace keeps
|
|
1027
|
+
// what the spec prints as TLC rebuilds it, so finding its states prints nothing.
|
|
853
1028
|
const findTraceSuccessor = (state: Value[], isMatch: (successor: Successor) => boolean) =>
|
|
854
1029
|
captureOutput(() => {
|
|
855
1030
|
for (const action of getSpecNextActions()) {
|
|
@@ -878,7 +1053,11 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
878
1053
|
steps.push({ state: previous, action: "Stuttering" });
|
|
879
1054
|
continue;
|
|
880
1055
|
}
|
|
1056
|
+
// TLC rebuilds each state at its level, which TLCGet reads.
|
|
1057
|
+
const rebuilt = current.rebuilt;
|
|
1058
|
+
current.rebuilt = { state: previous, level: depths[path[position - 1]] };
|
|
881
1059
|
const successor = findSuccessorWithFingerprint(previous, path[position]);
|
|
1060
|
+
current.rebuilt = rebuilt;
|
|
882
1061
|
if (!successor) throw new TlaEvaluationError(nextFailure);
|
|
883
1062
|
steps.push(successor);
|
|
884
1063
|
}
|
|
@@ -901,24 +1080,45 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
901
1080
|
: lastSuccessor.action;
|
|
902
1081
|
return toTrace([...steps, { state: lastSuccessor.state, action }], path, { known: 2 });
|
|
903
1082
|
};
|
|
904
|
-
// TLC
|
|
905
|
-
//
|
|
1083
|
+
// TLC rebuilds a lone initial state, unlike TLC 1.7.4. TLCTrace#printTrace prints it without the
|
|
1084
|
+
// alias, where tla-ts applies the alias as it does to every other trace.
|
|
906
1085
|
const getStateTrace = (index: number): Behavior =>
|
|
907
1086
|
parents[index] === -1
|
|
908
1087
|
? {
|
|
909
|
-
trace: [
|
|
1088
|
+
trace: [
|
|
1089
|
+
{
|
|
1090
|
+
action: undefined,
|
|
1091
|
+
label: undefined,
|
|
1092
|
+
state:
|
|
1093
|
+
config.alias === undefined
|
|
1094
|
+
? toRecord(states[index])
|
|
1095
|
+
: getAliasState(
|
|
1096
|
+
config.alias,
|
|
1097
|
+
[{ state: states[index], action: undefined }],
|
|
1098
|
+
0,
|
|
1099
|
+
undefined,
|
|
1100
|
+
),
|
|
1101
|
+
},
|
|
1102
|
+
],
|
|
910
1103
|
traceOutput: is174 ? [] : captureOutput(getSpecInitialStates).lines,
|
|
911
1104
|
}
|
|
912
1105
|
: getTrace(index);
|
|
913
|
-
// TLC rebuilds the trace
|
|
914
|
-
// an
|
|
1106
|
+
// TLC rebuilds the trace for the postcondition after a violation, but not after a failure.
|
|
1107
|
+
// TLC fails again to fingerprint the successor in the trace, as an unexpected exception.
|
|
1108
|
+
const isUnfingerprintable = (state: Value[]) => {
|
|
1109
|
+
try {
|
|
1110
|
+
return getFingerprintState(state).some((value) => getFingerprintError(value) !== undefined);
|
|
1111
|
+
} catch (error) {
|
|
1112
|
+
if (!(error instanceof TlaEvaluationError)) throw error;
|
|
1113
|
+
return true;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
915
1116
|
const getFailedTrace = (index: number, successor: Successor): Behavior => ({
|
|
916
1117
|
trace: getTrace(index, successor).trace,
|
|
917
1118
|
});
|
|
918
1119
|
// TLC names the initial state it was checking unless a standard module's Java code failed.
|
|
919
1120
|
const getFailureExitCode = (error: TlaEvaluationError, failureOptions: FailureOptions) => {
|
|
920
|
-
// TLC 1.7.4 exits with the result of
|
|
921
|
-
// when the error isn't in adding a state it has already seen to the behavior graph.
|
|
1121
|
+
// TLC 1.7.4 exits with the result of replaying the initial states, which fails again only here.
|
|
922
1122
|
if (
|
|
923
1123
|
failureOptions.isInitial &&
|
|
924
1124
|
!failureOptions.callStack &&
|
|
@@ -937,11 +1137,10 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
937
1137
|
getExitCode(error) ?? (error instanceof TlaModuleError ? error.exitCode : EXIT_STATUS.error)
|
|
938
1138
|
);
|
|
939
1139
|
}
|
|
940
|
-
// TLC exits with the code of a failed
|
|
941
|
-
// it does for a replay that fails to fingerprint.
|
|
1140
|
+
// TLC exits with the code of a failed initial replay whatever the error, as for a fingerprint.
|
|
942
1141
|
return failureOptions.isInitial || failureOptions.fingerprint
|
|
943
1142
|
? EXIT_STATUS.specEvaluationFailure
|
|
944
|
-
: getReplayExitCode(error);
|
|
1143
|
+
: getReplayExitCode(failureOptions.replayError ?? error);
|
|
945
1144
|
};
|
|
946
1145
|
const createFailureResult = (
|
|
947
1146
|
failed: unknown,
|
|
@@ -975,21 +1174,27 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
975
1174
|
outDegrees: failureOptions.outDegrees,
|
|
976
1175
|
};
|
|
977
1176
|
};
|
|
978
|
-
// TLC reports a successor
|
|
979
|
-
// with the partial state. It names the action when the next-state relation has several.
|
|
1177
|
+
// TLC reports a partial successor with the trace to it, naming the action if there are several.
|
|
980
1178
|
const reportIncompleteSuccessor = (index: number, error: TlaIncompleteSuccessorError) => {
|
|
981
1179
|
runtime.generatedStates++;
|
|
982
1180
|
const actions = getSpecNextActions();
|
|
1181
|
+
const named =
|
|
1182
|
+
actions.length === 1 ? actions : actions.filter((item) => item.name === error.action);
|
|
1183
|
+
// Inline disjuncts of the next-state relation share its name, so TLC's is the one that failed.
|
|
983
1184
|
const action =
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
const
|
|
992
|
-
|
|
1185
|
+
named.length === 1
|
|
1186
|
+
? named[0]
|
|
1187
|
+
: captureOutput(() =>
|
|
1188
|
+
named.find((item) =>
|
|
1189
|
+
hasIncompleteSuccessor(item.expression, states[index], environment, item.scope),
|
|
1190
|
+
),
|
|
1191
|
+
).result;
|
|
1192
|
+
const message = getIncompleteSuccessorMessage(
|
|
1193
|
+
error.variables,
|
|
1194
|
+
error.action,
|
|
1195
|
+
actions.length,
|
|
1196
|
+
options.version,
|
|
1197
|
+
);
|
|
993
1198
|
const undefinedValue = createModelValue("null");
|
|
994
1199
|
const partial = error.state.map((value) => value ?? undefinedValue);
|
|
995
1200
|
const failure = createFailureResult(error, getStateTrace(index));
|
|
@@ -1072,8 +1277,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1072
1277
|
}
|
|
1073
1278
|
insertSeen(hash, index + 1);
|
|
1074
1279
|
};
|
|
1075
|
-
//
|
|
1076
|
-
// the check stores after.
|
|
1280
|
+
// TLC adds a new successor to its states before it checks it, which the check stores after.
|
|
1077
1281
|
const unstoredState = { fingerprint: undefined as Value[] | undefined };
|
|
1078
1282
|
const countDistinctState = (depth: number) => {
|
|
1079
1283
|
runtime.distinctStates = states.length + 1;
|
|
@@ -1100,6 +1304,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1100
1304
|
candidate: undefined as Value[] | undefined,
|
|
1101
1305
|
candidateLevel: 0,
|
|
1102
1306
|
livenessSource: -1,
|
|
1307
|
+
rebuilt: undefined as { state: Value[]; level: number } | undefined,
|
|
1103
1308
|
};
|
|
1104
1309
|
const getPath = (index: number): Value[][] =>
|
|
1105
1310
|
index === -1 ? [] : [...getPath(parents[index]), states[index]];
|
|
@@ -1122,6 +1327,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1122
1327
|
const explored = source !== -1 ? source : current.isExpanding ? current.index : -1;
|
|
1123
1328
|
return explored === -1 ? 0 : depths[explored];
|
|
1124
1329
|
}
|
|
1330
|
+
const rebuilt = current.rebuilt;
|
|
1331
|
+
if (rebuilt) return state === rebuilt.state ? rebuilt.level : rebuilt.level + 1;
|
|
1125
1332
|
if (source !== -1) return state === states[source] ? depths[source] : depths[source] + 1;
|
|
1126
1333
|
if (state === current.candidate) return current.candidateLevel;
|
|
1127
1334
|
if (current.index === -1) return 0;
|
|
@@ -1129,6 +1336,10 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1129
1336
|
return current.isExpanding ? depths[current.index] + 1 : 0;
|
|
1130
1337
|
};
|
|
1131
1338
|
|
|
1339
|
+
const getGraphAction = (action: SpecAction) => ({
|
|
1340
|
+
name: action.name,
|
|
1341
|
+
signature: getActionSignature(action),
|
|
1342
|
+
});
|
|
1132
1343
|
const getGraphState = (state: Value[], level: number): GraphState => ({
|
|
1133
1344
|
fingerprint: BigInt.asIntN(64, runtime.getFingerprint(state)),
|
|
1134
1345
|
level,
|
|
@@ -1164,7 +1375,15 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1164
1375
|
liveness?.addInitialState(states.length, state);
|
|
1165
1376
|
stateWriter?.writeInitialState(getGraphState(state, 1));
|
|
1166
1377
|
}
|
|
1167
|
-
|
|
1378
|
+
if (options.isContinued) {
|
|
1379
|
+
search.getViolatedInvariants(state).forEach((invariant) =>
|
|
1380
|
+
reportContinuedViolation("invariant-violation", {
|
|
1381
|
+
name: invariant.name,
|
|
1382
|
+
...toTrace([{ action: undefined, state }], []),
|
|
1383
|
+
}),
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
const violated = options.isContinued ? undefined : search.findViolatedInvariant(state);
|
|
1168
1387
|
if (violated) {
|
|
1169
1388
|
return reportViolation("invariant-violation", {
|
|
1170
1389
|
name: violated.name,
|
|
@@ -1212,9 +1431,22 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1212
1431
|
source,
|
|
1213
1432
|
getGraphState(successor.state, depths[index] + 1),
|
|
1214
1433
|
existing !== -1,
|
|
1215
|
-
action &&
|
|
1434
|
+
action && getGraphAction(action),
|
|
1216
1435
|
);
|
|
1217
1436
|
}
|
|
1437
|
+
if (source && !isInModel && options.dump?.constrained) {
|
|
1438
|
+
const excluded = getGraphState(successor.state, depths[index] + 1);
|
|
1439
|
+
search
|
|
1440
|
+
.getExcludingConstraints(state, successor.state)
|
|
1441
|
+
.forEach((constraint) =>
|
|
1442
|
+
stateWriter?.writeConstrained(
|
|
1443
|
+
source,
|
|
1444
|
+
excluded,
|
|
1445
|
+
action && getGraphAction(action),
|
|
1446
|
+
constraint,
|
|
1447
|
+
),
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1218
1450
|
if (existing !== -1 && liveness) {
|
|
1219
1451
|
const stored = states[existing];
|
|
1220
1452
|
const isStored = stored.every((value, position) => value === successor.state[position]);
|
|
@@ -1227,23 +1459,20 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1227
1459
|
if (isNew) {
|
|
1228
1460
|
countDistinctState(depths[index] + 1);
|
|
1229
1461
|
expansion.newStates++;
|
|
1462
|
+
if (coverage) coverage.secondary[coveredAction.node]++;
|
|
1230
1463
|
}
|
|
1231
1464
|
if (existing === -1) {
|
|
1232
1465
|
try {
|
|
1233
1466
|
const violated = search.findViolatedInvariant(successor.state, state);
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
name: violated.name,
|
|
1238
|
-
...getTrace(index, successor),
|
|
1239
|
-
}),
|
|
1240
|
-
);
|
|
1467
|
+
const violation = violated && { name: violated.name, ...getTrace(index, successor) };
|
|
1468
|
+
if (violation && !options.isContinued) {
|
|
1469
|
+
return withOutDegrees(reportViolation("invariant-violation", violation));
|
|
1241
1470
|
}
|
|
1471
|
+
if (violation) reportContinuedViolation("invariant-violation", violation);
|
|
1242
1472
|
} catch (error) {
|
|
1243
1473
|
if (isStackOverflow(error)) throw error;
|
|
1244
|
-
// TLC replays the expansion and skips the invariants of a state
|
|
1245
|
-
// included unless the constraints exclude it.
|
|
1246
|
-
// leaves out the outdegree.
|
|
1474
|
+
// TLC replays the expansion and skips the invariants of a seen state, the failed one
|
|
1475
|
+
// included unless the constraints exclude it. A failed replay leaves out the outdegree.
|
|
1247
1476
|
const replay = captureOutput(() => replayNext(index));
|
|
1248
1477
|
return createFailureResult(
|
|
1249
1478
|
error,
|
|
@@ -1253,15 +1482,16 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1253
1482
|
}
|
|
1254
1483
|
}
|
|
1255
1484
|
const violatedProperty = search.findViolatedActionProperty(state, successor.state);
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
);
|
|
1485
|
+
const propertyViolation = violatedProperty && {
|
|
1486
|
+
name: violatedProperty.name,
|
|
1487
|
+
...getTrace(index, successor),
|
|
1488
|
+
};
|
|
1489
|
+
if (propertyViolation && !options.isContinued) {
|
|
1490
|
+
return withOutDegrees(reportViolation("liveness-violation", propertyViolation));
|
|
1263
1491
|
}
|
|
1492
|
+
if (propertyViolation) reportContinuedViolation("liveness-violation", propertyViolation);
|
|
1264
1493
|
if (!isNew) return undefined;
|
|
1494
|
+
if (coverage) countCoverageVariables(coverage, successor.state);
|
|
1265
1495
|
if (!isCanonicalizedFirst) canonicalizeState(successor.state);
|
|
1266
1496
|
markSeen(hash, states.length);
|
|
1267
1497
|
addState(successor.state, fingerprintState, index, successor.action);
|
|
@@ -1270,38 +1500,64 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1270
1500
|
};
|
|
1271
1501
|
|
|
1272
1502
|
const outcome: { result: CheckResult | undefined } = { result: undefined };
|
|
1503
|
+
const coveredAction = { node: -1 };
|
|
1273
1504
|
if (liveness) {
|
|
1274
1505
|
options.onProgress?.({ kind: "liveness-prepared", branches: liveness.branches });
|
|
1275
1506
|
}
|
|
1276
|
-
// TLC checks the assumptions once it has built the liveness checker
|
|
1277
|
-
// constructor.
|
|
1507
|
+
// TLC checks the assumptions once it has built the liveness checker.
|
|
1278
1508
|
const assumptionViolation = findViolatedAssumption();
|
|
1279
1509
|
if (assumptionViolation) return createResult("assumption-violation", assumptionViolation);
|
|
1280
1510
|
options.onProgress?.({ kind: "initial-states-started" });
|
|
1281
1511
|
if (spec.init !== undefined) {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
} catch (error) {
|
|
1291
|
-
const replay = captureOutput(replayInit);
|
|
1292
|
-
outcome.result = createFailureResult(
|
|
1293
|
-
error,
|
|
1294
|
-
{ trace: [], traceOutput: replay.lines },
|
|
1295
|
-
{ initialState: state, ...replay.result, isInitial: true },
|
|
1296
|
-
);
|
|
1297
|
-
}
|
|
1298
|
-
return outcome.result !== undefined;
|
|
1299
|
-
},
|
|
1300
|
-
spec.scope,
|
|
1512
|
+
// TLC keeps an initial state's StackOverflowError, counts the states after it, then reports it.
|
|
1513
|
+
const overflow: { state: Value[] | undefined } = { state: undefined };
|
|
1514
|
+
const reportInitialFailure = (error: unknown, state: Value[]) => {
|
|
1515
|
+
const replay = captureOutput(replayInit);
|
|
1516
|
+
return createFailureResult(
|
|
1517
|
+
error,
|
|
1518
|
+
{ trace: [], traceOutput: replay.lines },
|
|
1519
|
+
{ initialState: state, ...replay.result, isInitial: true },
|
|
1301
1520
|
);
|
|
1521
|
+
};
|
|
1522
|
+
try {
|
|
1523
|
+
const onInitialState = (state: Value[]) => {
|
|
1524
|
+
reportInitialStatesProgress(runtime.initialStates, options.onProgress);
|
|
1525
|
+
if (overflow.state) {
|
|
1526
|
+
runtime.generatedStates++;
|
|
1527
|
+
runtime.initialStates++;
|
|
1528
|
+
return false;
|
|
1529
|
+
}
|
|
1530
|
+
try {
|
|
1531
|
+
outcome.result = visitInitialState(state);
|
|
1532
|
+
} catch (error) {
|
|
1533
|
+
if (isStackOverflow(error)) overflow.state = state;
|
|
1534
|
+
else outcome.result = reportInitialFailure(error, state);
|
|
1535
|
+
}
|
|
1536
|
+
return outcome.result !== undefined;
|
|
1537
|
+
};
|
|
1538
|
+
if (coverage) {
|
|
1539
|
+
try {
|
|
1540
|
+
replayInitialStates(
|
|
1541
|
+
coverageInits,
|
|
1542
|
+
environment,
|
|
1543
|
+
(state) => {
|
|
1544
|
+
if (onInitialState(state)) throw STOP_WALK;
|
|
1545
|
+
},
|
|
1546
|
+
(partial) => {
|
|
1547
|
+
throw setExitCode(new TlaIllegalStateError([...partial]), EXIT_STATUS.error);
|
|
1548
|
+
},
|
|
1549
|
+
);
|
|
1550
|
+
} catch (error) {
|
|
1551
|
+
if (error !== STOP_WALK) throw error;
|
|
1552
|
+
}
|
|
1553
|
+
} else {
|
|
1554
|
+
forEachInitialState(spec.init, environment, onInitialState, spec.scope);
|
|
1555
|
+
}
|
|
1556
|
+
if (overflow.state) {
|
|
1557
|
+
outcome.result = reportInitialFailure(createStackOverflowError(), overflow.state);
|
|
1558
|
+
}
|
|
1302
1559
|
} catch (error) {
|
|
1303
|
-
// TLC prints
|
|
1304
|
-
// stops before it prints the statistics.
|
|
1560
|
+
// TLC prints null for each undefined variable and stops before the statistics.
|
|
1305
1561
|
if (error instanceof TlaIllegalStateError) {
|
|
1306
1562
|
const illegal = createFailureResult(
|
|
1307
1563
|
error,
|
|
@@ -1341,15 +1597,33 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1341
1597
|
}
|
|
1342
1598
|
return createSuccess();
|
|
1343
1599
|
}
|
|
1344
|
-
// TLC labels and colors
|
|
1345
|
-
//
|
|
1600
|
+
// TLC labels and colors a -dump edge by its action, so a graph that names its edges generates
|
|
1601
|
+
// successors action by action.
|
|
1346
1602
|
const isNamingEdges = Boolean(
|
|
1347
1603
|
options.dump?.dot && (options.dump.actionLabels || options.dump.colorize),
|
|
1348
1604
|
);
|
|
1349
1605
|
const forEachActionSuccessor = (
|
|
1350
1606
|
state: Value[],
|
|
1607
|
+
onUnsatisfied:
|
|
1608
|
+
| ((successor: Value[], conjunct: Expression, action?: SpecAction) => void)
|
|
1609
|
+
| undefined,
|
|
1351
1610
|
onSuccessor: (successor: Successor, action: SpecAction | undefined) => boolean,
|
|
1352
1611
|
) => {
|
|
1612
|
+
if (coverage) {
|
|
1613
|
+
const progress = { count: 0 };
|
|
1614
|
+
try {
|
|
1615
|
+
coverageActions.forEach((action) => {
|
|
1616
|
+
coveredAction.node = action.node;
|
|
1617
|
+
walkCoveredSuccessors(action, state, (successor) => {
|
|
1618
|
+
progress.count++;
|
|
1619
|
+
if (onSuccessor({ state: successor, action: action.name }, action)) throw STOP_WALK;
|
|
1620
|
+
});
|
|
1621
|
+
});
|
|
1622
|
+
} catch (error) {
|
|
1623
|
+
if (error !== STOP_WALK) throw error;
|
|
1624
|
+
}
|
|
1625
|
+
return progress.count;
|
|
1626
|
+
}
|
|
1353
1627
|
if (!isNamingEdges) {
|
|
1354
1628
|
return forEachSuccessor(
|
|
1355
1629
|
next,
|
|
@@ -1357,6 +1631,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1357
1631
|
environment,
|
|
1358
1632
|
(successor) => onSuccessor(successor, undefined),
|
|
1359
1633
|
spec.scope,
|
|
1634
|
+
undefined,
|
|
1635
|
+
onUnsatisfied,
|
|
1360
1636
|
);
|
|
1361
1637
|
}
|
|
1362
1638
|
const progress = { isStopped: false };
|
|
@@ -1373,13 +1649,14 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1373
1649
|
return progress.isStopped;
|
|
1374
1650
|
},
|
|
1375
1651
|
action.scope,
|
|
1652
|
+
undefined,
|
|
1653
|
+
onUnsatisfied && ((successor, conjunct) => onUnsatisfied(successor, conjunct, action)),
|
|
1376
1654
|
)
|
|
1377
1655
|
);
|
|
1378
1656
|
}, 0);
|
|
1379
1657
|
};
|
|
1380
|
-
// TLC's worker adds a state to the behavior graph even after its next states fail
|
|
1381
|
-
//
|
|
1382
|
-
// FingerprintException, which the worker doesn't catch. TLC 1.7.4 prints none.
|
|
1658
|
+
// TLC's worker adds a state to the behavior graph even after its next states fail, and prints
|
|
1659
|
+
// the call stack of an error in that, unless it is a FingerprintException. TLC 1.7.4 prints none.
|
|
1383
1660
|
const getLiveCallStack = (index: number, liveSuccessors: LiveSuccessor[]) => {
|
|
1384
1661
|
if (!liveness || is174) return undefined;
|
|
1385
1662
|
const replay = getReplayFailure((tracing) =>
|
|
@@ -1387,9 +1664,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1387
1664
|
);
|
|
1388
1665
|
return replay?.callStack.length && !replay.fingerprint ? replay.callStack : undefined;
|
|
1389
1666
|
};
|
|
1390
|
-
//
|
|
1391
|
-
//
|
|
1392
|
-
// which TLC 1.7.4 doesn't.
|
|
1667
|
+
// On an error in adding the state after the trace, TLC adds it again to print the call stack
|
|
1668
|
+
// instead of replaying the next-state relation, which TLC 1.7.4 doesn't.
|
|
1393
1669
|
const addFailedLiveState = (index: number, liveSuccessors: LiveSuccessor[]) => {
|
|
1394
1670
|
try {
|
|
1395
1671
|
liveness?.addState(index, states[index], liveSuccessors);
|
|
@@ -1408,10 +1684,9 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1408
1684
|
const replay = captureOutput(() => replayNext(index));
|
|
1409
1685
|
return { result: replay.result, lines: [...live.lines, ...replay.lines] };
|
|
1410
1686
|
};
|
|
1411
|
-
// TLC reports a stack overflow
|
|
1412
|
-
// behavior up to the state it expands.
|
|
1687
|
+
// TLC reports a stack overflow in the next states without a replay, up to the state it expands.
|
|
1413
1688
|
const reportNextStateOverflow = (index: number) =>
|
|
1414
|
-
createFailureResult(createStackOverflowError(), getStateTrace(index));
|
|
1689
|
+
createFailureResult(createStackOverflowError(), getStateTrace(index), { isNextState: true });
|
|
1415
1690
|
// After the trace, TLC replays the next-state relation with its call stack, printing again.
|
|
1416
1691
|
const reportNextStateFailure = (
|
|
1417
1692
|
error: unknown,
|
|
@@ -1429,7 +1704,17 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1429
1704
|
const expandState = (index: number, liveSuccessors: LiveSuccessor[]) => {
|
|
1430
1705
|
const state = states[index];
|
|
1431
1706
|
const source = stateWriter && getGraphState(state, depths[index]);
|
|
1432
|
-
const
|
|
1707
|
+
const writeUnsatisfied =
|
|
1708
|
+
source && options.dump?.constrained
|
|
1709
|
+
? (successor: Value[], conjunct: Expression, action?: SpecAction) =>
|
|
1710
|
+
stateWriter?.writeConstrained(
|
|
1711
|
+
source,
|
|
1712
|
+
getGraphState(successor, depths[index] + 1),
|
|
1713
|
+
action && getGraphAction(action),
|
|
1714
|
+
describeRange(conjunct),
|
|
1715
|
+
)
|
|
1716
|
+
: undefined;
|
|
1717
|
+
const successorCount = forEachActionSuccessor(state, writeUnsatisfied, (successor, action) => {
|
|
1433
1718
|
try {
|
|
1434
1719
|
outcome.result = visitSuccessor(index, successor, liveSuccessors, source, action);
|
|
1435
1720
|
} catch (error) {
|
|
@@ -1437,9 +1722,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1437
1722
|
outcome.result = reportNextStateOverflow(index);
|
|
1438
1723
|
return true;
|
|
1439
1724
|
}
|
|
1440
|
-
// TLC 1.7.4 reports the wrapped error without the trace, except for a failed property,
|
|
1441
|
-
//
|
|
1442
|
-
// adds the state to the behavior graph.
|
|
1725
|
+
// TLC 1.7.4 reports the wrapped error without the trace, except for a failed property, and
|
|
1726
|
+
// stops its worker before it adds the state to the behavior graph.
|
|
1443
1727
|
const replay = is174
|
|
1444
1728
|
? captureOutput(() => replayNext(index))
|
|
1445
1729
|
: replayFailedNext(index, liveSuccessors);
|
|
@@ -1451,11 +1735,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1451
1735
|
);
|
|
1452
1736
|
return true;
|
|
1453
1737
|
}
|
|
1454
|
-
|
|
1455
|
-
// reports as an exception it didn't expect.
|
|
1456
|
-
const isTraceFailed = getFingerprintState(successor.state).some(
|
|
1457
|
-
(value) => getFingerprintError(value) !== undefined,
|
|
1458
|
-
);
|
|
1738
|
+
const isTraceFailed = isUnfingerprintable(successor.state);
|
|
1459
1739
|
const traceFailure =
|
|
1460
1740
|
isTraceFailed && error instanceof TlaEvaluationError
|
|
1461
1741
|
? getFailureMessage(
|
|
@@ -1489,7 +1769,9 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1489
1769
|
}
|
|
1490
1770
|
if (result) return result;
|
|
1491
1771
|
const addLiveState = () => {
|
|
1492
|
-
if (liveness && source && is174
|
|
1772
|
+
if (liveness && source && (is174 || options.dump?.stuttering)) {
|
|
1773
|
+
stateWriter?.writeStuttering(source);
|
|
1774
|
+
}
|
|
1493
1775
|
const accepted = liveness?.addState(index, state, liveSuccessors);
|
|
1494
1776
|
if (!liveness || !accepted) return undefined;
|
|
1495
1777
|
const steps = getPathSteps(accepted);
|
|
@@ -1506,9 +1788,8 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1506
1788
|
};
|
|
1507
1789
|
if (successorCount === 0 && config.checkDeadlock) {
|
|
1508
1790
|
const deadlock = reportViolation("deadlock", { name: "deadlock", ...getStateTrace(index) });
|
|
1509
|
-
// TLC's worker still adds the deadlocked state to the behavior graph
|
|
1510
|
-
//
|
|
1511
|
-
// expanded.
|
|
1791
|
+
// TLC's worker still adds the deadlocked state to the behavior graph, reports a temporal
|
|
1792
|
+
// property that violates, and then counts the state as expanded.
|
|
1512
1793
|
const live = captureOutput(() => {
|
|
1513
1794
|
try {
|
|
1514
1795
|
return { additional: addLiveState()?.violation };
|
|
@@ -1532,8 +1813,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1532
1813
|
try {
|
|
1533
1814
|
return addLiveState();
|
|
1534
1815
|
} catch (error) {
|
|
1535
|
-
// TLC 1.7.4
|
|
1536
|
-
// it didn't expect, without the trace or a call stack, and exits as for any general error.
|
|
1816
|
+
// TLC 1.7.4 reports this as an unexpected exception, without the trace or a call stack.
|
|
1537
1817
|
if (is174 && error instanceof TlaEvaluationError) {
|
|
1538
1818
|
const unexpected = new TlaEvaluationError(
|
|
1539
1819
|
`${isEvalException(error) ? UNEXPECTED_EVAL_EXCEPTION : UNEXPECTED_EXCEPTION}${error.message}`,
|
|
@@ -1544,8 +1824,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1544
1824
|
{ outDegrees: getFailureOutDegrees() },
|
|
1545
1825
|
);
|
|
1546
1826
|
}
|
|
1547
|
-
// TLC
|
|
1548
|
-
// before the error, and reports the error as one in computing next states.
|
|
1827
|
+
// TLC adds the state again for the call stack, prints it first, and blames the next states.
|
|
1549
1828
|
const replay = getReplayFailure((tracing) =>
|
|
1550
1829
|
liveness?.addState(index, state, liveSuccessors, tracing),
|
|
1551
1830
|
);
|
|
@@ -1557,7 +1836,6 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1557
1836
|
});
|
|
1558
1837
|
}
|
|
1559
1838
|
};
|
|
1560
|
-
// TLC's Liveness#printStutteringCounterExampleWarning.
|
|
1561
1839
|
const getStutteringWarning = () => {
|
|
1562
1840
|
const name = config.specification;
|
|
1563
1841
|
const book =
|
|
@@ -1613,9 +1891,14 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1613
1891
|
: createActionRecord(findSuccessorWithFingerprint(lastState, cycleStart)?.action),
|
|
1614
1892
|
);
|
|
1615
1893
|
};
|
|
1616
|
-
const isPeriodic = liveness !== undefined && options.livenessCheck
|
|
1894
|
+
const isPeriodic = liveness !== undefined && (options.livenessCheck ?? "default") === "default";
|
|
1617
1895
|
const startedAt = performance.now();
|
|
1618
|
-
const periodic = {
|
|
1896
|
+
const periodic = {
|
|
1897
|
+
at: startedAt + PERIODIC_START,
|
|
1898
|
+
size: 1,
|
|
1899
|
+
time: 0,
|
|
1900
|
+
coverageCount: Math.trunc(options.coverage ?? 0),
|
|
1901
|
+
};
|
|
1619
1902
|
const findPeriodicViolation = (expanded: number) => {
|
|
1620
1903
|
const now = performance.now();
|
|
1621
1904
|
const isGrown = (expanded - periodic.size) / periodic.size > LIVENESS_GROWTH;
|
|
@@ -1651,45 +1934,56 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1651
1934
|
if (outcome.result) return outcome.result;
|
|
1652
1935
|
outDegrees[getOutDegreeBucket()]++;
|
|
1653
1936
|
expansion.newStates = 0;
|
|
1654
|
-
// TLC
|
|
1655
|
-
// reports how far the search got.
|
|
1937
|
+
// TLC checks liveness on the graph so far, then reports how far the search got.
|
|
1656
1938
|
if ((isPeriodic || options.onProgress) && performance.now() >= periodic.at) {
|
|
1657
1939
|
periodic.at = performance.now() + PROGRESS_INTERVAL;
|
|
1658
1940
|
const lasso = isPeriodic ? findPeriodicViolation(index + 1) : undefined;
|
|
1659
1941
|
if (liveness && lasso) return reportLasso(liveness, lasso);
|
|
1660
|
-
|
|
1942
|
+
// TLC reports the coverage with every report after the first `coverage` reports since the last.
|
|
1943
|
+
const isCoverageDue = options.coverage !== undefined && periodic.coverageCount === 0;
|
|
1944
|
+
periodic.coverageCount = isCoverageDue
|
|
1945
|
+
? Math.trunc(options.coverage ?? 0)
|
|
1946
|
+
: periodic.coverageCount - 1;
|
|
1947
|
+
const progress = createResult("success");
|
|
1948
|
+
options.onProgress?.({
|
|
1949
|
+
kind: "progress",
|
|
1950
|
+
statistics: { ...progress, coverage: isCoverageDue ? progress.coverage : undefined },
|
|
1951
|
+
});
|
|
1661
1952
|
}
|
|
1662
1953
|
}
|
|
1663
1954
|
|
|
1664
1955
|
current.index = -1;
|
|
1665
1956
|
current.candidate = undefined;
|
|
1666
|
-
|
|
1957
|
+
const finalLiveness = options.livenessCheck === "off" ? undefined : liveness;
|
|
1958
|
+
if (finalLiveness) {
|
|
1667
1959
|
options.onProgress?.({
|
|
1668
1960
|
kind: "liveness-started",
|
|
1669
|
-
branches:
|
|
1961
|
+
branches: finalLiveness.branches,
|
|
1670
1962
|
isComplete: true,
|
|
1671
1963
|
states: runtime.distinctStates,
|
|
1672
1964
|
statistics: createResult("success"),
|
|
1673
1965
|
});
|
|
1674
1966
|
}
|
|
1675
|
-
const lasso =
|
|
1676
|
-
if (
|
|
1967
|
+
const lasso = finalLiveness?.findViolation();
|
|
1968
|
+
if (finalLiveness && lasso) return reportLasso(finalLiveness, lasso);
|
|
1677
1969
|
|
|
1678
1970
|
// TLC finishes the check of the temporal properties before it checks the postconditions.
|
|
1679
|
-
if (
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1971
|
+
if (finalLiveness) options.onProgress?.({ kind: "liveness-finished" });
|
|
1972
|
+
const missingPostcondition = specification.moduleOperators.find(
|
|
1973
|
+
(operator) => operator.kind === "postcondition" && operator.key === undefined,
|
|
1974
|
+
);
|
|
1975
|
+
if (missingPostcondition) {
|
|
1976
|
+
return createFailureResult(createMissingOperatorError(missingPostcondition), { trace: [] });
|
|
1977
|
+
}
|
|
1978
|
+
const postcondition = search.findPostconditionViolation();
|
|
1979
|
+
if (postcondition) {
|
|
1980
|
+
return createResult("postcondition-violation", {
|
|
1981
|
+
name: postcondition.name,
|
|
1982
|
+
message: postcondition.message,
|
|
1983
|
+
counts: postcondition.counts,
|
|
1984
|
+
trace: [],
|
|
1985
|
+
postcondition,
|
|
1986
|
+
});
|
|
1693
1987
|
}
|
|
1694
|
-
return createSuccess();
|
|
1988
|
+
return continued.status ? createResult(continued.status) : createSuccess();
|
|
1695
1989
|
};
|