@iterativeflow/conformance 2.0.0-alpha.4 → 2.0.0-alpha.5

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 (2) hide show
  1. package/dist/index.mjs +31 -0
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1275,6 +1275,37 @@ const signalConformance = (label, makeBackend) => {
1275
1275
  expect(after?.signals.map((s) => s.name)).toEqual(["b"]);
1276
1276
  expect(after?.steps.get("wait")?.result).toBe("first");
1277
1277
  });
1278
+ it("requireVersion commits while the job version is unchanged, refuses once a racing signal moves it", async () => {
1279
+ const { store, queue } = await makeBackend();
1280
+ const { runId } = await store.startRun({
1281
+ name: "f",
1282
+ version: 1,
1283
+ input: {}
1284
+ });
1285
+ await queue.enqueue(runId);
1286
+ const [lease] = await queue.claim({
1287
+ limit: 1,
1288
+ leaseMs: 1e3,
1289
+ now: at(0)
1290
+ });
1291
+ expect((await store.checkpointStep({
1292
+ runId,
1293
+ cursorKey: "res",
1294
+ status: "ok",
1295
+ result: { received: false },
1296
+ attempts: 1
1297
+ }, { requireVersion: lease.version })).committed).not.toBe(false);
1298
+ expect((await store.loadRun(runId))?.steps.get("res")?.result).toEqual({ received: false });
1299
+ await store.postSignal(runId, "go", "payload");
1300
+ expect((await store.checkpointStep({
1301
+ runId,
1302
+ cursorKey: "res2",
1303
+ status: "ok",
1304
+ result: { received: false },
1305
+ attempts: 1
1306
+ }, { requireVersion: lease.version })).committed).toBe(false);
1307
+ expect((await store.loadRun(runId))?.steps.get("res2")).toBeUndefined();
1308
+ });
1278
1309
  it("distinct signals to a run preserve delivery order in the inbox", async () => {
1279
1310
  const { store } = await makeBackend();
1280
1311
  const { runId } = await store.startRun({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iterativeflow/conformance",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "build": "tsdown"
29
29
  },
30
30
  "dependencies": {
31
- "@iterativeflow/core": "2.0.0-alpha.4"
31
+ "@iterativeflow/core": "2.0.0-alpha.5"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "vitest": ">=3"