@rotorsoft/act-tck 1.36.17 → 1.36.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAQV,KAAK,EAIN,MAAM,sBAAsB,CAAC;AAc9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,OAAO,CAAC;IACpD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,eAAe,CAAC,EA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,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,YAAa,eAAe,KAAG,IAiiKtD,CAAC"}
package/dist/index.cjs CHANGED
@@ -2308,6 +2308,36 @@ var runStoreTck = (options) => {
2308
2308
  await fresh.dispose();
2309
2309
  }
2310
2310
  });
2311
+ (0, import_vitest9.it)("records the lease holder for a zero-length lease, so its ack lands", async () => {
2312
+ const fresh = await options.factory();
2313
+ try {
2314
+ await fresh.drop();
2315
+ await fresh.seed();
2316
+ const s = `lease-zero-${uid()}`;
2317
+ await fresh.subscribe([{ stream: s }]);
2318
+ const [committed] = await fresh.commit(
2319
+ s,
2320
+ [inc(1)],
2321
+ make_meta({ stream: s })
2322
+ );
2323
+ await correlate(fresh);
2324
+ const leased = await fresh.claim(1, 0, `w-${uid()}`, 0);
2325
+ const mine = leased.find((l) => l.stream === s);
2326
+ (0, import_vitest9.expect)(mine).toBeDefined();
2327
+ const acked = await fresh.ack([{ ...mine, at: committed.id }]);
2328
+ (0, import_vitest9.expect)(acked).toHaveLength(1);
2329
+ let at = -1;
2330
+ await fresh.query_streams(
2331
+ (p) => {
2332
+ at = p.at;
2333
+ },
2334
+ { stream: s, stream_exact: true }
2335
+ );
2336
+ (0, import_vitest9.expect)(at).toBe(committed.id);
2337
+ } finally {
2338
+ await fresh.dispose();
2339
+ }
2340
+ });
2311
2341
  (0, import_vitest9.it)("reports lagging=true from the lagging frontier and false from the leading frontier", async () => {
2312
2342
  const fresh = await options.factory();
2313
2343
  try {
@@ -3213,6 +3243,50 @@ var runStoreTck = (options) => {
3213
3243
  });
3214
3244
  (0, import_vitest9.expect)(seen).toEqual(["fast"]);
3215
3245
  });
3246
+ (0, import_vitest9.it)("keeps the lane when a lower-priority subscribe re-registers", async () => {
3247
+ const s = `lane-rank-${uid()}`;
3248
+ await store.subscribe([{ stream: s, lane: "fast", priority: 10 }]);
3249
+ await store.subscribe([{ stream: s, lane: "slow", priority: 0 }]);
3250
+ const seen = [];
3251
+ await store.query_streams(
3252
+ (p) => seen.push({ lane: p.lane, priority: p.priority }),
3253
+ { stream: s, stream_exact: true }
3254
+ );
3255
+ (0, import_vitest9.expect)(seen).toEqual([{ lane: "fast", priority: 10 }]);
3256
+ });
3257
+ (0, import_vitest9.it)("keeps the lane when a mark-only subscribe re-registers", async () => {
3258
+ const s = `lane-mark-${uid()}`;
3259
+ await store.subscribe([{ stream: s, lane: "fast", priority: 10 }]);
3260
+ await store.subscribe([{ stream: s, correlated_at: 7 }]);
3261
+ const seen = [];
3262
+ await store.query_streams(
3263
+ (p) => seen.push({ lane: p.lane, correlated_at: p.correlated_at }),
3264
+ { stream: s, stream_exact: true }
3265
+ );
3266
+ (0, import_vitest9.expect)(seen).toEqual([{ lane: "fast", correlated_at: 7 }]);
3267
+ });
3268
+ (0, import_vitest9.it)("re-lanes when the subscribe outranks the stored priority", async () => {
3269
+ const s = `lane-outrank-${uid()}`;
3270
+ await store.subscribe([{ stream: s, lane: "fast", priority: 0 }]);
3271
+ await store.subscribe([{ stream: s, lane: "slow", priority: 5 }]);
3272
+ const seen = [];
3273
+ await store.query_streams(
3274
+ (p) => seen.push({ lane: p.lane, priority: p.priority }),
3275
+ { stream: s, stream_exact: true }
3276
+ );
3277
+ (0, import_vitest9.expect)(seen).toEqual([{ lane: "slow", priority: 5 }]);
3278
+ });
3279
+ (0, import_vitest9.it)("re-lanes at equal priority, which is what keeps re-laning restart-driven", async () => {
3280
+ const s = `lane-equal-${uid()}`;
3281
+ await store.subscribe([{ stream: s, lane: "fast", priority: 7 }]);
3282
+ await store.subscribe([{ stream: s, lane: "slow", priority: 7 }]);
3283
+ const seen = [];
3284
+ await store.query_streams((p) => seen.push(p.lane), {
3285
+ stream: s,
3286
+ stream_exact: true
3287
+ });
3288
+ (0, import_vitest9.expect)(seen).toEqual(["slow"]);
3289
+ });
3216
3290
  (0, import_vitest9.it)("claim() filters by lane when supplied and returns lane on the Lease", async () => {
3217
3291
  const tag = uid();
3218
3292
  const src1 = `lane-claim-src1-${tag}`;
@@ -3656,6 +3730,25 @@ var runStoreTck = (options) => {
3656
3730
  }
3657
3731
  (0, import_vitest9.expect)([...visited].sort()).toEqual([...names].sort());
3658
3732
  });
3733
+ (0, import_vitest9.it)("limit: 0 returns no rows", async () => {
3734
+ const s = `qs-zero-${uid()}`;
3735
+ await store.subscribe([{ stream: s }]);
3736
+ const seen = [];
3737
+ const push = (p) => {
3738
+ seen.push(p.stream);
3739
+ };
3740
+ const filter = { stream: s, stream_exact: true };
3741
+ const control = await store.query_streams(push, filter);
3742
+ (0, import_vitest9.expect)(control.count).toBe(1);
3743
+ (0, import_vitest9.expect)(seen).toEqual([s]);
3744
+ seen.length = 0;
3745
+ const { count } = await store.query_streams(push, {
3746
+ ...filter,
3747
+ limit: 0
3748
+ });
3749
+ (0, import_vitest9.expect)(seen).toEqual([]);
3750
+ (0, import_vitest9.expect)(count).toBe(0);
3751
+ });
3659
3752
  (0, import_vitest9.it)("returns positions filtered by stream regex, exact, source, and source_exact", async () => {
3660
3753
  const tag = uid();
3661
3754
  const proj1 = `qs-${tag}-projection-tickets`;
@@ -3793,6 +3886,21 @@ var runStoreTck = (options) => {
3793
3886
  const unknown = await store.query_stats([`qst-${tag}-missing`]);
3794
3887
  (0, import_vitest9.expect)(unknown.size).toBe(0);
3795
3888
  });
3889
+ (0, import_vitest9.it)("limit: 0 returns no rows", async () => {
3890
+ const s = `qst-zero-${uid()}`;
3891
+ await store.commit(
3892
+ s,
3893
+ [inc(1)],
3894
+ make_meta({ stream: s })
3895
+ );
3896
+ const filter = { stream: s, stream_exact: true };
3897
+ const control = await store.query_stats(filter);
3898
+ (0, import_vitest9.expect)(control.size).toBe(1);
3899
+ const stats = await store.query_stats(filter, {
3900
+ limit: 0
3901
+ });
3902
+ (0, import_vitest9.expect)(stats.size).toBe(0);
3903
+ });
3796
3904
  (0, import_vitest9.it)("keyset pagination visits every stream regardless of name case (#1357)", async () => {
3797
3905
  const tag = uid();
3798
3906
  const names = [