rivetkit 2.0.41 → 2.0.43-rc.1

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 (115) hide show
  1. package/dist/tsup/actor/errors.cjs +2 -2
  2. package/dist/tsup/actor/errors.cjs.map +1 -1
  3. package/dist/tsup/actor/errors.js +1 -1
  4. package/dist/tsup/{chunk-LMG4QMDO.js → chunk-2NJQ3DJ5.js} +15 -5
  5. package/dist/tsup/{chunk-LMG4QMDO.js.map → chunk-2NJQ3DJ5.js.map} +1 -1
  6. package/dist/tsup/{chunk-SNAUKDDK.cjs → chunk-2XQS746M.cjs} +4 -4
  7. package/dist/tsup/chunk-2XQS746M.cjs.map +1 -0
  8. package/dist/tsup/{chunk-DSNSFYDL.cjs → chunk-3HKN5HQ7.cjs} +3 -3
  9. package/dist/tsup/chunk-3HKN5HQ7.cjs.map +1 -0
  10. package/dist/tsup/{chunk-B5UXC4QV.cjs → chunk-BEMEUFS2.cjs} +78 -78
  11. package/dist/tsup/chunk-BEMEUFS2.cjs.map +1 -0
  12. package/dist/tsup/chunk-CKBPIXRM.js +278 -0
  13. package/dist/tsup/chunk-CKBPIXRM.js.map +1 -0
  14. package/dist/tsup/{chunk-GTQKDCM4.cjs → chunk-ETNL2HZL.cjs} +49 -49
  15. package/dist/tsup/chunk-ETNL2HZL.cjs.map +1 -0
  16. package/dist/tsup/{chunk-OXN6EZUB.js → chunk-F7ZL4T63.js} +3 -3
  17. package/dist/tsup/chunk-GBENOENJ.cjs.map +1 -1
  18. package/dist/tsup/chunk-KDFWJKMJ.cjs.map +1 -1
  19. package/dist/tsup/{chunk-2YHR67M4.js → chunk-LFVF5SCU.js} +4 -4
  20. package/dist/tsup/chunk-LFVF5SCU.js.map +1 -0
  21. package/dist/tsup/{chunk-4UHJ3ADW.cjs → chunk-MQ3PTGWH.cjs} +115 -99
  22. package/dist/tsup/chunk-MQ3PTGWH.cjs.map +1 -0
  23. package/dist/tsup/{chunk-Y7ZDTLD2.js → chunk-NENM5PQN.js} +2 -2
  24. package/dist/tsup/chunk-R33VIC3W.cjs +278 -0
  25. package/dist/tsup/chunk-R33VIC3W.cjs.map +1 -0
  26. package/dist/tsup/{chunk-QDVKDX7G.cjs → chunk-ROVVTBUE.cjs} +9 -9
  27. package/dist/tsup/chunk-ROVVTBUE.cjs.map +1 -0
  28. package/dist/tsup/{chunk-7KIR3QLO.js → chunk-S22E2HUH.js} +24 -8
  29. package/dist/tsup/chunk-S22E2HUH.js.map +1 -0
  30. package/dist/tsup/{chunk-UGOCTUBG.js → chunk-TFMRMA5S.js} +5 -5
  31. package/dist/tsup/{chunk-WYZLRPQM.cjs → chunk-YR6H6STI.cjs} +269 -269
  32. package/dist/tsup/chunk-YR6H6STI.cjs.map +1 -0
  33. package/dist/tsup/{chunk-S6F7EKC7.cjs → chunk-YZZF7DES.cjs} +20 -10
  34. package/dist/tsup/chunk-YZZF7DES.cjs.map +1 -0
  35. package/dist/tsup/{chunk-4J5EFV3E.js → chunk-Z3BORZE2.js} +5 -5
  36. package/dist/tsup/{chunk-NRP2OHSW.js → chunk-ZKCVZA7Z.js} +5 -5
  37. package/dist/tsup/client/mod.cjs +6 -6
  38. package/dist/tsup/client/mod.cjs.map +1 -1
  39. package/dist/tsup/client/mod.d.cts +2 -2
  40. package/dist/tsup/client/mod.d.ts +2 -2
  41. package/dist/tsup/client/mod.js +5 -5
  42. package/dist/tsup/common/log.cjs +3 -3
  43. package/dist/tsup/common/log.cjs.map +1 -1
  44. package/dist/tsup/common/log.d.cts +2 -2
  45. package/dist/tsup/common/log.d.ts +2 -2
  46. package/dist/tsup/common/log.js +2 -2
  47. package/dist/tsup/common/websocket.cjs +4 -4
  48. package/dist/tsup/common/websocket.cjs.map +1 -1
  49. package/dist/tsup/common/websocket.js +3 -3
  50. package/dist/tsup/{config-D43N-CFi.d.ts → config-CLnylLYY.d.ts} +10 -10
  51. package/dist/tsup/{config-COyis_uH.d.cts → config-CZB2-W8x.d.cts} +10 -10
  52. package/dist/tsup/{driver-KyM2v645.d.ts → driver-D0QX9M11.d.ts} +1 -1
  53. package/dist/tsup/driver-helpers/mod.cjs +4 -4
  54. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  55. package/dist/tsup/driver-helpers/mod.d.cts +2 -2
  56. package/dist/tsup/driver-helpers/mod.d.ts +2 -2
  57. package/dist/tsup/driver-helpers/mod.js +3 -3
  58. package/dist/tsup/{driver-Bt7B-qMd.d.cts → driver-q-zqG7fc.d.cts} +1 -1
  59. package/dist/tsup/driver-test-suite/mod.cjs +323 -448
  60. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  61. package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
  62. package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
  63. package/dist/tsup/driver-test-suite/mod.js +916 -1041
  64. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  65. package/dist/tsup/inspector/mod.cjs.map +1 -1
  66. package/dist/tsup/mod.cjs +8 -8
  67. package/dist/tsup/mod.cjs.map +1 -1
  68. package/dist/tsup/mod.d.cts +4 -4
  69. package/dist/tsup/mod.d.ts +4 -4
  70. package/dist/tsup/mod.js +7 -7
  71. package/dist/tsup/serve-test-suite/mod.cjs +1581 -0
  72. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -0
  73. package/dist/tsup/serve-test-suite/mod.d.cts +9 -0
  74. package/dist/tsup/serve-test-suite/mod.d.ts +9 -0
  75. package/dist/tsup/serve-test-suite/mod.js +1578 -0
  76. package/dist/tsup/serve-test-suite/mod.js.map +1 -0
  77. package/dist/tsup/test/mod.cjs +8 -8
  78. package/dist/tsup/test/mod.cjs.map +1 -1
  79. package/dist/tsup/test/mod.d.cts +1 -1
  80. package/dist/tsup/test/mod.d.ts +1 -1
  81. package/dist/tsup/test/mod.js +7 -7
  82. package/dist/tsup/utils.cjs +3 -3
  83. package/dist/tsup/utils.cjs.map +1 -1
  84. package/dist/tsup/utils.js +2 -2
  85. package/package.json +14 -4
  86. package/src/actor/errors.ts +4 -4
  87. package/src/driver-test-suite/mod.ts +3 -0
  88. package/src/driver-test-suite/tests/actor-driver.ts +4 -0
  89. package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
  90. package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
  91. package/src/drivers/engine/actor-driver.ts +24 -4
  92. package/src/serve-test-suite/mod.ts +147 -0
  93. package/dist/schemas/actor-persist/v1.js +0 -167
  94. package/dist/schemas/actor-persist/v2.js +0 -200
  95. package/dist/schemas/actor-persist/v3.js +0 -200
  96. package/dist/schemas/client-protocol/v1.js +0 -301
  97. package/dist/schemas/client-protocol/v2.js +0 -299
  98. package/dist/schemas/file-system-driver/v1.js +0 -76
  99. package/dist/schemas/file-system-driver/v2.js +0 -103
  100. package/dist/schemas/file-system-driver/v3.js +0 -122
  101. package/dist/tsup/chunk-2YHR67M4.js.map +0 -1
  102. package/dist/tsup/chunk-4UHJ3ADW.cjs.map +0 -1
  103. package/dist/tsup/chunk-7KIR3QLO.js.map +0 -1
  104. package/dist/tsup/chunk-B5UXC4QV.cjs.map +0 -1
  105. package/dist/tsup/chunk-DSNSFYDL.cjs.map +0 -1
  106. package/dist/tsup/chunk-GTQKDCM4.cjs.map +0 -1
  107. package/dist/tsup/chunk-QDVKDX7G.cjs.map +0 -1
  108. package/dist/tsup/chunk-S6F7EKC7.cjs.map +0 -1
  109. package/dist/tsup/chunk-SNAUKDDK.cjs.map +0 -1
  110. package/dist/tsup/chunk-WYZLRPQM.cjs.map +0 -1
  111. /package/dist/tsup/{chunk-OXN6EZUB.js.map → chunk-F7ZL4T63.js.map} +0 -0
  112. /package/dist/tsup/{chunk-Y7ZDTLD2.js.map → chunk-NENM5PQN.js.map} +0 -0
  113. /package/dist/tsup/{chunk-UGOCTUBG.js.map → chunk-TFMRMA5S.js.map} +0 -0
  114. /package/dist/tsup/{chunk-4J5EFV3E.js.map → chunk-Z3BORZE2.js.map} +0 -0
  115. /package/dist/tsup/{chunk-NRP2OHSW.js.map → chunk-ZKCVZA7Z.js.map} +0 -0
@@ -1,19 +1,22 @@
1
1
  import {
2
- getPort
3
- } from "../chunk-4J5EFV3E.js";
2
+ HIBERNATION_SLEEP_TIMEOUT,
3
+ SLEEP_TIMEOUT,
4
+ logger
5
+ } from "../chunk-CKBPIXRM.js";
4
6
  import {
5
- actor
6
- } from "../chunk-7KIR3QLO.js";
7
- import "../chunk-NRP2OHSW.js";
7
+ getPort
8
+ } from "../chunk-Z3BORZE2.js";
9
+ import "../chunk-S22E2HUH.js";
10
+ import "../chunk-ZKCVZA7Z.js";
8
11
  import {
9
12
  ActorError,
10
13
  ClientConfigSchema,
11
14
  createClient,
12
15
  createClientWithDriver
13
- } from "../chunk-UGOCTUBG.js";
16
+ } from "../chunk-TFMRMA5S.js";
14
17
  import {
15
18
  importWebSocket
16
- } from "../chunk-Y7ZDTLD2.js";
19
+ } from "../chunk-NENM5PQN.js";
17
20
  import {
18
21
  HEADER_ACTOR_ID,
19
22
  WS_PROTOCOL_ACTOR,
@@ -24,28 +27,21 @@ import {
24
27
  WS_TEST_PROTOCOL_PATH,
25
28
  assertUnreachable,
26
29
  buildManagerRouter
27
- } from "../chunk-OXN6EZUB.js";
30
+ } from "../chunk-F7ZL4T63.js";
28
31
  import "../chunk-E6ZE2YEA.js";
29
32
  import {
30
- getLogger,
31
- noopNext,
32
- promiseWithResolvers
33
- } from "../chunk-LMG4QMDO.js";
33
+ noopNext
34
+ } from "../chunk-2NJQ3DJ5.js";
34
35
  import {
35
36
  INTERNAL_ERROR_CODE,
36
37
  INTERNAL_ERROR_DESCRIPTION
37
- } from "../chunk-2YHR67M4.js";
38
+ } from "../chunk-LFVF5SCU.js";
38
39
 
39
40
  // src/driver-test-suite/mod.ts
40
41
  import { serve as honoServe } from "@hono/node-server";
41
42
  import { createNodeWebSocket } from "@hono/node-ws";
42
43
  import invariant2 from "invariant";
43
- import { describe as describe23 } from "vitest";
44
-
45
- // src/driver-test-suite/log.ts
46
- function logger() {
47
- return getLogger("test-suite");
48
- }
44
+ import { describe as describe25 } from "vitest";
49
45
 
50
46
  // src/driver-test-suite/tests/action-features.ts
51
47
  import { describe, expect, test } from "vitest";
@@ -786,76 +782,6 @@ function runActorConnTests(driverTestConfig) {
786
782
 
787
783
  // src/driver-test-suite/tests/actor-conn-hibernation.ts
788
784
  import { describe as describe3, expect as expect3, test as test3, vi as vi3 } from "vitest";
789
-
790
- // fixtures/driver-test-suite/hibernation.ts
791
- var HIBERNATION_SLEEP_TIMEOUT = 500;
792
- var hibernationActor = actor({
793
- state: {
794
- sleepCount: 0,
795
- wakeCount: 0
796
- },
797
- createConnState: (c) => {
798
- return {
799
- count: 0,
800
- connectCount: 0,
801
- disconnectCount: 0
802
- };
803
- },
804
- onWake: (c) => {
805
- c.state.wakeCount += 1;
806
- },
807
- onSleep: (c) => {
808
- c.state.sleepCount += 1;
809
- },
810
- onConnect: (c, conn) => {
811
- conn.state.connectCount += 1;
812
- },
813
- onDisconnect: (c, conn) => {
814
- conn.state.disconnectCount += 1;
815
- },
816
- actions: {
817
- // Basic RPC that returns a simple value
818
- ping: (c) => {
819
- return "pong";
820
- },
821
- // Increment the connection's count
822
- connIncrement: (c) => {
823
- c.conn.state.count += 1;
824
- return c.conn.state.count;
825
- },
826
- // Get the connection's count
827
- getConnCount: (c) => {
828
- return c.conn.state.count;
829
- },
830
- // Get the connection's lifecycle counts
831
- getConnLifecycleCounts: (c) => {
832
- return {
833
- connectCount: c.conn.state.connectCount,
834
- disconnectCount: c.conn.state.disconnectCount
835
- };
836
- },
837
- // Get all connection IDs
838
- getConnectionIds: (c) => {
839
- return c.conns.entries().map((x) => x[0]).toArray();
840
- },
841
- // Get actor sleep/wake counts
842
- getActorCounts: (c) => {
843
- return {
844
- sleepCount: c.state.sleepCount,
845
- wakeCount: c.state.wakeCount
846
- };
847
- },
848
- // Trigger sleep
849
- triggerSleep: (c) => {
850
- c.sleep();
851
- }
852
- },
853
- options: {
854
- sleepTimeout: HIBERNATION_SLEEP_TIMEOUT
855
- }
856
- });
857
-
858
- // src/driver-test-suite/tests/actor-conn-hibernation.ts
859
785
  function runActorConnHibernationTests(driverTestConfig) {
860
786
  var _a;
861
787
  describe3.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.hibernation)(
@@ -1119,11 +1045,49 @@ function runActorConnStateTests(driverTestConfig) {
1119
1045
  });
1120
1046
  }
1121
1047
 
1048
+ // src/driver-test-suite/tests/conn-error-serialization.ts
1049
+ import { describe as describe5, expect as expect5, test as test5 } from "vitest";
1050
+ function runConnErrorSerializationTests(driverTestConfig) {
1051
+ describe5("Connection Error Serialization Tests", () => {
1052
+ test5("error thrown in createConnState preserves group and code through WebSocket serialization", async (c) => {
1053
+ const { client } = await setupDriverTest(c, driverTestConfig);
1054
+ const actorKey = `test-error-serialization-${Date.now()}`;
1055
+ const actor = client.connErrorSerializationActor.getOrCreate(
1056
+ [actorKey],
1057
+ { params: { shouldThrow: true } }
1058
+ );
1059
+ const conn = actor.connect();
1060
+ let caughtError;
1061
+ try {
1062
+ await conn.getValue();
1063
+ } catch (err) {
1064
+ caughtError = err;
1065
+ }
1066
+ expect5(caughtError).toBeDefined();
1067
+ expect5(caughtError.group).toBe("connection");
1068
+ expect5(caughtError.code).toBe("custom_error");
1069
+ await conn.dispose();
1070
+ });
1071
+ test5("successful createConnState does not throw error", async (c) => {
1072
+ const { client } = await setupDriverTest(c, driverTestConfig);
1073
+ const actorKey = `test-no-error-${Date.now()}`;
1074
+ const actor = client.connErrorSerializationActor.getOrCreate(
1075
+ [actorKey],
1076
+ { params: { shouldThrow: false } }
1077
+ );
1078
+ const conn = actor.connect();
1079
+ const value = await conn.getValue();
1080
+ expect5(value).toBe(0);
1081
+ await conn.dispose();
1082
+ });
1083
+ });
1084
+ }
1085
+
1122
1086
  // src/driver-test-suite/tests/actor-destroy.ts
1123
- import { describe as describe5, expect as expect5, test as test5, vi as vi5 } from "vitest";
1087
+ import { describe as describe6, expect as expect6, test as test6, vi as vi5 } from "vitest";
1124
1088
  function runActorDestroyTests(driverTestConfig) {
1125
- describe5("Actor Destroy Tests", () => {
1126
- test5("actor destroy clears state (without connect)", async (c) => {
1089
+ describe6("Actor Destroy Tests", () => {
1090
+ test6("actor destroy clears state (without connect)", async (c) => {
1127
1091
  const { client } = await setupDriverTest(c, driverTestConfig);
1128
1092
  const actorKey = "test-destroy-without-connect";
1129
1093
  const observer = client.destroyObserver.getOrCreate(["observer"]);
@@ -1131,12 +1095,12 @@ function runActorDestroyTests(driverTestConfig) {
1131
1095
  const destroyActor = client.destroyActor.getOrCreate([actorKey]);
1132
1096
  await destroyActor.setValue(42);
1133
1097
  const value = await destroyActor.getValue();
1134
- expect5(value).toBe(42);
1098
+ expect6(value).toBe(42);
1135
1099
  const actorId = await destroyActor.resolve();
1136
1100
  await destroyActor.destroy();
1137
1101
  await vi5.waitFor(async () => {
1138
1102
  const wasDestroyed = await observer.wasDestroyed(actorKey);
1139
- expect5(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1103
+ expect6(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1140
1104
  });
1141
1105
  await vi5.waitFor(async () => {
1142
1106
  let actorRunning = false;
@@ -1144,20 +1108,20 @@ function runActorDestroyTests(driverTestConfig) {
1144
1108
  await client.destroyActor.getForId(actorId).getValue();
1145
1109
  actorRunning = true;
1146
1110
  } catch (err) {
1147
- expect5(err.group).toBe("actor");
1148
- expect5(err.code).toBe("not_found");
1111
+ expect6(err.group).toBe("actor");
1112
+ expect6(err.code).toBe("not_found");
1149
1113
  }
1150
- expect5(actorRunning, "actor still running").toBeFalsy();
1114
+ expect6(actorRunning, "actor still running").toBeFalsy();
1151
1115
  });
1152
1116
  let existsById = false;
1153
1117
  try {
1154
1118
  await client.destroyActor.getForId(actorId).getValue();
1155
1119
  existsById = true;
1156
1120
  } catch (err) {
1157
- expect5(err.group).toBe("actor");
1158
- expect5(err.code).toBe("not_found");
1121
+ expect6(err.group).toBe("actor");
1122
+ expect6(err.code).toBe("not_found");
1159
1123
  }
1160
- expect5(
1124
+ expect6(
1161
1125
  existsById,
1162
1126
  "actor should not exist after destroy"
1163
1127
  ).toBeFalsy();
@@ -1166,10 +1130,10 @@ function runActorDestroyTests(driverTestConfig) {
1166
1130
  await client.destroyActor.get(["test-destroy-without-connect"]).resolve();
1167
1131
  existsByKey = true;
1168
1132
  } catch (err) {
1169
- expect5(err.group).toBe("actor");
1170
- expect5(err.code).toBe("not_found");
1133
+ expect6(err.group).toBe("actor");
1134
+ expect6(err.code).toBe("not_found");
1171
1135
  }
1172
- expect5(
1136
+ expect6(
1173
1137
  existsByKey,
1174
1138
  "actor should not exist after destroy"
1175
1139
  ).toBeFalsy();
@@ -1177,9 +1141,9 @@ function runActorDestroyTests(driverTestConfig) {
1177
1141
  "test-destroy-without-connect"
1178
1142
  ]);
1179
1143
  const newValue = await newActor.getValue();
1180
- expect5(newValue).toBe(0);
1144
+ expect6(newValue).toBe(0);
1181
1145
  });
1182
- test5("actor destroy clears state (with connect)", async (c) => {
1146
+ test6("actor destroy clears state (with connect)", async (c) => {
1183
1147
  const { client } = await setupDriverTest(c, driverTestConfig);
1184
1148
  const actorKey = "test-destroy-with-connect";
1185
1149
  const observer = client.destroyObserver.getOrCreate(["observer"]);
@@ -1191,12 +1155,12 @@ function runActorDestroyTests(driverTestConfig) {
1191
1155
  const destroyActor = destroyActorHandle.connect();
1192
1156
  await destroyActor.setValue(99);
1193
1157
  const value = await destroyActor.getValue();
1194
- expect5(value).toBe(99);
1158
+ expect6(value).toBe(99);
1195
1159
  await destroyActor.destroy();
1196
1160
  await destroyActor.dispose();
1197
1161
  await vi5.waitFor(async () => {
1198
1162
  const wasDestroyed = await observer.wasDestroyed(actorKey);
1199
- expect5(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1163
+ expect6(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1200
1164
  });
1201
1165
  await vi5.waitFor(async () => {
1202
1166
  let actorRunning = false;
@@ -1204,20 +1168,20 @@ function runActorDestroyTests(driverTestConfig) {
1204
1168
  await client.destroyActor.getForId(actorId).getValue();
1205
1169
  actorRunning = true;
1206
1170
  } catch (err) {
1207
- expect5(err.group).toBe("actor");
1208
- expect5(err.code).toBe("not_found");
1171
+ expect6(err.group).toBe("actor");
1172
+ expect6(err.code).toBe("not_found");
1209
1173
  }
1210
- expect5(actorRunning, "actor still running").toBeFalsy();
1174
+ expect6(actorRunning, "actor still running").toBeFalsy();
1211
1175
  });
1212
1176
  let existsById = false;
1213
1177
  try {
1214
1178
  await client.destroyActor.getForId(actorId).getValue();
1215
1179
  existsById = true;
1216
1180
  } catch (err) {
1217
- expect5(err.group).toBe("actor");
1218
- expect5(err.code).toBe("not_found");
1181
+ expect6(err.group).toBe("actor");
1182
+ expect6(err.code).toBe("not_found");
1219
1183
  }
1220
- expect5(
1184
+ expect6(
1221
1185
  existsById,
1222
1186
  "actor should not exist after destroy"
1223
1187
  ).toBeFalsy();
@@ -1226,10 +1190,10 @@ function runActorDestroyTests(driverTestConfig) {
1226
1190
  await client.destroyActor.get(["test-destroy-with-connect"]).resolve();
1227
1191
  existsByKey = true;
1228
1192
  } catch (err) {
1229
- expect5(err.group).toBe("actor");
1230
- expect5(err.code).toBe("not_found");
1193
+ expect6(err.group).toBe("actor");
1194
+ expect6(err.code).toBe("not_found");
1231
1195
  }
1232
- expect5(
1196
+ expect6(
1233
1197
  existsByKey,
1234
1198
  "actor should not exist after destroy"
1235
1199
  ).toBeFalsy();
@@ -1237,9 +1201,9 @@ function runActorDestroyTests(driverTestConfig) {
1237
1201
  "test-destroy-with-connect"
1238
1202
  ]);
1239
1203
  const newValue = await newActor.getValue();
1240
- expect5(newValue).toBe(0);
1204
+ expect6(newValue).toBe(0);
1241
1205
  });
1242
- test5("actor destroy allows recreation via getOrCreate with resolve", async (c) => {
1206
+ test6("actor destroy allows recreation via getOrCreate with resolve", async (c) => {
1243
1207
  const { client } = await setupDriverTest(c, driverTestConfig);
1244
1208
  const actorKey = "test-destroy-getorcreate-resolve";
1245
1209
  const observer = client.destroyObserver.getOrCreate(["observer"]);
@@ -1247,12 +1211,12 @@ function runActorDestroyTests(driverTestConfig) {
1247
1211
  const destroyActor = client.destroyActor.getOrCreate([actorKey]);
1248
1212
  await destroyActor.setValue(123);
1249
1213
  const value = await destroyActor.getValue();
1250
- expect5(value).toBe(123);
1214
+ expect6(value).toBe(123);
1251
1215
  const actorId = await destroyActor.resolve();
1252
1216
  await destroyActor.destroy();
1253
1217
  await vi5.waitFor(async () => {
1254
1218
  const wasDestroyed = await observer.wasDestroyed(actorKey);
1255
- expect5(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1219
+ expect6(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1256
1220
  });
1257
1221
  await vi5.waitFor(async () => {
1258
1222
  let actorRunning = false;
@@ -1260,17 +1224,17 @@ function runActorDestroyTests(driverTestConfig) {
1260
1224
  await client.destroyActor.getForId(actorId).getValue();
1261
1225
  actorRunning = true;
1262
1226
  } catch (err) {
1263
- expect5(err.group).toBe("actor");
1264
- expect5(err.code).toBe("not_found");
1227
+ expect6(err.group).toBe("actor");
1228
+ expect6(err.code).toBe("not_found");
1265
1229
  }
1266
- expect5(actorRunning, "actor still running").toBeFalsy();
1230
+ expect6(actorRunning, "actor still running").toBeFalsy();
1267
1231
  });
1268
1232
  const newHandle = client.destroyActor.getOrCreate([actorKey]);
1269
1233
  const newActorId = await newHandle.resolve();
1270
1234
  const newValue = await newHandle.getValue();
1271
- expect5(newValue).toBe(0);
1235
+ expect6(newValue).toBe(0);
1272
1236
  });
1273
- test5("actor destroy allows recreation via create", async (c) => {
1237
+ test6("actor destroy allows recreation via create", async (c) => {
1274
1238
  const { client } = await setupDriverTest(c, driverTestConfig);
1275
1239
  const actorKey = "test-destroy-create";
1276
1240
  const observer = client.destroyObserver.getOrCreate(["observer"]);
@@ -1278,12 +1242,12 @@ function runActorDestroyTests(driverTestConfig) {
1278
1242
  const initialHandle = await client.destroyActor.create([actorKey]);
1279
1243
  await initialHandle.setValue(456);
1280
1244
  const value = await initialHandle.getValue();
1281
- expect5(value).toBe(456);
1245
+ expect6(value).toBe(456);
1282
1246
  const actorId = await initialHandle.resolve();
1283
1247
  await initialHandle.destroy();
1284
1248
  await vi5.waitFor(async () => {
1285
1249
  const wasDestroyed = await observer.wasDestroyed(actorKey);
1286
- expect5(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1250
+ expect6(wasDestroyed, "actor onDestroy not called").toBeTruthy();
1287
1251
  });
1288
1252
  await vi5.waitFor(async () => {
1289
1253
  let actorRunning = false;
@@ -1291,31 +1255,127 @@ function runActorDestroyTests(driverTestConfig) {
1291
1255
  await client.destroyActor.getForId(actorId).getValue();
1292
1256
  actorRunning = true;
1293
1257
  } catch (err) {
1294
- expect5(err.group).toBe("actor");
1295
- expect5(err.code).toBe("not_found");
1258
+ expect6(err.group).toBe("actor");
1259
+ expect6(err.code).toBe("not_found");
1296
1260
  }
1297
- expect5(actorRunning, "actor still running").toBeFalsy();
1261
+ expect6(actorRunning, "actor still running").toBeFalsy();
1298
1262
  });
1299
1263
  const newHandle = await client.destroyActor.create([actorKey]);
1300
1264
  const newActorId = await newHandle.resolve();
1301
1265
  const newValue = await newHandle.getValue();
1302
- expect5(newValue).toBe(0);
1266
+ expect6(newValue).toBe(0);
1303
1267
  });
1304
1268
  });
1305
1269
  }
1306
1270
 
1307
1271
  // src/driver-test-suite/tests/actor-driver.ts
1308
- import { describe as describe9 } from "vitest";
1272
+ import { describe as describe11 } from "vitest";
1273
+
1274
+ // src/driver-test-suite/tests/actor-lifecycle.ts
1275
+ import { describe as describe7, expect as expect7, test as test7 } from "vitest";
1276
+ function runActorLifecycleTests(driverTestConfig) {
1277
+ describe7("Actor Lifecycle Tests", () => {
1278
+ test7("actor stop during start waits for start to complete", async (c) => {
1279
+ const { client } = await setupDriverTest(c, driverTestConfig);
1280
+ const actorKey = `test-stop-during-start-${Date.now()}`;
1281
+ const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1282
+ const pingPromise = actor.ping();
1283
+ const actorId = await actor.resolve();
1284
+ await actor.destroy();
1285
+ const result = await pingPromise;
1286
+ expect7(result).toBe("pong");
1287
+ let destroyed = false;
1288
+ try {
1289
+ await client.startStopRaceActor.getForId(actorId).ping();
1290
+ } catch (err) {
1291
+ destroyed = true;
1292
+ expect7(err.group).toBe("actor");
1293
+ expect7(err.code).toBe("not_found");
1294
+ }
1295
+ expect7(destroyed).toBe(true);
1296
+ });
1297
+ test7("actor stop before actor instantiation completes cleans up handler", async (c) => {
1298
+ const { client } = await setupDriverTest(c, driverTestConfig);
1299
+ const actorKey = `test-stop-before-instantiation-${Date.now()}`;
1300
+ const actors = Array.from(
1301
+ { length: 5 },
1302
+ (_, i) => client.startStopRaceActor.getOrCreate([
1303
+ `${actorKey}-${i}`
1304
+ ])
1305
+ );
1306
+ const ids = await Promise.all(actors.map((a) => a.resolve()));
1307
+ await Promise.all(actors.map((a) => a.destroy()));
1308
+ for (const id of ids) {
1309
+ let destroyed = false;
1310
+ try {
1311
+ await client.startStopRaceActor.getForId(id).ping();
1312
+ } catch (err) {
1313
+ destroyed = true;
1314
+ expect7(err.group).toBe("actor");
1315
+ expect7(err.code).toBe("not_found");
1316
+ }
1317
+ expect7(destroyed, `actor ${id} should be destroyed`).toBe(
1318
+ true
1319
+ );
1320
+ }
1321
+ });
1322
+ test7("onBeforeActorStart completes before stop proceeds", async (c) => {
1323
+ const { client } = await setupDriverTest(c, driverTestConfig);
1324
+ const actorKey = `test-before-actor-start-${Date.now()}`;
1325
+ const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1326
+ const statePromise = actor.getState();
1327
+ await actor.destroy();
1328
+ const state = await statePromise;
1329
+ expect7(state.initialized).toBe(true);
1330
+ expect7(state.startCompleted).toBe(true);
1331
+ });
1332
+ test7("multiple rapid create/destroy cycles handle race correctly", async (c) => {
1333
+ const { client } = await setupDriverTest(c, driverTestConfig);
1334
+ for (let i = 0; i < 10; i++) {
1335
+ const actorKey = `test-rapid-cycle-${Date.now()}-${i}`;
1336
+ const actor = client.startStopRaceActor.getOrCreate([
1337
+ actorKey
1338
+ ]);
1339
+ const resolvePromise = actor.resolve();
1340
+ const destroyPromise = actor.destroy();
1341
+ await Promise.all([resolvePromise, destroyPromise]);
1342
+ }
1343
+ expect7(true).toBe(true);
1344
+ });
1345
+ test7("actor stop called with no actor instance cleans up handler", async (c) => {
1346
+ const { client } = await setupDriverTest(c, driverTestConfig);
1347
+ const actorKey = `test-cleanup-no-instance-${Date.now()}`;
1348
+ const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1349
+ const id = await actor.resolve();
1350
+ await actor.destroy();
1351
+ const newActor = client.startStopRaceActor.getOrCreate([
1352
+ actorKey
1353
+ ]);
1354
+ const result = await newActor.ping();
1355
+ expect7(result).toBe("pong");
1356
+ await newActor.destroy();
1357
+ });
1358
+ test7("onDestroy is called even when actor is destroyed during start", async (c) => {
1359
+ const { client } = await setupDriverTest(c, driverTestConfig);
1360
+ const actorKey = `test-ondestroy-during-start-${Date.now()}`;
1361
+ const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1362
+ const statePromise = actor.getState();
1363
+ await actor.destroy();
1364
+ const state = await statePromise;
1365
+ expect7(state.destroyCalled).toBe(true);
1366
+ });
1367
+ });
1368
+ }
1309
1369
 
1310
1370
  // src/driver-test-suite/tests/actor-schedule.ts
1311
- import { describe as describe6, expect as expect6, test as test6 } from "vitest";
1371
+ import { describe as describe8, expect as expect8, test as test8 } from "vitest";
1312
1372
  function runActorScheduleTests(driverTestConfig) {
1313
1373
  var _a;
1314
- describe6.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.schedule)(
1374
+ describe8.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.schedule)(
1315
1375
  "Actor Schedule Tests",
1316
1376
  () => {
1317
- describe6("Scheduled Alarms", () => {
1318
- test6("executes c.schedule.at() with specific timestamp", async (c) => {
1377
+ describe8("Scheduled Alarms", () => {
1378
+ test8("executes c.schedule.at() with specific timestamp", async (c) => {
1319
1379
  const { client } = await setupDriverTest(
1320
1380
  c,
1321
1381
  driverTestConfig
@@ -1326,10 +1386,10 @@ function runActorScheduleTests(driverTestConfig) {
1326
1386
  await waitFor(driverTestConfig, 500);
1327
1387
  const lastRun = await scheduled.getLastRun();
1328
1388
  const scheduledCount = await scheduled.getScheduledCount();
1329
- expect6(lastRun).toBeGreaterThan(0);
1330
- expect6(scheduledCount).toBe(1);
1389
+ expect8(lastRun).toBeGreaterThan(0);
1390
+ expect8(scheduledCount).toBe(1);
1331
1391
  });
1332
- test6("executes c.schedule.after() with delay", async (c) => {
1392
+ test8("executes c.schedule.after() with delay", async (c) => {
1333
1393
  const { client } = await setupDriverTest(
1334
1394
  c,
1335
1395
  driverTestConfig
@@ -1339,10 +1399,10 @@ function runActorScheduleTests(driverTestConfig) {
1339
1399
  await waitFor(driverTestConfig, 500);
1340
1400
  const lastRun = await scheduled.getLastRun();
1341
1401
  const scheduledCount = await scheduled.getScheduledCount();
1342
- expect6(lastRun).toBeGreaterThan(0);
1343
- expect6(scheduledCount).toBe(1);
1402
+ expect8(lastRun).toBeGreaterThan(0);
1403
+ expect8(scheduledCount).toBe(1);
1344
1404
  });
1345
- test6("multiple scheduled tasks execute in order", async (c) => {
1405
+ test8("multiple scheduled tasks execute in order", async (c) => {
1346
1406
  const { client } = await setupDriverTest(
1347
1407
  c,
1348
1408
  driverTestConfig
@@ -1354,13 +1414,13 @@ function runActorScheduleTests(driverTestConfig) {
1354
1414
  await scheduled.scheduleTaskAfterWithId("third", 1250);
1355
1415
  await waitFor(driverTestConfig, 500);
1356
1416
  const history1 = await scheduled.getTaskHistory();
1357
- expect6(history1).toEqual(["first"]);
1417
+ expect8(history1).toEqual(["first"]);
1358
1418
  await waitFor(driverTestConfig, 500);
1359
1419
  const history2 = await scheduled.getTaskHistory();
1360
- expect6(history2).toEqual(["first", "second"]);
1420
+ expect8(history2).toEqual(["first", "second"]);
1361
1421
  await waitFor(driverTestConfig, 500);
1362
1422
  const history3 = await scheduled.getTaskHistory();
1363
- expect6(history3).toEqual(["first", "second", "third"]);
1423
+ expect8(history3).toEqual(["first", "second", "third"]);
1364
1424
  });
1365
1425
  });
1366
1426
  }
@@ -1368,220 +1428,33 @@ function runActorScheduleTests(driverTestConfig) {
1368
1428
  }
1369
1429
 
1370
1430
  // src/driver-test-suite/tests/actor-sleep.ts
1371
- import { describe as describe7, expect as expect7, test as test7 } from "vitest";
1372
-
1373
- // fixtures/driver-test-suite/sleep.ts
1374
- var SLEEP_TIMEOUT = 1e3;
1375
- var sleep = actor({
1376
- state: { startCount: 0, sleepCount: 0 },
1377
- onWake: (c) => {
1378
- c.state.startCount += 1;
1379
- },
1380
- onSleep: (c) => {
1381
- c.state.sleepCount += 1;
1382
- },
1383
- actions: {
1384
- triggerSleep: (c) => {
1385
- c.sleep();
1386
- },
1387
- getCounts: (c) => {
1388
- return {
1389
- startCount: c.state.startCount,
1390
- sleepCount: c.state.sleepCount
1391
- };
1392
- },
1393
- setAlarm: async (c, duration) => {
1394
- await c.schedule.after(duration, "onAlarm");
1395
- },
1396
- onAlarm: (c) => {
1397
- c.log.info("alarm called");
1398
- }
1399
- },
1400
- options: {
1401
- sleepTimeout: SLEEP_TIMEOUT
1402
- }
1403
- });
1404
- var sleepWithLongRpc = actor({
1405
- state: { startCount: 0, sleepCount: 0 },
1406
- createVars: () => ({}),
1407
- onWake: (c) => {
1408
- c.state.startCount += 1;
1409
- },
1410
- onSleep: (c) => {
1411
- c.state.sleepCount += 1;
1412
- },
1413
- actions: {
1414
- getCounts: (c) => {
1415
- return {
1416
- startCount: c.state.startCount,
1417
- sleepCount: c.state.sleepCount
1418
- };
1419
- },
1420
- longRunningRpc: async (c) => {
1421
- c.log.info("starting long running rpc");
1422
- c.vars.longRunningResolve = promiseWithResolvers();
1423
- c.broadcast("waiting");
1424
- await c.vars.longRunningResolve.promise;
1425
- c.log.info("finished long running rpc");
1426
- },
1427
- finishLongRunningRpc: (c) => {
1428
- var _a;
1429
- return (_a = c.vars.longRunningResolve) == null ? void 0 : _a.resolve();
1430
- }
1431
- },
1432
- options: {
1433
- sleepTimeout: SLEEP_TIMEOUT
1434
- }
1435
- });
1436
- var sleepWithRawHttp = actor({
1437
- state: { startCount: 0, sleepCount: 0, requestCount: 0 },
1438
- onWake: (c) => {
1439
- c.state.startCount += 1;
1440
- },
1441
- onSleep: (c) => {
1442
- c.state.sleepCount += 1;
1443
- },
1444
- onRequest: async (c, request) => {
1445
- c.state.requestCount += 1;
1446
- const url = new URL(request.url);
1447
- if (url.pathname === "/long-request") {
1448
- const duration = parseInt(
1449
- url.searchParams.get("duration") || "1000"
1450
- );
1451
- c.log.info({ msg: "starting long fetch request", duration });
1452
- await new Promise((resolve) => setTimeout(resolve, duration));
1453
- c.log.info("finished long fetch request");
1454
- return new Response(JSON.stringify({ completed: true }), {
1455
- headers: { "Content-Type": "application/json" }
1456
- });
1457
- }
1458
- return new Response("Not Found", { status: 404 });
1459
- },
1460
- actions: {
1461
- getCounts: (c) => {
1462
- return {
1463
- startCount: c.state.startCount,
1464
- sleepCount: c.state.sleepCount,
1465
- requestCount: c.state.requestCount
1466
- };
1467
- }
1468
- },
1469
- options: {
1470
- sleepTimeout: SLEEP_TIMEOUT
1471
- }
1472
- });
1473
- var sleepWithRawWebSocket = actor({
1474
- state: { startCount: 0, sleepCount: 0, connectionCount: 0 },
1475
- onWake: (c) => {
1476
- c.state.startCount += 1;
1477
- },
1478
- onSleep: (c) => {
1479
- c.state.sleepCount += 1;
1480
- },
1481
- onWebSocket: (c, websocket) => {
1482
- c.state.connectionCount += 1;
1483
- c.log.info({
1484
- msg: "websocket connected",
1485
- connectionCount: c.state.connectionCount
1486
- });
1487
- websocket.send(
1488
- JSON.stringify({
1489
- type: "connected",
1490
- connectionCount: c.state.connectionCount
1491
- })
1492
- );
1493
- websocket.addEventListener("message", (event) => {
1494
- const data = event.data;
1495
- if (typeof data === "string") {
1496
- try {
1497
- const parsed = JSON.parse(data);
1498
- if (parsed.type === "getCounts") {
1499
- websocket.send(
1500
- JSON.stringify({
1501
- type: "counts",
1502
- startCount: c.state.startCount,
1503
- sleepCount: c.state.sleepCount,
1504
- connectionCount: c.state.connectionCount
1505
- })
1506
- );
1507
- } else if (parsed.type === "keepAlive") {
1508
- websocket.send(JSON.stringify({ type: "ack" }));
1509
- }
1510
- } catch {
1511
- websocket.send(data);
1512
- }
1513
- }
1514
- });
1515
- websocket.addEventListener("close", () => {
1516
- c.state.connectionCount -= 1;
1517
- c.log.info({
1518
- msg: "websocket disconnected",
1519
- connectionCount: c.state.connectionCount
1520
- });
1521
- });
1522
- },
1523
- actions: {
1524
- getCounts: (c) => {
1525
- return {
1526
- startCount: c.state.startCount,
1527
- sleepCount: c.state.sleepCount,
1528
- connectionCount: c.state.connectionCount
1529
- };
1530
- }
1531
- },
1532
- options: {
1533
- sleepTimeout: SLEEP_TIMEOUT
1534
- }
1535
- });
1536
- var sleepWithNoSleepOption = actor({
1537
- state: { startCount: 0, sleepCount: 0 },
1538
- onWake: (c) => {
1539
- c.state.startCount += 1;
1540
- },
1541
- onSleep: (c) => {
1542
- c.state.sleepCount += 1;
1543
- },
1544
- actions: {
1545
- getCounts: (c) => {
1546
- return {
1547
- startCount: c.state.startCount,
1548
- sleepCount: c.state.sleepCount
1549
- };
1550
- }
1551
- },
1552
- options: {
1553
- sleepTimeout: SLEEP_TIMEOUT,
1554
- noSleep: true
1555
- }
1556
- });
1557
-
1558
- // src/driver-test-suite/tests/actor-sleep.ts
1431
+ import { describe as describe9, expect as expect9, test as test9 } from "vitest";
1559
1432
  function runActorSleepTests(driverTestConfig) {
1560
1433
  var _a;
1561
- describe7.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.sleep)("Actor Sleep Tests", () => {
1562
- test7("actor sleep persists state", async (c) => {
1434
+ describe9.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.sleep)("Actor Sleep Tests", () => {
1435
+ test9("actor sleep persists state", async (c) => {
1563
1436
  const { client } = await setupDriverTest(c, driverTestConfig);
1564
1437
  const sleepActor = client.sleep.getOrCreate();
1565
1438
  {
1566
1439
  const { startCount, sleepCount } = await sleepActor.getCounts();
1567
- expect7(sleepCount).toBe(0);
1568
- expect7(startCount).toBe(1);
1440
+ expect9(sleepCount).toBe(0);
1441
+ expect9(startCount).toBe(1);
1569
1442
  }
1570
1443
  await sleepActor.triggerSleep();
1571
1444
  await waitFor(driverTestConfig, 250);
1572
1445
  {
1573
1446
  const { startCount, sleepCount } = await sleepActor.getCounts();
1574
- expect7(sleepCount).toBe(1);
1575
- expect7(startCount).toBe(2);
1447
+ expect9(sleepCount).toBe(1);
1448
+ expect9(startCount).toBe(2);
1576
1449
  }
1577
1450
  });
1578
- test7("actor sleep persists state with connect", async (c) => {
1451
+ test9("actor sleep persists state with connect", async (c) => {
1579
1452
  const { client } = await setupDriverTest(c, driverTestConfig);
1580
1453
  const sleepActor = client.sleep.getOrCreate().connect();
1581
1454
  {
1582
1455
  const { startCount, sleepCount } = await sleepActor.getCounts();
1583
- expect7(sleepCount).toBe(0);
1584
- expect7(startCount).toBe(1);
1456
+ expect9(sleepCount).toBe(0);
1457
+ expect9(startCount).toBe(1);
1585
1458
  }
1586
1459
  await sleepActor.triggerSleep();
1587
1460
  await sleepActor.dispose();
@@ -1589,108 +1462,108 @@ function runActorSleepTests(driverTestConfig) {
1589
1462
  const sleepActor2 = client.sleep.getOrCreate();
1590
1463
  {
1591
1464
  const { startCount, sleepCount } = await sleepActor2.getCounts();
1592
- expect7(sleepCount).toBe(1);
1593
- expect7(startCount).toBe(2);
1465
+ expect9(sleepCount).toBe(1);
1466
+ expect9(startCount).toBe(2);
1594
1467
  }
1595
1468
  });
1596
- test7("actor automatically sleeps after timeout", async (c) => {
1469
+ test9("actor automatically sleeps after timeout", async (c) => {
1597
1470
  const { client } = await setupDriverTest(c, driverTestConfig);
1598
1471
  const sleepActor = client.sleep.getOrCreate();
1599
1472
  {
1600
1473
  const { startCount, sleepCount } = await sleepActor.getCounts();
1601
- expect7(sleepCount).toBe(0);
1602
- expect7(startCount).toBe(1);
1474
+ expect9(sleepCount).toBe(0);
1475
+ expect9(startCount).toBe(1);
1603
1476
  }
1604
1477
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1605
1478
  {
1606
1479
  const { startCount, sleepCount } = await sleepActor.getCounts();
1607
- expect7(sleepCount).toBe(1);
1608
- expect7(startCount).toBe(2);
1480
+ expect9(sleepCount).toBe(1);
1481
+ expect9(startCount).toBe(2);
1609
1482
  }
1610
1483
  });
1611
- test7("actor automatically sleeps after timeout with connect", async (c) => {
1484
+ test9("actor automatically sleeps after timeout with connect", async (c) => {
1612
1485
  const { client } = await setupDriverTest(c, driverTestConfig);
1613
1486
  const sleepActor = client.sleep.getOrCreate().connect();
1614
1487
  {
1615
1488
  const { startCount, sleepCount } = await sleepActor.getCounts();
1616
- expect7(sleepCount).toBe(0);
1617
- expect7(startCount).toBe(1);
1489
+ expect9(sleepCount).toBe(0);
1490
+ expect9(startCount).toBe(1);
1618
1491
  }
1619
1492
  await sleepActor.dispose();
1620
1493
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1621
1494
  const sleepActor2 = client.sleep.getOrCreate();
1622
1495
  {
1623
1496
  const { startCount, sleepCount } = await sleepActor2.getCounts();
1624
- expect7(sleepCount).toBe(1);
1625
- expect7(startCount).toBe(2);
1497
+ expect9(sleepCount).toBe(1);
1498
+ expect9(startCount).toBe(2);
1626
1499
  }
1627
1500
  });
1628
- test7("rpc calls keep actor awake", async (c) => {
1501
+ test9("rpc calls keep actor awake", async (c) => {
1629
1502
  const { client } = await setupDriverTest(c, driverTestConfig);
1630
1503
  const sleepActor = client.sleep.getOrCreate();
1631
1504
  {
1632
1505
  const { startCount, sleepCount } = await sleepActor.getCounts();
1633
- expect7(sleepCount).toBe(0);
1634
- expect7(startCount).toBe(1);
1506
+ expect9(sleepCount).toBe(0);
1507
+ expect9(startCount).toBe(1);
1635
1508
  }
1636
1509
  await waitFor(driverTestConfig, SLEEP_TIMEOUT - 250);
1637
1510
  {
1638
1511
  const { startCount, sleepCount } = await sleepActor.getCounts();
1639
- expect7(sleepCount).toBe(0);
1640
- expect7(startCount).toBe(1);
1512
+ expect9(sleepCount).toBe(0);
1513
+ expect9(startCount).toBe(1);
1641
1514
  }
1642
1515
  await waitFor(driverTestConfig, SLEEP_TIMEOUT - 250);
1643
1516
  {
1644
1517
  const { startCount, sleepCount } = await sleepActor.getCounts();
1645
- expect7(sleepCount).toBe(0);
1646
- expect7(startCount).toBe(1);
1518
+ expect9(sleepCount).toBe(0);
1519
+ expect9(startCount).toBe(1);
1647
1520
  }
1648
1521
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1649
1522
  {
1650
1523
  const { startCount, sleepCount } = await sleepActor.getCounts();
1651
- expect7(sleepCount).toBe(1);
1652
- expect7(startCount).toBe(2);
1524
+ expect9(sleepCount).toBe(1);
1525
+ expect9(startCount).toBe(2);
1653
1526
  }
1654
1527
  });
1655
- test7("alarms keep actor awake", async (c) => {
1528
+ test9("alarms keep actor awake", async (c) => {
1656
1529
  const { client } = await setupDriverTest(c, driverTestConfig);
1657
1530
  const sleepActor = client.sleep.getOrCreate();
1658
1531
  {
1659
1532
  const { startCount, sleepCount } = await sleepActor.getCounts();
1660
- expect7(sleepCount).toBe(0);
1661
- expect7(startCount).toBe(1);
1533
+ expect9(sleepCount).toBe(0);
1534
+ expect9(startCount).toBe(1);
1662
1535
  }
1663
1536
  await sleepActor.setAlarm(SLEEP_TIMEOUT - 250);
1664
1537
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1665
1538
  {
1666
1539
  const { startCount, sleepCount } = await sleepActor.getCounts();
1667
- expect7(sleepCount).toBe(0);
1668
- expect7(startCount).toBe(1);
1540
+ expect9(sleepCount).toBe(0);
1541
+ expect9(startCount).toBe(1);
1669
1542
  }
1670
1543
  });
1671
- test7("alarms wake actors", async (c) => {
1544
+ test9("alarms wake actors", async (c) => {
1672
1545
  const { client } = await setupDriverTest(c, driverTestConfig);
1673
1546
  const sleepActor = client.sleep.getOrCreate();
1674
1547
  {
1675
1548
  const { startCount, sleepCount } = await sleepActor.getCounts();
1676
- expect7(sleepCount).toBe(0);
1677
- expect7(startCount).toBe(1);
1549
+ expect9(sleepCount).toBe(0);
1550
+ expect9(startCount).toBe(1);
1678
1551
  }
1679
1552
  await sleepActor.setAlarm(SLEEP_TIMEOUT + 250);
1680
1553
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 200);
1681
1554
  {
1682
1555
  const { startCount, sleepCount } = await sleepActor.getCounts();
1683
- expect7(sleepCount).toBe(1);
1684
- expect7(startCount).toBe(2);
1556
+ expect9(sleepCount).toBe(1);
1557
+ expect9(startCount).toBe(2);
1685
1558
  }
1686
1559
  });
1687
- test7("long running rpcs keep actor awake", async (c) => {
1560
+ test9("long running rpcs keep actor awake", async (c) => {
1688
1561
  const { client } = await setupDriverTest(c, driverTestConfig);
1689
1562
  const sleepActor = client.sleepWithLongRpc.getOrCreate().connect();
1690
1563
  {
1691
1564
  const { startCount, sleepCount } = await sleepActor.getCounts();
1692
- expect7(sleepCount).toBe(0);
1693
- expect7(startCount).toBe(1);
1565
+ expect9(sleepCount).toBe(0);
1566
+ expect9(startCount).toBe(1);
1694
1567
  }
1695
1568
  const waitPromise = new Promise(
1696
1569
  (resolve) => sleepActor.once("waiting", resolve)
@@ -1702,19 +1575,19 @@ function runActorSleepTests(driverTestConfig) {
1702
1575
  await longRunningPromise;
1703
1576
  {
1704
1577
  const { startCount, sleepCount } = await sleepActor.getCounts();
1705
- expect7(sleepCount).toBe(0);
1706
- expect7(startCount).toBe(1);
1578
+ expect9(sleepCount).toBe(0);
1579
+ expect9(startCount).toBe(1);
1707
1580
  }
1708
1581
  await sleepActor.dispose();
1709
1582
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1710
1583
  const sleepActor2 = client.sleepWithLongRpc.getOrCreate();
1711
1584
  {
1712
1585
  const { startCount, sleepCount } = await sleepActor2.getCounts();
1713
- expect7(sleepCount).toBe(1);
1714
- expect7(startCount).toBe(2);
1586
+ expect9(sleepCount).toBe(1);
1587
+ expect9(startCount).toBe(2);
1715
1588
  }
1716
1589
  });
1717
- test7("active raw websockets keep actor awake", async (c) => {
1590
+ test9("active raw websockets keep actor awake", async (c) => {
1718
1591
  const { client, endpoint: baseUrl } = await setupDriverTest(
1719
1592
  c,
1720
1593
  driverTestConfig
@@ -1722,8 +1595,8 @@ function runActorSleepTests(driverTestConfig) {
1722
1595
  const sleepActor = client.sleepWithRawWebSocket.getOrCreate();
1723
1596
  {
1724
1597
  const { startCount, sleepCount } = await sleepActor.getCounts();
1725
- expect7(sleepCount).toBe(0);
1726
- expect7(startCount).toBe(1);
1598
+ expect9(sleepCount).toBe(0);
1599
+ expect9(startCount).toBe(1);
1727
1600
  }
1728
1601
  const ws = await sleepActor.websocket();
1729
1602
  await new Promise((resolve, reject) => {
@@ -1748,17 +1621,17 @@ function runActorSleepTests(driverTestConfig) {
1748
1621
  }
1749
1622
  };
1750
1623
  });
1751
- expect7(counts.sleepCount).toBe(0);
1752
- expect7(counts.startCount).toBe(1);
1624
+ expect9(counts.sleepCount).toBe(0);
1625
+ expect9(counts.startCount).toBe(1);
1753
1626
  ws.close();
1754
1627
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1755
1628
  {
1756
1629
  const { startCount, sleepCount } = await sleepActor.getCounts();
1757
- expect7(sleepCount).toBe(1);
1758
- expect7(startCount).toBe(2);
1630
+ expect9(sleepCount).toBe(1);
1631
+ expect9(startCount).toBe(2);
1759
1632
  }
1760
1633
  });
1761
- test7("active raw fetch requests keep actor awake", async (c) => {
1634
+ test9("active raw fetch requests keep actor awake", async (c) => {
1762
1635
  const { client, endpoint: baseUrl } = await setupDriverTest(
1763
1636
  c,
1764
1637
  driverTestConfig
@@ -1766,8 +1639,8 @@ function runActorSleepTests(driverTestConfig) {
1766
1639
  const sleepActor = client.sleepWithRawHttp.getOrCreate();
1767
1640
  {
1768
1641
  const { startCount, sleepCount } = await sleepActor.getCounts();
1769
- expect7(sleepCount).toBe(0);
1770
- expect7(startCount).toBe(1);
1642
+ expect9(sleepCount).toBe(0);
1643
+ expect9(startCount).toBe(1);
1771
1644
  }
1772
1645
  const fetchDuration = SLEEP_TIMEOUT + 250;
1773
1646
  const fetchPromise = sleepActor.fetch(
@@ -1775,67 +1648,67 @@ function runActorSleepTests(driverTestConfig) {
1775
1648
  );
1776
1649
  const response = await fetchPromise;
1777
1650
  const result = await response.json();
1778
- expect7(result.completed).toBe(true);
1651
+ expect9(result.completed).toBe(true);
1779
1652
  {
1780
1653
  const { startCount, sleepCount, requestCount } = await sleepActor.getCounts();
1781
- expect7(sleepCount).toBe(0);
1782
- expect7(startCount).toBe(1);
1783
- expect7(requestCount).toBe(1);
1654
+ expect9(sleepCount).toBe(0);
1655
+ expect9(startCount).toBe(1);
1656
+ expect9(requestCount).toBe(1);
1784
1657
  }
1785
1658
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1786
1659
  {
1787
1660
  const { startCount, sleepCount } = await sleepActor.getCounts();
1788
- expect7(sleepCount).toBe(1);
1789
- expect7(startCount).toBe(2);
1661
+ expect9(sleepCount).toBe(1);
1662
+ expect9(startCount).toBe(2);
1790
1663
  }
1791
1664
  });
1792
- test7("noSleep option disables sleeping", async (c) => {
1665
+ test9("noSleep option disables sleeping", async (c) => {
1793
1666
  const { client } = await setupDriverTest(c, driverTestConfig);
1794
1667
  const sleepActor = client.sleepWithNoSleepOption.getOrCreate();
1795
1668
  {
1796
1669
  const { startCount, sleepCount } = await sleepActor.getCounts();
1797
- expect7(sleepCount).toBe(0);
1798
- expect7(startCount).toBe(1);
1670
+ expect9(sleepCount).toBe(0);
1671
+ expect9(startCount).toBe(1);
1799
1672
  }
1800
1673
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1801
1674
  {
1802
1675
  const { startCount, sleepCount } = await sleepActor.getCounts();
1803
- expect7(sleepCount).toBe(0);
1804
- expect7(startCount).toBe(1);
1676
+ expect9(sleepCount).toBe(0);
1677
+ expect9(startCount).toBe(1);
1805
1678
  }
1806
1679
  await waitFor(driverTestConfig, SLEEP_TIMEOUT + 250);
1807
1680
  {
1808
1681
  const { startCount, sleepCount } = await sleepActor.getCounts();
1809
- expect7(sleepCount).toBe(0);
1810
- expect7(startCount).toBe(1);
1682
+ expect9(sleepCount).toBe(0);
1683
+ expect9(startCount).toBe(1);
1811
1684
  }
1812
1685
  });
1813
1686
  });
1814
1687
  }
1815
1688
 
1816
1689
  // src/driver-test-suite/tests/actor-state.ts
1817
- import { describe as describe8, expect as expect8, test as test8 } from "vitest";
1690
+ import { describe as describe10, expect as expect10, test as test10 } from "vitest";
1818
1691
  function runActorStateTests(driverTestConfig) {
1819
- describe8("Actor State Tests", () => {
1820
- describe8("State Persistence", () => {
1821
- test8("persists state between actor instances", async (c) => {
1692
+ describe10("Actor State Tests", () => {
1693
+ describe10("State Persistence", () => {
1694
+ test10("persists state between actor instances", async (c) => {
1822
1695
  const { client } = await setupDriverTest(c, driverTestConfig);
1823
1696
  const counterInstance = client.counter.getOrCreate();
1824
1697
  const initialCount = await counterInstance.increment(5);
1825
- expect8(initialCount).toBe(5);
1698
+ expect10(initialCount).toBe(5);
1826
1699
  const sameInstance = client.counter.getOrCreate();
1827
1700
  const persistedCount = await sameInstance.increment(3);
1828
- expect8(persistedCount).toBe(8);
1701
+ expect10(persistedCount).toBe(8);
1829
1702
  });
1830
- test8("restores state after actor disconnect/reconnect", async (c) => {
1703
+ test10("restores state after actor disconnect/reconnect", async (c) => {
1831
1704
  const { client } = await setupDriverTest(c, driverTestConfig);
1832
1705
  const counterInstance = client.counter.getOrCreate();
1833
1706
  await counterInstance.increment(5);
1834
1707
  const reconnectedInstance = client.counter.getOrCreate();
1835
1708
  const persistedCount = await reconnectedInstance.increment(0);
1836
- expect8(persistedCount).toBe(5);
1709
+ expect10(persistedCount).toBe(5);
1837
1710
  });
1838
- test8("maintains separate state for different actors", async (c) => {
1711
+ test10("maintains separate state for different actors", async (c) => {
1839
1712
  const { client } = await setupDriverTest(c, driverTestConfig);
1840
1713
  const counterA = client.counter.getOrCreate(["counter-a"]);
1841
1714
  await counterA.increment(5);
@@ -1843,8 +1716,8 @@ function runActorStateTests(driverTestConfig) {
1843
1716
  await counterB.increment(10);
1844
1717
  const countA = await counterA.increment(0);
1845
1718
  const countB = await counterB.increment(0);
1846
- expect8(countA).toBe(5);
1847
- expect8(countB).toBe(10);
1719
+ expect10(countA).toBe(5);
1720
+ expect10(countB).toBe(10);
1848
1721
  });
1849
1722
  });
1850
1723
  });
@@ -1852,90 +1725,91 @@ function runActorStateTests(driverTestConfig) {
1852
1725
 
1853
1726
  // src/driver-test-suite/tests/actor-driver.ts
1854
1727
  function runActorDriverTests(driverTestConfig) {
1855
- describe9("Actor Driver Tests", () => {
1728
+ describe11("Actor Driver Tests", () => {
1856
1729
  runActorStateTests(driverTestConfig);
1857
1730
  runActorScheduleTests(driverTestConfig);
1858
1731
  runActorSleepTests(driverTestConfig);
1732
+ runActorLifecycleTests(driverTestConfig);
1859
1733
  });
1860
1734
  }
1861
1735
 
1862
1736
  // src/driver-test-suite/tests/actor-error-handling.ts
1863
- import { describe as describe10, expect as expect9, test as test9 } from "vitest";
1737
+ import { describe as describe12, expect as expect11, test as test11 } from "vitest";
1864
1738
  function runActorErrorHandlingTests(driverTestConfig) {
1865
- describe10("Actor Error Handling Tests", () => {
1866
- describe10("UserError Handling", () => {
1867
- test9("should handle simple UserError with message", async (c) => {
1739
+ describe12("Actor Error Handling Tests", () => {
1740
+ describe12("UserError Handling", () => {
1741
+ test11("should handle simple UserError with message", async (c) => {
1868
1742
  const { client } = await setupDriverTest(c, driverTestConfig);
1869
1743
  const handle = client.errorHandlingActor.getOrCreate();
1870
1744
  try {
1871
1745
  await handle.throwSimpleError();
1872
- expect9(true).toBe(false);
1746
+ expect11(true).toBe(false);
1873
1747
  } catch (error) {
1874
- expect9(error.message).toBe("Simple error message");
1875
- expect9(error.code).toBe("user_error");
1876
- expect9(error.metadata).toBeUndefined();
1748
+ expect11(error.message).toBe("Simple error message");
1749
+ expect11(error.code).toBe("user_error");
1750
+ expect11(error.metadata).toBeUndefined();
1877
1751
  }
1878
1752
  });
1879
- test9("should handle detailed UserError with code and metadata", async (c) => {
1753
+ test11("should handle detailed UserError with code and metadata", async (c) => {
1880
1754
  const { client } = await setupDriverTest(c, driverTestConfig);
1881
1755
  const handle = client.errorHandlingActor.getOrCreate();
1882
1756
  try {
1883
1757
  await handle.throwDetailedError();
1884
- expect9(true).toBe(false);
1758
+ expect11(true).toBe(false);
1885
1759
  } catch (error) {
1886
- expect9(error.message).toBe("Detailed error message");
1887
- expect9(error.code).toBe("detailed_error");
1888
- expect9(error.metadata).toBeDefined();
1889
- expect9(error.metadata.reason).toBe("test");
1890
- expect9(error.metadata.timestamp).toBeDefined();
1760
+ expect11(error.message).toBe("Detailed error message");
1761
+ expect11(error.code).toBe("detailed_error");
1762
+ expect11(error.metadata).toBeDefined();
1763
+ expect11(error.metadata.reason).toBe("test");
1764
+ expect11(error.metadata.timestamp).toBeDefined();
1891
1765
  }
1892
1766
  });
1893
1767
  });
1894
- describe10("Internal Error Handling", () => {
1895
- test9("should convert internal errors to safe format", async (c) => {
1768
+ describe12("Internal Error Handling", () => {
1769
+ test11("should convert internal errors to safe format", async (c) => {
1896
1770
  const { client } = await setupDriverTest(c, driverTestConfig);
1897
1771
  const handle = client.errorHandlingActor.getOrCreate();
1898
1772
  try {
1899
1773
  await handle.throwInternalError();
1900
- expect9(true).toBe(false);
1774
+ expect11(true).toBe(false);
1901
1775
  } catch (error) {
1902
- expect9(error.code).toBe(INTERNAL_ERROR_CODE);
1903
- expect9(error.message).toBe(INTERNAL_ERROR_DESCRIPTION);
1776
+ expect11(error.code).toBe(INTERNAL_ERROR_CODE);
1777
+ expect11(error.message).toBe(INTERNAL_ERROR_DESCRIPTION);
1904
1778
  }
1905
1779
  });
1906
1780
  });
1907
- describe10.skip("Action Timeout", () => {
1908
- test9("should handle action timeouts with custom duration", async (c) => {
1781
+ describe12.skip("Action Timeout", () => {
1782
+ test11("should handle action timeouts with custom duration", async (c) => {
1909
1783
  const { client } = await setupDriverTest(c, driverTestConfig);
1910
1784
  const handle = client.errorHandlingActor.getOrCreate();
1911
1785
  const timeoutPromise = handle.timeoutAction();
1912
1786
  try {
1913
1787
  await timeoutPromise;
1914
- expect9(true).toBe(false);
1788
+ expect11(true).toBe(false);
1915
1789
  } catch (error) {
1916
- expect9(error.message).toMatch(/timed out/i);
1790
+ expect11(error.message).toMatch(/timed out/i);
1917
1791
  }
1918
1792
  });
1919
- test9("should successfully run actions within timeout", async (c) => {
1793
+ test11("should successfully run actions within timeout", async (c) => {
1920
1794
  const { client } = await setupDriverTest(c, driverTestConfig);
1921
1795
  const handle = client.errorHandlingActor.getOrCreate();
1922
1796
  const result = await handle.delayedAction(200);
1923
- expect9(result).toBe("Completed after 200ms");
1797
+ expect11(result).toBe("Completed after 200ms");
1924
1798
  });
1925
- test9("should respect different timeouts for different actors", async (c) => {
1799
+ test11("should respect different timeouts for different actors", async (c) => {
1926
1800
  const { client } = await setupDriverTest(c, driverTestConfig);
1927
1801
  try {
1928
1802
  await client.customTimeoutActor.getOrCreate().slowAction();
1929
- expect9(true).toBe(false);
1803
+ expect11(true).toBe(false);
1930
1804
  } catch (error) {
1931
- expect9(error.message).toMatch(/timed out/i);
1805
+ expect11(error.message).toMatch(/timed out/i);
1932
1806
  }
1933
1807
  const quickResult = await client.customTimeoutActor.getOrCreate().quickAction();
1934
- expect9(quickResult).toBe("Quick action completed");
1808
+ expect11(quickResult).toBe("Quick action completed");
1935
1809
  });
1936
1810
  });
1937
- describe10("Error Recovery", () => {
1938
- test9("should continue working after errors", async (c) => {
1811
+ describe12("Error Recovery", () => {
1812
+ test11("should continue working after errors", async (c) => {
1939
1813
  const { client } = await setupDriverTest(c, driverTestConfig);
1940
1814
  const handle = client.errorHandlingActor.getOrCreate();
1941
1815
  try {
@@ -1943,27 +1817,27 @@ function runActorErrorHandlingTests(driverTestConfig) {
1943
1817
  } catch (error) {
1944
1818
  }
1945
1819
  const result = await handle.successfulAction();
1946
- expect9(result).toBe("success");
1820
+ expect11(result).toBe("success");
1947
1821
  });
1948
1822
  });
1949
1823
  });
1950
1824
  }
1951
1825
 
1952
1826
  // src/driver-test-suite/tests/actor-handle.ts
1953
- import { describe as describe11, expect as expect10, test as test10 } from "vitest";
1827
+ import { describe as describe13, expect as expect12, test as test12 } from "vitest";
1954
1828
  function runActorHandleTests(driverTestConfig) {
1955
- describe11("Actor Handle Tests", () => {
1956
- describe11("Access Methods", () => {
1957
- test10("should use .get() to access a actor", async (c) => {
1829
+ describe13("Actor Handle Tests", () => {
1830
+ describe13("Access Methods", () => {
1831
+ test12("should use .get() to access a actor", async (c) => {
1958
1832
  const { client } = await setupDriverTest(c, driverTestConfig);
1959
1833
  await client.counter.create(["test-get-handle"]);
1960
1834
  const handle = client.counter.get(["test-get-handle"]);
1961
1835
  const count = await handle.increment(5);
1962
- expect10(count).toBe(5);
1836
+ expect12(count).toBe(5);
1963
1837
  const retrievedCount = await handle.getCount();
1964
- expect10(retrievedCount).toBe(5);
1838
+ expect12(retrievedCount).toBe(5);
1965
1839
  });
1966
- test10("should use .getForId() to access a actor by ID", async (c) => {
1840
+ test12("should use .getForId() to access a actor by ID", async (c) => {
1967
1841
  const { client } = await setupDriverTest(c, driverTestConfig);
1968
1842
  const handle = client.counter.getOrCreate([
1969
1843
  "test-get-for-id-handle"
@@ -1972,73 +1846,73 @@ function runActorHandleTests(driverTestConfig) {
1972
1846
  const actorId = await handle.resolve();
1973
1847
  const idHandle = client.counter.getForId(actorId);
1974
1848
  const count = await idHandle.getCount();
1975
- expect10(count).toBe(3);
1849
+ expect12(count).toBe(3);
1976
1850
  const newCount = await idHandle.increment(4);
1977
- expect10(newCount).toBe(7);
1851
+ expect12(newCount).toBe(7);
1978
1852
  });
1979
- test10("should use .getOrCreate() to access or create a actor", async (c) => {
1853
+ test12("should use .getOrCreate() to access or create a actor", async (c) => {
1980
1854
  const { client } = await setupDriverTest(c, driverTestConfig);
1981
1855
  const handle = client.counter.getOrCreate([
1982
1856
  "test-get-or-create-handle"
1983
1857
  ]);
1984
1858
  const count = await handle.increment(7);
1985
- expect10(count).toBe(7);
1859
+ expect12(count).toBe(7);
1986
1860
  const sameHandle = client.counter.getOrCreate([
1987
1861
  "test-get-or-create-handle"
1988
1862
  ]);
1989
1863
  const retrievedCount = await sameHandle.getCount();
1990
- expect10(retrievedCount).toBe(7);
1864
+ expect12(retrievedCount).toBe(7);
1991
1865
  });
1992
- test10("should use (await create()) to create and return a handle", async (c) => {
1866
+ test12("should use (await create()) to create and return a handle", async (c) => {
1993
1867
  const { client } = await setupDriverTest(c, driverTestConfig);
1994
1868
  const handle = await client.counter.create([
1995
1869
  "test-create-handle"
1996
1870
  ]);
1997
1871
  const count = await handle.increment(9);
1998
- expect10(count).toBe(9);
1872
+ expect12(count).toBe(9);
1999
1873
  const retrievedCount = await handle.getCount();
2000
- expect10(retrievedCount).toBe(9);
1874
+ expect12(retrievedCount).toBe(9);
2001
1875
  });
2002
- test10("errors when calling create twice with the same key", async (c) => {
1876
+ test12("errors when calling create twice with the same key", async (c) => {
2003
1877
  const { client } = await setupDriverTest(c, driverTestConfig);
2004
1878
  const key = ["duplicate-create-handle", crypto.randomUUID()];
2005
1879
  await client.counter.create(key);
2006
1880
  try {
2007
1881
  await client.counter.create(key);
2008
- expect10.fail("did not error on duplicate create");
1882
+ expect12.fail("did not error on duplicate create");
2009
1883
  } catch (err) {
2010
- expect10(err.group).toBe("actor");
2011
- expect10(err.code).toBe("duplicate_key");
1884
+ expect12(err.group).toBe("actor");
1885
+ expect12(err.code).toBe("duplicate_key");
2012
1886
  }
2013
1887
  });
2014
- test10(".get().resolve() errors for non-existent actor", async (c) => {
1888
+ test12(".get().resolve() errors for non-existent actor", async (c) => {
2015
1889
  const { client } = await setupDriverTest(c, driverTestConfig);
2016
1890
  const missingId = `nonexistent-${crypto.randomUUID()}`;
2017
1891
  try {
2018
1892
  await client.counter.get([missingId]).resolve();
2019
- expect10.fail(
1893
+ expect12.fail(
2020
1894
  "did not error for get().resolve() on missing actor"
2021
1895
  );
2022
1896
  } catch (err) {
2023
- expect10(err.group).toBe("actor");
2024
- expect10(err.code).toBe("not_found");
1897
+ expect12(err.group).toBe("actor");
1898
+ expect12(err.code).toBe("not_found");
2025
1899
  }
2026
1900
  });
2027
1901
  });
2028
- describe11("Action Functionality", () => {
2029
- test10("should call actions directly on the handle", async (c) => {
1902
+ describe13("Action Functionality", () => {
1903
+ test12("should call actions directly on the handle", async (c) => {
2030
1904
  const { client } = await setupDriverTest(c, driverTestConfig);
2031
1905
  const handle = client.counter.getOrCreate([
2032
1906
  "test-action-handle"
2033
1907
  ]);
2034
1908
  const count1 = await handle.increment(3);
2035
- expect10(count1).toBe(3);
1909
+ expect12(count1).toBe(3);
2036
1910
  const count2 = await handle.increment(5);
2037
- expect10(count2).toBe(8);
1911
+ expect12(count2).toBe(8);
2038
1912
  const retrievedCount = await handle.getCount();
2039
- expect10(retrievedCount).toBe(8);
1913
+ expect12(retrievedCount).toBe(8);
2040
1914
  });
2041
- test10("should handle independent handles to the same actor", async (c) => {
1915
+ test12("should handle independent handles to the same actor", async (c) => {
2042
1916
  const { client } = await setupDriverTest(c, driverTestConfig);
2043
1917
  const handle1 = client.counter.getOrCreate([
2044
1918
  "test-multiple-handles"
@@ -2046,82 +1920,82 @@ function runActorHandleTests(driverTestConfig) {
2046
1920
  const handle2 = client.counter.get(["test-multiple-handles"]);
2047
1921
  await handle1.increment(3);
2048
1922
  const count = await handle2.getCount();
2049
- expect10(count).toBe(3);
1923
+ expect12(count).toBe(3);
2050
1924
  const finalCount = await handle2.increment(4);
2051
- expect10(finalCount).toBe(7);
1925
+ expect12(finalCount).toBe(7);
2052
1926
  const checkCount = await handle1.getCount();
2053
- expect10(checkCount).toBe(7);
1927
+ expect12(checkCount).toBe(7);
2054
1928
  });
2055
- test10("should resolve a actor's ID", async (c) => {
1929
+ test12("should resolve a actor's ID", async (c) => {
2056
1930
  const { client } = await setupDriverTest(c, driverTestConfig);
2057
1931
  const handle = client.counter.getOrCreate(["test-resolve-id"]);
2058
1932
  await handle.increment(1);
2059
1933
  const actorId = await handle.resolve();
2060
- expect10(typeof actorId).toBe("string");
2061
- expect10(actorId).not.toBe("");
1934
+ expect12(typeof actorId).toBe("string");
1935
+ expect12(actorId).not.toBe("");
2062
1936
  const idHandle = client.counter.getForId(actorId);
2063
1937
  const count = await idHandle.getCount();
2064
- expect10(count).toBe(1);
1938
+ expect12(count).toBe(1);
2065
1939
  });
2066
1940
  });
2067
- describe11("Lifecycle Hooks", () => {
2068
- test10("should trigger lifecycle hooks on actor creation", async (c) => {
1941
+ describe13("Lifecycle Hooks", () => {
1942
+ test12("should trigger lifecycle hooks on actor creation", async (c) => {
2069
1943
  const { client } = await setupDriverTest(c, driverTestConfig);
2070
1944
  const handle = client.counterWithLifecycle.getOrCreate([
2071
1945
  "test-lifecycle-handle"
2072
1946
  ]);
2073
1947
  const initialEvents = await handle.getEvents();
2074
- expect10(initialEvents).toContain("onWake");
1948
+ expect12(initialEvents).toContain("onWake");
2075
1949
  const sameHandle = client.counterWithLifecycle.getOrCreate([
2076
1950
  "test-lifecycle-handle"
2077
1951
  ]);
2078
1952
  const events = await sameHandle.getEvents();
2079
- expect10(events).toContain("onWake");
2080
- expect10(events.filter((e) => e === "onWake").length).toBe(1);
1953
+ expect12(events).toContain("onWake");
1954
+ expect12(events.filter((e) => e === "onWake").length).toBe(1);
2081
1955
  });
2082
- test10("should trigger lifecycle hooks for each Action call", async (c) => {
1956
+ test12("should trigger lifecycle hooks for each Action call", async (c) => {
2083
1957
  const { client } = await setupDriverTest(c, driverTestConfig);
2084
1958
  const viewHandle = client.counterWithLifecycle.getOrCreate([
2085
1959
  "test-lifecycle-action"
2086
1960
  ]);
2087
1961
  const initialEvents = await viewHandle.getEvents();
2088
- expect10(initialEvents).toContain("onWake");
2089
- expect10(initialEvents).not.toContain("onBeforeConnect");
2090
- expect10(initialEvents).not.toContain("onConnect");
2091
- expect10(initialEvents).not.toContain("onDisconnect");
1962
+ expect12(initialEvents).toContain("onWake");
1963
+ expect12(initialEvents).not.toContain("onBeforeConnect");
1964
+ expect12(initialEvents).not.toContain("onConnect");
1965
+ expect12(initialEvents).not.toContain("onDisconnect");
2092
1966
  const trackingHandle = client.counterWithLifecycle.getOrCreate(
2093
1967
  ["test-lifecycle-action"],
2094
1968
  { params: { trackLifecycle: true } }
2095
1969
  );
2096
1970
  await trackingHandle.increment(5);
2097
1971
  const eventsAfterAction = await viewHandle.getEvents();
2098
- expect10(eventsAfterAction).toContain("onBeforeConnect");
2099
- expect10(eventsAfterAction).toContain("onConnect");
2100
- expect10(eventsAfterAction).toContain("onDisconnect");
2101
- expect10(
1972
+ expect12(eventsAfterAction).toContain("onBeforeConnect");
1973
+ expect12(eventsAfterAction).toContain("onConnect");
1974
+ expect12(eventsAfterAction).toContain("onDisconnect");
1975
+ expect12(
2102
1976
  eventsAfterAction.filter((e) => e === "onBeforeConnect").length
2103
1977
  ).toBe(1);
2104
- expect10(
1978
+ expect12(
2105
1979
  eventsAfterAction.filter((e) => e === "onConnect").length
2106
1980
  ).toBe(1);
2107
- expect10(
1981
+ expect12(
2108
1982
  eventsAfterAction.filter((e) => e === "onDisconnect").length
2109
1983
  ).toBe(1);
2110
1984
  await trackingHandle.increment(10);
2111
1985
  const eventsAfterSecondAction = await viewHandle.getEvents();
2112
- expect10(
1986
+ expect12(
2113
1987
  eventsAfterSecondAction.filter(
2114
1988
  (e) => e === "onBeforeConnect"
2115
1989
  ).length
2116
1990
  ).toBe(2);
2117
- expect10(
1991
+ expect12(
2118
1992
  eventsAfterSecondAction.filter((e) => e === "onConnect").length
2119
1993
  ).toBe(2);
2120
- expect10(
1994
+ expect12(
2121
1995
  eventsAfterSecondAction.filter((e) => e === "onDisconnect").length
2122
1996
  ).toBe(2);
2123
1997
  });
2124
- test10("should trigger lifecycle hooks for each Action call across multiple handles", async (c) => {
1998
+ test12("should trigger lifecycle hooks for each Action call across multiple handles", async (c) => {
2125
1999
  const { client } = await setupDriverTest(c, driverTestConfig);
2126
2000
  const viewHandle = client.counterWithLifecycle.getOrCreate([
2127
2001
  "test-lifecycle-multi-handle"
@@ -2137,12 +2011,12 @@ function runActorHandleTests(driverTestConfig) {
2137
2011
  await trackingHandle1.increment(5);
2138
2012
  await trackingHandle2.increment(10);
2139
2013
  const events = await viewHandle.getEvents();
2140
- expect10(events.filter((e) => e === "onWake").length).toBe(1);
2141
- expect10(
2014
+ expect12(events.filter((e) => e === "onWake").length).toBe(1);
2015
+ expect12(
2142
2016
  events.filter((e) => e === "onBeforeConnect").length
2143
2017
  ).toBe(2);
2144
- expect10(events.filter((e) => e === "onConnect").length).toBe(2);
2145
- expect10(events.filter((e) => e === "onDisconnect").length).toBe(
2018
+ expect12(events.filter((e) => e === "onConnect").length).toBe(2);
2019
+ expect12(events.filter((e) => e === "onDisconnect").length).toBe(
2146
2020
  2
2147
2021
  );
2148
2022
  });
@@ -2151,27 +2025,27 @@ function runActorHandleTests(driverTestConfig) {
2151
2025
  }
2152
2026
 
2153
2027
  // src/driver-test-suite/tests/actor-inline-client.ts
2154
- import { describe as describe12, expect as expect11, test as test11 } from "vitest";
2028
+ import { describe as describe14, expect as expect13, test as test13 } from "vitest";
2155
2029
  function runActorInlineClientTests(driverTestConfig) {
2156
- describe12("Actor Inline Client Tests", () => {
2157
- describe12("Stateless Client Calls", () => {
2158
- test11("should make stateless calls to other actors", async (c) => {
2030
+ describe14("Actor Inline Client Tests", () => {
2031
+ describe14("Stateless Client Calls", () => {
2032
+ test13("should make stateless calls to other actors", async (c) => {
2159
2033
  const { client } = await setupDriverTest(c, driverTestConfig);
2160
2034
  const inlineClientHandle = client.inlineClientActor.getOrCreate(
2161
2035
  ["inline-client-test"]
2162
2036
  );
2163
2037
  const result = await inlineClientHandle.callCounterIncrement(5);
2164
- expect11(result).toBe(5);
2038
+ expect13(result).toBe(5);
2165
2039
  const counterState = await inlineClientHandle.getCounterState();
2166
- expect11(counterState).toBe(5);
2040
+ expect13(counterState).toBe(5);
2167
2041
  const messages = await inlineClientHandle.getMessages();
2168
- expect11(messages).toHaveLength(2);
2169
- expect11(messages[0]).toContain(
2042
+ expect13(messages).toHaveLength(2);
2043
+ expect13(messages[0]).toContain(
2170
2044
  "Called counter.increment(5), result: 5"
2171
2045
  );
2172
- expect11(messages[1]).toContain("Got counter state: 5");
2046
+ expect13(messages[1]).toContain("Got counter state: 5");
2173
2047
  });
2174
- test11("should handle multiple stateless calls", async (c) => {
2048
+ test13("should handle multiple stateless calls", async (c) => {
2175
2049
  const { client } = await setupDriverTest(c, driverTestConfig);
2176
2050
  const inlineClientHandle = client.inlineClientActor.getOrCreate(
2177
2051
  ["inline-client-multi"]
@@ -2180,58 +2054,58 @@ function runActorInlineClientTests(driverTestConfig) {
2180
2054
  const result1 = await inlineClientHandle.callCounterIncrement(3);
2181
2055
  const result2 = await inlineClientHandle.callCounterIncrement(7);
2182
2056
  const finalState = await inlineClientHandle.getCounterState();
2183
- expect11(result1).toBe(3);
2184
- expect11(result2).toBe(10);
2185
- expect11(finalState).toBe(10);
2057
+ expect13(result1).toBe(3);
2058
+ expect13(result2).toBe(10);
2059
+ expect13(finalState).toBe(10);
2186
2060
  const messages = await inlineClientHandle.getMessages();
2187
- expect11(messages).toHaveLength(3);
2188
- expect11(messages[0]).toContain(
2061
+ expect13(messages).toHaveLength(3);
2062
+ expect13(messages[0]).toContain(
2189
2063
  "Called counter.increment(3), result: 3"
2190
2064
  );
2191
- expect11(messages[1]).toContain(
2065
+ expect13(messages[1]).toContain(
2192
2066
  "Called counter.increment(7), result: 10"
2193
2067
  );
2194
- expect11(messages[2]).toContain("Got counter state: 10");
2068
+ expect13(messages[2]).toContain("Got counter state: 10");
2195
2069
  });
2196
2070
  });
2197
- describe12("Stateful Client Calls", () => {
2198
- test11("should connect to other actors and receive events", async (c) => {
2071
+ describe14("Stateful Client Calls", () => {
2072
+ test13("should connect to other actors and receive events", async (c) => {
2199
2073
  const { client } = await setupDriverTest(c, driverTestConfig);
2200
2074
  const inlineClientHandle = client.inlineClientActor.getOrCreate(
2201
2075
  ["inline-client-stateful"]
2202
2076
  );
2203
2077
  await inlineClientHandle.clearMessages();
2204
2078
  const result = await inlineClientHandle.connectToCounterAndIncrement(4);
2205
- expect11(result.result1).toBe(4);
2206
- expect11(result.result2).toBe(12);
2207
- expect11(result.events).toEqual([4, 12]);
2079
+ expect13(result.result1).toBe(4);
2080
+ expect13(result.result2).toBe(12);
2081
+ expect13(result.events).toEqual([4, 12]);
2208
2082
  const messages = await inlineClientHandle.getMessages();
2209
- expect11(messages).toHaveLength(1);
2210
- expect11(messages[0]).toContain(
2083
+ expect13(messages).toHaveLength(1);
2084
+ expect13(messages[0]).toContain(
2211
2085
  "Connected to counter, incremented by 4 and 8"
2212
2086
  );
2213
- expect11(messages[0]).toContain("results: 4, 12");
2214
- expect11(messages[0]).toContain("events: [4,12]");
2087
+ expect13(messages[0]).toContain("results: 4, 12");
2088
+ expect13(messages[0]).toContain("events: [4,12]");
2215
2089
  });
2216
- test11("should handle stateful connection independently", async (c) => {
2090
+ test13("should handle stateful connection independently", async (c) => {
2217
2091
  const { client } = await setupDriverTest(c, driverTestConfig);
2218
2092
  const inlineClientHandle = client.inlineClientActor.getOrCreate(
2219
2093
  ["inline-client-independent"]
2220
2094
  );
2221
2095
  await inlineClientHandle.clearMessages();
2222
2096
  const result = await inlineClientHandle.connectToCounterAndIncrement(2);
2223
- expect11(result.result1).toBe(2);
2224
- expect11(result.result2).toBe(6);
2225
- expect11(result.events).toEqual([2, 6]);
2097
+ expect13(result.result1).toBe(2);
2098
+ expect13(result.result2).toBe(6);
2099
+ expect13(result.events).toEqual([2, 6]);
2226
2100
  const messages = await inlineClientHandle.getMessages();
2227
- expect11(messages).toHaveLength(1);
2228
- expect11(messages[0]).toContain(
2101
+ expect13(messages).toHaveLength(1);
2102
+ expect13(messages[0]).toContain(
2229
2103
  "Connected to counter, incremented by 2 and 4"
2230
2104
  );
2231
2105
  });
2232
2106
  });
2233
- describe12("Mixed Client Usage", () => {
2234
- test11("should handle both stateless and stateful calls", async (c) => {
2107
+ describe14("Mixed Client Usage", () => {
2108
+ test13("should handle both stateless and stateful calls", async (c) => {
2235
2109
  const { client } = await setupDriverTest(c, driverTestConfig);
2236
2110
  const inlineClientHandle = client.inlineClientActor.getOrCreate(
2237
2111
  ["inline-client-mixed"]
@@ -2239,17 +2113,17 @@ function runActorInlineClientTests(driverTestConfig) {
2239
2113
  await inlineClientHandle.clearMessages();
2240
2114
  await inlineClientHandle.callCounterIncrement(1);
2241
2115
  const statelessResult = await inlineClientHandle.getCounterState();
2242
- expect11(statelessResult).toBe(1);
2116
+ expect13(statelessResult).toBe(1);
2243
2117
  const statefulResult = await inlineClientHandle.connectToCounterAndIncrement(3);
2244
- expect11(statefulResult.result1).toBe(3);
2245
- expect11(statefulResult.result2).toBe(9);
2118
+ expect13(statefulResult.result1).toBe(3);
2119
+ expect13(statefulResult.result2).toBe(9);
2246
2120
  const messages = await inlineClientHandle.getMessages();
2247
- expect11(messages).toHaveLength(3);
2248
- expect11(messages[0]).toContain(
2121
+ expect13(messages).toHaveLength(3);
2122
+ expect13(messages[0]).toContain(
2249
2123
  "Called counter.increment(1), result: 1"
2250
2124
  );
2251
- expect11(messages[1]).toContain("Got counter state: 1");
2252
- expect11(messages[2]).toContain(
2125
+ expect13(messages[1]).toContain("Got counter state: 1");
2126
+ expect13(messages[2]).toContain(
2253
2127
  "Connected to counter, incremented by 3 and 6"
2254
2128
  );
2255
2129
  });
@@ -2258,32 +2132,32 @@ function runActorInlineClientTests(driverTestConfig) {
2258
2132
  }
2259
2133
 
2260
2134
  // src/driver-test-suite/tests/actor-inspector.ts
2261
- import { describe as describe13 } from "vitest";
2135
+ import { describe as describe15 } from "vitest";
2262
2136
  function runActorInspectorTests(driverTestConfig) {
2263
- describe13.skip("Actor Inspector Tests", () => {
2137
+ describe15.skip("Actor Inspector Tests", () => {
2264
2138
  });
2265
2139
  }
2266
2140
 
2267
2141
  // src/driver-test-suite/tests/actor-kv.ts
2268
- import { describe as describe14, expect as expect12, test as test12 } from "vitest";
2142
+ import { describe as describe16, expect as expect14, test as test14 } from "vitest";
2269
2143
  function runActorKvTests(driverTestConfig) {
2270
- describe14("Actor KV Tests", () => {
2271
- test12("supports text encoding and decoding", async (c) => {
2144
+ describe16("Actor KV Tests", () => {
2145
+ test14("supports text encoding and decoding", async (c) => {
2272
2146
  const { client } = await setupDriverTest(c, driverTestConfig);
2273
2147
  const kvHandle = client.kvActor.getOrCreate(["kv-text"]);
2274
2148
  await kvHandle.putText("greeting", "hello");
2275
2149
  const value = await kvHandle.getText("greeting");
2276
- expect12(value).toBe("hello");
2150
+ expect14(value).toBe("hello");
2277
2151
  await kvHandle.putText("prefix-a", "alpha");
2278
2152
  await kvHandle.putText("prefix-b", "beta");
2279
2153
  const results = await kvHandle.listText("prefix-");
2280
2154
  const sorted = results.sort((a, b) => a.key.localeCompare(b.key));
2281
- expect12(sorted).toEqual([
2155
+ expect14(sorted).toEqual([
2282
2156
  { key: "prefix-a", value: "alpha" },
2283
2157
  { key: "prefix-b", value: "beta" }
2284
2158
  ]);
2285
2159
  });
2286
- test12(
2160
+ test14(
2287
2161
  "supports arrayBuffer encoding and decoding",
2288
2162
  async (c) => {
2289
2163
  const { client } = await setupDriverTest(c, driverTestConfig);
@@ -2296,32 +2170,32 @@ function runActorKvTests(driverTestConfig) {
2296
2170
  23,
2297
2171
  42
2298
2172
  ]);
2299
- expect12(values).toEqual([4, 8, 15, 16, 23, 42]);
2173
+ expect14(values).toEqual([4, 8, 15, 16, 23, 42]);
2300
2174
  }
2301
2175
  );
2302
2176
  });
2303
2177
  }
2304
2178
 
2305
2179
  // src/driver-test-suite/tests/actor-metadata.ts
2306
- import { describe as describe15, expect as expect13, test as test13 } from "vitest";
2180
+ import { describe as describe17, expect as expect15, test as test15 } from "vitest";
2307
2181
  function runActorMetadataTests(driverTestConfig) {
2308
- describe15("Actor Metadata Tests", () => {
2309
- describe15("Actor Name", () => {
2310
- test13("should provide access to actor name", async (c) => {
2182
+ describe17("Actor Metadata Tests", () => {
2183
+ describe17("Actor Name", () => {
2184
+ test15("should provide access to actor name", async (c) => {
2311
2185
  const { client } = await setupDriverTest(c, driverTestConfig);
2312
2186
  const handle = client.metadataActor.getOrCreate();
2313
2187
  const actorName = await handle.getActorName();
2314
- expect13(actorName).toBe("metadataActor");
2188
+ expect15(actorName).toBe("metadataActor");
2315
2189
  });
2316
- test13("should preserve actor name in state during onWake", async (c) => {
2190
+ test15("should preserve actor name in state during onWake", async (c) => {
2317
2191
  const { client } = await setupDriverTest(c, driverTestConfig);
2318
2192
  const handle = client.metadataActor.getOrCreate();
2319
2193
  const storedName = await handle.getStoredActorName();
2320
- expect13(storedName).toBe("metadataActor");
2194
+ expect15(storedName).toBe("metadataActor");
2321
2195
  });
2322
2196
  });
2323
- describe15("Actor Tags", () => {
2324
- test13("should provide access to tags", async (c) => {
2197
+ describe17("Actor Tags", () => {
2198
+ test15("should provide access to tags", async (c) => {
2325
2199
  const { client } = await setupDriverTest(c, driverTestConfig);
2326
2200
  const handle = client.metadataActor.getOrCreate();
2327
2201
  await handle.setupTestTags({
@@ -2329,12 +2203,12 @@ function runActorMetadataTests(driverTestConfig) {
2329
2203
  purpose: "metadata-test"
2330
2204
  });
2331
2205
  const tags = await handle.getTags();
2332
- expect13(tags).toHaveProperty("env");
2333
- expect13(tags.env).toBe("test");
2334
- expect13(tags).toHaveProperty("purpose");
2335
- expect13(tags.purpose).toBe("metadata-test");
2206
+ expect15(tags).toHaveProperty("env");
2207
+ expect15(tags.env).toBe("test");
2208
+ expect15(tags).toHaveProperty("purpose");
2209
+ expect15(tags.purpose).toBe("metadata-test");
2336
2210
  });
2337
- test13("should allow accessing individual tags", async (c) => {
2211
+ test15("should allow accessing individual tags", async (c) => {
2338
2212
  const { client } = await setupDriverTest(c, driverTestConfig);
2339
2213
  const handle = client.metadataActor.getOrCreate();
2340
2214
  await handle.setupTestTags({
@@ -2344,110 +2218,110 @@ function runActorMetadataTests(driverTestConfig) {
2344
2218
  const category = await handle.getTag("category");
2345
2219
  const version = await handle.getTag("version");
2346
2220
  const nonexistent = await handle.getTag("nonexistent");
2347
- expect13(category).toBe("test-actor");
2348
- expect13(version).toBe("1.0");
2349
- expect13(nonexistent).toBeNull();
2221
+ expect15(category).toBe("test-actor");
2222
+ expect15(version).toBe("1.0");
2223
+ expect15(nonexistent).toBeNull();
2350
2224
  });
2351
2225
  });
2352
- describe15("Metadata Structure", () => {
2353
- test13("should provide complete metadata object", async (c) => {
2226
+ describe17("Metadata Structure", () => {
2227
+ test15("should provide complete metadata object", async (c) => {
2354
2228
  const { client } = await setupDriverTest(c, driverTestConfig);
2355
2229
  const handle = client.metadataActor.getOrCreate();
2356
2230
  await handle.setupTestTags({ type: "metadata-test" });
2357
2231
  await handle.setupTestRegion("us-west-1");
2358
2232
  const metadata = await handle.getMetadata();
2359
- expect13(metadata).toHaveProperty("name");
2360
- expect13(metadata.name).toBe("metadataActor");
2361
- expect13(metadata).toHaveProperty("tags");
2362
- expect13(metadata.tags).toHaveProperty("type");
2363
- expect13(metadata.tags.type).toBe("metadata-test");
2364
- expect13(metadata).toHaveProperty("region");
2365
- expect13(metadata.region).toBe("us-west-1");
2233
+ expect15(metadata).toHaveProperty("name");
2234
+ expect15(metadata.name).toBe("metadataActor");
2235
+ expect15(metadata).toHaveProperty("tags");
2236
+ expect15(metadata.tags).toHaveProperty("type");
2237
+ expect15(metadata.tags.type).toBe("metadata-test");
2238
+ expect15(metadata).toHaveProperty("region");
2239
+ expect15(metadata.region).toBe("us-west-1");
2366
2240
  });
2367
2241
  });
2368
- describe15("Region Information", () => {
2369
- test13("should retrieve region information", async (c) => {
2242
+ describe17("Region Information", () => {
2243
+ test15("should retrieve region information", async (c) => {
2370
2244
  const { client } = await setupDriverTest(c, driverTestConfig);
2371
2245
  const handle = client.metadataActor.getOrCreate();
2372
2246
  await handle.setupTestRegion("eu-central-1");
2373
2247
  const region = await handle.getRegion();
2374
- expect13(region).toBe("eu-central-1");
2248
+ expect15(region).toBe("eu-central-1");
2375
2249
  });
2376
2250
  });
2377
2251
  });
2378
2252
  }
2379
2253
 
2380
2254
  // src/driver-test-suite/tests/actor-onstatechange.ts
2381
- import { describe as describe16, expect as expect14, test as test14 } from "vitest";
2255
+ import { describe as describe18, expect as expect16, test as test16 } from "vitest";
2382
2256
  function runActorOnStateChangeTests(driverTestConfig) {
2383
- describe16("Actor onStateChange Tests", () => {
2384
- test14("triggers onStateChange when state is modified", async (c) => {
2257
+ describe18("Actor onStateChange Tests", () => {
2258
+ test16("triggers onStateChange when state is modified", async (c) => {
2385
2259
  const { client } = await setupDriverTest(c, driverTestConfig);
2386
- const actor2 = client.onStateChangeActor.getOrCreate();
2387
- await actor2.setValue(10);
2388
- const changeCount = await actor2.getChangeCount();
2389
- expect14(changeCount).toBe(1);
2260
+ const actor = client.onStateChangeActor.getOrCreate();
2261
+ await actor.setValue(10);
2262
+ const changeCount = await actor.getChangeCount();
2263
+ expect16(changeCount).toBe(1);
2390
2264
  });
2391
- test14("triggers onChange multiple times for multiple state changes", async (c) => {
2265
+ test16("triggers onChange multiple times for multiple state changes", async (c) => {
2392
2266
  const { client } = await setupDriverTest(c, driverTestConfig);
2393
- const actor2 = client.onStateChangeActor.getOrCreate();
2394
- await actor2.incrementMultiple(3);
2395
- const changeCount = await actor2.getChangeCount();
2396
- expect14(changeCount).toBe(3);
2267
+ const actor = client.onStateChangeActor.getOrCreate();
2268
+ await actor.incrementMultiple(3);
2269
+ const changeCount = await actor.getChangeCount();
2270
+ expect16(changeCount).toBe(3);
2397
2271
  });
2398
- test14("does NOT trigger onChange for read-only actions", async (c) => {
2272
+ test16("does NOT trigger onChange for read-only actions", async (c) => {
2399
2273
  const { client } = await setupDriverTest(c, driverTestConfig);
2400
- const actor2 = client.onStateChangeActor.getOrCreate();
2401
- await actor2.setValue(5);
2402
- const value = await actor2.getValue();
2403
- expect14(value).toBe(5);
2404
- const changeCount = await actor2.getChangeCount();
2405
- expect14(changeCount).toBe(1);
2406
- });
2407
- test14("does NOT trigger onChange for computed values", async (c) => {
2274
+ const actor = client.onStateChangeActor.getOrCreate();
2275
+ await actor.setValue(5);
2276
+ const value = await actor.getValue();
2277
+ expect16(value).toBe(5);
2278
+ const changeCount = await actor.getChangeCount();
2279
+ expect16(changeCount).toBe(1);
2280
+ });
2281
+ test16("does NOT trigger onChange for computed values", async (c) => {
2408
2282
  const { client } = await setupDriverTest(c, driverTestConfig);
2409
- const actor2 = client.onStateChangeActor.getOrCreate();
2410
- await actor2.setValue(3);
2283
+ const actor = client.onStateChangeActor.getOrCreate();
2284
+ await actor.setValue(3);
2411
2285
  {
2412
- const changeCount = await actor2.getChangeCount();
2413
- expect14(changeCount).toBe(1);
2286
+ const changeCount = await actor.getChangeCount();
2287
+ expect16(changeCount).toBe(1);
2414
2288
  }
2415
- const doubled = await actor2.getDoubled();
2416
- expect14(doubled).toBe(6);
2289
+ const doubled = await actor.getDoubled();
2290
+ expect16(doubled).toBe(6);
2417
2291
  {
2418
- const changeCount = await actor2.getChangeCount();
2419
- expect14(changeCount).toBe(1);
2292
+ const changeCount = await actor.getChangeCount();
2293
+ expect16(changeCount).toBe(1);
2420
2294
  }
2421
2295
  });
2422
- test14("simple: connect, call action, dispose does NOT trigger onChange", async (c) => {
2296
+ test16("simple: connect, call action, dispose does NOT trigger onChange", async (c) => {
2423
2297
  const { client } = await setupDriverTest(c, driverTestConfig);
2424
- const actor2 = client.onStateChangeActor.getOrCreate();
2425
- const connection = await actor2.connect();
2298
+ const actor = client.onStateChangeActor.getOrCreate();
2299
+ const connection = await actor.connect();
2426
2300
  const value = await connection.getValue();
2427
- expect14(value).toBe(0);
2301
+ expect16(value).toBe(0);
2428
2302
  await connection.dispose();
2429
- const changeCount = await actor2.getChangeCount();
2430
- expect14(changeCount).toBe(0);
2303
+ const changeCount = await actor.getChangeCount();
2304
+ expect16(changeCount).toBe(0);
2431
2305
  });
2432
2306
  });
2433
2307
  }
2434
2308
 
2435
2309
  // src/driver-test-suite/tests/actor-vars.ts
2436
- import { describe as describe17, expect as expect15, test as test15 } from "vitest";
2310
+ import { describe as describe19, expect as expect17, test as test17 } from "vitest";
2437
2311
  function runActorVarsTests(driverTestConfig) {
2438
- describe17("Actor Variables", () => {
2439
- describe17("Static vars", () => {
2440
- test15("should provide access to static vars", async (c) => {
2312
+ describe19("Actor Variables", () => {
2313
+ describe19("Static vars", () => {
2314
+ test17("should provide access to static vars", async (c) => {
2441
2315
  const { client } = await setupDriverTest(c, driverTestConfig);
2442
2316
  const instance = client.staticVarActor.getOrCreate();
2443
2317
  const result = await instance.getVars();
2444
- expect15(result).toEqual({ counter: 42, name: "test-actor" });
2318
+ expect17(result).toEqual({ counter: 42, name: "test-actor" });
2445
2319
  const name = await instance.getName();
2446
- expect15(name).toBe("test-actor");
2320
+ expect17(name).toBe("test-actor");
2447
2321
  });
2448
2322
  });
2449
- describe17("Deep cloning of static vars", () => {
2450
- test15("should deep clone static vars between actor instances", async (c) => {
2323
+ describe19("Deep cloning of static vars", () => {
2324
+ test17("should deep clone static vars between actor instances", async (c) => {
2451
2325
  const { client } = await setupDriverTest(c, driverTestConfig);
2452
2326
  const instance1 = client.nestedVarActor.getOrCreate([
2453
2327
  "instance1"
@@ -2456,100 +2330,100 @@ function runActorVarsTests(driverTestConfig) {
2456
2330
  "instance2"
2457
2331
  ]);
2458
2332
  const modifiedVars = await instance1.modifyNested();
2459
- expect15(modifiedVars.nested.value).toBe("modified");
2460
- expect15(modifiedVars.nested.array).toContain(4);
2461
- expect15(modifiedVars.nested.obj.key).toBe("new-value");
2333
+ expect17(modifiedVars.nested.value).toBe("modified");
2334
+ expect17(modifiedVars.nested.array).toContain(4);
2335
+ expect17(modifiedVars.nested.obj.key).toBe("new-value");
2462
2336
  const instance2Vars = await instance2.getVars();
2463
- expect15(instance2Vars.nested.value).toBe("original");
2464
- expect15(instance2Vars.nested.array).toEqual([1, 2, 3]);
2465
- expect15(instance2Vars.nested.obj.key).toBe("value");
2337
+ expect17(instance2Vars.nested.value).toBe("original");
2338
+ expect17(instance2Vars.nested.array).toEqual([1, 2, 3]);
2339
+ expect17(instance2Vars.nested.obj.key).toBe("value");
2466
2340
  });
2467
2341
  });
2468
- describe17("createVars", () => {
2469
- test15("should support dynamic vars creation", async (c) => {
2342
+ describe19("createVars", () => {
2343
+ test17("should support dynamic vars creation", async (c) => {
2470
2344
  const { client } = await setupDriverTest(c, driverTestConfig);
2471
2345
  const instance = client.dynamicVarActor.getOrCreate();
2472
2346
  const vars = await instance.getVars();
2473
- expect15(vars).toHaveProperty("random");
2474
- expect15(vars).toHaveProperty("computed");
2475
- expect15(typeof vars.random).toBe("number");
2476
- expect15(typeof vars.computed).toBe("string");
2477
- expect15(vars.computed).toMatch(/^Actor-\d+$/);
2347
+ expect17(vars).toHaveProperty("random");
2348
+ expect17(vars).toHaveProperty("computed");
2349
+ expect17(typeof vars.random).toBe("number");
2350
+ expect17(typeof vars.computed).toBe("string");
2351
+ expect17(vars.computed).toMatch(/^Actor-\d+$/);
2478
2352
  });
2479
- test15("should create different vars for different instances", async (c) => {
2353
+ test17("should create different vars for different instances", async (c) => {
2480
2354
  const { client } = await setupDriverTest(c, driverTestConfig);
2481
2355
  const instance1 = client.uniqueVarActor.getOrCreate(["test1"]);
2482
2356
  const instance2 = client.uniqueVarActor.getOrCreate(["test2"]);
2483
2357
  const vars1 = await instance1.getVars();
2484
2358
  const vars2 = await instance2.getVars();
2485
- expect15(vars1.id).not.toBe(vars2.id);
2359
+ expect17(vars1.id).not.toBe(vars2.id);
2486
2360
  });
2487
2361
  });
2488
- describe17("Driver Context", () => {
2489
- test15("should provide access to driver context", async (c) => {
2362
+ describe19("Driver Context", () => {
2363
+ test17("should provide access to driver context", async (c) => {
2490
2364
  const { client } = await setupDriverTest(c, driverTestConfig);
2491
2365
  const instance = client.driverCtxActor.getOrCreate();
2492
2366
  const vars = await instance.getVars();
2493
- expect15(vars).toHaveProperty("hasDriverCtx");
2367
+ expect17(vars).toHaveProperty("hasDriverCtx");
2494
2368
  });
2495
2369
  });
2496
2370
  });
2497
2371
  }
2498
2372
 
2499
2373
  // src/driver-test-suite/tests/manager-driver.ts
2500
- import { describe as describe18, expect as expect16, test as test16 } from "vitest";
2374
+ import { describe as describe20, expect as expect18, test as test18 } from "vitest";
2501
2375
  function runManagerDriverTests(driverTestConfig) {
2502
- describe18("Manager Driver Tests", () => {
2503
- describe18("Client Connection Methods", () => {
2504
- test16("connect() - finds or creates a actor", async (c) => {
2376
+ describe20("Manager Driver Tests", () => {
2377
+ describe20("Client Connection Methods", () => {
2378
+ test18("connect() - finds or creates a actor", async (c) => {
2505
2379
  const { client } = await setupDriverTest(c, driverTestConfig);
2506
2380
  const counterA = client.counter.getOrCreate();
2507
2381
  await counterA.increment(5);
2508
2382
  const counterAAgain = client.counter.getOrCreate();
2509
2383
  const count = await counterAAgain.increment(0);
2510
- expect16(count).toBe(5);
2384
+ expect18(count).toBe(5);
2511
2385
  const counterB = client.counter.getOrCreate([
2512
2386
  "counter-b",
2513
2387
  "testing"
2514
2388
  ]);
2515
2389
  await counterB.increment(10);
2516
2390
  const countB = await counterB.increment(0);
2517
- expect16(countB).toBe(10);
2391
+ expect18(countB).toBe(10);
2518
2392
  });
2519
- test16("throws ActorAlreadyExists when creating duplicate actors", async (c) => {
2393
+ test18("throws ActorAlreadyExists when creating duplicate actors", async (c) => {
2520
2394
  const { client } = await setupDriverTest(c, driverTestConfig);
2521
2395
  const uniqueKey = ["duplicate-actor-test", crypto.randomUUID()];
2522
2396
  const counter = client.counter.getOrCreate(uniqueKey);
2523
2397
  await counter.increment(5);
2524
2398
  try {
2525
2399
  await client.counter.create(uniqueKey);
2526
- expect16.fail("did not error on duplicate create");
2400
+ expect18.fail("did not error on duplicate create");
2527
2401
  } catch (err) {
2528
- expect16(err.group).toBe("actor");
2529
- expect16(err.code).toBe("duplicate_key");
2402
+ expect18(err.group).toBe("actor");
2403
+ expect18(err.code).toBe("duplicate_key");
2530
2404
  }
2531
2405
  const count = await counter.increment(0);
2532
- expect16(count).toBe(5);
2406
+ expect18(count).toBe(5);
2533
2407
  });
2534
2408
  });
2535
- describe18("Connection Options", () => {
2536
- test16("get without create prevents actor creation", async (c) => {
2409
+ describe20("Connection Options", () => {
2410
+ test18("get without create prevents actor creation", async (c) => {
2537
2411
  const { client } = await setupDriverTest(c, driverTestConfig);
2538
2412
  const nonexistentId = `nonexistent-${crypto.randomUUID()}`;
2539
2413
  try {
2540
2414
  await client.counter.get([nonexistentId]).resolve();
2541
- expect16.fail("did not error for get");
2415
+ expect18.fail("did not error for get");
2542
2416
  } catch (err) {
2543
- expect16(err.group).toBe("actor");
2544
- expect16(err.code).toBe("not_found");
2417
+ expect18(err.group).toBe("actor");
2418
+ expect18(err.code).toBe("not_found");
2545
2419
  }
2546
2420
  const createdCounter = client.counter.getOrCreate(nonexistentId);
2547
2421
  await createdCounter.increment(3);
2548
2422
  const retrievedCounter = client.counter.get(nonexistentId);
2549
2423
  const count = await retrievedCounter.increment(0);
2550
- expect16(count).toBe(3);
2424
+ expect18(count).toBe(3);
2551
2425
  });
2552
- test16("connection params are passed to actors", async (c) => {
2426
+ test18("connection params are passed to actors", async (c) => {
2553
2427
  const { client } = await setupDriverTest(c, driverTestConfig);
2554
2428
  const counter = client.counter.getOrCreate(void 0, {
2555
2429
  params: {
@@ -2560,41 +2434,41 @@ function runManagerDriverTests(driverTestConfig) {
2560
2434
  });
2561
2435
  await counter.increment(1);
2562
2436
  const count = await counter.increment(0);
2563
- expect16(count).toBe(1);
2437
+ expect18(count).toBe(1);
2564
2438
  });
2565
2439
  });
2566
- describe18("Actor Creation & Retrieval", () => {
2567
- test16("creates and retrieves actors by ID", async (c) => {
2440
+ describe20("Actor Creation & Retrieval", () => {
2441
+ test18("creates and retrieves actors by ID", async (c) => {
2568
2442
  const { client } = await setupDriverTest(c, driverTestConfig);
2569
2443
  const uniqueId = `test-counter-${crypto.randomUUID()}`;
2570
2444
  const counter = client.counter.getOrCreate([uniqueId]);
2571
2445
  await counter.increment(10);
2572
2446
  const retrievedCounter = client.counter.getOrCreate([uniqueId]);
2573
2447
  const count = await retrievedCounter.increment(0);
2574
- expect16(count).toBe(10);
2448
+ expect18(count).toBe(10);
2575
2449
  });
2576
- test16("passes input to actor during creation", async (c) => {
2450
+ test18("passes input to actor during creation", async (c) => {
2577
2451
  const { client } = await setupDriverTest(c, driverTestConfig);
2578
2452
  const testInput = {
2579
2453
  name: "test-actor",
2580
2454
  value: 42,
2581
2455
  nested: { foo: "bar" }
2582
2456
  };
2583
- const actor2 = await client.inputActor.create(void 0, {
2457
+ const actor = await client.inputActor.create(void 0, {
2584
2458
  input: testInput
2585
2459
  });
2586
- const inputs = await actor2.getInputs();
2587
- expect16(inputs.initialInput).toEqual(testInput);
2588
- expect16(inputs.onCreateInput).toEqual(testInput);
2460
+ const inputs = await actor.getInputs();
2461
+ expect18(inputs.initialInput).toEqual(testInput);
2462
+ expect18(inputs.onCreateInput).toEqual(testInput);
2589
2463
  });
2590
- test16("input is undefined when not provided", async (c) => {
2464
+ test18("input is undefined when not provided", async (c) => {
2591
2465
  const { client } = await setupDriverTest(c, driverTestConfig);
2592
- const actor2 = await client.inputActor.create();
2593
- const inputs = await actor2.getInputs();
2594
- expect16(inputs.initialInput).toBeUndefined();
2595
- expect16(inputs.onCreateInput).toBeUndefined();
2466
+ const actor = await client.inputActor.create();
2467
+ const inputs = await actor.getInputs();
2468
+ expect18(inputs.initialInput).toBeUndefined();
2469
+ expect18(inputs.onCreateInput).toBeUndefined();
2596
2470
  });
2597
- test16("getOrCreate passes input to actor during creation", async (c) => {
2471
+ test18("getOrCreate passes input to actor during creation", async (c) => {
2598
2472
  const { client } = await setupDriverTest(c, driverTestConfig);
2599
2473
  const uniqueKey = [`input-test-${crypto.randomUUID()}`];
2600
2474
  const testInput = {
@@ -2602,20 +2476,20 @@ function runManagerDriverTests(driverTestConfig) {
2602
2476
  value: 100,
2603
2477
  nested: { baz: "qux" }
2604
2478
  };
2605
- const actor2 = client.inputActor.getOrCreate(uniqueKey, {
2479
+ const actor = client.inputActor.getOrCreate(uniqueKey, {
2606
2480
  createWithInput: testInput
2607
2481
  });
2608
- const inputs = await actor2.getInputs();
2609
- expect16(inputs.initialInput).toEqual(testInput);
2610
- expect16(inputs.onCreateInput).toEqual(testInput);
2482
+ const inputs = await actor.getInputs();
2483
+ expect18(inputs.initialInput).toEqual(testInput);
2484
+ expect18(inputs.onCreateInput).toEqual(testInput);
2611
2485
  const existingActor = client.inputActor.getOrCreate(uniqueKey);
2612
2486
  const existingInputs = await existingActor.getInputs();
2613
- expect16(existingInputs.initialInput).toEqual(testInput);
2614
- expect16(existingInputs.onCreateInput).toEqual(testInput);
2487
+ expect18(existingInputs.initialInput).toEqual(testInput);
2488
+ expect18(existingInputs.onCreateInput).toEqual(testInput);
2615
2489
  });
2616
2490
  });
2617
- describe18("Key Matching", () => {
2618
- test16("matches actors only with exactly the same keys", async (c) => {
2491
+ describe20("Key Matching", () => {
2492
+ test18("matches actors only with exactly the same keys", async (c) => {
2619
2493
  const { client } = await setupDriverTest(c, driverTestConfig);
2620
2494
  const originalCounter = client.counter.getOrCreate([
2621
2495
  "counter-match",
@@ -2629,20 +2503,20 @@ function runManagerDriverTests(driverTestConfig) {
2629
2503
  "us-east"
2630
2504
  ]);
2631
2505
  const exactMatchCount = await exactMatchCounter.increment(0);
2632
- expect16(exactMatchCount).toBe(10);
2506
+ expect18(exactMatchCount).toBe(10);
2633
2507
  const subsetMatchCounter = client.counter.getOrCreate([
2634
2508
  "counter-match",
2635
2509
  "test"
2636
2510
  ]);
2637
2511
  const subsetMatchCount = await subsetMatchCounter.increment(0);
2638
- expect16(subsetMatchCount).toBe(0);
2512
+ expect18(subsetMatchCount).toBe(0);
2639
2513
  const singleKeyCounter = client.counter.getOrCreate([
2640
2514
  "counter-match"
2641
2515
  ]);
2642
2516
  const singleKeyCount = await singleKeyCounter.increment(0);
2643
- expect16(singleKeyCount).toBe(0);
2517
+ expect18(singleKeyCount).toBe(0);
2644
2518
  });
2645
- test16("string key matches array with single string key", async (c) => {
2519
+ test18("string key matches array with single string key", async (c) => {
2646
2520
  const { client } = await setupDriverTest(c, driverTestConfig);
2647
2521
  const stringKeyCounter = client.counter.getOrCreate("string-key-test");
2648
2522
  await stringKeyCounter.increment(7);
@@ -2650,20 +2524,20 @@ function runManagerDriverTests(driverTestConfig) {
2650
2524
  "string-key-test"
2651
2525
  ]);
2652
2526
  const count = await arrayKeyCounter.increment(0);
2653
- expect16(count).toBe(7);
2527
+ expect18(count).toBe(7);
2654
2528
  });
2655
- test16("undefined key matches empty array key and no key", async (c) => {
2529
+ test18("undefined key matches empty array key and no key", async (c) => {
2656
2530
  const { client } = await setupDriverTest(c, driverTestConfig);
2657
2531
  const undefinedKeyCounter = client.counter.getOrCreate(void 0);
2658
2532
  await undefinedKeyCounter.increment(12);
2659
2533
  const emptyArrayKeyCounter = client.counter.getOrCreate([]);
2660
2534
  const emptyArrayCount = await emptyArrayKeyCounter.increment(0);
2661
- expect16(emptyArrayCount).toBe(12);
2535
+ expect18(emptyArrayCount).toBe(12);
2662
2536
  const noKeyCounter = client.counter.getOrCreate();
2663
2537
  const noKeyCount = await noKeyCounter.increment(0);
2664
- expect16(noKeyCount).toBe(12);
2538
+ expect18(noKeyCount).toBe(12);
2665
2539
  });
2666
- test16("no keys does not match actors with keys", async (c) => {
2540
+ test18("no keys does not match actors with keys", async (c) => {
2667
2541
  const { client } = await setupDriverTest(c, driverTestConfig);
2668
2542
  const keyedCounter = client.counter.getOrCreate([
2669
2543
  "counter-with-keys",
@@ -2672,9 +2546,9 @@ function runManagerDriverTests(driverTestConfig) {
2672
2546
  await keyedCounter.increment(15);
2673
2547
  const noKeysCounter = client.counter.getOrCreate();
2674
2548
  const count = await noKeysCounter.increment(10);
2675
- expect16(count).toBe(10);
2549
+ expect18(count).toBe(10);
2676
2550
  });
2677
- test16("actors with keys match actors with no keys", async (c) => {
2551
+ test18("actors with keys match actors with no keys", async (c) => {
2678
2552
  const { client } = await setupDriverTest(c, driverTestConfig);
2679
2553
  const noKeysCounter = client.counter.getOrCreate();
2680
2554
  await noKeysCounter.increment(25);
@@ -2683,11 +2557,11 @@ function runManagerDriverTests(driverTestConfig) {
2683
2557
  "prod"
2684
2558
  ]);
2685
2559
  const keyedCount = await keyedCounter.increment(0);
2686
- expect16(keyedCount).toBe(0);
2560
+ expect18(keyedCount).toBe(0);
2687
2561
  });
2688
2562
  });
2689
- describe18("Multiple Actor Instances", () => {
2690
- test16("creates multiple actor instances of the same type", async (c) => {
2563
+ describe20("Multiple Actor Instances", () => {
2564
+ test18("creates multiple actor instances of the same type", async (c) => {
2691
2565
  const { client } = await setupDriverTest(c, driverTestConfig);
2692
2566
  const instance1 = client.counter.getOrCreate(["multi-1"]);
2693
2567
  const instance2 = client.counter.getOrCreate(["multi-2"]);
@@ -2698,291 +2572,291 @@ function runManagerDriverTests(driverTestConfig) {
2698
2572
  const retrieved1 = client.counter.getOrCreate(["multi-1"]);
2699
2573
  const retrieved2 = client.counter.getOrCreate(["multi-2"]);
2700
2574
  const retrieved3 = client.counter.getOrCreate(["multi-3"]);
2701
- expect16(await retrieved1.increment(0)).toBe(1);
2702
- expect16(await retrieved2.increment(0)).toBe(2);
2703
- expect16(await retrieved3.increment(0)).toBe(3);
2575
+ expect18(await retrieved1.increment(0)).toBe(1);
2576
+ expect18(await retrieved2.increment(0)).toBe(2);
2577
+ expect18(await retrieved3.increment(0)).toBe(3);
2704
2578
  });
2705
- test16("handles default instance with no explicit ID", async (c) => {
2579
+ test18("handles default instance with no explicit ID", async (c) => {
2706
2580
  const { client } = await setupDriverTest(c, driverTestConfig);
2707
2581
  const defaultCounter = client.counter.getOrCreate();
2708
2582
  await defaultCounter.increment(5);
2709
2583
  const sameDefaultCounter = client.counter.getOrCreate();
2710
2584
  const count = await sameDefaultCounter.increment(0);
2711
- expect16(count).toBe(5);
2585
+ expect18(count).toBe(5);
2712
2586
  });
2713
2587
  });
2714
2588
  });
2715
2589
  }
2716
2590
 
2717
2591
  // src/driver-test-suite/tests/raw-http.ts
2718
- import { describe as describe19, expect as expect17, test as test17 } from "vitest";
2592
+ import { describe as describe21, expect as expect19, test as test19 } from "vitest";
2719
2593
  function runRawHttpTests(driverTestConfig) {
2720
- describe19("raw http", () => {
2721
- test17("should handle raw HTTP GET requests", async (c) => {
2594
+ describe21("raw http", () => {
2595
+ test19("should handle raw HTTP GET requests", async (c) => {
2722
2596
  const { client } = await setupDriverTest(c, driverTestConfig);
2723
- const actor2 = client.rawHttpActor.getOrCreate(["test"]);
2724
- const helloResponse = await actor2.fetch("api/hello");
2725
- expect17(helloResponse.ok).toBe(true);
2597
+ const actor = client.rawHttpActor.getOrCreate(["test"]);
2598
+ const helloResponse = await actor.fetch("api/hello");
2599
+ expect19(helloResponse.ok).toBe(true);
2726
2600
  const helloData = await helloResponse.json();
2727
- expect17(helloData).toEqual({ message: "Hello from actor!" });
2601
+ expect19(helloData).toEqual({ message: "Hello from actor!" });
2728
2602
  });
2729
- test17("should handle raw HTTP POST requests with echo", async (c) => {
2603
+ test19("should handle raw HTTP POST requests with echo", async (c) => {
2730
2604
  const { client } = await setupDriverTest(c, driverTestConfig);
2731
- const actor2 = client.rawHttpActor.getOrCreate(["test"]);
2605
+ const actor = client.rawHttpActor.getOrCreate(["test"]);
2732
2606
  const testData = { test: "data", number: 123 };
2733
- const echoResponse = await actor2.fetch("api/echo", {
2607
+ const echoResponse = await actor.fetch("api/echo", {
2734
2608
  method: "POST",
2735
2609
  headers: {
2736
2610
  "Content-Type": "application/json"
2737
2611
  },
2738
2612
  body: JSON.stringify(testData)
2739
2613
  });
2740
- expect17(echoResponse.ok).toBe(true);
2614
+ expect19(echoResponse.ok).toBe(true);
2741
2615
  const echoData = await echoResponse.json();
2742
- expect17(echoData).toEqual(testData);
2616
+ expect19(echoData).toEqual(testData);
2743
2617
  });
2744
- test17("should track state across raw HTTP requests", async (c) => {
2618
+ test19("should track state across raw HTTP requests", async (c) => {
2745
2619
  const { client } = await setupDriverTest(c, driverTestConfig);
2746
- const actor2 = client.rawHttpActor.getOrCreate(["state-test"]);
2747
- await actor2.fetch("api/hello");
2748
- await actor2.fetch("api/hello");
2749
- await actor2.fetch("api/state");
2750
- const stateResponse = await actor2.fetch("api/state");
2751
- expect17(stateResponse.ok).toBe(true);
2620
+ const actor = client.rawHttpActor.getOrCreate(["state-test"]);
2621
+ await actor.fetch("api/hello");
2622
+ await actor.fetch("api/hello");
2623
+ await actor.fetch("api/state");
2624
+ const stateResponse = await actor.fetch("api/state");
2625
+ expect19(stateResponse.ok).toBe(true);
2752
2626
  const stateData = await stateResponse.json();
2753
- expect17(stateData.requestCount).toBe(4);
2627
+ expect19(stateData.requestCount).toBe(4);
2754
2628
  });
2755
- test17("should pass headers correctly", async (c) => {
2629
+ test19("should pass headers correctly", async (c) => {
2756
2630
  const { client } = await setupDriverTest(c, driverTestConfig);
2757
- const actor2 = client.rawHttpActor.getOrCreate(["headers-test"]);
2631
+ const actor = client.rawHttpActor.getOrCreate(["headers-test"]);
2758
2632
  const customHeaders = {
2759
2633
  "X-Custom-Header": "test-value",
2760
2634
  "X-Another-Header": "another-value"
2761
2635
  };
2762
- const response = await actor2.fetch("api/headers", {
2636
+ const response = await actor.fetch("api/headers", {
2763
2637
  headers: customHeaders
2764
2638
  });
2765
- expect17(response.ok).toBe(true);
2639
+ expect19(response.ok).toBe(true);
2766
2640
  const headers = await response.json();
2767
- expect17(headers["x-custom-header"]).toBe("test-value");
2768
- expect17(headers["x-another-header"]).toBe("another-value");
2641
+ expect19(headers["x-custom-header"]).toBe("test-value");
2642
+ expect19(headers["x-another-header"]).toBe("another-value");
2769
2643
  });
2770
- test17("should return 404 for unhandled paths", async (c) => {
2644
+ test19("should return 404 for unhandled paths", async (c) => {
2771
2645
  const { client } = await setupDriverTest(c, driverTestConfig);
2772
- const actor2 = client.rawHttpActor.getOrCreate(["404-test"]);
2773
- const response = await actor2.fetch("api/nonexistent");
2774
- expect17(response.ok).toBe(false);
2775
- expect17(response.status).toBe(404);
2646
+ const actor = client.rawHttpActor.getOrCreate(["404-test"]);
2647
+ const response = await actor.fetch("api/nonexistent");
2648
+ expect19(response.ok).toBe(false);
2649
+ expect19(response.status).toBe(404);
2776
2650
  });
2777
- test17("should return 404 when no onRequest handler defined", async (c) => {
2651
+ test19("should return 404 when no onRequest handler defined", async (c) => {
2778
2652
  const { client } = await setupDriverTest(c, driverTestConfig);
2779
- const actor2 = client.rawHttpNoHandlerActor.getOrCreate([
2653
+ const actor = client.rawHttpNoHandlerActor.getOrCreate([
2780
2654
  "no-handler"
2781
2655
  ]);
2782
- const response = await actor2.fetch("api/anything");
2783
- expect17(response.ok).toBe(false);
2784
- expect17(response.status).toBe(404);
2656
+ const response = await actor.fetch("api/anything");
2657
+ expect19(response.ok).toBe(false);
2658
+ expect19(response.status).toBe(404);
2785
2659
  });
2786
- test17("should return 500 error when onRequest returns void", async (c) => {
2660
+ test19("should return 500 error when onRequest returns void", async (c) => {
2787
2661
  const { client } = await setupDriverTest(c, driverTestConfig);
2788
- const actor2 = client.rawHttpVoidReturnActor.getOrCreate([
2662
+ const actor = client.rawHttpVoidReturnActor.getOrCreate([
2789
2663
  "void-return"
2790
2664
  ]);
2791
- const response = await actor2.fetch("api/anything");
2792
- expect17(response.ok).toBe(false);
2793
- expect17(response.status).toBe(500);
2665
+ const response = await actor.fetch("api/anything");
2666
+ expect19(response.ok).toBe(false);
2667
+ expect19(response.status).toBe(500);
2794
2668
  try {
2795
2669
  const errorData = await response.json();
2796
- expect17(errorData.message).toContain(
2670
+ expect19(errorData.message).toContain(
2797
2671
  "onRequest handler must return a Response"
2798
2672
  );
2799
2673
  } catch {
2800
2674
  }
2801
2675
  });
2802
- test17("should handle different HTTP methods", async (c) => {
2676
+ test19("should handle different HTTP methods", async (c) => {
2803
2677
  const { client } = await setupDriverTest(c, driverTestConfig);
2804
- const actor2 = client.rawHttpActor.getOrCreate(["methods-test"]);
2678
+ const actor = client.rawHttpActor.getOrCreate(["methods-test"]);
2805
2679
  const methods = ["GET", "POST", "PUT", "DELETE", "PATCH"];
2806
2680
  for (const method of methods) {
2807
- const response = await actor2.fetch("api/echo", {
2681
+ const response = await actor.fetch("api/echo", {
2808
2682
  method,
2809
2683
  body: ["POST", "PUT", "PATCH"].includes(method) ? JSON.stringify({ method }) : void 0
2810
2684
  });
2811
2685
  if (method === "POST") {
2812
- expect17(response.ok).toBe(true);
2686
+ expect19(response.ok).toBe(true);
2813
2687
  const data = await response.json();
2814
- expect17(data).toEqual({ method });
2688
+ expect19(data).toEqual({ method });
2815
2689
  } else if (method === "GET") {
2816
- expect17(response.status).toBe(404);
2690
+ expect19(response.status).toBe(404);
2817
2691
  } else {
2818
- expect17(response.status).toBe(404);
2692
+ expect19(response.status).toBe(404);
2819
2693
  }
2820
2694
  }
2821
2695
  });
2822
- test17("should handle binary data", async (c) => {
2696
+ test19("should handle binary data", async (c) => {
2823
2697
  const { client } = await setupDriverTest(c, driverTestConfig);
2824
- const actor2 = client.rawHttpActor.getOrCreate(["binary-test"]);
2698
+ const actor = client.rawHttpActor.getOrCreate(["binary-test"]);
2825
2699
  const binaryData = new Uint8Array([1, 2, 3, 4, 5]);
2826
- const response = await actor2.fetch("api/echo", {
2700
+ const response = await actor.fetch("api/echo", {
2827
2701
  method: "POST",
2828
2702
  headers: {
2829
2703
  "Content-Type": "application/octet-stream"
2830
2704
  },
2831
2705
  body: binaryData
2832
2706
  });
2833
- expect17(response.ok).toBe(true);
2707
+ expect19(response.ok).toBe(true);
2834
2708
  const responseBuffer = await response.arrayBuffer();
2835
2709
  const responseArray = new Uint8Array(responseBuffer);
2836
- expect17(Array.from(responseArray)).toEqual([1, 2, 3, 4, 5]);
2710
+ expect19(Array.from(responseArray)).toEqual([1, 2, 3, 4, 5]);
2837
2711
  });
2838
- test17("should work with Hono router using createVars", async (c) => {
2712
+ test19("should work with Hono router using createVars", async (c) => {
2839
2713
  const { client } = await setupDriverTest(c, driverTestConfig);
2840
- const actor2 = client.rawHttpHonoActor.getOrCreate(["hono-test"]);
2841
- const rootResponse = await actor2.fetch("/");
2842
- expect17(rootResponse.ok).toBe(true);
2714
+ const actor = client.rawHttpHonoActor.getOrCreate(["hono-test"]);
2715
+ const rootResponse = await actor.fetch("/");
2716
+ expect19(rootResponse.ok).toBe(true);
2843
2717
  const rootData = await rootResponse.json();
2844
- expect17(rootData).toEqual({ message: "Welcome to Hono actor!" });
2845
- const usersResponse = await actor2.fetch("/users");
2846
- expect17(usersResponse.ok).toBe(true);
2718
+ expect19(rootData).toEqual({ message: "Welcome to Hono actor!" });
2719
+ const usersResponse = await actor.fetch("/users");
2720
+ expect19(usersResponse.ok).toBe(true);
2847
2721
  const users = await usersResponse.json();
2848
- expect17(users).toEqual([
2722
+ expect19(users).toEqual([
2849
2723
  { id: 1, name: "Alice" },
2850
2724
  { id: 2, name: "Bob" }
2851
2725
  ]);
2852
- const userResponse = await actor2.fetch("/users/1");
2853
- expect17(userResponse.ok).toBe(true);
2726
+ const userResponse = await actor.fetch("/users/1");
2727
+ expect19(userResponse.ok).toBe(true);
2854
2728
  const user = await userResponse.json();
2855
- expect17(user).toEqual({ id: 1, name: "Alice" });
2729
+ expect19(user).toEqual({ id: 1, name: "Alice" });
2856
2730
  const newUser = { name: "Charlie" };
2857
- const createResponse = await actor2.fetch("/users", {
2731
+ const createResponse = await actor.fetch("/users", {
2858
2732
  method: "POST",
2859
2733
  headers: { "Content-Type": "application/json" },
2860
2734
  body: JSON.stringify(newUser)
2861
2735
  });
2862
- expect17(createResponse.ok).toBe(true);
2863
- expect17(createResponse.status).toBe(201);
2736
+ expect19(createResponse.ok).toBe(true);
2737
+ expect19(createResponse.status).toBe(201);
2864
2738
  const createdUser = await createResponse.json();
2865
- expect17(createdUser).toEqual({ id: 3, name: "Charlie" });
2739
+ expect19(createdUser).toEqual({ id: 3, name: "Charlie" });
2866
2740
  const updateData = { name: "Alice Updated" };
2867
- const updateResponse = await actor2.fetch("/users/1", {
2741
+ const updateResponse = await actor.fetch("/users/1", {
2868
2742
  method: "PUT",
2869
2743
  headers: { "Content-Type": "application/json" },
2870
2744
  body: JSON.stringify(updateData)
2871
2745
  });
2872
- expect17(updateResponse.ok).toBe(true);
2746
+ expect19(updateResponse.ok).toBe(true);
2873
2747
  const updatedUser = await updateResponse.json();
2874
- expect17(updatedUser).toEqual({ id: 1, name: "Alice Updated" });
2875
- const deleteResponse = await actor2.fetch("/users/2", {
2748
+ expect19(updatedUser).toEqual({ id: 1, name: "Alice Updated" });
2749
+ const deleteResponse = await actor.fetch("/users/2", {
2876
2750
  method: "DELETE"
2877
2751
  });
2878
- expect17(deleteResponse.ok).toBe(true);
2752
+ expect19(deleteResponse.ok).toBe(true);
2879
2753
  const deleteResult = await deleteResponse.json();
2880
- expect17(deleteResult).toEqual({ message: "User 2 deleted" });
2881
- const notFoundResponse = await actor2.fetch("/api/unknown");
2882
- expect17(notFoundResponse.ok).toBe(false);
2883
- expect17(notFoundResponse.status).toBe(404);
2754
+ expect19(deleteResult).toEqual({ message: "User 2 deleted" });
2755
+ const notFoundResponse = await actor.fetch("/api/unknown");
2756
+ expect19(notFoundResponse.ok).toBe(false);
2757
+ expect19(notFoundResponse.status).toBe(404);
2884
2758
  });
2885
- test17("should handle paths with and without leading slashes", async (c) => {
2759
+ test19("should handle paths with and without leading slashes", async (c) => {
2886
2760
  const { client } = await setupDriverTest(c, driverTestConfig);
2887
- const actor2 = client.rawHttpActor.getOrCreate(["path-test"]);
2888
- const responseWithoutSlash = await actor2.fetch("api/hello");
2889
- expect17(responseWithoutSlash.ok).toBe(true);
2761
+ const actor = client.rawHttpActor.getOrCreate(["path-test"]);
2762
+ const responseWithoutSlash = await actor.fetch("api/hello");
2763
+ expect19(responseWithoutSlash.ok).toBe(true);
2890
2764
  const dataWithoutSlash = await responseWithoutSlash.json();
2891
- expect17(dataWithoutSlash).toEqual({ message: "Hello from actor!" });
2892
- const responseWithSlash = await actor2.fetch("/api/hello");
2893
- expect17(responseWithSlash.ok).toBe(true);
2765
+ expect19(dataWithoutSlash).toEqual({ message: "Hello from actor!" });
2766
+ const responseWithSlash = await actor.fetch("/api/hello");
2767
+ expect19(responseWithSlash.ok).toBe(true);
2894
2768
  const dataWithSlash = await responseWithSlash.json();
2895
- expect17(dataWithSlash).toEqual({ message: "Hello from actor!" });
2769
+ expect19(dataWithSlash).toEqual({ message: "Hello from actor!" });
2896
2770
  });
2897
- test17("should not create double slashes in request URLs", async (c) => {
2771
+ test19("should not create double slashes in request URLs", async (c) => {
2898
2772
  const { client } = await setupDriverTest(c, driverTestConfig);
2899
- const actor2 = client.rawHttpHonoActor.getOrCreate(["url-test"]);
2900
- const response = await actor2.fetch("/users");
2901
- expect17(response.ok).toBe(true);
2773
+ const actor = client.rawHttpHonoActor.getOrCreate(["url-test"]);
2774
+ const response = await actor.fetch("/users");
2775
+ expect19(response.ok).toBe(true);
2902
2776
  const data = await response.json();
2903
- expect17(data).toEqual([
2777
+ expect19(data).toEqual([
2904
2778
  { id: 1, name: "Alice" },
2905
2779
  { id: 2, name: "Bob" }
2906
2780
  ]);
2907
2781
  });
2908
- test17("should handle forwarded requests correctly without double slashes", async (c) => {
2782
+ test19("should handle forwarded requests correctly without double slashes", async (c) => {
2909
2783
  const { client } = await setupDriverTest(c, driverTestConfig);
2910
- const actor2 = client.rawHttpHonoActor.getOrCreate(["forward-test"]);
2784
+ const actor = client.rawHttpHonoActor.getOrCreate(["forward-test"]);
2911
2785
  const truncatedPath = "/users";
2912
2786
  const url = new URL(truncatedPath, "http://example.com");
2913
2787
  const newRequest = new Request(url, {
2914
2788
  method: "GET"
2915
2789
  });
2916
- const response = await actor2.fetch(
2790
+ const response = await actor.fetch(
2917
2791
  truncatedPath,
2918
2792
  newRequest
2919
2793
  );
2920
- expect17(response.ok).toBe(true);
2794
+ expect19(response.ok).toBe(true);
2921
2795
  const users = await response.json();
2922
- expect17(users).toEqual([
2796
+ expect19(users).toEqual([
2923
2797
  { id: 1, name: "Alice" },
2924
2798
  { id: 2, name: "Bob" }
2925
2799
  ]);
2926
2800
  });
2927
- test17("example fix: should properly forward requests using just Request object", async (c) => {
2801
+ test19("example fix: should properly forward requests using just Request object", async (c) => {
2928
2802
  const { client } = await setupDriverTest(c, driverTestConfig);
2929
- const actor2 = client.rawHttpHonoActor.getOrCreate(["forward-fix"]);
2803
+ const actor = client.rawHttpHonoActor.getOrCreate(["forward-fix"]);
2930
2804
  const truncatedPath = "/users/1";
2931
2805
  const url = new URL(truncatedPath, "http://example.com");
2932
2806
  const newRequest = new Request(url, {
2933
2807
  method: "GET"
2934
2808
  });
2935
- const response = await actor2.fetch(newRequest);
2936
- expect17(response.ok).toBe(true);
2809
+ const response = await actor.fetch(newRequest);
2810
+ expect19(response.ok).toBe(true);
2937
2811
  const user = await response.json();
2938
- expect17(user).toEqual({ id: 1, name: "Alice" });
2812
+ expect19(user).toEqual({ id: 1, name: "Alice" });
2939
2813
  });
2940
- test17("should support standard fetch API with URL and Request objects", async (c) => {
2814
+ test19("should support standard fetch API with URL and Request objects", async (c) => {
2941
2815
  const { client } = await setupDriverTest(c, driverTestConfig);
2942
- const actor2 = client.rawHttpActor.getOrCreate(["fetch-api-test"]);
2816
+ const actor = client.rawHttpActor.getOrCreate(["fetch-api-test"]);
2943
2817
  const url = new URL("/api/echo", "http://example.com");
2944
- const urlResponse = await actor2.fetch(url, {
2818
+ const urlResponse = await actor.fetch(url, {
2945
2819
  method: "POST",
2946
2820
  headers: { "Content-Type": "application/json" },
2947
2821
  body: JSON.stringify({ from: "URL object" })
2948
2822
  });
2949
- expect17(urlResponse.ok).toBe(true);
2823
+ expect19(urlResponse.ok).toBe(true);
2950
2824
  const urlData = await urlResponse.json();
2951
- expect17(urlData).toEqual({ from: "URL object" });
2825
+ expect19(urlData).toEqual({ from: "URL object" });
2952
2826
  const request = new Request("http://example.com/api/echo", {
2953
2827
  method: "POST",
2954
2828
  headers: { "Content-Type": "application/json" },
2955
2829
  body: JSON.stringify({ from: "Request object" })
2956
2830
  });
2957
- const requestResponse = await actor2.fetch(request);
2958
- expect17(requestResponse.ok).toBe(true);
2831
+ const requestResponse = await actor.fetch(request);
2832
+ expect19(requestResponse.ok).toBe(true);
2959
2833
  const requestData = await requestResponse.json();
2960
- expect17(requestData).toEqual({ from: "Request object" });
2834
+ expect19(requestData).toEqual({ from: "Request object" });
2961
2835
  const request2 = new Request("http://example.com/api/headers", {
2962
2836
  method: "GET",
2963
2837
  headers: { "X-Original": "request-header" }
2964
2838
  });
2965
- const overrideResponse = await actor2.fetch(request2, {
2839
+ const overrideResponse = await actor.fetch(request2, {
2966
2840
  headers: { "X-Override": "init-header" }
2967
2841
  });
2968
- expect17(overrideResponse.ok).toBe(true);
2842
+ expect19(overrideResponse.ok).toBe(true);
2969
2843
  const headers = await overrideResponse.json();
2970
- expect17(headers["x-override"]).toBe("init-header");
2971
- expect17(headers["x-original"]).toBe("request-header");
2844
+ expect19(headers["x-override"]).toBe("init-header");
2845
+ expect19(headers["x-original"]).toBe("request-header");
2972
2846
  });
2973
2847
  });
2974
2848
  }
2975
2849
 
2976
2850
  // src/driver-test-suite/tests/raw-http-request-properties.ts
2977
- import { describe as describe20, expect as expect18, test as test18 } from "vitest";
2851
+ import { describe as describe22, expect as expect20, test as test20 } from "vitest";
2978
2852
  function runRawHttpRequestPropertiesTests(driverTestConfig) {
2979
- describe20("raw http request properties", () => {
2980
- test18("should pass all Request properties correctly to onRequest", async (c) => {
2853
+ describe22("raw http request properties", () => {
2854
+ test20("should pass all Request properties correctly to onRequest", async (c) => {
2981
2855
  const { client } = await setupDriverTest(c, driverTestConfig);
2982
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2856
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
2983
2857
  "test"
2984
2858
  ]);
2985
- const response = await actor2.fetch("test/path?foo=bar&baz=qux", {
2859
+ const response = await actor.fetch("test/path?foo=bar&baz=qux", {
2986
2860
  method: "POST",
2987
2861
  headers: {
2988
2862
  "Content-Type": "application/json",
@@ -2991,73 +2865,73 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
2991
2865
  },
2992
2866
  body: JSON.stringify({ test: "data" })
2993
2867
  });
2994
- expect18(response.ok).toBe(true);
2868
+ expect20(response.ok).toBe(true);
2995
2869
  const data = await response.json();
2996
- expect18(data.url).toContain("/test/path?foo=bar&baz=qux");
2997
- expect18(data.pathname).toBe("/test/path");
2998
- expect18(data.search).toBe("?foo=bar&baz=qux");
2999
- expect18(data.searchParams).toEqual({
2870
+ expect20(data.url).toContain("/test/path?foo=bar&baz=qux");
2871
+ expect20(data.pathname).toBe("/test/path");
2872
+ expect20(data.search).toBe("?foo=bar&baz=qux");
2873
+ expect20(data.searchParams).toEqual({
3000
2874
  foo: "bar",
3001
2875
  baz: "qux"
3002
2876
  });
3003
- expect18(data.method).toBe("POST");
3004
- expect18(data.headers["content-type"]).toBe("application/json");
3005
- expect18(data.headers["x-custom-header"]).toBe("custom-value");
3006
- expect18(data.headers["authorization"]).toBe("Bearer test-token");
3007
- expect18(data.body).toEqual({ test: "data" });
2877
+ expect20(data.method).toBe("POST");
2878
+ expect20(data.headers["content-type"]).toBe("application/json");
2879
+ expect20(data.headers["x-custom-header"]).toBe("custom-value");
2880
+ expect20(data.headers["authorization"]).toBe("Bearer test-token");
2881
+ expect20(data.body).toEqual({ test: "data" });
3008
2882
  });
3009
- test18("should handle GET requests with no body", async (c) => {
2883
+ test20("should handle GET requests with no body", async (c) => {
3010
2884
  const { client } = await setupDriverTest(c, driverTestConfig);
3011
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2885
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3012
2886
  "test"
3013
2887
  ]);
3014
- const response = await actor2.fetch("test/get", {
2888
+ const response = await actor.fetch("test/get", {
3015
2889
  method: "GET"
3016
2890
  });
3017
- expect18(response.ok).toBe(true);
2891
+ expect20(response.ok).toBe(true);
3018
2892
  const data = await response.json();
3019
- expect18(data.method).toBe("GET");
3020
- expect18(data.body).toBeNull();
2893
+ expect20(data.method).toBe("GET");
2894
+ expect20(data.body).toBeNull();
3021
2895
  });
3022
- test18("should handle different content types", async (c) => {
2896
+ test20("should handle different content types", async (c) => {
3023
2897
  const { client } = await setupDriverTest(c, driverTestConfig);
3024
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2898
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3025
2899
  "test"
3026
2900
  ]);
3027
2901
  const formData = new URLSearchParams();
3028
2902
  formData.append("field1", "value1");
3029
2903
  formData.append("field2", "value2");
3030
- const formResponse = await actor2.fetch("test/form", {
2904
+ const formResponse = await actor.fetch("test/form", {
3031
2905
  method: "POST",
3032
2906
  headers: {
3033
2907
  "Content-Type": "application/x-www-form-urlencoded"
3034
2908
  },
3035
2909
  body: formData.toString()
3036
2910
  });
3037
- expect18(formResponse.ok).toBe(true);
2911
+ expect20(formResponse.ok).toBe(true);
3038
2912
  const formResult = await formResponse.json();
3039
- expect18(formResult.headers["content-type"]).toBe(
2913
+ expect20(formResult.headers["content-type"]).toBe(
3040
2914
  "application/x-www-form-urlencoded"
3041
2915
  );
3042
- expect18(formResult.bodyText).toBe("field1=value1&field2=value2");
3043
- const textResponse = await actor2.fetch("test/text", {
2916
+ expect20(formResult.bodyText).toBe("field1=value1&field2=value2");
2917
+ const textResponse = await actor.fetch("test/text", {
3044
2918
  method: "POST",
3045
2919
  headers: {
3046
2920
  "Content-Type": "text/plain"
3047
2921
  },
3048
2922
  body: "Hello, World!"
3049
2923
  });
3050
- expect18(textResponse.ok).toBe(true);
2924
+ expect20(textResponse.ok).toBe(true);
3051
2925
  const textResult = await textResponse.json();
3052
- expect18(textResult.headers["content-type"]).toBe("text/plain");
3053
- expect18(textResult.bodyText).toBe("Hello, World!");
2926
+ expect20(textResult.headers["content-type"]).toBe("text/plain");
2927
+ expect20(textResult.bodyText).toBe("Hello, World!");
3054
2928
  });
3055
- test18("should preserve all header casing and values", async (c) => {
2929
+ test20("should preserve all header casing and values", async (c) => {
3056
2930
  const { client } = await setupDriverTest(c, driverTestConfig);
3057
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2931
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3058
2932
  "test"
3059
2933
  ]);
3060
- const response = await actor2.fetch("test/headers", {
2934
+ const response = await actor.fetch("test/headers", {
3061
2935
  headers: {
3062
2936
  Accept: "application/json",
3063
2937
  "Accept-Language": "en-US,en;q=0.9",
@@ -3066,40 +2940,40 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3066
2940
  "X-Request-ID": "12345"
3067
2941
  }
3068
2942
  });
3069
- expect18(response.ok).toBe(true);
2943
+ expect20(response.ok).toBe(true);
3070
2944
  const data = await response.json();
3071
- expect18(data.headers["accept"]).toBe("application/json");
3072
- expect18(data.headers["accept-language"]).toBe("en-US,en;q=0.9");
3073
- expect18(data.headers["cache-control"]).toBe("no-cache");
3074
- expect18(data.headers["user-agent"]).toBeTruthy();
3075
- expect18(data.headers["x-request-id"]).toBe("12345");
2945
+ expect20(data.headers["accept"]).toBe("application/json");
2946
+ expect20(data.headers["accept-language"]).toBe("en-US,en;q=0.9");
2947
+ expect20(data.headers["cache-control"]).toBe("no-cache");
2948
+ expect20(data.headers["user-agent"]).toBeTruthy();
2949
+ expect20(data.headers["x-request-id"]).toBe("12345");
3076
2950
  });
3077
- test18("should handle empty and special URL paths", async (c) => {
2951
+ test20("should handle empty and special URL paths", async (c) => {
3078
2952
  const { client } = await setupDriverTest(c, driverTestConfig);
3079
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2953
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3080
2954
  "test"
3081
2955
  ]);
3082
- const rootResponse = await actor2.fetch("");
3083
- expect18(rootResponse.ok).toBe(true);
2956
+ const rootResponse = await actor.fetch("");
2957
+ expect20(rootResponse.ok).toBe(true);
3084
2958
  const rootData = await rootResponse.json();
3085
- expect18(rootData.pathname).toBe("/");
3086
- const specialResponse = await actor2.fetch(
2959
+ expect20(rootData.pathname).toBe("/");
2960
+ const specialResponse = await actor.fetch(
3087
2961
  "test/path%20with%20spaces/and%2Fslashes"
3088
2962
  );
3089
- expect18(specialResponse.ok).toBe(true);
2963
+ expect20(specialResponse.ok).toBe(true);
3090
2964
  const specialData = await specialResponse.json();
3091
- expect18(specialData.pathname).toMatch(
2965
+ expect20(specialData.pathname).toMatch(
3092
2966
  /path.*with.*spaces.*and.*slashes/
3093
2967
  );
3094
- const fragmentResponse = await actor2.fetch("test/path#fragment");
3095
- expect18(fragmentResponse.ok).toBe(true);
2968
+ const fragmentResponse = await actor.fetch("test/path#fragment");
2969
+ expect20(fragmentResponse.ok).toBe(true);
3096
2970
  const fragmentData = await fragmentResponse.json();
3097
- expect18(fragmentData.pathname).toBe("/test/path");
3098
- expect18(fragmentData.hash).toBe("");
2971
+ expect20(fragmentData.pathname).toBe("/test/path");
2972
+ expect20(fragmentData.hash).toBe("");
3099
2973
  });
3100
- test18("should handle request properties for all HTTP methods", async (c) => {
2974
+ test20("should handle request properties for all HTTP methods", async (c) => {
3101
2975
  const { client } = await setupDriverTest(c, driverTestConfig);
3102
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
2976
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3103
2977
  "test"
3104
2978
  ]);
3105
2979
  const methods = [
@@ -3112,7 +2986,7 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3112
2986
  "OPTIONS"
3113
2987
  ];
3114
2988
  for (const method of methods) {
3115
- const response = await actor2.fetch(
2989
+ const response = await actor.fetch(
3116
2990
  `test/${method.toLowerCase()}`,
3117
2991
  {
3118
2992
  method,
@@ -3121,37 +2995,37 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3121
2995
  }
3122
2996
  );
3123
2997
  if (method === "HEAD") {
3124
- expect18(response.status).toBe(200);
2998
+ expect20(response.status).toBe(200);
3125
2999
  const text = await response.text();
3126
- expect18(text).toBe("");
3000
+ expect20(text).toBe("");
3127
3001
  } else if (method === "OPTIONS") {
3128
- expect18(response.status).toBe(204);
3002
+ expect20(response.status).toBe(204);
3129
3003
  const text = await response.text();
3130
- expect18(text).toBe("");
3004
+ expect20(text).toBe("");
3131
3005
  } else {
3132
- expect18(response.ok).toBe(true);
3006
+ expect20(response.ok).toBe(true);
3133
3007
  const data = await response.json();
3134
- expect18(data.method).toBe(method);
3008
+ expect20(data.method).toBe(method);
3135
3009
  }
3136
3010
  }
3137
3011
  });
3138
- test18("should handle complex query parameters", async (c) => {
3012
+ test20("should handle complex query parameters", async (c) => {
3139
3013
  const { client } = await setupDriverTest(c, driverTestConfig);
3140
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3014
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3141
3015
  "test"
3142
3016
  ]);
3143
- const response = await actor2.fetch(
3017
+ const response = await actor.fetch(
3144
3018
  "test?key=value1&key=value2&array[]=1&array[]=2&nested[prop]=val"
3145
3019
  );
3146
- expect18(response.ok).toBe(true);
3020
+ expect20(response.ok).toBe(true);
3147
3021
  const data = await response.json();
3148
- expect18(data.searchParams.key).toBe("value2");
3149
- expect18(data.searchParams["array[]"]).toBe("2");
3150
- expect18(data.searchParams["nested[prop]"]).toBe("val");
3022
+ expect20(data.searchParams.key).toBe("value2");
3023
+ expect20(data.searchParams["array[]"]).toBe("2");
3024
+ expect20(data.searchParams["nested[prop]"]).toBe("val");
3151
3025
  });
3152
- test18("should handle multipart form data", async (c) => {
3026
+ test20("should handle multipart form data", async (c) => {
3153
3027
  const { client } = await setupDriverTest(c, driverTestConfig);
3154
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3028
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3155
3029
  "test"
3156
3030
  ]);
3157
3031
  const boundary = "----RivetKitBoundary";
@@ -3166,36 +3040,36 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3166
3040
  "value2",
3167
3041
  `------${boundary}--`
3168
3042
  ].join("\r\n");
3169
- const response = await actor2.fetch("test/multipart", {
3043
+ const response = await actor.fetch("test/multipart", {
3170
3044
  method: "POST",
3171
3045
  headers: {
3172
3046
  "Content-Type": `multipart/form-data; boundary=----${boundary}`
3173
3047
  },
3174
3048
  body
3175
3049
  });
3176
- expect18(response.ok).toBe(true);
3050
+ expect20(response.ok).toBe(true);
3177
3051
  const data = await response.json();
3178
- expect18(data.headers["content-type"]).toContain(
3052
+ expect20(data.headers["content-type"]).toContain(
3179
3053
  "multipart/form-data"
3180
3054
  );
3181
- expect18(data.bodyText).toContain("field1");
3182
- expect18(data.bodyText).toContain("value1");
3055
+ expect20(data.bodyText).toContain("field1");
3056
+ expect20(data.bodyText).toContain("value1");
3183
3057
  });
3184
- test18("should handle very long URLs", async (c) => {
3058
+ test20("should handle very long URLs", async (c) => {
3185
3059
  const { client } = await setupDriverTest(c, driverTestConfig);
3186
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3060
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3187
3061
  "test"
3188
3062
  ]);
3189
3063
  const longValue = "x".repeat(1e3);
3190
- const response = await actor2.fetch(`test/long?param=${longValue}`);
3191
- expect18(response.ok).toBe(true);
3064
+ const response = await actor.fetch(`test/long?param=${longValue}`);
3065
+ expect20(response.ok).toBe(true);
3192
3066
  const data = await response.json();
3193
- expect18(data.searchParams.param).toBe(longValue);
3194
- expect18(data.search.length).toBeGreaterThan(1e3);
3067
+ expect20(data.searchParams.param).toBe(longValue);
3068
+ expect20(data.search.length).toBeGreaterThan(1e3);
3195
3069
  });
3196
- test18.skip("should handle large request bodies", async (c) => {
3070
+ test20.skip("should handle large request bodies", async (c) => {
3197
3071
  const { client } = await setupDriverTest(c, driverTestConfig);
3198
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3072
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3199
3073
  "test"
3200
3074
  ]);
3201
3075
  const largeArray = new Array(1e4).fill({
@@ -3203,107 +3077,107 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3203
3077
  name: "Test",
3204
3078
  description: "This is a test object with some data"
3205
3079
  });
3206
- const response = await actor2.fetch("test/large", {
3080
+ const response = await actor.fetch("test/large", {
3207
3081
  method: "POST",
3208
3082
  headers: {
3209
3083
  "Content-Type": "application/json"
3210
3084
  },
3211
3085
  body: JSON.stringify(largeArray)
3212
3086
  });
3213
- expect18(response.ok).toBe(true);
3087
+ expect20(response.ok).toBe(true);
3214
3088
  const data = await response.json();
3215
- expect18(data.body).toHaveLength(1e4);
3089
+ expect20(data.body).toHaveLength(1e4);
3216
3090
  });
3217
- test18("should handle missing content-type header", async (c) => {
3091
+ test20("should handle missing content-type header", async (c) => {
3218
3092
  const { client } = await setupDriverTest(c, driverTestConfig);
3219
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3093
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3220
3094
  "test"
3221
3095
  ]);
3222
- const response = await actor2.fetch("test/no-content-type", {
3096
+ const response = await actor.fetch("test/no-content-type", {
3223
3097
  method: "POST",
3224
3098
  body: "plain text without content-type"
3225
3099
  });
3226
- expect18(response.ok).toBe(true);
3100
+ expect20(response.ok).toBe(true);
3227
3101
  const data = await response.json();
3228
- expect18(data.bodyText).toBe("plain text without content-type");
3102
+ expect20(data.bodyText).toBe("plain text without content-type");
3229
3103
  });
3230
- test18("should handle empty request body", async (c) => {
3104
+ test20("should handle empty request body", async (c) => {
3231
3105
  const { client } = await setupDriverTest(c, driverTestConfig);
3232
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3106
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3233
3107
  "test"
3234
3108
  ]);
3235
- const response = await actor2.fetch("test/empty", {
3109
+ const response = await actor.fetch("test/empty", {
3236
3110
  method: "POST",
3237
3111
  headers: {
3238
3112
  "Content-Type": "application/json"
3239
3113
  },
3240
3114
  body: ""
3241
3115
  });
3242
- expect18(response.ok).toBe(true);
3116
+ expect20(response.ok).toBe(true);
3243
3117
  });
3244
- test18("should handle custom HTTP methods", async (c) => {
3118
+ test20("should handle custom HTTP methods", async (c) => {
3245
3119
  const { client } = await setupDriverTest(c, driverTestConfig);
3246
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3120
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3247
3121
  "test"
3248
3122
  ]);
3249
3123
  try {
3250
- const response = await actor2.fetch("test/custom", {
3124
+ const response = await actor.fetch("test/custom", {
3251
3125
  method: "CUSTOM"
3252
3126
  });
3253
3127
  if (response.ok) {
3254
3128
  const data = await response.json();
3255
- expect18(data.method).toBe("CUSTOM");
3129
+ expect20(data.method).toBe("CUSTOM");
3256
3130
  }
3257
3131
  } catch (error) {
3258
3132
  }
3259
3133
  });
3260
- test18("should handle cookies in headers", async (c) => {
3134
+ test20("should handle cookies in headers", async (c) => {
3261
3135
  const { client } = await setupDriverTest(c, driverTestConfig);
3262
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3136
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3263
3137
  "test"
3264
3138
  ]);
3265
- const response = await actor2.fetch("test/cookies", {
3139
+ const response = await actor.fetch("test/cookies", {
3266
3140
  headers: {
3267
3141
  Cookie: "session=abc123; user=test; preferences=dark_mode"
3268
3142
  }
3269
3143
  });
3270
- expect18(response.ok).toBe(true);
3144
+ expect20(response.ok).toBe(true);
3271
3145
  const data = await response.json();
3272
- expect18(data.headers.cookie).toBe(
3146
+ expect20(data.headers.cookie).toBe(
3273
3147
  "session=abc123; user=test; preferences=dark_mode"
3274
3148
  );
3275
3149
  });
3276
- test18("should handle URL encoding properly", async (c) => {
3150
+ test20("should handle URL encoding properly", async (c) => {
3277
3151
  const { client } = await setupDriverTest(c, driverTestConfig);
3278
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3152
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3279
3153
  "test"
3280
3154
  ]);
3281
- const response = await actor2.fetch(
3155
+ const response = await actor.fetch(
3282
3156
  "test/encoded?special=%20%21%40%23%24%25%5E%26&unicode=%E2%9C%93&email=test%40example.com"
3283
3157
  );
3284
- expect18(response.ok).toBe(true);
3158
+ expect20(response.ok).toBe(true);
3285
3159
  const data = await response.json();
3286
- expect18(data.searchParams.special).toBe(" !@#$%^&");
3287
- expect18(data.searchParams.unicode).toBe("\u2713");
3288
- expect18(data.searchParams.email).toBe("test@example.com");
3160
+ expect20(data.searchParams.special).toBe(" !@#$%^&");
3161
+ expect20(data.searchParams.unicode).toBe("\u2713");
3162
+ expect20(data.searchParams.email).toBe("test@example.com");
3289
3163
  });
3290
- test18("should handle concurrent requests maintaining separate contexts", async (c) => {
3164
+ test20("should handle concurrent requests maintaining separate contexts", async (c) => {
3291
3165
  const { client } = await setupDriverTest(c, driverTestConfig);
3292
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3166
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
3293
3167
  "test"
3294
3168
  ]);
3295
3169
  const requests = [
3296
- actor2.fetch("test/concurrent?id=1", {
3170
+ actor.fetch("test/concurrent?id=1", {
3297
3171
  method: "POST",
3298
3172
  headers: { "Content-Type": "application/json" },
3299
3173
  body: JSON.stringify({ request: 1 })
3300
3174
  }),
3301
- actor2.fetch("test/concurrent?id=2", {
3175
+ actor.fetch("test/concurrent?id=2", {
3302
3176
  method: "PUT",
3303
3177
  headers: { "Content-Type": "application/json" },
3304
3178
  body: JSON.stringify({ request: 2 })
3305
3179
  }),
3306
- actor2.fetch("test/concurrent?id=3", {
3180
+ actor.fetch("test/concurrent?id=3", {
3307
3181
  method: "DELETE"
3308
3182
  })
3309
3183
  ];
@@ -3311,27 +3185,27 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3311
3185
  const results = await Promise.all(
3312
3186
  responses.map((r) => r.json())
3313
3187
  );
3314
- expect18(results[0].searchParams.id).toBe("1");
3315
- expect18(results[0].method).toBe("POST");
3316
- expect18(results[0].body).toEqual({ request: 1 });
3317
- expect18(results[1].searchParams.id).toBe("2");
3318
- expect18(results[1].method).toBe("PUT");
3319
- expect18(results[1].body).toEqual({ request: 2 });
3320
- expect18(results[2].searchParams.id).toBe("3");
3321
- expect18(results[2].method).toBe("DELETE");
3322
- expect18(results[2].body).toBeNull();
3188
+ expect20(results[0].searchParams.id).toBe("1");
3189
+ expect20(results[0].method).toBe("POST");
3190
+ expect20(results[0].body).toEqual({ request: 1 });
3191
+ expect20(results[1].searchParams.id).toBe("2");
3192
+ expect20(results[1].method).toBe("PUT");
3193
+ expect20(results[1].body).toEqual({ request: 2 });
3194
+ expect20(results[2].searchParams.id).toBe("3");
3195
+ expect20(results[2].method).toBe("DELETE");
3196
+ expect20(results[2].body).toBeNull();
3323
3197
  });
3324
3198
  });
3325
3199
  }
3326
3200
 
3327
3201
  // src/driver-test-suite/tests/raw-websocket.ts
3328
- import { describe as describe21, expect as expect19, test as test19 } from "vitest";
3202
+ import { describe as describe23, expect as expect21, test as test21 } from "vitest";
3329
3203
  function runRawWebSocketTests(driverTestConfig) {
3330
- describe21("raw websocket", () => {
3331
- test19("should establish raw WebSocket connection", async (c) => {
3204
+ describe23("raw websocket", () => {
3205
+ test21("should establish raw WebSocket connection", async (c) => {
3332
3206
  const { client } = await setupDriverTest(c, driverTestConfig);
3333
- const actor2 = client.rawWebSocketActor.getOrCreate(["basic"]);
3334
- const ws = await actor2.websocket();
3207
+ const actor = client.rawWebSocketActor.getOrCreate(["basic"]);
3208
+ const ws = await actor.websocket();
3335
3209
  await new Promise((resolve) => {
3336
3210
  if (ws.readyState === WebSocket.OPEN) {
3337
3211
  resolve();
@@ -3355,14 +3229,14 @@ function runRawWebSocketTests(driverTestConfig) {
3355
3229
  );
3356
3230
  ws.addEventListener("close", reject);
3357
3231
  });
3358
- expect19(welcomeMessage.type).toBe("welcome");
3359
- expect19(welcomeMessage.connectionCount).toBe(1);
3232
+ expect21(welcomeMessage.type).toBe("welcome");
3233
+ expect21(welcomeMessage.connectionCount).toBe(1);
3360
3234
  ws.close();
3361
3235
  });
3362
- test19("should echo messages", async (c) => {
3236
+ test21("should echo messages", async (c) => {
3363
3237
  const { client } = await setupDriverTest(c, driverTestConfig);
3364
- const actor2 = client.rawWebSocketActor.getOrCreate(["echo"]);
3365
- const ws = await actor2.websocket();
3238
+ const actor = client.rawWebSocketActor.getOrCreate(["echo"]);
3239
+ const ws = await actor.websocket();
3366
3240
  if (ws.readyState !== WebSocket.OPEN) {
3367
3241
  await new Promise((resolve, reject) => {
3368
3242
  ws.addEventListener("open", () => resolve(), {
@@ -3387,13 +3261,13 @@ function runRawWebSocketTests(driverTestConfig) {
3387
3261
  );
3388
3262
  ws.addEventListener("close", reject);
3389
3263
  });
3390
- expect19(echoMessage).toEqual(testMessage);
3264
+ expect21(echoMessage).toEqual(testMessage);
3391
3265
  ws.close();
3392
3266
  });
3393
- test19("should handle ping/pong protocol", async (c) => {
3267
+ test21("should handle ping/pong protocol", async (c) => {
3394
3268
  const { client } = await setupDriverTest(c, driverTestConfig);
3395
- const actor2 = client.rawWebSocketActor.getOrCreate(["ping"]);
3396
- const ws = await actor2.websocket();
3269
+ const actor = client.rawWebSocketActor.getOrCreate(["ping"]);
3270
+ const ws = await actor.websocket();
3397
3271
  if (ws.readyState !== WebSocket.OPEN) {
3398
3272
  await new Promise((resolve, reject) => {
3399
3273
  ws.addEventListener("open", () => resolve(), {
@@ -3416,11 +3290,11 @@ function runRawWebSocketTests(driverTestConfig) {
3416
3290
  });
3417
3291
  ws.addEventListener("close", reject);
3418
3292
  });
3419
- expect19(pongMessage.type).toBe("pong");
3420
- expect19(pongMessage.timestamp).toBeDefined();
3293
+ expect21(pongMessage.type).toBe("pong");
3294
+ expect21(pongMessage.timestamp).toBeDefined();
3421
3295
  ws.close();
3422
3296
  });
3423
- test19("should track stats across connections", async (c) => {
3297
+ test21("should track stats across connections", async (c) => {
3424
3298
  const { client } = await setupDriverTest(c, driverTestConfig);
3425
3299
  const actor1 = client.rawWebSocketActor.getOrCreate(["stats"]);
3426
3300
  const ws1 = await actor1.websocket();
@@ -3464,20 +3338,20 @@ function runRawWebSocketTests(driverTestConfig) {
3464
3338
  });
3465
3339
  ws1.send(JSON.stringify({ type: "getStats" }));
3466
3340
  const stats = await statsPromise;
3467
- expect19(stats.connectionCount).toBe(2);
3468
- expect19(stats.messageCount).toBe(4);
3341
+ expect21(stats.connectionCount).toBe(2);
3342
+ expect21(stats.messageCount).toBe(4);
3469
3343
  const actionStats = await actor1.getStats();
3470
- expect19(actionStats.connectionCount).toBe(2);
3471
- expect19(actionStats.messageCount).toBe(4);
3344
+ expect21(actionStats.connectionCount).toBe(2);
3345
+ expect21(actionStats.messageCount).toBe(4);
3472
3346
  ws1.close();
3473
3347
  ws2.close();
3474
3348
  });
3475
- test19("should handle binary data", async (c) => {
3349
+ test21("should handle binary data", async (c) => {
3476
3350
  const { client } = await setupDriverTest(c, driverTestConfig);
3477
- const actor2 = client.rawWebSocketBinaryActor.getOrCreate([
3351
+ const actor = client.rawWebSocketBinaryActor.getOrCreate([
3478
3352
  "binary"
3479
3353
  ]);
3480
- const ws = await actor2.websocket();
3354
+ const ws = await actor.websocket();
3481
3355
  if (ws.readyState !== WebSocket.OPEN) {
3482
3356
  await new Promise((resolve, reject) => {
3483
3357
  ws.addEventListener("open", () => resolve(), {
@@ -3505,7 +3379,7 @@ function runRawWebSocketTests(driverTestConfig) {
3505
3379
  const smallData = new Uint8Array([1, 2, 3, 4, 5]);
3506
3380
  ws.send(smallData);
3507
3381
  const smallReversed = await receiveBinaryMessage();
3508
- expect19(Array.from(smallReversed)).toEqual([5, 4, 3, 2, 1]);
3382
+ expect21(Array.from(smallReversed)).toEqual([5, 4, 3, 2, 1]);
3509
3383
  const largeData = new Uint8Array(1024);
3510
3384
  for (let i = 0; i < largeData.length; i++) {
3511
3385
  largeData[i] = i % 256;
@@ -3513,16 +3387,16 @@ function runRawWebSocketTests(driverTestConfig) {
3513
3387
  ws.send(largeData);
3514
3388
  const largeReversed = await receiveBinaryMessage();
3515
3389
  for (let i = 0; i < largeData.length; i++) {
3516
- expect19(largeReversed[i]).toBe(
3390
+ expect21(largeReversed[i]).toBe(
3517
3391
  largeData[largeData.length - 1 - i]
3518
3392
  );
3519
3393
  }
3520
3394
  ws.close();
3521
3395
  });
3522
- test19("should work with custom paths", async (c) => {
3396
+ test21("should work with custom paths", async (c) => {
3523
3397
  const { client } = await setupDriverTest(c, driverTestConfig);
3524
- const actor2 = client.rawWebSocketActor.getOrCreate(["paths"]);
3525
- const ws = await actor2.websocket("custom/path");
3398
+ const actor = client.rawWebSocketActor.getOrCreate(["paths"]);
3399
+ const ws = await actor.websocket("custom/path");
3526
3400
  await new Promise((resolve, reject) => {
3527
3401
  ws.addEventListener("open", () => {
3528
3402
  resolve();
@@ -3539,13 +3413,13 @@ function runRawWebSocketTests(driverTestConfig) {
3539
3413
  { once: true }
3540
3414
  );
3541
3415
  });
3542
- expect19(welcomeMessage.type).toBe("welcome");
3416
+ expect21(welcomeMessage.type).toBe("welcome");
3543
3417
  ws.close();
3544
3418
  });
3545
- test19("should handle connection close properly", async (c) => {
3419
+ test21("should handle connection close properly", async (c) => {
3546
3420
  const { client } = await setupDriverTest(c, driverTestConfig);
3547
- const actor2 = client.rawWebSocketActor.getOrCreate(["close-test"]);
3548
- const ws = await actor2.websocket();
3421
+ const actor = client.rawWebSocketActor.getOrCreate(["close-test"]);
3422
+ const ws = await actor.websocket();
3549
3423
  if (ws.readyState !== WebSocket.OPEN) {
3550
3424
  await new Promise((resolve, reject) => {
3551
3425
  ws.addEventListener("open", () => resolve(), {
@@ -3554,8 +3428,8 @@ function runRawWebSocketTests(driverTestConfig) {
3554
3428
  ws.addEventListener("close", reject);
3555
3429
  });
3556
3430
  }
3557
- const initialStats = await actor2.getStats();
3558
- expect19(initialStats.connectionCount).toBe(1);
3431
+ const initialStats = await actor.getStats();
3432
+ expect21(initialStats.connectionCount).toBe(1);
3559
3433
  const closePromise = new Promise((resolve) => {
3560
3434
  ws.addEventListener("close", () => resolve(), { once: true });
3561
3435
  });
@@ -3563,20 +3437,20 @@ function runRawWebSocketTests(driverTestConfig) {
3563
3437
  await closePromise;
3564
3438
  let finalStats;
3565
3439
  for (let i = 0; i < 20; i++) {
3566
- finalStats = await actor2.getStats();
3440
+ finalStats = await actor.getStats();
3567
3441
  if (finalStats.connectionCount === 0) {
3568
3442
  break;
3569
3443
  }
3570
3444
  await new Promise((resolve) => setTimeout(resolve, 50));
3571
3445
  }
3572
- expect19(finalStats == null ? void 0 : finalStats.connectionCount).toBe(0);
3446
+ expect21(finalStats == null ? void 0 : finalStats.connectionCount).toBe(0);
3573
3447
  });
3574
- test19("should properly handle onWebSocket open and close events", async (c) => {
3448
+ test21("should properly handle onWebSocket open and close events", async (c) => {
3575
3449
  const { client } = await setupDriverTest(c, driverTestConfig);
3576
- const actor2 = client.rawWebSocketActor.getOrCreate([
3450
+ const actor = client.rawWebSocketActor.getOrCreate([
3577
3451
  "open-close-test"
3578
3452
  ]);
3579
- const ws1 = await actor2.websocket();
3453
+ const ws1 = await actor.websocket();
3580
3454
  await new Promise((resolve, reject) => {
3581
3455
  ws1.addEventListener("open", () => resolve(), { once: true });
3582
3456
  ws1.addEventListener("close", reject);
@@ -3591,9 +3465,9 @@ function runRawWebSocketTests(driverTestConfig) {
3591
3465
  );
3592
3466
  ws1.addEventListener("close", reject);
3593
3467
  });
3594
- expect19(welcome1.type).toBe("welcome");
3595
- expect19(welcome1.connectionCount).toBe(1);
3596
- const ws2 = await actor2.websocket();
3468
+ expect21(welcome1.type).toBe("welcome");
3469
+ expect21(welcome1.connectionCount).toBe(1);
3470
+ const ws2 = await actor.websocket();
3597
3471
  await new Promise((resolve, reject) => {
3598
3472
  ws2.addEventListener("open", () => resolve(), { once: true });
3599
3473
  ws2.addEventListener("close", reject);
@@ -3608,43 +3482,43 @@ function runRawWebSocketTests(driverTestConfig) {
3608
3482
  );
3609
3483
  ws2.addEventListener("close", reject);
3610
3484
  });
3611
- expect19(welcome2.type).toBe("welcome");
3612
- expect19(welcome2.connectionCount).toBe(2);
3613
- const midStats = await actor2.getStats();
3614
- expect19(midStats.connectionCount).toBe(2);
3485
+ expect21(welcome2.type).toBe("welcome");
3486
+ expect21(welcome2.connectionCount).toBe(2);
3487
+ const midStats = await actor.getStats();
3488
+ expect21(midStats.connectionCount).toBe(2);
3615
3489
  ws1.close();
3616
3490
  await new Promise((resolve) => {
3617
3491
  ws1.addEventListener("close", () => resolve(), { once: true });
3618
3492
  });
3619
3493
  let afterFirstClose;
3620
3494
  for (let i = 0; i < 20; i++) {
3621
- afterFirstClose = await actor2.getStats();
3495
+ afterFirstClose = await actor.getStats();
3622
3496
  if (afterFirstClose.connectionCount === 1) {
3623
3497
  break;
3624
3498
  }
3625
3499
  await new Promise((resolve) => setTimeout(resolve, 50));
3626
3500
  }
3627
- expect19(afterFirstClose == null ? void 0 : afterFirstClose.connectionCount).toBe(1);
3501
+ expect21(afterFirstClose == null ? void 0 : afterFirstClose.connectionCount).toBe(1);
3628
3502
  ws2.close();
3629
3503
  await new Promise((resolve) => {
3630
3504
  ws2.addEventListener("close", () => resolve(), { once: true });
3631
3505
  });
3632
3506
  let finalStats;
3633
3507
  for (let i = 0; i < 20; i++) {
3634
- finalStats = await actor2.getStats();
3508
+ finalStats = await actor.getStats();
3635
3509
  if (finalStats.connectionCount === 0) {
3636
3510
  break;
3637
3511
  }
3638
3512
  await new Promise((resolve) => setTimeout(resolve, 50));
3639
3513
  }
3640
- expect19(finalStats == null ? void 0 : finalStats.connectionCount).toBe(0);
3514
+ expect21(finalStats == null ? void 0 : finalStats.connectionCount).toBe(0);
3641
3515
  });
3642
- test19("should handle query parameters in websocket paths", async (c) => {
3516
+ test21("should handle query parameters in websocket paths", async (c) => {
3643
3517
  const { client } = await setupDriverTest(c, driverTestConfig);
3644
- const actor2 = client.rawWebSocketActor.getOrCreate([
3518
+ const actor = client.rawWebSocketActor.getOrCreate([
3645
3519
  "query-params"
3646
3520
  ]);
3647
- const ws = await actor2.websocket(
3521
+ const ws = await actor.websocket(
3648
3522
  "api/v1/stream?token=abc123&user=test"
3649
3523
  );
3650
3524
  await new Promise((resolve, reject) => {
@@ -3662,17 +3536,17 @@ function runRawWebSocketTests(driverTestConfig) {
3662
3536
  });
3663
3537
  ws.send(JSON.stringify({ type: "getRequestInfo" }));
3664
3538
  const requestInfo = await requestInfoPromise;
3665
- expect19(requestInfo.url).toContain("api/v1/stream");
3666
- expect19(requestInfo.url).toContain("token=abc123");
3667
- expect19(requestInfo.url).toContain("user=test");
3539
+ expect21(requestInfo.url).toContain("api/v1/stream");
3540
+ expect21(requestInfo.url).toContain("token=abc123");
3541
+ expect21(requestInfo.url).toContain("user=test");
3668
3542
  ws.close();
3669
3543
  });
3670
- test19("should handle query parameters on base websocket path (no subpath)", async (c) => {
3544
+ test21("should handle query parameters on base websocket path (no subpath)", async (c) => {
3671
3545
  const { client } = await setupDriverTest(c, driverTestConfig);
3672
- const actor2 = client.rawWebSocketActor.getOrCreate([
3546
+ const actor = client.rawWebSocketActor.getOrCreate([
3673
3547
  "base-path-query-params"
3674
3548
  ]);
3675
- const ws = await actor2.websocket("?token=secret&session=123");
3549
+ const ws = await actor.websocket("?token=secret&session=123");
3676
3550
  await new Promise((resolve, reject) => {
3677
3551
  ws.addEventListener("open", () => resolve(), { once: true });
3678
3552
  ws.addEventListener("error", reject);
@@ -3691,18 +3565,18 @@ function runRawWebSocketTests(driverTestConfig) {
3691
3565
  });
3692
3566
  ws.send(JSON.stringify({ type: "getRequestInfo" }));
3693
3567
  const requestInfo = await requestInfoPromise;
3694
- expect19(requestInfo.url).toContain("token=secret");
3695
- expect19(requestInfo.url).toContain("session=123");
3568
+ expect21(requestInfo.url).toContain("token=secret");
3569
+ expect21(requestInfo.url).toContain("session=123");
3696
3570
  ws.close();
3697
3571
  });
3698
3572
  });
3699
3573
  }
3700
3574
 
3701
3575
  // src/driver-test-suite/tests/request-access.ts
3702
- import { describe as describe22, expect as expect20, test as test20 } from "vitest";
3576
+ import { describe as describe24, expect as expect22, test as test22 } from "vitest";
3703
3577
  function runRequestAccessTests(driverTestConfig) {
3704
- describe22("Request Access in Lifecycle Hooks", () => {
3705
- test20("should have access to request object in onBeforeConnect and createConnState", async (c) => {
3578
+ describe24("Request Access in Lifecycle Hooks", () => {
3579
+ test22("should have access to request object in onBeforeConnect and createConnState", async (c) => {
3706
3580
  const { client } = await setupDriverTest(c, driverTestConfig);
3707
3581
  const handle = client.requestAccessActor.getOrCreate(
3708
3582
  ["test-request"],
@@ -3713,23 +3587,23 @@ function runRequestAccessTests(driverTestConfig) {
3713
3587
  const connection = handle.connect();
3714
3588
  const requestInfo = await connection.getRequestInfo();
3715
3589
  if (driverTestConfig.clientType === "http") {
3716
- expect20(requestInfo.onBeforeConnect.hasRequest).toBe(true);
3717
- expect20(requestInfo.onBeforeConnect.requestUrl).toBeDefined();
3718
- expect20(requestInfo.onBeforeConnect.requestMethod).toBeDefined();
3719
- expect20(
3590
+ expect22(requestInfo.onBeforeConnect.hasRequest).toBe(true);
3591
+ expect22(requestInfo.onBeforeConnect.requestUrl).toBeDefined();
3592
+ expect22(requestInfo.onBeforeConnect.requestMethod).toBeDefined();
3593
+ expect22(
3720
3594
  requestInfo.onBeforeConnect.requestHeaders
3721
3595
  ).toBeDefined();
3722
- expect20(requestInfo.createConnState.hasRequest).toBe(true);
3723
- expect20(requestInfo.createConnState.requestUrl).toBeDefined();
3724
- expect20(requestInfo.createConnState.requestMethod).toBeDefined();
3725
- expect20(
3596
+ expect22(requestInfo.createConnState.hasRequest).toBe(true);
3597
+ expect22(requestInfo.createConnState.requestUrl).toBeDefined();
3598
+ expect22(requestInfo.createConnState.requestMethod).toBeDefined();
3599
+ expect22(
3726
3600
  requestInfo.createConnState.requestHeaders
3727
3601
  ).toBeDefined();
3728
3602
  } else {
3729
3603
  }
3730
3604
  await connection.dispose();
3731
3605
  });
3732
- test20("should not have request when trackRequest is false", async (c) => {
3606
+ test22("should not have request when trackRequest is false", async (c) => {
3733
3607
  const { client } = await setupDriverTest(c, driverTestConfig);
3734
3608
  const handle = client.requestAccessActor.getOrCreate(
3735
3609
  ["test-no-request"],
@@ -3739,21 +3613,21 @@ function runRequestAccessTests(driverTestConfig) {
3739
3613
  );
3740
3614
  const connection = handle.connect();
3741
3615
  const requestInfo = await connection.getRequestInfo();
3742
- expect20(requestInfo.onBeforeConnect.hasRequest).toBe(false);
3743
- expect20(requestInfo.onBeforeConnect.requestUrl).toBeNull();
3744
- expect20(requestInfo.onBeforeConnect.requestMethod).toBeNull();
3745
- expect20(
3616
+ expect22(requestInfo.onBeforeConnect.hasRequest).toBe(false);
3617
+ expect22(requestInfo.onBeforeConnect.requestUrl).toBeNull();
3618
+ expect22(requestInfo.onBeforeConnect.requestMethod).toBeNull();
3619
+ expect22(
3746
3620
  Object.keys(requestInfo.onBeforeConnect.requestHeaders)
3747
3621
  ).toHaveLength(0);
3748
- expect20(requestInfo.createConnState.hasRequest).toBe(false);
3749
- expect20(requestInfo.createConnState.requestUrl).toBeNull();
3750
- expect20(requestInfo.createConnState.requestMethod).toBeNull();
3751
- expect20(
3622
+ expect22(requestInfo.createConnState.hasRequest).toBe(false);
3623
+ expect22(requestInfo.createConnState.requestUrl).toBeNull();
3624
+ expect22(requestInfo.createConnState.requestMethod).toBeNull();
3625
+ expect22(
3752
3626
  Object.keys(requestInfo.createConnState.requestHeaders)
3753
3627
  ).toHaveLength(0);
3754
3628
  await connection.dispose();
3755
3629
  });
3756
- test20("should capture request headers and method", async (c) => {
3630
+ test22("should capture request headers and method", async (c) => {
3757
3631
  const { client } = await setupDriverTest(c, driverTestConfig);
3758
3632
  const handle = client.requestAccessActor.getOrCreate(
3759
3633
  ["test-headers"],
@@ -3764,18 +3638,18 @@ function runRequestAccessTests(driverTestConfig) {
3764
3638
  const connection = handle.connect();
3765
3639
  const requestInfo = await connection.getRequestInfo();
3766
3640
  if (driverTestConfig.clientType === "http") {
3767
- expect20(requestInfo.onBeforeConnect.hasRequest).toBe(true);
3768
- expect20(requestInfo.onBeforeConnect.requestMethod).toBeTruthy();
3769
- expect20(requestInfo.onBeforeConnect.requestUrl).toBeTruthy();
3770
- expect20(requestInfo.onBeforeConnect.requestHeaders).toBeTruthy();
3771
- expect20(typeof requestInfo.onBeforeConnect.requestHeaders).toBe(
3641
+ expect22(requestInfo.onBeforeConnect.hasRequest).toBe(true);
3642
+ expect22(requestInfo.onBeforeConnect.requestMethod).toBeTruthy();
3643
+ expect22(requestInfo.onBeforeConnect.requestUrl).toBeTruthy();
3644
+ expect22(requestInfo.onBeforeConnect.requestHeaders).toBeTruthy();
3645
+ expect22(typeof requestInfo.onBeforeConnect.requestHeaders).toBe(
3772
3646
  "object"
3773
3647
  );
3774
- expect20(requestInfo.createConnState.hasRequest).toBe(true);
3775
- expect20(requestInfo.createConnState.requestMethod).toBeTruthy();
3776
- expect20(requestInfo.createConnState.requestUrl).toBeTruthy();
3777
- expect20(requestInfo.createConnState.requestHeaders).toBeTruthy();
3778
- expect20(typeof requestInfo.createConnState.requestHeaders).toBe(
3648
+ expect22(requestInfo.createConnState.hasRequest).toBe(true);
3649
+ expect22(requestInfo.createConnState.requestMethod).toBeTruthy();
3650
+ expect22(requestInfo.createConnState.requestUrl).toBeTruthy();
3651
+ expect22(requestInfo.createConnState.requestHeaders).toBeTruthy();
3652
+ expect22(typeof requestInfo.createConnState.requestHeaders).toBe(
3779
3653
  "object"
3780
3654
  );
3781
3655
  } else {
@@ -3790,10 +3664,10 @@ function runDriverTests(driverTestConfigPartial) {
3790
3664
  var _a;
3791
3665
  const clientTypes = ((_a = driverTestConfigPartial.skip) == null ? void 0 : _a.inline) ? ["http"] : ["http", "inline"];
3792
3666
  for (const clientType of clientTypes) {
3793
- describe23(`client type (${clientType})`, () => {
3667
+ describe25(`client type (${clientType})`, () => {
3794
3668
  const encodings = ["bare", "cbor", "json"];
3795
3669
  for (const encoding of encodings) {
3796
- describe23(`encoding (${encoding})`, () => {
3670
+ describe25(`encoding (${encoding})`, () => {
3797
3671
  const driverTestConfig = {
3798
3672
  ...driverTestConfigPartial,
3799
3673
  clientType,
@@ -3804,6 +3678,7 @@ function runDriverTests(driverTestConfigPartial) {
3804
3678
  runActorConnTests(driverTestConfig);
3805
3679
  runActorConnStateTests(driverTestConfig);
3806
3680
  runActorConnHibernationTests(driverTestConfig);
3681
+ runConnErrorSerializationTests(driverTestConfig);
3807
3682
  runActorDestroyTests(driverTestConfig);
3808
3683
  runRequestAccessTests(driverTestConfig);
3809
3684
  runActorHandleTests(driverTestConfig);