lawspec 0.24.0 → 0.25.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/README.md +29 -22
  3. package/UNICODE-LICENSE.txt +39 -0
  4. package/api.mjs +14 -23
  5. package/bin/lawspec.mjs +186 -65
  6. package/build.json +255 -159
  7. package/builtin-data-names.mjs +73 -0
  8. package/core.wasm +2 -2
  9. package/examples/native-payments/clojure/lawspec.json +13 -2
  10. package/examples/native-payments/csharp/lawspec.json +13 -2
  11. package/examples/native-payments/elixir/lawspec.json +14 -3
  12. package/examples/native-payments/erlang/lawspec.json +14 -3
  13. package/examples/native-payments/fsharp/lawspec.json +14 -3
  14. package/examples/native-payments/gleam/lawspec.json +14 -3
  15. package/examples/native-payments/go/lawspec.json +14 -3
  16. package/examples/native-payments/groovy/lawspec.json +14 -3
  17. package/examples/native-payments/haskell/lawspec.json +14 -3
  18. package/examples/native-payments/java/lawspec.json +14 -3
  19. package/examples/native-payments/javascript/lawspec.json +14 -3
  20. package/examples/native-payments/kotlin/lawspec.json +14 -3
  21. package/examples/native-payments/python/lawspec.json +14 -3
  22. package/examples/native-payments/rust/lawspec.json +14 -3
  23. package/examples/native-payments/scala/lawspec.json +14 -3
  24. package/examples/native-payments/swift/lawspec.json +14 -3
  25. package/examples/native-payments/typescript/lawspec.json +14 -3
  26. package/examples/packages/orders/lawspec.json +25 -5
  27. package/examples/packages/orders/orders.lawspec +36 -34
  28. package/examples/packages/shop-domain/src/domain.lawspec +23 -21
  29. package/examples/packages/shop-tax-1/src/rates.lawspec +4 -4
  30. package/examples/packages/shop-tax-2/src/rates.lawspec +5 -4
  31. package/examples/rc1/authorization-snapshots.lawspec +112 -0
  32. package/examples/rc1/banner-filenames.lawspec +63 -0
  33. package/examples/rc1/bit-codec.lawspec +56 -0
  34. package/examples/rc1/bounded-witness-search.lawspec +144 -0
  35. package/examples/rc1/conflicting-requirements.lawspec +30 -0
  36. package/examples/rc1/constructive-witnesses.lawspec +113 -0
  37. package/examples/rc1/documentary-review.lawspec +42 -0
  38. package/examples/rc1/empty-domains.lawspec +46 -0
  39. package/examples/rc1/finite-integer-domains.lawspec +75 -0
  40. package/examples/rc1/law-metadata.lawspec +29 -0
  41. package/examples/rc1/native-payments.lawspec +107 -0
  42. package/examples/rc1/nesting/rrr.lawspec +33 -0
  43. package/examples/rc1/nesting/rru.lawspec +56 -0
  44. package/examples/rc1/nesting/rur.lawspec +57 -0
  45. package/examples/rc1/nesting/ruu.lawspec +77 -0
  46. package/examples/rc1/nesting/urr.lawspec +52 -0
  47. package/examples/rc1/nesting/uru.lawspec +72 -0
  48. package/examples/rc1/nesting/uur.lawspec +73 -0
  49. package/examples/rc1/nesting/uuu.lawspec +95 -0
  50. package/examples/rc1/order-workflow.lawspec +126 -0
  51. package/examples/rc1/parcel-measurements.lawspec +92 -0
  52. package/examples/rc1/picture-records.lawspec +51 -0
  53. package/examples/rc1/picture-tuples.lawspec +47 -0
  54. package/examples/rc1/record-payloads.lawspec +56 -0
  55. package/examples/rc1/recursive-records.lawspec +64 -0
  56. package/examples/rc1/refund-conformance.lawspec +44 -0
  57. package/examples/rc1/refund-policy.lawspec +88 -0
  58. package/examples/rc1/requirement-composition.lawspec +89 -0
  59. package/examples/rc1/structural-records.lawspec +53 -0
  60. package/examples/rc1-authoring.lawspec +56 -0
  61. package/examples-command.mjs +11 -5
  62. package/explain.mjs +112 -0
  63. package/expression-presentation.mjs +333 -0
  64. package/files.mjs +16 -0
  65. package/index.d.ts +929 -11
  66. package/lsp.mjs +231 -0
  67. package/migrate.mjs +135 -0
  68. package/migration-bindings.mjs +86 -0
  69. package/migration-cases.mjs +45 -0
  70. package/migration-collections.mjs +54 -0
  71. package/migration-correspondence.mjs +275 -0
  72. package/migration-generation.mjs +99 -0
  73. package/migration-laws.mjs +102 -0
  74. package/migration-records.mjs +166 -0
  75. package/migration-source.mjs +247 -0
  76. package/migration-write.mjs +156 -0
  77. package/native-evidence.mjs +187 -0
  78. package/native-examples.mjs +8 -1
  79. package/node-events-reporter.mjs +23 -0
  80. package/package.json +8 -1
  81. package/positional-fields.mjs +13 -0
  82. package/proof.d.ts +35 -0
  83. package/proof.mjs +174 -0
  84. package/starter-rc1.lawspec +25 -0
  85. package/templates.mjs +2 -2
  86. package/test-command.mjs +107 -35
  87. package/typed-presentation.mjs +165 -0
package/index.d.ts CHANGED
@@ -34,12 +34,78 @@ 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
+
67
+ export interface SourceFieldUse {
68
+ kind: 'field-access' | 'field-update';
69
+ constructor: string;
70
+ field: string;
71
+ index: number;
72
+ span: Span;
73
+ base?: Span;
74
+ expression?: Span;
75
+ }
76
+
77
+ export interface SourceConstructorShape {
78
+ constructor: string;
79
+ nominalRecord: boolean;
80
+ }
81
+
82
+ export type MigrationSourceFields =
83
+ {
84
+ status: 'available';
85
+ version: 1;
86
+ uses: SourceFieldUse[];
87
+ constructors: SourceConstructorShape[];
88
+ } |
89
+ {status: 'unavailable'; reason: string;};
90
+
37
91
  export interface Diagnostic {
38
92
  code: string;
39
93
  message: string;
40
94
  at: Location | null;
41
95
  }
42
96
 
97
+ export interface MatchWarning extends Diagnostic {
98
+ severity: 'warning';
99
+ span: Span;
100
+ }
101
+
102
+ export interface MatchWarningAnalysis {
103
+ kind: 'match-reachability';
104
+ complete: false;
105
+ scope: 'ordered-pattern-specialization';
106
+ reason: string;
107
+ }
108
+
43
109
  export interface Artifact {
44
110
  path: string;
45
111
  content: string;
@@ -72,6 +138,14 @@ export interface Expr {
72
138
 
73
139
  export type ExprNode =
74
140
  {kind: 'constant'; value: ScalarValue;} |
141
+ {kind: 'field'; constructor: string; index: number; value: Expr;} |
142
+ {
143
+ kind: 'update';
144
+ constructor: string;
145
+ index: number;
146
+ value: Expr;
147
+ field: Expr;
148
+ } |
75
149
  {kind: 'match'; value: Expr; cases: MatchCase[];} |
76
150
  {kind: 'allElements'; value: Expr; binder: Binder; predicate: Expr;} |
77
151
  {kind: 'allPayloads'; value: Expr; predicates: PayloadPredicate[];} |
@@ -87,13 +161,33 @@ export type ExprNode =
87
161
  } |
88
162
  {kind: 'unary'; operator: '-' | '!'; argument: Expr;} |
89
163
  {kind: 'shortCircuit'; operator: '&&' | '||'; left: Expr; right: Expr;} |
164
+ {kind: 'if'; condition: Expr; then: Expr; else: Expr;} |
90
165
  {kind: 'convert'; conversion: 'explicit' | 'checked'; argument: Expr;} |
91
- {kind: 'helper'; name: string; arguments: Expr[];};
166
+ {kind: 'helper'; name: string; arguments: Expr[];} |
167
+ {kind: 'perform'; ability: string; operation: string; arguments: Expr[];} |
168
+ {kind: 'handle'; handling: 'catchFailure'; ability: string; body: Expr;} |
169
+ {
170
+ kind: 'handle';
171
+ handling: 'withHandler';
172
+ ability: string;
173
+ handler: string;
174
+ body: Expr;
175
+ } |
176
+ {kind: 'let'; binder: Binder; value: Expr; body: Expr;} |
177
+ {
178
+ kind: 'calls';
179
+ ability: string;
180
+ operation: string;
181
+ arguments: Expr[] | null;
182
+ };
92
183
 
93
184
  export type Assertion =
94
185
  {kind: 'equal'; evidence: Evidence; left: Expr; right: Expr;} |
95
186
  {kind: 'implies'; guard: Expr; body: Assertion;} |
96
- {kind: 'all'; items: Assertion[];};
187
+ {kind: 'all'; items: Assertion[];} |
188
+ {kind: 'not'; body: Assertion;} |
189
+ {kind: 'forall'; binder: Binder; predicates: Expr[]; body: Assertion;} |
190
+ {kind: 'exists'; binder: Binder; predicates: Expr[]; body: Assertion;};
97
191
 
98
192
  export interface Generation {
99
193
  cases: number;
@@ -126,24 +220,115 @@ export interface Example {
126
220
  expectations: Assertion[];
127
221
  }
128
222
 
223
+ export interface LawMetadata {
224
+ id?: string;
225
+ owner?: string;
226
+ }
227
+
228
+ export interface HarnessWitness {
229
+ binder: string;
230
+ path: string[];
231
+ expression: Expr;
232
+ }
233
+
234
+ export type HarnessDraw =
235
+ {kind: 'any'; type: Type; aim: Input | null;} |
236
+ {kind: 'one-of'; type: Type; values: Expr[];} |
237
+ {kind: 'frequency'; alternatives: {weight: number; draw: HarnessDraw;}[];} |
238
+ {
239
+ kind: 'such-that';
240
+ draw: HarnessDraw;
241
+ binder: Binder;
242
+ predicate: Expr;
243
+ maxDiscards: number;
244
+ } |
245
+ {kind: 'bind'; binder: Binder; from: HarnessDraw; body: HarnessDraw;};
246
+
247
+ export interface HarnessSearch {
248
+ binder: string;
249
+ path: string[];
250
+ strategy: string;
251
+ draw: HarnessDraw;
252
+ }
253
+
254
+ export interface LawHarness {
255
+ unit: string | null;
256
+ tags: string[];
257
+ skip: string | null;
258
+ knownFailing: string | null;
259
+ timeoutMilliseconds: number | null;
260
+ repeat: number;
261
+ retries: number;
262
+ labels: Expr[];
263
+ target: Expr | null;
264
+ group: string | null;
265
+ orderRandom: boolean;
266
+ parallel: boolean;
267
+ witnesses: HarnessWitness[];
268
+ searches: HarnessSearch[];
269
+ cover: {percent: number; label: string; when: Expr;}[];
270
+ classify: {label: string; when: Expr;}[];
271
+ strategies: {input: string; strategy: string; draw: HarnessDraw;}[];
272
+ }
273
+
274
+ export interface DocumentaryTarget {
275
+ id: string;
276
+ unit: string;
277
+ name: string;
278
+ span: {spanStart: Location; spanEnd: Location;};
279
+ referenceSpan: {spanStart: Location; spanEnd: Location;};
280
+ }
281
+
282
+ export type ReferenceSelector =
283
+ {kind: 'definition' | 'description' | 'rationale' | 'references';} |
284
+ {kind: 'named-reference'; name: string;};
285
+
286
+ export type DocumentaryReference =
287
+ {kind: 'law'; target: DocumentaryTarget; selector?: ReferenceSelector;} |
288
+ {kind: 'function'; target: DocumentaryTarget;} |
289
+ {kind: 'external'; resource: string; name?: string;};
290
+
129
291
  export interface Law {
130
292
  id: string;
131
293
  owner: string;
132
294
  name: string;
133
295
  inputs: Input[];
296
+ parameters?: Input[];
134
297
  assertion: Assertion;
135
298
  examples: Example[];
136
299
  description: string;
137
300
  rationale: string;
138
- references: string[];
301
+ references: DocumentaryReference[];
139
302
  location: Location;
140
303
  trace: string[];
141
304
  generation: Generation;
305
+ inputDomain: 'nonempty' | 'universal';
306
+ metadata: LawMetadata;
307
+ harness: LawHarness;
308
+ }
309
+
310
+ export interface DeclarationSource {
311
+ unit: string;
312
+ name: string;
313
+ canonicalName?: string;
142
314
  }
143
315
 
144
316
  export interface Unit {
145
317
  id: string;
146
- declarations: (Binder & {origin: Origin;})[];
318
+ declarations: (Binder & {
319
+ origin: Origin;
320
+ source?: DeclarationSource;
321
+ representation?: 'structural-record-storage';
322
+ })[];
323
+ }
324
+
325
+ export interface StructuralRecord {
326
+ kind: 'record';
327
+ digest: string;
328
+ descriptor: string;
329
+ positions?: string[];
330
+ indexGuards?: string[];
331
+ fields: {name: string; predicates: Expr[];}[];
147
332
  }
148
333
 
149
334
  export interface DataTypeDeclaration {
@@ -152,6 +337,7 @@ export interface DataTypeDeclaration {
152
337
  parameters: string[];
153
338
  origin: Origin;
154
339
  constructors: {id: string; name: string; fields: Binder[]; origin: Origin;}[];
340
+ structure?: StructuralRecord;
155
341
  }
156
342
 
157
343
  export interface Contract {
@@ -173,10 +359,9 @@ export interface Refinement {
173
359
 
174
360
  export type NativeReference = string[];
175
361
 
176
- export interface NativeFieldBinding {
177
- field: string;
178
- native: string;
179
- }
362
+ export type NativeFieldBinding =
363
+ {field: string; native: string; path?: never; argument?: never;} |
364
+ {field: string; native: string; path: string[]; argument: number;};
180
365
 
181
366
  export interface NativeConstructorBinding {
182
367
  constructor: string;
@@ -211,6 +396,11 @@ export interface NativeFunctionBinding {
211
396
  constructor?: NativeReference;
212
397
  }
213
398
 
399
+ export interface NativeNameBinding {
400
+ declaration: string;
401
+ name: string;
402
+ }
403
+
214
404
  export interface NativeGoImport {
215
405
  alias: string;
216
406
  path: string;
@@ -221,16 +411,42 @@ export interface NativeErlangInclude {
221
411
  library?: boolean;
222
412
  }
223
413
 
414
+ export interface NativeHandlerBinding {
415
+ ability: string;
416
+ native: NativeReference;
417
+ }
418
+
419
+ export interface NativeFailureMapping {
420
+ failure: string;
421
+ native: NativeReference;
422
+ }
423
+
424
+ export interface NativeNetworkBinding {
425
+ identity?: string;
426
+ trusted?: string;
427
+ }
428
+
224
429
  export interface NativeBindings {
225
430
  types?: NativeTypeBinding[];
226
431
  generators?: NativeGeneratorBinding[];
227
432
  functions?: NativeFunctionBinding[];
228
433
  rustCrate?: string;
229
434
  goImports?: NativeGoImport[];
435
+ names?: NativeNameBinding[];
436
+ handlers?: NativeHandlerBinding[];
437
+ failures?: NativeFailureMapping[];
438
+ network?: NativeNetworkBinding;
230
439
  erlangIncludes?: NativeErlangInclude[];
231
440
  }
232
441
 
233
442
  export type DischargeStatus =
443
+ 'planned' |
444
+ 'not-verified' |
445
+ 'incomplete' |
446
+ 'unsupported' |
447
+ 'known-failing' |
448
+ 'flaky' |
449
+ 'skipped' |
234
450
  'proved' |
235
451
  'exhaustively-checked' |
236
452
  'property-tested' |
@@ -249,6 +465,12 @@ export interface ObligationEvidence {
249
465
  environment?: string;
250
466
  environmentRun?: AttestedRun;
251
467
  against?: AttestedDependency[];
468
+ plannedEnvironment?: string;
469
+ plannedEnvironmentRun?: AttestedRun;
470
+ plannedAgainst?: AttestedDependency[];
471
+ nativeEvidence?: NativeConformanceEvidence;
472
+ adequacy?: NativeAdequacy[];
473
+ plannedEvidence?: {status: DischargeStatus; reason: string};
252
474
  }
253
475
 
254
476
  export interface AttestedRun {
@@ -276,7 +498,8 @@ export interface AttestationView {
276
498
  environment: string;
277
499
  run: AttestedRun;
278
500
  producer?: PackageVersion;
279
- dependencies: (AttestedDependency & {obligations: string[]})[];
501
+ dependencies: (AttestedDependency &
502
+ {obligations: string[]; plannedObligations: string[];})[];
280
503
  }
281
504
 
282
505
  export interface PackageVersion {
@@ -298,9 +521,32 @@ export interface PackageView {
298
521
  units: string[];
299
522
  }
300
523
 
524
+ export type VerificationLayer =
525
+ 'proof' |
526
+ 'exhaustive' |
527
+ 'property' |
528
+ 'examples' |
529
+ 'runtime' |
530
+ 'model' |
531
+ 'analysis';
532
+
533
+ export interface Verification {
534
+ layers?: VerificationLayer[];
535
+ }
536
+
537
+ export interface VerificationSelection {
538
+ layers: VerificationLayer[];
539
+ selection: 'no-selected-checks' | 'selected-checks';
540
+ intrinsicDefinitionChecks: true;
541
+ }
542
+
301
543
  export interface CheckRequest {
544
+ languageProfile: '1.0-rc.1';
545
+ verification?: Verification;
546
+ migrationSnapshot?: boolean;
547
+ warnMatches?: boolean;
302
548
  sources: Source[];
303
- schemaVersion?: 3 | 4;
549
+ schemaVersion?: 5;
304
550
  machineBits?: 32 | 64;
305
551
  generation?: Partial<Generation>;
306
552
  nativeBindings?: NativeBindings;
@@ -318,9 +564,655 @@ export interface GenerationRequest extends CheckRequest {
318
564
  minify?: boolean;
319
565
  }
320
566
 
567
+ export interface MigrationRequest extends CheckRequest {
568
+ schemaVersion?: 5;
569
+ languageProfile: '1.0-rc.1';
570
+ from: '0.24';
571
+ }
572
+
573
+ export interface MigrationBaselineRequest extends MigrationRequest {
574
+ includeGeneration?: boolean;
575
+ target?: Target;
576
+ sourceDir?: string;
577
+ testDir?: string;
578
+ minify?: boolean;
579
+ }
580
+
581
+ export interface MigrationComparisonRequest extends MigrationRequest {
582
+ migrated: CheckRequest & {schemaVersion?: 5; languageProfile: '1.0-rc.1'};
583
+ }
584
+
585
+ export interface MigrationBindingRequest extends MigrationComparisonRequest {
586
+ target?: Target;
587
+ }
588
+
589
+ export interface MigrationGenerationRequest extends MigrationBindingRequest {
590
+ target: Target;
591
+ sourceDir?: string;
592
+ testDir?: string;
593
+ minify?: boolean;
594
+ migrated: GenerationRequest &
595
+ {schemaVersion?: 5; languageProfile: '1.0-rc.1';};
596
+ }
597
+
598
+ export interface MigrationArtifact {
599
+ path: string;
600
+ ownership: 'user' | 'generated';
601
+ placement: 'source' | 'test';
602
+ contentDigest: string;
603
+ adapterReferenceDigest?: string;
604
+ }
605
+
606
+ export type MigrationGenerationSide =
607
+ {
608
+ status: 'accepted';
609
+ artifactDigest: string;
610
+ files: MigrationArtifact[];
611
+ diagnostics: Diagnostic[];
612
+ } |
613
+ {status: 'rejected'; diagnostics: Diagnostic[];} |
614
+ {status: 'not-established'; reason: string;};
615
+
616
+ export type MigrationNativeBoundarySide =
617
+ {status: 'available'; contract: Record<string, unknown>; digest: string;} |
618
+ {status: 'unavailable'; reason: string;};
619
+
620
+ export interface MigrationNativeBoundary {
621
+ version: 1;
622
+ algorithm: 'sha256';
623
+ policy: 'resolved-native-contract-v1';
624
+ status: 'matched' | 'not-established';
625
+ scope: string;
626
+ before: MigrationNativeBoundarySide;
627
+ after: MigrationNativeBoundarySide;
628
+ nativeConformance: 'not-established';
629
+ lawVerification: 'not-established-by-boundary-correspondence';
630
+ assumptions: string[];
631
+ }
632
+
633
+ export type MigrationGenerationReceipt =
634
+ {
635
+ version: 1;
636
+ algorithm: 'sha256';
637
+ status: 'accepted' | 'not-established';
638
+ scope: string;
639
+ target: Target;
640
+ machineBits: 32 | 64;
641
+ sourceDir: string | null;
642
+ testDir: string | null;
643
+ minify: boolean;
644
+ generation: Generation;
645
+ planning: 'legacy-harnesses';
646
+ sourceInputs: {before: string; after: string};
647
+ bindingProposal: MigrationBindingProposal;
648
+ before: MigrationGenerationSide;
649
+ after: MigrationGenerationSide;
650
+ nativeBoundary: MigrationNativeBoundary;
651
+ nativeConformance: 'not-established';
652
+ lawVerification: 'not-established-by-generation';
653
+ } |
654
+ {status: 'unavailable'; reason: string;};
655
+
656
+ export interface MigrationPayloadField {
657
+ label: string;
658
+ fromIndex: number;
659
+ toIndex: number;
660
+ fromBinder: string;
661
+ toBinder: string;
662
+ }
663
+
664
+ export type MigrationPayloadConstructor =
665
+ {constructor: string; kind: 'unchanged';} |
666
+ {
667
+ constructor: string;
668
+ kind: 'single-payload';
669
+ fields: MigrationPayloadField[];
670
+ } |
671
+ {
672
+ constructor: string;
673
+ kind: 'record-payload';
674
+ fields: MigrationPayloadField[];
675
+ recordType: string;
676
+ recordConstructor: string;
677
+ };
678
+
679
+ export type MigrationPayloadChange =
680
+ {
681
+ type: string;
682
+ status: 'matched';
683
+ constructors: MigrationPayloadConstructor[];
684
+ } |
685
+ {type: string; status: 'not-established'; reason: string;};
686
+
687
+ export interface MigrationPending {
688
+ status: 'not-established';
689
+ reason: string;
690
+ }
691
+
692
+ export type MigrationCoreTransport =
693
+ MigrationPending |
694
+ {
695
+ status: 'matched' | 'not-established';
696
+ version: 1;
697
+ algorithm: 'sha256';
698
+ machineBits: 32 | 64;
699
+ scope: string;
700
+ copyValidated: true;
701
+ originalsUnchanged: true;
702
+ sourceBeforeDigest: string;
703
+ catalogOrdering: string;
704
+ assumptions: string[];
705
+ indexMeasureBodies?: {
706
+ definition: string;
707
+ beforeBodyDigest: string;
708
+ afterBodyDigest: string;
709
+ basis: string;
710
+ }[];
711
+ program: {
712
+ status: 'matched' | 'not-established';
713
+ before: string;
714
+ after: string;
715
+ };
716
+ definitionPlane: {
717
+ status: 'matched' | 'not-established';
718
+ before: string;
719
+ after: string;
720
+ };
721
+ lawBodies: {
722
+ status: 'matched' | 'not-established';
723
+ before: string;
724
+ after: string;
725
+ };
726
+ domainPolicies: {
727
+ status: 'matched' | 'not-established';
728
+ before: {comparisonId: string; policy: 'nonempty' | 'universal'}[];
729
+ after: {comparisonId: string; policy: 'nonempty' | 'universal'}[];
730
+ };
731
+ before: MigrationSemanticSnapshot & {status: 'available'};
732
+ after: MigrationSemanticSnapshot & {status: 'available'};
733
+ };
734
+
735
+ export interface MigrationDigestPair {
736
+ status: 'matched' | 'not-established';
737
+ before: string;
738
+ after: string;
739
+ }
740
+
741
+ export interface MigrationTemplateCertificate {
742
+ status: 'matched' | 'not-established';
743
+ version: 1;
744
+ algorithm: 'sha256';
745
+ machineBits: 32 | 64;
746
+ scope: string;
747
+ before: MigrationTemplateDomainAnchors;
748
+ after: MigrationTemplateDomainAnchors;
749
+ originalsUnchanged: true;
750
+ lawVerification: 'not-established-by-migration-correspondence';
751
+ }
752
+
753
+ export type MigrationDefinitionTransport =
754
+ MigrationPending |
755
+ MigrationTemplateCertificate &
756
+ {
757
+ interfaces: MigrationDigestPair & {scope: string};
758
+ typedCore: MigrationCoreTransport;
759
+ typeVariables: string;
760
+ nativeConformance: 'not-established';
761
+ };
762
+
763
+ export type MigrationLawTransport =
764
+ MigrationPending |
765
+ MigrationTemplateCertificate &
766
+ {
767
+ metadata: MigrationDigestPair;
768
+ typedCore: MigrationCoreTransport;
769
+ lawBodiesEvaluated: false;
770
+ parameterInterpretation: string;
771
+ };
772
+
773
+ export type MigrationUnitTransport =
774
+ MigrationPending |
775
+ MigrationTemplateCertificate &
776
+ {
777
+ metadata: MigrationDigestPair;
778
+ definitions: 'matched' | 'not-established';
779
+ laws: 'matched' | 'not-established';
780
+ payloadShapes: 'matched';
781
+ };
782
+
783
+ export interface MigrationProgramAnchor {
784
+ programDigest: string;
785
+ definitionPlaneDigest: string;
786
+ lawBodiesDigest: string;
787
+ }
788
+
789
+ export type MigrationBindingChange =
790
+ {
791
+ kind: 'single-payload-field';
792
+ type: string;
793
+ constructor: string;
794
+ from: string;
795
+ to: string;
796
+ native: string;
797
+ } |
798
+ {
799
+ kind: 'grouped-record-payload';
800
+ type: string;
801
+ constructor: string;
802
+ payload: string;
803
+ fields: {
804
+ field: string;
805
+ native: string;
806
+ nativeArgumentIndex: number;
807
+ payloadPath: string[];
808
+ }[];
809
+ };
810
+
811
+ export type MigrationBindingProposal =
812
+ {status: 'unavailable'; reason: string;} |
813
+ {
814
+ version: 1;
815
+ algorithm: 'sha256';
816
+ status: 'matched' | 'not-established';
817
+ machineBits: 32 | 64;
818
+ scope: string;
819
+ target: string;
820
+ inputBindings: NativeBindings;
821
+ originalBindingsDigest: string;
822
+ before: MigrationProgramAnchor;
823
+ after: MigrationProgramAnchor;
824
+ proposedNativeBindings: NativeBindings;
825
+ requirements: string[];
826
+ changes: MigrationBindingChange[];
827
+ beforeValidated: true;
828
+ afterValidated: boolean;
829
+ proposalComplete: boolean;
830
+ originalsUnchanged: true;
831
+ sourceTemplates: {
832
+ before: MigrationTemplateDomainAnchors;
833
+ after: MigrationTemplateDomainAnchors;
834
+ };
835
+ bindings: {
836
+ status: 'matched' | 'not-established';
837
+ before: string | null;
838
+ after: string | null;
839
+ };
840
+ obligations: {
841
+ status: 'matched' | 'not-established';
842
+ before: ObligationEvidence[];
843
+ after: ObligationEvidence[] | null;
844
+ };
845
+ nativeConformance: 'not-established';
846
+ targetGeneration: 'not-established';
847
+ lawVerification: 'not-established-by-binding-correspondence';
848
+ };
849
+
850
+ export type MigrationPayloadComparison =
851
+ {
852
+ version: 1;
853
+ algorithm: 'sha256';
854
+ status: 'not-established';
855
+ machineBits: 32 | 64;
856
+ scope: string;
857
+ beforeDigest: string;
858
+ afterDigest: string;
859
+ payloadShapes: {
860
+ status: 'matched' | 'not-established';
861
+ unchangedTypes: number;
862
+ changes: MigrationPayloadChange[];
863
+ introducedRecords: string[];
864
+ unexplainedAddedTypes: string[];
865
+ };
866
+ executableTransport: MigrationCoreTransport;
867
+ definitionTemplates?: MigrationDefinitionTransport;
868
+ lawTemplates?: MigrationLawTransport;
869
+ sourceUnits?: MigrationUnitTransport;
870
+ dependencyBehavior: MigrationPending;
871
+ nativeBindings: MigrationPending;
872
+ lawVerification: 'not-established-by-payload-shapes';
873
+ validated: false;
874
+ } |
875
+ {status: 'unavailable'; reason: string;};
876
+
877
+ export interface MigrationDomainBinding {
878
+ binder: string;
879
+ value: DataValue;
880
+ }
881
+
882
+ export interface MigrationParameterInputCase {
883
+ parameters: MigrationDomainBinding[];
884
+ witness: MigrationDomainBinding[];
885
+ }
886
+
887
+ export type MigrationInputDomain =
888
+ {
889
+ comparisonId: string;
890
+ domainDigest: string;
891
+ inputCount: number;
892
+ search: string;
893
+ candidateChecks: number;
894
+ searchLimit: number;
895
+ finiteLimit: number;
896
+ notes: string[];
897
+ formalParameterCount?: number;
898
+ parameterInterpretation?: string;
899
+ status: 'inhabited';
900
+ witness: {binder: string; value: DataValue;}[];
901
+ uniformity?: 'parameter-independent';
902
+ } |
903
+ {
904
+ comparisonId: string;
905
+ domainDigest: string;
906
+ inputCount: number;
907
+ search: string;
908
+ candidateChecks: number;
909
+ searchLimit: number;
910
+ finiteLimit: number;
911
+ notes: string[];
912
+ formalParameterCount?: number;
913
+ parameterInterpretation?: string;
914
+ status: 'empty';
915
+ complete: true;
916
+ } |
917
+ {
918
+ comparisonId: string;
919
+ domainDigest: string;
920
+ inputCount: number;
921
+ search: string;
922
+ candidateChecks: number;
923
+ searchLimit: number;
924
+ finiteLimit: number;
925
+ notes: string[];
926
+ formalParameterCount?: number;
927
+ parameterInterpretation?: string;
928
+ status: 'uniformly-inhabited';
929
+ complete: true;
930
+ uniformity: 'complete-finite-parameters';
931
+ parameterCases: MigrationParameterInputCase[];
932
+ } |
933
+ {
934
+ comparisonId: string;
935
+ domainDigest: string;
936
+ inputCount: number;
937
+ search: string;
938
+ candidateChecks: number;
939
+ searchLimit: number;
940
+ finiteLimit: number;
941
+ notes: string[];
942
+ formalParameterCount?: number;
943
+ parameterInterpretation?: string;
944
+ status: 'empty-parameters';
945
+ complete: true;
946
+ } |
947
+ {
948
+ comparisonId: string;
949
+ domainDigest: string;
950
+ inputCount: number;
951
+ search: string;
952
+ candidateChecks: number;
953
+ searchLimit: number;
954
+ finiteLimit: number;
955
+ notes: string[];
956
+ formalParameterCount?: number;
957
+ parameterInterpretation?: string;
958
+ status: 'parameter-counterexample';
959
+ complete: true;
960
+ parameters: MigrationDomainBinding[];
961
+ reason: string;
962
+ } |
963
+ {
964
+ comparisonId: string;
965
+ domainDigest: string;
966
+ inputCount: number;
967
+ search: string;
968
+ candidateChecks: number;
969
+ searchLimit: number;
970
+ finiteLimit: number;
971
+ notes: string[];
972
+ formalParameterCount?: number;
973
+ parameterInterpretation?: string;
974
+ status: 'incomplete' | 'unsupported';
975
+ complete: false;
976
+ reason: string;
977
+ };
978
+
979
+ export type MigrationDomainSnapshot =
980
+ {
981
+ status: 'available';
982
+ version: 1;
983
+ algorithm: 'sha256';
984
+ machineBits: 32 | 64;
985
+ lawBodiesEvaluated: false;
986
+ scope: string;
987
+ domains: MigrationInputDomain[];
988
+ } |
989
+ {status: 'unavailable'; reason: string;};
990
+
991
+ export interface MigrationTemplateDomainAnchors {
992
+ declarationsDigest: string;
993
+ definitionTemplatesDigest: string;
994
+ lawTemplatesDigest: string;
995
+ lawBodiesDigest: string;
996
+ }
997
+
998
+ export type MigrationTemplateDomainSnapshot =
999
+ MigrationDomainSnapshot &
1000
+ {status: 'available'; sourceTemplates: MigrationTemplateDomainAnchors;};
1001
+
1002
+ export type MigrationTemplateSnapshot =
1003
+ {
1004
+ status: 'available';
1005
+ version: 1;
1006
+ algorithm: 'sha256';
1007
+ machineBits: 32 | 64;
1008
+ scope: string;
1009
+ declarationsDigest: string;
1010
+ definitionTemplatesDigest: string;
1011
+ lawTemplatesDigest: string;
1012
+ lawBodiesDigest: string;
1013
+ units: {comparisonId: string; digest: string;}[];
1014
+ definitions: {comparisonId: string; digest: string;}[];
1015
+ laws: {comparisonId: string; digest: string;}[];
1016
+ domainPolicies: {
1017
+ comparisonId: string;
1018
+ policy: 'nonempty' | 'universal';
1019
+ formalParameterCount?: number;
1020
+ }[];
1021
+ inputDomains?: MigrationTemplateDomainSnapshot;
1022
+ } |
1023
+ {status: 'unavailable'; reason: string;};
1024
+
1025
+ export type MigrationSemanticSnapshot =
1026
+ {
1027
+ status: 'available';
1028
+ version: 1;
1029
+ algorithm: 'sha256';
1030
+ machineBits: 32 | 64;
1031
+ scope: string;
1032
+ programDigest: string;
1033
+ definitionPlaneDigest: string;
1034
+ lawBodiesDigest: string;
1035
+ sourceTemplates?: MigrationTemplateSnapshot;
1036
+ inputDomains?: MigrationDomainSnapshot;
1037
+ definitions: {comparisonId: string; digest: string;}[];
1038
+ contracts: {comparisonId: string; digest: string;}[];
1039
+ dataTypes: {comparisonId: string; digest: string;}[];
1040
+ domainPolicies: {
1041
+ comparisonId: string;
1042
+ policy: 'nonempty' | 'universal';
1043
+ formalParameterCount?: number;
1044
+ }[];
1045
+ } |
1046
+ {status: 'unavailable'; reason: string;};
1047
+
1048
+ export type ProofTask =
1049
+ {
1050
+ encoding: 'lawspec-smtlib-v1';
1051
+ owner: string;
1052
+ declaration: string;
1053
+ at: Location;
1054
+ programFingerprint: string;
1055
+ machineBits: 32 | 64;
1056
+ status: 'ready';
1057
+ script: string;
1058
+ taskFingerprint: string;
1059
+ trust: string;
1060
+ } |
1061
+ {
1062
+ encoding: 'lawspec-smtlib-v1';
1063
+ owner: string;
1064
+ declaration: string;
1065
+ at: Location;
1066
+ programFingerprint: string;
1067
+ machineBits: 32 | 64;
1068
+ status: 'unsupported';
1069
+ reason: string;
1070
+ };
1071
+
1072
+ export type NativeSeed = number | string;
1073
+
1074
+ export type NativeFreshness =
1075
+ 'matching-inputs' | 'stale' | 'not-selected' | 'unavailable' | 'not-run';
1076
+
1077
+ export type NativeConformanceStatus =
1078
+ 'passed' |
1079
+ 'failed' |
1080
+ 'partial' |
1081
+ 'incomplete' |
1082
+ 'skipped' |
1083
+ 'known-failing' |
1084
+ 'not-selected' |
1085
+ 'stale' |
1086
+ 'unavailable';
1087
+
1088
+ export type NativeOutcome =
1089
+ 'passed' |
1090
+ 'failed' |
1091
+ 'skipped' |
1092
+ 'incomplete' |
1093
+ 'not-run' |
1094
+ 'known-failing';
1095
+
1096
+ export interface NativeCompletedTest {
1097
+ name: string;
1098
+ classname?: string;
1099
+ identity?: string;
1100
+ status: 'passed' | 'failed' | 'skipped';
1101
+ failure?: string;
1102
+ reason?: string;
1103
+ time?: number;
1104
+ }
1105
+
1106
+ export interface NativeExecutionProfile {
1107
+ target: string;
1108
+ root: string;
1109
+ machineBits: 32 | 64;
1110
+ minify: boolean;
1111
+ build: string;
1112
+ }
1113
+
1114
+ export interface NativeExecutionCheck {
1115
+ id: string;
1116
+ unit: string;
1117
+ file: string;
1118
+ name: string;
1119
+ label: string;
1120
+ scope?: string;
1121
+ obligations: NativeEvidenceTarget[];
1122
+ nativeGroup: string[];
1123
+ }
1124
+
1125
+ export interface NativeInvocation {
1126
+ ok: boolean;
1127
+ command: string | null;
1128
+ output?: string;
1129
+ }
1130
+
1131
+ export interface NativeExecutionAttempt {
1132
+ key: string;
1133
+ planKey: string;
1134
+ seed: NativeSeed;
1135
+ at: string;
1136
+ outcome: NativeOutcome;
1137
+ profile: NativeExecutionProfile;
1138
+ check: NativeExecutionCheck;
1139
+ coverage: NativeCheckCoverage;
1140
+ tests: NativeCompletedTest[];
1141
+ invocation: NativeInvocation;
1142
+ verification: 'native-execution';
1143
+ searchCompleteness: 'not-established';
1144
+ }
1145
+
1146
+ export interface NativeExecutionObservation {
1147
+ target: string;
1148
+ root: string;
1149
+ outcome: NativeOutcome;
1150
+ freshness: NativeFreshness;
1151
+ reason: string;
1152
+ check?: {id: string; obligations: NativeEvidenceTarget[]};
1153
+ obligations?: NativeEvidenceTarget[];
1154
+ coverage?: NativeCheckCoverage;
1155
+ attempt?: NativeExecutionAttempt;
1156
+ harness?: {flaky?: boolean; adequacy?: NativeAdequacy[]};
1157
+ }
1158
+
1159
+ export interface NativeAdequacy {
1160
+ test: string;
1161
+ cases: number;
1162
+ cover?: NativeCoverageObservation[];
1163
+ classes?: Record<string, number>;
1164
+ labels?: Record<string, number>;
1165
+ }
1166
+
1167
+ export interface NativeCoverageObservation {
1168
+ label: string;
1169
+ observed: number;
1170
+ required: number;
1171
+ met: boolean;
1172
+ }
1173
+
1174
+ export interface NativeConformanceEvidence {
1175
+ kind: 'native-conformance';
1176
+ status: NativeConformanceStatus;
1177
+ searchCompleteness: 'complete-finite-inputs' | 'not-established';
1178
+ observations: NativeExecutionObservation[];
1179
+ }
1180
+
1181
+ export interface NativeCheckCoverage {
1182
+ kind: 'sampled' | 'examples' | 'finite-inputs';
1183
+ cases?: number;
1184
+ scopedQuantifiers: boolean;
1185
+ }
1186
+
1187
+ export interface NativeEvidenceTarget {
1188
+ declaration: string;
1189
+ stage: string;
1190
+ }
1191
+
1192
+ export interface NativeTestEntry {
1193
+ law: string;
1194
+ unit: string;
1195
+ label: string;
1196
+ index: number;
1197
+ file: string;
1198
+ key: string;
1199
+ callsAdapters: boolean;
1200
+ name: string;
1201
+ tags: string[];
1202
+ skip: string | null;
1203
+ knownFailing: string | null;
1204
+ parallel: boolean;
1205
+ kind?: 'model';
1206
+ scope?: string;
1207
+ obligations?: NativeEvidenceTarget[];
1208
+ coverage: NativeCheckCoverage;
1209
+ }
1210
+
321
1211
  export interface Result {
322
- schemaVersion: 3 | 4;
1212
+ schemaVersion: 5;
323
1213
  machineBits?: 32 | 64;
1214
+ languageProfile?: "1.0-rc.1";
1215
+ verification?: VerificationSelection;
324
1216
  generation?: Generation;
325
1217
  units?: Unit[];
326
1218
  dataTypes?: DataTypeDeclaration[];
@@ -329,8 +1221,28 @@ export interface Result {
329
1221
  contracts?: {owner: string; contract: Contract;}[];
330
1222
  refinements?: Refinement[];
331
1223
  diagnostics: Diagnostic[];
1224
+ warnings?: MatchWarning[];
1225
+ warningAnalysis?: MatchWarningAnalysis;
332
1226
  expansions?: string[];
333
1227
  files?: Artifact[];
1228
+ formattedSources?: Source[];
1229
+ tests?: NativeTestEntry[];
1230
+ baselineGeneration?: {
1231
+ status: 'generated';
1232
+ planning: 'legacy-harnesses';
1233
+ execution: 'not-run';
1234
+ nativeConformance: 'not-established';
1235
+ lawVerification: 'not-established-by-generation';
1236
+ };
1237
+ sourceLanguageProfile?: '0.24';
1238
+ sourceSyntax?: SourceSyntax[];
1239
+ sourceFields?: MigrationSourceFields;
1240
+ migrationSemantics?: MigrationSemanticSnapshot;
1241
+ migrationComparison?: MigrationPayloadComparison;
1242
+ migrationBindings?: MigrationBindingProposal;
1243
+ migrationGeneration?: MigrationGenerationReceipt;
1244
+ migrationComparisonInput?: 'before' | 'migrated';
1245
+ proofTasks?: ProofTask[];
334
1246
  evidence?: ObligationEvidence[];
335
1247
  attestation?: AttestationView;
336
1248
  packages?: PackageView[];
@@ -386,9 +1298,15 @@ export type ScalarValue =
386
1298
  {type: 'Nullable' | 'Optional'; value: ScalarValue | null;};
387
1299
 
388
1300
  export interface Compiler {
1301
+ format(input: CheckRequest): Promise<Result>;
389
1302
  check(input: CheckRequest): Promise<Result>;
390
1303
  expand(input: CheckRequest): Promise<Result>;
1304
+ proofTasks(input: CheckRequest): Promise<Result>;
391
1305
  planGeneration(input: GenerationRequest): Promise<Result>;
1306
+ migrationBaseline(input: MigrationBaselineRequest): Promise<Result>;
1307
+ migrationComparison(input: MigrationComparisonRequest): Promise<Result>;
1308
+ migrationBindings(input: MigrationBindingRequest): Promise<Result>;
1309
+ migrationGeneration(input: MigrationGenerationRequest): Promise<Result>;
392
1310
  }
393
1311
 
394
1312
  export function createCompiler(): Promise<Compiler>;