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