lawspec 0.25.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.
Files changed (149) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/README.md +5 -4
  3. package/api.mjs +0 -8
  4. package/bin/lawspec.mjs +14 -52
  5. package/build.json +77 -105
  6. package/core.wasm +2 -2
  7. package/core_jsffi.js +5 -0
  8. package/examples/native-payments/clojure/lawspec.json +1 -1
  9. package/examples/native-payments/csharp/lawspec.json +1 -1
  10. package/examples/native-payments/elixir/lawspec.json +1 -1
  11. package/examples/native-payments/erlang/lawspec.json +1 -1
  12. package/examples/native-payments/fsharp/lawspec.json +1 -1
  13. package/examples/native-payments/gleam/lawspec.json +1 -1
  14. package/examples/native-payments/go/lawspec.json +1 -1
  15. package/examples/native-payments/groovy/lawspec.json +1 -1
  16. package/examples/native-payments/haskell/lawspec.json +1 -1
  17. package/examples/native-payments/java/lawspec.json +1 -1
  18. package/examples/native-payments/javascript/lawspec.json +1 -1
  19. package/examples/native-payments/kotlin/lawspec.json +1 -1
  20. package/examples/native-payments/python/lawspec.json +1 -1
  21. package/examples/native-payments/rust/lawspec.json +1 -1
  22. package/examples/native-payments/scala/lawspec.json +1 -1
  23. package/examples/native-payments/swift/lawspec.json +1 -1
  24. package/examples/native-payments/typescript/lawspec.json +1 -1
  25. package/examples/packages/orders/lawspec.json +1 -1
  26. package/examples/packages/orders/orders.lawspec +27 -25
  27. package/examples/packages/shop-domain/src/domain.lawspec +15 -14
  28. package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
  29. package/examples/packages/shop-tax-1/src/rates.lawspec +1 -0
  30. package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
  31. package/examples/packages/shop-tax-2/src/rates.lawspec +1 -0
  32. package/examples/rc1/authorization-snapshots.lawspec +24 -23
  33. package/examples/rc1/banner-filenames.lawspec +7 -6
  34. package/examples/rc1/bit-codec.lawspec +12 -11
  35. package/examples/rc1/bounded-witness-search.lawspec +52 -45
  36. package/examples/rc1/conflicting-requirements.lawspec +8 -7
  37. package/examples/rc1/constructive-witnesses.lawspec +40 -33
  38. package/examples/rc1/documentary-review.lawspec +9 -8
  39. package/examples/rc1/empty-domains.lawspec +16 -15
  40. package/examples/rc1/finite-integer-domains.lawspec +24 -23
  41. package/examples/rc1/law-metadata.lawspec +6 -5
  42. package/examples/rc1/native-payments.lawspec +17 -16
  43. package/examples/rc1/nesting/rrr.lawspec +4 -3
  44. package/examples/rc1/nesting/rru.lawspec +7 -6
  45. package/examples/rc1/nesting/rur.lawspec +7 -6
  46. package/examples/rc1/nesting/ruu.lawspec +10 -9
  47. package/examples/rc1/nesting/urr.lawspec +7 -6
  48. package/examples/rc1/nesting/uru.lawspec +10 -9
  49. package/examples/rc1/nesting/uur.lawspec +10 -9
  50. package/examples/rc1/nesting/uuu.lawspec +13 -12
  51. package/examples/rc1/order-workflow.lawspec +18 -17
  52. package/examples/rc1/parcel-measurements.lawspec +14 -13
  53. package/examples/rc1/picture-records.lawspec +6 -5
  54. package/examples/rc1/picture-tuples.lawspec +6 -5
  55. package/examples/rc1/record-payloads.lawspec +12 -11
  56. package/examples/rc1/recursive-records.lawspec +11 -10
  57. package/examples/rc1/refund-conformance.lawspec +7 -6
  58. package/examples/rc1/refund-policy.lawspec +15 -14
  59. package/examples/rc1/requirement-composition.lawspec +26 -25
  60. package/examples/rc1/structural-records.lawspec +13 -12
  61. package/examples/rc1-authoring.lawspec +6 -5
  62. package/examples/specs/abilities.lawspec +67 -65
  63. package/examples/specs/ability_imports.lawspec +58 -57
  64. package/examples/specs/actors.lawspec +23 -22
  65. package/examples/specs/algebra.lawspec +142 -141
  66. package/examples/specs/approvals.lawspec +16 -15
  67. package/examples/specs/async_bindings.lawspec +10 -9
  68. package/examples/specs/async_fetch.lawspec +12 -11
  69. package/examples/specs/atoi_codec.lawspec +16 -15
  70. package/examples/specs/boolean_flags.lawspec +10 -9
  71. package/examples/specs/builtins.lawspec +73 -72
  72. package/examples/specs/canonical_url.lawspec +14 -13
  73. package/examples/specs/collections.lawspec +153 -154
  74. package/examples/specs/composition.lawspec +70 -66
  75. package/examples/specs/concurrent_collections.lawspec +8 -7
  76. package/examples/specs/consistency.lawspec +4 -3
  77. package/examples/specs/contracts.lawspec +80 -79
  78. package/examples/specs/crypto.lawspec +26 -25
  79. package/examples/specs/ctc.lawspec +148 -0
  80. package/examples/specs/currying.lawspec +32 -31
  81. package/examples/specs/data_types.lawspec +50 -49
  82. package/examples/specs/distribution.lawspec +57 -56
  83. package/examples/specs/domain_modeling.lawspec +48 -47
  84. package/examples/specs/durations.lawspec +39 -38
  85. package/examples/specs/equivalent.lawspec +25 -24
  86. package/examples/specs/failures.lawspec +64 -63
  87. package/examples/specs/finite_data.lawspec +32 -31
  88. package/examples/specs/flow_stack.lawspec +64 -63
  89. package/examples/specs/gadt_expressions.lawspec +50 -49
  90. package/examples/specs/generation.lawspec +115 -114
  91. package/examples/specs/handler_bindings.lawspec +42 -40
  92. package/examples/specs/handles.lawspec +2 -1
  93. package/examples/specs/harness.lawspec +45 -43
  94. package/examples/specs/harness_testing.lawspec +18 -13
  95. package/examples/specs/indexed_arithmetic.lawspec +401 -126
  96. package/examples/specs/indexed_families.lawspec +182 -66
  97. package/examples/specs/keywords.lawspec +22 -21
  98. package/examples/specs/limits.lawspec +6 -5
  99. package/examples/specs/list_contracts.lawspec +121 -120
  100. package/examples/specs/list_refinements.lawspec +43 -42
  101. package/examples/specs/lists.lawspec +45 -44
  102. package/examples/specs/matchers.lawspec +79 -78
  103. package/examples/specs/matching.lawspec +43 -42
  104. package/examples/specs/mixed_inputs.lawspec +25 -24
  105. package/examples/specs/models.lawspec +44 -43
  106. package/examples/specs/parse_port.lawspec +28 -27
  107. package/examples/specs/payments.lawspec +55 -54
  108. package/examples/specs/railway.lawspec +59 -58
  109. package/examples/specs/records.lawspec +149 -148
  110. package/examples/specs/records_inner.lawspec +5 -4
  111. package/examples/specs/recursive_refinements.lawspec +30 -29
  112. package/examples/specs/refined_definitions.lawspec +24 -23
  113. package/examples/specs/refinements.lawspec +58 -57
  114. package/examples/specs/resilience.lawspec +159 -158
  115. package/examples/specs/resources.lawspec +61 -60
  116. package/examples/specs/scalar_adapters.lawspec +60 -59
  117. package/examples/specs/scalar_catalog.lawspec +165 -164
  118. package/examples/specs/scalars.lawspec +78 -77
  119. package/examples/specs/scheduling_order.lawspec +8 -7
  120. package/examples/specs/scheduling_overlap.lawspec +5 -4
  121. package/examples/specs/sequences.lawspec +66 -65
  122. package/examples/specs/sessions.lawspec +13 -12
  123. package/examples/specs/slug.lawspec +16 -15
  124. package/examples/specs/sum_refinements.lawspec +42 -41
  125. package/examples/specs/tables.lawspec +29 -28
  126. package/examples/specs/total_functions.lawspec +71 -70
  127. package/examples/specs/workflows.lawspec +101 -100
  128. package/examples-command.mjs +4 -6
  129. package/explain.mjs +6 -4
  130. package/expression-presentation.mjs +8 -8
  131. package/files.mjs +1 -1
  132. package/index.d.ts +4 -527
  133. package/launcher.mjs +9 -2
  134. package/lsp.mjs +10 -6
  135. package/native-examples.mjs +2 -2
  136. package/package.json +1 -1
  137. package/starter-rc1.lawspec +6 -5
  138. package/starter.lawspec +16 -15
  139. package/templates.mjs +4 -2
  140. package/migrate.mjs +0 -135
  141. package/migration-bindings.mjs +0 -86
  142. package/migration-cases.mjs +0 -45
  143. package/migration-collections.mjs +0 -54
  144. package/migration-correspondence.mjs +0 -275
  145. package/migration-generation.mjs +0 -99
  146. package/migration-laws.mjs +0 -102
  147. package/migration-records.mjs +0 -166
  148. package/migration-source.mjs +0 -247
  149. package/migration-write.mjs +0 -156
package/index.d.ts CHANGED
@@ -64,34 +64,12 @@ export interface SourceSyntax {
64
64
  references: SourceSyntaxReference[];
65
65
  }
66
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
-
91
67
  export interface Diagnostic {
92
68
  code: string;
93
69
  message: string;
94
70
  at: Location | null;
71
+ span?: Span;
72
+ related?: {message: string; span: Span;}[];
95
73
  }
96
74
 
97
75
  export interface MatchWarning extends Diagnostic {
@@ -541,9 +519,8 @@ export interface VerificationSelection {
541
519
  }
542
520
 
543
521
  export interface CheckRequest {
544
- languageProfile: '1.0-rc.1';
522
+ languageProfile: '1.0-rc.2';
545
523
  verification?: Verification;
546
- migrationSnapshot?: boolean;
547
524
  warnMatches?: boolean;
548
525
  sources: Source[];
549
526
  schemaVersion?: 5;
@@ -564,487 +541,6 @@ export interface GenerationRequest extends CheckRequest {
564
541
  minify?: boolean;
565
542
  }
566
543
 
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
544
  export type ProofTask =
1049
545
  {
1050
546
  encoding: 'lawspec-smtlib-v1';
@@ -1211,7 +707,7 @@ export interface NativeTestEntry {
1211
707
  export interface Result {
1212
708
  schemaVersion: 5;
1213
709
  machineBits?: 32 | 64;
1214
- languageProfile?: "1.0-rc.1";
710
+ languageProfile?: "1.0-rc.2";
1215
711
  verification?: VerificationSelection;
1216
712
  generation?: Generation;
1217
713
  units?: Unit[];
@@ -1227,21 +723,6 @@ export interface Result {
1227
723
  files?: Artifact[];
1228
724
  formattedSources?: Source[];
1229
725
  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
726
  proofTasks?: ProofTask[];
1246
727
  evidence?: ObligationEvidence[];
1247
728
  attestation?: AttestationView;
@@ -1303,10 +784,6 @@ export interface Compiler {
1303
784
  expand(input: CheckRequest): Promise<Result>;
1304
785
  proofTasks(input: CheckRequest): Promise<Result>;
1305
786
  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>;
1310
787
  }
1311
788
 
1312
789
  export function createCompiler(): Promise<Compiler>;
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
- pending = result.catch(() => {});
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: ["lawspec"],
42
+ args: coreArguments,
36
43
  env: { PWD: "/" },
37
44
  preopens: { "/": process.cwd() },
38
45
  });
package/lsp.mjs CHANGED
@@ -46,8 +46,8 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
46
46
  let config;
47
47
  try { config = JSON.parse(await readFile(path.join(workspace, 'lawspec.json'), 'utf8')); }
48
48
  catch (error) { if (error.code !== 'ENOENT') throw error; }
49
- if(config&&(config.version!==2||config.languageProfile!=='1.0-rc.1'))
50
- throw new Error('The language server requires configuration version 2 and languageProfile 1.0-rc.1; run lawspec migrate --from 0.24 first.');
49
+ if(config&&(config.version!==2||config.languageProfile!=='1.0-rc.2'))
50
+ throw new Error('The language server requires configuration version 2 and languageProfile 1.0-rc.2.');
51
51
  for (const entry of config?.sources ?? []) await visit(path.resolve(workspace, entry));
52
52
  for (const [uri, document] of documents) sources.set(fileURLToPath(uri), { path: fileURLToPath(uri), content: document.text });
53
53
  return [...sources.values()];
@@ -63,7 +63,7 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
63
63
  }
64
64
  async function check() {
65
65
  const sources = await projectSources();
66
- const result = await compiler.check({ sources, languageProfile: '1.0-rc.1', verification: { layers: [] }, ...(warnMatches ? {warnMatches:true} : {}) });
66
+ const result = await compiler.check({ sources, languageProfile: '1.0-rc.2', verification: { layers: [] }, ...(warnMatches ? {warnMatches:true} : {}) });
67
67
  last = { sources, result };
68
68
  for (const [uri, document] of documents) {
69
69
  const file = fileURLToPath(uri);
@@ -72,7 +72,11 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
72
72
  const content = document.text.split('\n')[start.line] ?? '';
73
73
  const end = { ...start, character: Math.min(content.length, start.character + ([...content.slice(start.character)][0]?.length ?? 0)) };
74
74
  const range = d.span ? span(d.span)?.range ?? {start,end} : {start,end};
75
- return { range, severity: d.severity === 'warning' ? 2 : 1, code: d.code, source: 'LawSpec', message: d.message };
75
+ return { range, severity: d.severity === 'warning' ? 2 : 1, code: d.code, source: 'LawSpec', message: d.message,
76
+ ...(d.related?.length ? {relatedInformation: d.related.flatMap(item => {
77
+ const origin = span(item.span);
78
+ return origin ? [{location: {uri: origin.uri, range: origin.range}, message: item.message}] : [];
79
+ })} : {}) };
76
80
  });
77
81
  send({ jsonrpc: '2.0', method: 'textDocument/publishDiagnostics', params: { uri, version: document.version, diagnostics } });
78
82
  }
@@ -143,7 +147,7 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
143
147
  workspace = params.rootUri ? fileURLToPath(params.rootUri) : params.rootPath ?? workspace;
144
148
  result = { capabilities: { textDocumentSync: 1, positionEncoding: 'utf-16', documentFormattingProvider: true,
145
149
  documentSymbolProvider: true, hoverProvider: true, definitionProvider: true, referencesProvider: true },
146
- serverInfo: { name: 'LawSpec', version: '1.0-rc.1' } };
150
+ serverInfo: { name: 'LawSpec', version: '1.0-rc.2' } };
147
151
  break;
148
152
  case 'initialized': break;
149
153
  case 'workspace/didChangeConfiguration': {
@@ -168,7 +172,7 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
168
172
  const document = documents.get(params.textDocument.uri);
169
173
  if (!document) { result = []; break; }
170
174
  const sourcePath = fileURLToPath(params.textDocument.uri);
171
- const response = await compiler.format({ sources: await projectSources(), languageProfile: '1.0-rc.1', verification: { layers: [] } });
175
+ const response = await compiler.format({ sources: await projectSources(), languageProfile: '1.0-rc.2', verification: { layers: [] } });
172
176
  if (response.diagnostics?.length) { result = []; break; }
173
177
  const formatted = response.formattedSources.find(s => s.path === sourcePath);
174
178
  result = formatted && formatted.content !== document.text
@@ -31,8 +31,8 @@ export async function exportNativePayments(options, selected) {
31
31
  'laws/payments.lawspec': law,
32
32
  };
33
33
  const config = JSON.parse(files['lawspec.json']);
34
- if(config.version!==2||config.languageProfile!=='1.0-rc.1')
35
- throw new Error(`Bundled native payments configuration for ${target} must use version 2 and languageProfile 1.0-rc.1`);
34
+ if(config.version!==2||config.languageProfile!=='1.0-rc.2')
35
+ throw new Error(`Bundled native payments configuration for ${target} must use version 2 and languageProfile 1.0-rc.2`);
36
36
  config.machineBits = options.machineBits ?? 64;
37
37
  files['lawspec.json'] = JSON.stringify(config, null, options.minify ? undefined : 2) + '\n';
38
38
  const instructions = target === 'gleam' ? setup[target].replace(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawspec",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "description": "State the law once. Check it everywhere.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,13 +7,13 @@ atoi of type Text -> Int32
7
7
  law codec is
8
8
  description:
9
9
  "Converting an integer to decimal text and reading it back preserves it."
10
- end
10
+ end description
11
11
 
12
12
  definition:
13
13
  for all (x of type Int32) =>
14
14
  atoi (itoa x) must be x
15
- end
16
- end
15
+ end for all
16
+ end definition
17
17
 
18
18
  expect itoa x = encoded
19
19
  expect atoi encoded = x
@@ -21,5 +21,6 @@ law codec is
21
21
  row -42, "-42"
22
22
  row 0, "0"
23
23
  row 42, "42"
24
- end
25
- end
24
+ end table
25
+ end law
26
+ end unit