lawspec 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -1
- package/README.md +34 -26
- package/UNICODE-LICENSE.txt +39 -0
- package/api.mjs +6 -23
- package/bin/lawspec.mjs +148 -65
- package/build.json +245 -177
- package/builtin-data-names.mjs +73 -0
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -0
- package/examples/native-payments/clojure/lawspec.json +13 -2
- package/examples/native-payments/csharp/lawspec.json +13 -2
- package/examples/native-payments/elixir/lawspec.json +14 -3
- package/examples/native-payments/erlang/lawspec.json +14 -3
- package/examples/native-payments/fsharp/lawspec.json +14 -3
- package/examples/native-payments/gleam/lawspec.json +14 -3
- package/examples/native-payments/go/lawspec.json +14 -3
- package/examples/native-payments/groovy/lawspec.json +14 -3
- package/examples/native-payments/haskell/lawspec.json +14 -3
- package/examples/native-payments/java/lawspec.json +14 -3
- package/examples/native-payments/javascript/lawspec.json +14 -3
- package/examples/native-payments/kotlin/lawspec.json +14 -3
- package/examples/native-payments/python/lawspec.json +14 -3
- package/examples/native-payments/rust/lawspec.json +14 -3
- package/examples/native-payments/scala/lawspec.json +14 -3
- package/examples/native-payments/swift/lawspec.json +14 -3
- package/examples/native-payments/typescript/lawspec.json +14 -3
- package/examples/packages/orders/lawspec.json +25 -5
- package/examples/packages/orders/orders.lawspec +57 -53
- package/examples/packages/shop-domain/src/domain.lawspec +36 -33
- package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-1/src/rates.lawspec +5 -4
- package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-2/src/rates.lawspec +6 -4
- package/examples/rc1/authorization-snapshots.lawspec +113 -0
- package/examples/rc1/banner-filenames.lawspec +64 -0
- package/examples/rc1/bit-codec.lawspec +57 -0
- package/examples/rc1/bounded-witness-search.lawspec +151 -0
- package/examples/rc1/conflicting-requirements.lawspec +31 -0
- package/examples/rc1/constructive-witnesses.lawspec +120 -0
- package/examples/rc1/documentary-review.lawspec +43 -0
- package/examples/rc1/empty-domains.lawspec +47 -0
- package/examples/rc1/finite-integer-domains.lawspec +76 -0
- package/examples/rc1/law-metadata.lawspec +30 -0
- package/examples/rc1/native-payments.lawspec +108 -0
- package/examples/rc1/nesting/rrr.lawspec +34 -0
- package/examples/rc1/nesting/rru.lawspec +57 -0
- package/examples/rc1/nesting/rur.lawspec +58 -0
- package/examples/rc1/nesting/ruu.lawspec +78 -0
- package/examples/rc1/nesting/urr.lawspec +53 -0
- package/examples/rc1/nesting/uru.lawspec +73 -0
- package/examples/rc1/nesting/uur.lawspec +74 -0
- package/examples/rc1/nesting/uuu.lawspec +96 -0
- package/examples/rc1/order-workflow.lawspec +127 -0
- package/examples/rc1/parcel-measurements.lawspec +93 -0
- package/examples/rc1/picture-records.lawspec +52 -0
- package/examples/rc1/picture-tuples.lawspec +48 -0
- package/examples/rc1/record-payloads.lawspec +57 -0
- package/examples/rc1/recursive-records.lawspec +65 -0
- package/examples/rc1/refund-conformance.lawspec +45 -0
- package/examples/rc1/refund-policy.lawspec +89 -0
- package/examples/rc1/requirement-composition.lawspec +90 -0
- package/examples/rc1/structural-records.lawspec +54 -0
- package/examples/rc1-authoring.lawspec +57 -0
- package/examples/specs/abilities.lawspec +67 -65
- package/examples/specs/ability_imports.lawspec +58 -57
- package/examples/specs/actors.lawspec +23 -22
- package/examples/specs/algebra.lawspec +142 -141
- package/examples/specs/approvals.lawspec +16 -15
- package/examples/specs/async_bindings.lawspec +10 -9
- package/examples/specs/async_fetch.lawspec +12 -11
- package/examples/specs/atoi_codec.lawspec +16 -15
- package/examples/specs/boolean_flags.lawspec +10 -9
- package/examples/specs/builtins.lawspec +73 -72
- package/examples/specs/canonical_url.lawspec +14 -13
- package/examples/specs/collections.lawspec +153 -154
- package/examples/specs/composition.lawspec +70 -66
- package/examples/specs/concurrent_collections.lawspec +8 -7
- package/examples/specs/consistency.lawspec +4 -3
- package/examples/specs/contracts.lawspec +80 -79
- package/examples/specs/crypto.lawspec +26 -25
- package/examples/specs/ctc.lawspec +148 -0
- package/examples/specs/currying.lawspec +32 -31
- package/examples/specs/data_types.lawspec +50 -49
- package/examples/specs/distribution.lawspec +57 -56
- package/examples/specs/domain_modeling.lawspec +48 -47
- package/examples/specs/durations.lawspec +39 -38
- package/examples/specs/equivalent.lawspec +25 -24
- package/examples/specs/failures.lawspec +64 -63
- package/examples/specs/finite_data.lawspec +32 -31
- package/examples/specs/flow_stack.lawspec +64 -63
- package/examples/specs/gadt_expressions.lawspec +50 -49
- package/examples/specs/generation.lawspec +115 -114
- package/examples/specs/handler_bindings.lawspec +42 -40
- package/examples/specs/handles.lawspec +2 -1
- package/examples/specs/harness.lawspec +45 -43
- package/examples/specs/harness_testing.lawspec +18 -13
- package/examples/specs/indexed_arithmetic.lawspec +401 -126
- package/examples/specs/indexed_families.lawspec +182 -66
- package/examples/specs/keywords.lawspec +22 -21
- package/examples/specs/limits.lawspec +6 -5
- package/examples/specs/list_contracts.lawspec +121 -120
- package/examples/specs/list_refinements.lawspec +43 -42
- package/examples/specs/lists.lawspec +45 -44
- package/examples/specs/matchers.lawspec +79 -78
- package/examples/specs/matching.lawspec +43 -42
- package/examples/specs/mixed_inputs.lawspec +25 -24
- package/examples/specs/models.lawspec +44 -43
- package/examples/specs/parse_port.lawspec +28 -27
- package/examples/specs/payments.lawspec +55 -54
- package/examples/specs/railway.lawspec +59 -58
- package/examples/specs/records.lawspec +149 -148
- package/examples/specs/records_inner.lawspec +5 -4
- package/examples/specs/recursive_refinements.lawspec +30 -29
- package/examples/specs/refined_definitions.lawspec +24 -23
- package/examples/specs/refinements.lawspec +58 -57
- package/examples/specs/resilience.lawspec +159 -158
- package/examples/specs/resources.lawspec +61 -60
- package/examples/specs/scalar_adapters.lawspec +60 -59
- package/examples/specs/scalar_catalog.lawspec +165 -164
- package/examples/specs/scalars.lawspec +78 -77
- package/examples/specs/scheduling_order.lawspec +8 -7
- package/examples/specs/scheduling_overlap.lawspec +5 -4
- package/examples/specs/sequences.lawspec +66 -65
- package/examples/specs/sessions.lawspec +13 -12
- package/examples/specs/slug.lawspec +16 -15
- package/examples/specs/sum_refinements.lawspec +42 -41
- package/examples/specs/tables.lawspec +29 -28
- package/examples/specs/total_functions.lawspec +71 -70
- package/examples/specs/workflows.lawspec +101 -100
- package/examples-command.mjs +8 -4
- package/explain.mjs +114 -0
- package/expression-presentation.mjs +333 -0
- package/files.mjs +16 -0
- package/index.d.ts +406 -11
- package/launcher.mjs +9 -2
- package/lsp.mjs +235 -0
- package/native-evidence.mjs +187 -0
- package/native-examples.mjs +8 -1
- package/node-events-reporter.mjs +23 -0
- package/package.json +8 -1
- package/positional-fields.mjs +13 -0
- package/proof.d.ts +35 -0
- package/proof.mjs +174 -0
- package/starter-rc1.lawspec +26 -0
- package/starter.lawspec +16 -15
- package/templates.mjs +6 -4
- package/test-command.mjs +107 -35
- package/typed-presentation.mjs +165 -0
package/index.d.ts
CHANGED
|
@@ -34,10 +34,54 @@ export interface Span {
|
|
|
34
34
|
end: Location;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface SourceSyntaxNode {
|
|
38
|
+
kind: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
span: Span;
|
|
41
|
+
uses?: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface SourceSyntaxBinding {
|
|
45
|
+
namespace: 'type' | 'constructor' | 'refinement' | 'value' | 'law';
|
|
46
|
+
name: string;
|
|
47
|
+
target: string;
|
|
48
|
+
declaration?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SourceSyntaxReference {
|
|
52
|
+
name: string;
|
|
53
|
+
target: string;
|
|
54
|
+
span: Span;
|
|
55
|
+
declaration?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SourceSyntax {
|
|
59
|
+
version: 1;
|
|
60
|
+
path: string;
|
|
61
|
+
unit: string;
|
|
62
|
+
nodes: SourceSyntaxNode[];
|
|
63
|
+
bindings: SourceSyntaxBinding[];
|
|
64
|
+
references: SourceSyntaxReference[];
|
|
65
|
+
}
|
|
66
|
+
|
|
37
67
|
export interface Diagnostic {
|
|
38
68
|
code: string;
|
|
39
69
|
message: string;
|
|
40
70
|
at: Location | null;
|
|
71
|
+
span?: Span;
|
|
72
|
+
related?: {message: string; span: Span;}[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface MatchWarning extends Diagnostic {
|
|
76
|
+
severity: 'warning';
|
|
77
|
+
span: Span;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface MatchWarningAnalysis {
|
|
81
|
+
kind: 'match-reachability';
|
|
82
|
+
complete: false;
|
|
83
|
+
scope: 'ordered-pattern-specialization';
|
|
84
|
+
reason: string;
|
|
41
85
|
}
|
|
42
86
|
|
|
43
87
|
export interface Artifact {
|
|
@@ -72,6 +116,14 @@ export interface Expr {
|
|
|
72
116
|
|
|
73
117
|
export type ExprNode =
|
|
74
118
|
{kind: 'constant'; value: ScalarValue;} |
|
|
119
|
+
{kind: 'field'; constructor: string; index: number; value: Expr;} |
|
|
120
|
+
{
|
|
121
|
+
kind: 'update';
|
|
122
|
+
constructor: string;
|
|
123
|
+
index: number;
|
|
124
|
+
value: Expr;
|
|
125
|
+
field: Expr;
|
|
126
|
+
} |
|
|
75
127
|
{kind: 'match'; value: Expr; cases: MatchCase[];} |
|
|
76
128
|
{kind: 'allElements'; value: Expr; binder: Binder; predicate: Expr;} |
|
|
77
129
|
{kind: 'allPayloads'; value: Expr; predicates: PayloadPredicate[];} |
|
|
@@ -87,13 +139,33 @@ export type ExprNode =
|
|
|
87
139
|
} |
|
|
88
140
|
{kind: 'unary'; operator: '-' | '!'; argument: Expr;} |
|
|
89
141
|
{kind: 'shortCircuit'; operator: '&&' | '||'; left: Expr; right: Expr;} |
|
|
142
|
+
{kind: 'if'; condition: Expr; then: Expr; else: Expr;} |
|
|
90
143
|
{kind: 'convert'; conversion: 'explicit' | 'checked'; argument: Expr;} |
|
|
91
|
-
{kind: 'helper'; name: string; arguments: Expr[];}
|
|
144
|
+
{kind: 'helper'; name: string; arguments: Expr[];} |
|
|
145
|
+
{kind: 'perform'; ability: string; operation: string; arguments: Expr[];} |
|
|
146
|
+
{kind: 'handle'; handling: 'catchFailure'; ability: string; body: Expr;} |
|
|
147
|
+
{
|
|
148
|
+
kind: 'handle';
|
|
149
|
+
handling: 'withHandler';
|
|
150
|
+
ability: string;
|
|
151
|
+
handler: string;
|
|
152
|
+
body: Expr;
|
|
153
|
+
} |
|
|
154
|
+
{kind: 'let'; binder: Binder; value: Expr; body: Expr;} |
|
|
155
|
+
{
|
|
156
|
+
kind: 'calls';
|
|
157
|
+
ability: string;
|
|
158
|
+
operation: string;
|
|
159
|
+
arguments: Expr[] | null;
|
|
160
|
+
};
|
|
92
161
|
|
|
93
162
|
export type Assertion =
|
|
94
163
|
{kind: 'equal'; evidence: Evidence; left: Expr; right: Expr;} |
|
|
95
164
|
{kind: 'implies'; guard: Expr; body: Assertion;} |
|
|
96
|
-
{kind: 'all'; items: Assertion[];}
|
|
165
|
+
{kind: 'all'; items: Assertion[];} |
|
|
166
|
+
{kind: 'not'; body: Assertion;} |
|
|
167
|
+
{kind: 'forall'; binder: Binder; predicates: Expr[]; body: Assertion;} |
|
|
168
|
+
{kind: 'exists'; binder: Binder; predicates: Expr[]; body: Assertion;};
|
|
97
169
|
|
|
98
170
|
export interface Generation {
|
|
99
171
|
cases: number;
|
|
@@ -126,24 +198,115 @@ export interface Example {
|
|
|
126
198
|
expectations: Assertion[];
|
|
127
199
|
}
|
|
128
200
|
|
|
201
|
+
export interface LawMetadata {
|
|
202
|
+
id?: string;
|
|
203
|
+
owner?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface HarnessWitness {
|
|
207
|
+
binder: string;
|
|
208
|
+
path: string[];
|
|
209
|
+
expression: Expr;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export type HarnessDraw =
|
|
213
|
+
{kind: 'any'; type: Type; aim: Input | null;} |
|
|
214
|
+
{kind: 'one-of'; type: Type; values: Expr[];} |
|
|
215
|
+
{kind: 'frequency'; alternatives: {weight: number; draw: HarnessDraw;}[];} |
|
|
216
|
+
{
|
|
217
|
+
kind: 'such-that';
|
|
218
|
+
draw: HarnessDraw;
|
|
219
|
+
binder: Binder;
|
|
220
|
+
predicate: Expr;
|
|
221
|
+
maxDiscards: number;
|
|
222
|
+
} |
|
|
223
|
+
{kind: 'bind'; binder: Binder; from: HarnessDraw; body: HarnessDraw;};
|
|
224
|
+
|
|
225
|
+
export interface HarnessSearch {
|
|
226
|
+
binder: string;
|
|
227
|
+
path: string[];
|
|
228
|
+
strategy: string;
|
|
229
|
+
draw: HarnessDraw;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface LawHarness {
|
|
233
|
+
unit: string | null;
|
|
234
|
+
tags: string[];
|
|
235
|
+
skip: string | null;
|
|
236
|
+
knownFailing: string | null;
|
|
237
|
+
timeoutMilliseconds: number | null;
|
|
238
|
+
repeat: number;
|
|
239
|
+
retries: number;
|
|
240
|
+
labels: Expr[];
|
|
241
|
+
target: Expr | null;
|
|
242
|
+
group: string | null;
|
|
243
|
+
orderRandom: boolean;
|
|
244
|
+
parallel: boolean;
|
|
245
|
+
witnesses: HarnessWitness[];
|
|
246
|
+
searches: HarnessSearch[];
|
|
247
|
+
cover: {percent: number; label: string; when: Expr;}[];
|
|
248
|
+
classify: {label: string; when: Expr;}[];
|
|
249
|
+
strategies: {input: string; strategy: string; draw: HarnessDraw;}[];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface DocumentaryTarget {
|
|
253
|
+
id: string;
|
|
254
|
+
unit: string;
|
|
255
|
+
name: string;
|
|
256
|
+
span: {spanStart: Location; spanEnd: Location;};
|
|
257
|
+
referenceSpan: {spanStart: Location; spanEnd: Location;};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type ReferenceSelector =
|
|
261
|
+
{kind: 'definition' | 'description' | 'rationale' | 'references';} |
|
|
262
|
+
{kind: 'named-reference'; name: string;};
|
|
263
|
+
|
|
264
|
+
export type DocumentaryReference =
|
|
265
|
+
{kind: 'law'; target: DocumentaryTarget; selector?: ReferenceSelector;} |
|
|
266
|
+
{kind: 'function'; target: DocumentaryTarget;} |
|
|
267
|
+
{kind: 'external'; resource: string; name?: string;};
|
|
268
|
+
|
|
129
269
|
export interface Law {
|
|
130
270
|
id: string;
|
|
131
271
|
owner: string;
|
|
132
272
|
name: string;
|
|
133
273
|
inputs: Input[];
|
|
274
|
+
parameters?: Input[];
|
|
134
275
|
assertion: Assertion;
|
|
135
276
|
examples: Example[];
|
|
136
277
|
description: string;
|
|
137
278
|
rationale: string;
|
|
138
|
-
references:
|
|
279
|
+
references: DocumentaryReference[];
|
|
139
280
|
location: Location;
|
|
140
281
|
trace: string[];
|
|
141
282
|
generation: Generation;
|
|
283
|
+
inputDomain: 'nonempty' | 'universal';
|
|
284
|
+
metadata: LawMetadata;
|
|
285
|
+
harness: LawHarness;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface DeclarationSource {
|
|
289
|
+
unit: string;
|
|
290
|
+
name: string;
|
|
291
|
+
canonicalName?: string;
|
|
142
292
|
}
|
|
143
293
|
|
|
144
294
|
export interface Unit {
|
|
145
295
|
id: string;
|
|
146
|
-
declarations: (Binder & {
|
|
296
|
+
declarations: (Binder & {
|
|
297
|
+
origin: Origin;
|
|
298
|
+
source?: DeclarationSource;
|
|
299
|
+
representation?: 'structural-record-storage';
|
|
300
|
+
})[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface StructuralRecord {
|
|
304
|
+
kind: 'record';
|
|
305
|
+
digest: string;
|
|
306
|
+
descriptor: string;
|
|
307
|
+
positions?: string[];
|
|
308
|
+
indexGuards?: string[];
|
|
309
|
+
fields: {name: string; predicates: Expr[];}[];
|
|
147
310
|
}
|
|
148
311
|
|
|
149
312
|
export interface DataTypeDeclaration {
|
|
@@ -152,6 +315,7 @@ export interface DataTypeDeclaration {
|
|
|
152
315
|
parameters: string[];
|
|
153
316
|
origin: Origin;
|
|
154
317
|
constructors: {id: string; name: string; fields: Binder[]; origin: Origin;}[];
|
|
318
|
+
structure?: StructuralRecord;
|
|
155
319
|
}
|
|
156
320
|
|
|
157
321
|
export interface Contract {
|
|
@@ -173,10 +337,9 @@ export interface Refinement {
|
|
|
173
337
|
|
|
174
338
|
export type NativeReference = string[];
|
|
175
339
|
|
|
176
|
-
export
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
340
|
+
export type NativeFieldBinding =
|
|
341
|
+
{field: string; native: string; path?: never; argument?: never;} |
|
|
342
|
+
{field: string; native: string; path: string[]; argument: number;};
|
|
180
343
|
|
|
181
344
|
export interface NativeConstructorBinding {
|
|
182
345
|
constructor: string;
|
|
@@ -211,6 +374,11 @@ export interface NativeFunctionBinding {
|
|
|
211
374
|
constructor?: NativeReference;
|
|
212
375
|
}
|
|
213
376
|
|
|
377
|
+
export interface NativeNameBinding {
|
|
378
|
+
declaration: string;
|
|
379
|
+
name: string;
|
|
380
|
+
}
|
|
381
|
+
|
|
214
382
|
export interface NativeGoImport {
|
|
215
383
|
alias: string;
|
|
216
384
|
path: string;
|
|
@@ -221,16 +389,42 @@ export interface NativeErlangInclude {
|
|
|
221
389
|
library?: boolean;
|
|
222
390
|
}
|
|
223
391
|
|
|
392
|
+
export interface NativeHandlerBinding {
|
|
393
|
+
ability: string;
|
|
394
|
+
native: NativeReference;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface NativeFailureMapping {
|
|
398
|
+
failure: string;
|
|
399
|
+
native: NativeReference;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface NativeNetworkBinding {
|
|
403
|
+
identity?: string;
|
|
404
|
+
trusted?: string;
|
|
405
|
+
}
|
|
406
|
+
|
|
224
407
|
export interface NativeBindings {
|
|
225
408
|
types?: NativeTypeBinding[];
|
|
226
409
|
generators?: NativeGeneratorBinding[];
|
|
227
410
|
functions?: NativeFunctionBinding[];
|
|
228
411
|
rustCrate?: string;
|
|
229
412
|
goImports?: NativeGoImport[];
|
|
413
|
+
names?: NativeNameBinding[];
|
|
414
|
+
handlers?: NativeHandlerBinding[];
|
|
415
|
+
failures?: NativeFailureMapping[];
|
|
416
|
+
network?: NativeNetworkBinding;
|
|
230
417
|
erlangIncludes?: NativeErlangInclude[];
|
|
231
418
|
}
|
|
232
419
|
|
|
233
420
|
export type DischargeStatus =
|
|
421
|
+
'planned' |
|
|
422
|
+
'not-verified' |
|
|
423
|
+
'incomplete' |
|
|
424
|
+
'unsupported' |
|
|
425
|
+
'known-failing' |
|
|
426
|
+
'flaky' |
|
|
427
|
+
'skipped' |
|
|
234
428
|
'proved' |
|
|
235
429
|
'exhaustively-checked' |
|
|
236
430
|
'property-tested' |
|
|
@@ -249,6 +443,12 @@ export interface ObligationEvidence {
|
|
|
249
443
|
environment?: string;
|
|
250
444
|
environmentRun?: AttestedRun;
|
|
251
445
|
against?: AttestedDependency[];
|
|
446
|
+
plannedEnvironment?: string;
|
|
447
|
+
plannedEnvironmentRun?: AttestedRun;
|
|
448
|
+
plannedAgainst?: AttestedDependency[];
|
|
449
|
+
nativeEvidence?: NativeConformanceEvidence;
|
|
450
|
+
adequacy?: NativeAdequacy[];
|
|
451
|
+
plannedEvidence?: {status: DischargeStatus; reason: string};
|
|
252
452
|
}
|
|
253
453
|
|
|
254
454
|
export interface AttestedRun {
|
|
@@ -276,7 +476,8 @@ export interface AttestationView {
|
|
|
276
476
|
environment: string;
|
|
277
477
|
run: AttestedRun;
|
|
278
478
|
producer?: PackageVersion;
|
|
279
|
-
dependencies: (AttestedDependency &
|
|
479
|
+
dependencies: (AttestedDependency &
|
|
480
|
+
{obligations: string[]; plannedObligations: string[];})[];
|
|
280
481
|
}
|
|
281
482
|
|
|
282
483
|
export interface PackageVersion {
|
|
@@ -298,9 +499,31 @@ export interface PackageView {
|
|
|
298
499
|
units: string[];
|
|
299
500
|
}
|
|
300
501
|
|
|
502
|
+
export type VerificationLayer =
|
|
503
|
+
'proof' |
|
|
504
|
+
'exhaustive' |
|
|
505
|
+
'property' |
|
|
506
|
+
'examples' |
|
|
507
|
+
'runtime' |
|
|
508
|
+
'model' |
|
|
509
|
+
'analysis';
|
|
510
|
+
|
|
511
|
+
export interface Verification {
|
|
512
|
+
layers?: VerificationLayer[];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface VerificationSelection {
|
|
516
|
+
layers: VerificationLayer[];
|
|
517
|
+
selection: 'no-selected-checks' | 'selected-checks';
|
|
518
|
+
intrinsicDefinitionChecks: true;
|
|
519
|
+
}
|
|
520
|
+
|
|
301
521
|
export interface CheckRequest {
|
|
522
|
+
languageProfile: '1.0-rc.2';
|
|
523
|
+
verification?: Verification;
|
|
524
|
+
warnMatches?: boolean;
|
|
302
525
|
sources: Source[];
|
|
303
|
-
schemaVersion?:
|
|
526
|
+
schemaVersion?: 5;
|
|
304
527
|
machineBits?: 32 | 64;
|
|
305
528
|
generation?: Partial<Generation>;
|
|
306
529
|
nativeBindings?: NativeBindings;
|
|
@@ -318,9 +541,174 @@ export interface GenerationRequest extends CheckRequest {
|
|
|
318
541
|
minify?: boolean;
|
|
319
542
|
}
|
|
320
543
|
|
|
544
|
+
export type ProofTask =
|
|
545
|
+
{
|
|
546
|
+
encoding: 'lawspec-smtlib-v1';
|
|
547
|
+
owner: string;
|
|
548
|
+
declaration: string;
|
|
549
|
+
at: Location;
|
|
550
|
+
programFingerprint: string;
|
|
551
|
+
machineBits: 32 | 64;
|
|
552
|
+
status: 'ready';
|
|
553
|
+
script: string;
|
|
554
|
+
taskFingerprint: string;
|
|
555
|
+
trust: string;
|
|
556
|
+
} |
|
|
557
|
+
{
|
|
558
|
+
encoding: 'lawspec-smtlib-v1';
|
|
559
|
+
owner: string;
|
|
560
|
+
declaration: string;
|
|
561
|
+
at: Location;
|
|
562
|
+
programFingerprint: string;
|
|
563
|
+
machineBits: 32 | 64;
|
|
564
|
+
status: 'unsupported';
|
|
565
|
+
reason: string;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
export type NativeSeed = number | string;
|
|
569
|
+
|
|
570
|
+
export type NativeFreshness =
|
|
571
|
+
'matching-inputs' | 'stale' | 'not-selected' | 'unavailable' | 'not-run';
|
|
572
|
+
|
|
573
|
+
export type NativeConformanceStatus =
|
|
574
|
+
'passed' |
|
|
575
|
+
'failed' |
|
|
576
|
+
'partial' |
|
|
577
|
+
'incomplete' |
|
|
578
|
+
'skipped' |
|
|
579
|
+
'known-failing' |
|
|
580
|
+
'not-selected' |
|
|
581
|
+
'stale' |
|
|
582
|
+
'unavailable';
|
|
583
|
+
|
|
584
|
+
export type NativeOutcome =
|
|
585
|
+
'passed' |
|
|
586
|
+
'failed' |
|
|
587
|
+
'skipped' |
|
|
588
|
+
'incomplete' |
|
|
589
|
+
'not-run' |
|
|
590
|
+
'known-failing';
|
|
591
|
+
|
|
592
|
+
export interface NativeCompletedTest {
|
|
593
|
+
name: string;
|
|
594
|
+
classname?: string;
|
|
595
|
+
identity?: string;
|
|
596
|
+
status: 'passed' | 'failed' | 'skipped';
|
|
597
|
+
failure?: string;
|
|
598
|
+
reason?: string;
|
|
599
|
+
time?: number;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export interface NativeExecutionProfile {
|
|
603
|
+
target: string;
|
|
604
|
+
root: string;
|
|
605
|
+
machineBits: 32 | 64;
|
|
606
|
+
minify: boolean;
|
|
607
|
+
build: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface NativeExecutionCheck {
|
|
611
|
+
id: string;
|
|
612
|
+
unit: string;
|
|
613
|
+
file: string;
|
|
614
|
+
name: string;
|
|
615
|
+
label: string;
|
|
616
|
+
scope?: string;
|
|
617
|
+
obligations: NativeEvidenceTarget[];
|
|
618
|
+
nativeGroup: string[];
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export interface NativeInvocation {
|
|
622
|
+
ok: boolean;
|
|
623
|
+
command: string | null;
|
|
624
|
+
output?: string;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface NativeExecutionAttempt {
|
|
628
|
+
key: string;
|
|
629
|
+
planKey: string;
|
|
630
|
+
seed: NativeSeed;
|
|
631
|
+
at: string;
|
|
632
|
+
outcome: NativeOutcome;
|
|
633
|
+
profile: NativeExecutionProfile;
|
|
634
|
+
check: NativeExecutionCheck;
|
|
635
|
+
coverage: NativeCheckCoverage;
|
|
636
|
+
tests: NativeCompletedTest[];
|
|
637
|
+
invocation: NativeInvocation;
|
|
638
|
+
verification: 'native-execution';
|
|
639
|
+
searchCompleteness: 'not-established';
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export interface NativeExecutionObservation {
|
|
643
|
+
target: string;
|
|
644
|
+
root: string;
|
|
645
|
+
outcome: NativeOutcome;
|
|
646
|
+
freshness: NativeFreshness;
|
|
647
|
+
reason: string;
|
|
648
|
+
check?: {id: string; obligations: NativeEvidenceTarget[]};
|
|
649
|
+
obligations?: NativeEvidenceTarget[];
|
|
650
|
+
coverage?: NativeCheckCoverage;
|
|
651
|
+
attempt?: NativeExecutionAttempt;
|
|
652
|
+
harness?: {flaky?: boolean; adequacy?: NativeAdequacy[]};
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export interface NativeAdequacy {
|
|
656
|
+
test: string;
|
|
657
|
+
cases: number;
|
|
658
|
+
cover?: NativeCoverageObservation[];
|
|
659
|
+
classes?: Record<string, number>;
|
|
660
|
+
labels?: Record<string, number>;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export interface NativeCoverageObservation {
|
|
664
|
+
label: string;
|
|
665
|
+
observed: number;
|
|
666
|
+
required: number;
|
|
667
|
+
met: boolean;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface NativeConformanceEvidence {
|
|
671
|
+
kind: 'native-conformance';
|
|
672
|
+
status: NativeConformanceStatus;
|
|
673
|
+
searchCompleteness: 'complete-finite-inputs' | 'not-established';
|
|
674
|
+
observations: NativeExecutionObservation[];
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface NativeCheckCoverage {
|
|
678
|
+
kind: 'sampled' | 'examples' | 'finite-inputs';
|
|
679
|
+
cases?: number;
|
|
680
|
+
scopedQuantifiers: boolean;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface NativeEvidenceTarget {
|
|
684
|
+
declaration: string;
|
|
685
|
+
stage: string;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export interface NativeTestEntry {
|
|
689
|
+
law: string;
|
|
690
|
+
unit: string;
|
|
691
|
+
label: string;
|
|
692
|
+
index: number;
|
|
693
|
+
file: string;
|
|
694
|
+
key: string;
|
|
695
|
+
callsAdapters: boolean;
|
|
696
|
+
name: string;
|
|
697
|
+
tags: string[];
|
|
698
|
+
skip: string | null;
|
|
699
|
+
knownFailing: string | null;
|
|
700
|
+
parallel: boolean;
|
|
701
|
+
kind?: 'model';
|
|
702
|
+
scope?: string;
|
|
703
|
+
obligations?: NativeEvidenceTarget[];
|
|
704
|
+
coverage: NativeCheckCoverage;
|
|
705
|
+
}
|
|
706
|
+
|
|
321
707
|
export interface Result {
|
|
322
|
-
schemaVersion:
|
|
708
|
+
schemaVersion: 5;
|
|
323
709
|
machineBits?: 32 | 64;
|
|
710
|
+
languageProfile?: "1.0-rc.2";
|
|
711
|
+
verification?: VerificationSelection;
|
|
324
712
|
generation?: Generation;
|
|
325
713
|
units?: Unit[];
|
|
326
714
|
dataTypes?: DataTypeDeclaration[];
|
|
@@ -329,8 +717,13 @@ export interface Result {
|
|
|
329
717
|
contracts?: {owner: string; contract: Contract;}[];
|
|
330
718
|
refinements?: Refinement[];
|
|
331
719
|
diagnostics: Diagnostic[];
|
|
720
|
+
warnings?: MatchWarning[];
|
|
721
|
+
warningAnalysis?: MatchWarningAnalysis;
|
|
332
722
|
expansions?: string[];
|
|
333
723
|
files?: Artifact[];
|
|
724
|
+
formattedSources?: Source[];
|
|
725
|
+
tests?: NativeTestEntry[];
|
|
726
|
+
proofTasks?: ProofTask[];
|
|
334
727
|
evidence?: ObligationEvidence[];
|
|
335
728
|
attestation?: AttestationView;
|
|
336
729
|
packages?: PackageView[];
|
|
@@ -386,8 +779,10 @@ export type ScalarValue =
|
|
|
386
779
|
{type: 'Nullable' | 'Optional'; value: ScalarValue | null;};
|
|
387
780
|
|
|
388
781
|
export interface Compiler {
|
|
782
|
+
format(input: CheckRequest): Promise<Result>;
|
|
389
783
|
check(input: CheckRequest): Promise<Result>;
|
|
390
784
|
expand(input: CheckRequest): Promise<Result>;
|
|
785
|
+
proofTasks(input: CheckRequest): Promise<Result>;
|
|
391
786
|
planGeneration(input: GenerationRequest): Promise<Result>;
|
|
392
787
|
}
|
|
393
788
|
|
package/launcher.mjs
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
let compiled;
|
|
4
4
|
|
|
5
|
+
// GHC's JSFFI reactor reads these WASI arguments during initialization. Bound
|
|
6
|
+
// the heap below wasm32's address ceiling and compact the oldest generation
|
|
7
|
+
// in place instead of reserving a second copy near that ceiling.
|
|
8
|
+
// -with-rtsopts has no effect on this -no-hs-main reactor build.
|
|
9
|
+
const coreArguments = ["lawspec", "+RTS", "-M3584m", "-c", "-RTS"];
|
|
10
|
+
|
|
5
11
|
// Instantiate the compiler core with a platform's WASI preview1 imports and
|
|
6
12
|
// serialize calls: the core handles one JSON request at a time.
|
|
7
13
|
async function instantiateCore(module, wasiImports, initialize) {
|
|
@@ -18,7 +24,8 @@ async function instantiateCore(module, wasiImports, initialize) {
|
|
|
18
24
|
const result = pending.then(async () =>
|
|
19
25
|
JSON.parse(await instance.exports.lawspec_call(JSON.stringify(input))),
|
|
20
26
|
);
|
|
21
|
-
|
|
27
|
+
// The queue needs completion only, not the previous generated project DTO.
|
|
28
|
+
pending = result.then(() => {}, () => {});
|
|
22
29
|
return result;
|
|
23
30
|
};
|
|
24
31
|
}
|
|
@@ -32,7 +39,7 @@ export async function loadCore() {
|
|
|
32
39
|
);
|
|
33
40
|
const wasi = new WASI({
|
|
34
41
|
version: "preview1",
|
|
35
|
-
args:
|
|
42
|
+
args: coreArguments,
|
|
36
43
|
env: { PWD: "/" },
|
|
37
44
|
preopens: { "/": process.cwd() },
|
|
38
45
|
});
|