@reventlessdev/reventless-gwt 1.0.0-alpha.292 → 1.0.0-alpha.293

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 CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 1.0.0-alpha.293 (2026-11-21)
7
+
8
+ ### Features
9
+
10
+ * **gwt:** a flow runs what was sent, states rows and acceptance, and keeps time ([0d418c9](https://github.com/ReventlessDev/reventless-core/commit/0d418c9f890a4255d5b906f1246ccb705d3a9a6a))
11
+ * **gwt:** a flow says who acts, reacts once, and starts after another ([1cae4fc](https://github.com/ReventlessDev/reventless-core/commit/1cae4fcc3d0a3c2743efaba0ea876ff3e02664ec))
12
+ * **gwt:** a plugin's flow steps come ready-made, and a failure names its step ([861bb08](https://github.com/ReventlessDev/reventless-core/commit/861bb08cea20b006fd44f08b6c10c51774487faf))
13
+ * **gwt:** a system's boundary is tested without a test written, and a flow reaches every part ([9475f85](https://github.com/ReventlessDev/reventless-core/commit/9475f858027b55a819b5132b25b9d2e186ade934))
14
+
15
+
6
16
  # 1.0.0-alpha.292 (2026-11-20)
7
17
 
8
18
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-gwt",
3
- "version": "1.0.0-alpha.292",
3
+ "version": "1.0.0-alpha.293",
4
4
  "description": "Given-When-Then DSLs and test harness for Reventless slice testing",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "sury": "11.1.0",
17
17
  "@reventlessdev/rescript-effect": "1.0.0-alpha.4",
18
- "@reventlessdev/rescript-jest": "1.0.0-alpha.14",
19
18
  "@reventlessdev/rescript-node": "2.0.0-alpha.26",
20
- "@reventlessdev/reventless-infra": "3.0.0-alpha.236",
21
- "@reventlessdev/reventless-core": "3.0.0-alpha.343",
22
- "@reventlessdev/reventless-spec": "3.0.0-alpha.205"
19
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.237",
20
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.206",
21
+ "@reventlessdev/rescript-jest": "1.0.0-alpha.14",
22
+ "@reventlessdev/reventless-core": "3.0.0-alpha.344"
23
23
  },
24
24
  "devDependencies": {
25
25
  "rescript": "12.3.1",
@@ -0,0 +1,57 @@
1
+ // Whether a DCB consistency boundary derives its tag scope over all its slices.
2
+ //
3
+ // One slice's own test cannot show this: a single slice always resolves, so the
4
+ // all-or-nothing fallback in `deriveEffectiveScope` (one unresolvable slice
5
+ // discarding the derived scope for every slice beside it) has no per-slice
6
+ // symptom. The slices keep passing their own tests while the platform rejects
7
+ // valid commands. `generate-plugin` writes this test for every system, over its
8
+ // `Plugin.dcbSliceSchemas`, so the boundary is checked as deployed with no test
9
+ // written for it.
10
+
11
+ let resolves = (~name: string, slices: array<Reventless.DcbTag.sliceSchemas>): Outcome.outcome => {
12
+ let scope = Reventless.DcbTag.deriveEffectiveScope(slices)
13
+ // Deploy and boot derive the storage partition from the same slices and refuse
14
+ // the boundary when it fails, so the test fails with their reasons.
15
+ let partitionReasons = {
16
+ let shapes = slices->Array.map(Reventless.DcbTag.sliceShape)
17
+ let hints = Reventless.DcbValidation.validatePartitionHintsVsInference(~shapes)
18
+ let arms = Reventless.DcbValidation.validateCrossPartitionArms(
19
+ ~shapes,
20
+ ~inferred=Reventless.DcbScopeInference.infer(shapes),
21
+ )
22
+ let contradictions =
23
+ hints.contradictions
24
+ ->Array.concat(arms.contradictions)
25
+ ->Array.map(e => `${e.sliceName}: ${e.message}`)
26
+ switch Reventless.DcbTag.deriveBoundaryPartition(slices) {
27
+ | _ => contradictions
28
+ | exception JsExn(err) =>
29
+ contradictions->Array.concat([
30
+ JsExn.message(err)->Option.getOr("partition derivation failed"),
31
+ ])
32
+ }
33
+ }
34
+
35
+ // Beyond that, an ambiguity that costs nothing is not a failure: a boundary whose
36
+ // fallback carries every derived key reads exactly as the derivation would. What
37
+ // fails is losing a key, because that is the case where the runtime answers wrongly.
38
+ if partitionReasons->Array.length > 0 {
39
+ Outcome.fail(PartitionUnresolved({boundary: name, reasons: partitionReasons}))
40
+ } else if scope.droppedCrossPartitionTagKeys->Array.length > 0 {
41
+ Outcome.fail(
42
+ ScopeDegraded({
43
+ boundary: name,
44
+ dropped: scope.droppedCrossPartitionTagKeys,
45
+ ambiguities: scope.ambiguities->Array.map(((slice, reason)) => `${slice}: ${reason}`),
46
+ }),
47
+ )
48
+ } else {
49
+ Outcome.pass
50
+ }
51
+ }
52
+
53
+ /** The test of one system's boundary, named for the system. */
54
+ let test = (~system: string, slices: array<Reventless.DcbTag.sliceSchemas>) =>
55
+ JestBind.test(~slice=system, `the ${system} boundary derives its DCB scope`, () =>
56
+ resolves(~name=system, slices)
57
+ )
@@ -0,0 +1,56 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
4
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
+ import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
6
+ import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
7
+ import * as Outcome$ReventlessGwt from "./Outcome.res.mjs";
8
+ import * as JestBind$ReventlessGwt from "./JestBind.res.mjs";
9
+ import * as DcbValidation$Reventless from "@reventlessdev/reventless-spec/src/components/DcbValidation.res.mjs";
10
+ import * as DcbScopeInference$Reventless from "@reventlessdev/reventless-spec/src/components/DcbScopeInference.res.mjs";
11
+
12
+ function resolves(name, slices) {
13
+ let scope = DcbTag$Reventless.deriveEffectiveScope(slices);
14
+ let shapes = slices.map(DcbTag$Reventless.sliceShape);
15
+ let hints = DcbValidation$Reventless.validatePartitionHintsVsInference(shapes);
16
+ let arms = DcbValidation$Reventless.validateCrossPartitionArms(shapes, DcbScopeInference$Reventless.infer(shapes));
17
+ let contradictions = hints.contradictions.concat(arms.contradictions).map(e => e.sliceName + `: ` + e.message);
18
+ let partitionReasons;
19
+ try {
20
+ DcbTag$Reventless.deriveBoundaryPartition(slices);
21
+ partitionReasons = contradictions;
22
+ } catch (raw_err) {
23
+ let err = Primitive_exceptions.internalToException(raw_err);
24
+ if (err.RE_EXN_ID === "JsExn") {
25
+ partitionReasons = contradictions.concat([Stdlib_Option.getOr(Stdlib_JsExn.message(err._1), "partition derivation failed")]);
26
+ } else {
27
+ throw err;
28
+ }
29
+ }
30
+ if (partitionReasons.length !== 0) {
31
+ return Outcome$ReventlessGwt.fail({
32
+ TAG: "PartitionUnresolved",
33
+ boundary: name,
34
+ reasons: partitionReasons
35
+ });
36
+ } else if (scope.droppedCrossPartitionTagKeys.length !== 0) {
37
+ return Outcome$ReventlessGwt.fail({
38
+ TAG: "ScopeDegraded",
39
+ boundary: name,
40
+ dropped: scope.droppedCrossPartitionTagKeys,
41
+ ambiguities: scope.ambiguities.map(param => param[0] + `: ` + param[1])
42
+ });
43
+ } else {
44
+ return Outcome$ReventlessGwt.pass;
45
+ }
46
+ }
47
+
48
+ function test(system, slices) {
49
+ JestBind$ReventlessGwt.test(system, `the ` + system + ` boundary derives its DCB scope`, () => resolves(system, slices));
50
+ }
51
+
52
+ export {
53
+ resolves,
54
+ test,
55
+ }
56
+ /* Stdlib_JsExn Not a pure module */
@@ -93,6 +93,34 @@ module Caller = {
93
93
  }
94
94
  /** A caller with no identity. */
95
95
  let anonymous: t = {claim: Unidentified, roles: [], signedIn: false}
96
+
97
+ /** The group a test's operator holds, elevated in every read the test makes. */
98
+ let operatorGroup = "reventless-gwt-operator"
99
+
100
+ /** The caller as the read rules take them. */
101
+ let identity = (who: t): Reventless.Identity.t => {
102
+ let groups = who.roles->Array.map(Reventless.Role.groupOf)
103
+ switch who.claim {
104
+ | Owned({userId}) => {userId, username: userId, groups, provider: InMemory}
105
+ | Exempt => {
106
+ userId: "operator",
107
+ username: "operator",
108
+ groups: groups->Array.concat([operatorGroup]),
109
+ provider: InMemory,
110
+ }
111
+ | Unidentified => Reventless.Identity.anonymous
112
+ }
113
+ }
114
+
115
+ /** The claim a command carries: an owner holding a role whose group is elevated
116
+ acts for anyone, as the platform classifies them. */
117
+ let claimWith = (who: t, ~elevated: array<string>): Message.CallerClaim.t =>
118
+ switch who.claim {
119
+ | Owned(_)
120
+ if who.roles->Array.some(role => elevated->Array.includes(Reventless.Role.groupOf(role))) =>
121
+ Exempt
122
+ | claim => claim
123
+ }
96
124
  }
97
125
 
98
126
  /** `Caller` as a scenario sees it: roles typed by the spec's own `role`, so they
@@ -3,11 +3,13 @@
3
3
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
4
4
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
5
  import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
6
+ import * as Role$Reventless from "@reventlessdev/reventless-spec/src/types/Role.res.mjs";
6
7
  import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components/Owner.res.mjs";
7
8
  import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
8
9
  import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
9
10
  import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
10
11
  import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
12
+ import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
11
13
  import * as DcbDecode$Reventless from "@reventlessdev/reventless-spec/src/components/DcbDecode.res.mjs";
12
14
  import * as Outcome$ReventlessGwt from "./Outcome.res.mjs";
13
15
  import * as OwnerScope$Reventless from "@reventlessdev/reventless-spec/src/types/OwnerScope.res.mjs";
@@ -80,13 +82,51 @@ let anonymous = {
80
82
  signedIn: false
81
83
  };
82
84
 
85
+ let operatorGroup = "reventless-gwt-operator";
86
+
87
+ function identity(who) {
88
+ let groups = who.roles.map(Role$Reventless.groupOf);
89
+ let match = who.claim;
90
+ if (typeof match !== "object") {
91
+ if (match === "Exempt") {
92
+ return {
93
+ userId: "operator",
94
+ username: "operator",
95
+ groups: groups.concat([operatorGroup]),
96
+ provider: "InMemory"
97
+ };
98
+ } else {
99
+ return Identity$Reventless.anonymous;
100
+ }
101
+ }
102
+ let userId = match.userId;
103
+ return {
104
+ userId: userId,
105
+ username: userId,
106
+ groups: groups,
107
+ provider: "InMemory"
108
+ };
109
+ }
110
+
111
+ function claimWith(who, elevated) {
112
+ let claim = who.claim;
113
+ if (typeof claim !== "object" || !who.roles.some(role => elevated.includes(Role$Reventless.groupOf(role)))) {
114
+ return claim;
115
+ } else {
116
+ return "Exempt";
117
+ }
118
+ }
119
+
83
120
  let Caller = {
84
121
  roleNames: roleNames,
85
122
  owner: owner,
86
123
  inRoles: inRoles,
87
124
  operator: operator,
88
125
  operatorIn: operatorIn,
89
- anonymous: anonymous
126
+ anonymous: anonymous,
127
+ operatorGroup: operatorGroup,
128
+ identity: identity,
129
+ claimWith: claimWith
90
130
  };
91
131
 
92
132
  function Callers(R) {
@@ -1012,4 +1052,4 @@ export {
1012
1052
  Make,
1013
1053
  MakeFromAggregate,
1014
1054
  }
1015
- /* Owner-Reventless Not a pure module */
1055
+ /* Role-Reventless Not a pure module */