@rulvar/store-conformance 1.81.1 → 1.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +15 -1
- package/dist/index.js +25 -19
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -42,9 +42,23 @@ declare function journalStoreConformance(mk: StoreFactory<JournalStore>): Confor
|
|
|
42
42
|
declare function leasableStoreConformance(mk: StoreFactory<LeasableStore>, options?: {
|
|
43
43
|
/**
|
|
44
44
|
* The store's configured lease TTL, when known: enables the
|
|
45
|
-
* wall-clock expiry and renew-keeps-held checks
|
|
45
|
+
* wall-clock expiry and renew-keeps-held checks against the MAIN
|
|
46
|
+
* factory. LEGACY single-ttl pairing: the mandatory checks follow
|
|
47
|
+
* the suite's no-wall-clock convention, and a short shared ttl lets
|
|
48
|
+
* one scheduler stall expire a just-acquired lease inside them (the
|
|
49
|
+
* cycle 80 CI flake). Prefer `expiry`.
|
|
46
50
|
*/
|
|
47
51
|
ttlMs?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The wall-clock expiry check's OWN store and ttl (cycle 80): hand
|
|
54
|
+
* the mandatory checks a main factory whose ttl no realistic stall
|
|
55
|
+
* can cross, and give the expiry check its short-ttl store here.
|
|
56
|
+
* Wins over `ttlMs` when both are present.
|
|
57
|
+
*/
|
|
58
|
+
expiry?: {
|
|
59
|
+
ttlMs: number;
|
|
60
|
+
mk: StoreFactory<LeasableStore>;
|
|
61
|
+
};
|
|
48
62
|
}): ConformanceSuite;
|
|
49
63
|
//#endregion
|
|
50
64
|
//#region src/fenced-writes.d.ts
|
package/dist/index.js
CHANGED
|
@@ -703,26 +703,32 @@ function leasableStoreConformance(mk, options) {
|
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
];
|
|
706
|
-
const
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
title: "renew at ttl/3 keeps the lease held past ttl; an unrenewed lease expires",
|
|
710
|
-
async run() {
|
|
711
|
-
const store = await mk();
|
|
712
|
-
const held = await store.acquire(RUN$2, "owner-a");
|
|
713
|
-
const cadence = Math.floor(ttlMs / 3);
|
|
714
|
-
const deadline = Date.now() + Math.ceil(ttlMs * 1.5);
|
|
715
|
-
while (Date.now() < deadline) {
|
|
716
|
-
await sleep$2(cadence);
|
|
717
|
-
await store.renew(held);
|
|
718
|
-
ensure(await mustReject(() => store.acquire(RUN$2, "owner-b")) instanceof LeaseHeldError, "lease-ttl-and-renew-cadence", "a lease renewed at ttl/3 must stay held past the original ttl");
|
|
719
|
-
}
|
|
720
|
-
await store.release(held);
|
|
721
|
-
const abandoned = await store.acquire("expiring-run", "owner-a");
|
|
722
|
-
await sleep$2(Math.ceil(ttlMs * 1.2));
|
|
723
|
-
ensure((await store.acquire("expiring-run", "owner-b")).epoch > abandoned.epoch, "lease-ttl-and-renew-cadence", "reclaiming an expired lease must advance the fencing epoch");
|
|
724
|
-
}
|
|
706
|
+
const expiry = options?.expiry ?? (options?.ttlMs === void 0 ? void 0 : {
|
|
707
|
+
ttlMs: options.ttlMs,
|
|
708
|
+
mk
|
|
725
709
|
});
|
|
710
|
+
if (expiry !== void 0) {
|
|
711
|
+
const { ttlMs, mk: mkExpiry } = expiry;
|
|
712
|
+
checks.push({
|
|
713
|
+
id: "lease-ttl-and-renew-cadence",
|
|
714
|
+
title: "renew at ttl/3 keeps the lease held past ttl; an unrenewed lease expires",
|
|
715
|
+
async run() {
|
|
716
|
+
const store = await mkExpiry();
|
|
717
|
+
const held = await store.acquire(RUN$2, "owner-a");
|
|
718
|
+
const cadence = Math.floor(ttlMs / 3);
|
|
719
|
+
const deadline = Date.now() + Math.ceil(ttlMs * 1.5);
|
|
720
|
+
while (Date.now() < deadline) {
|
|
721
|
+
await sleep$2(cadence);
|
|
722
|
+
await store.renew(held);
|
|
723
|
+
ensure(await mustReject(() => store.acquire(RUN$2, "owner-b")) instanceof LeaseHeldError, "lease-ttl-and-renew-cadence", "a lease renewed at ttl/3 must stay held past the original ttl");
|
|
724
|
+
}
|
|
725
|
+
await store.release(held);
|
|
726
|
+
const abandoned = await store.acquire("expiring-run", "owner-a");
|
|
727
|
+
await sleep$2(Math.ceil(ttlMs * 1.2));
|
|
728
|
+
ensure((await store.acquire("expiring-run", "owner-b")).epoch > abandoned.epoch, "lease-ttl-and-renew-cadence", "reclaiming an expired lease must advance the fencing epoch");
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}
|
|
726
732
|
return makeSuite("leasableStoreConformance", checks);
|
|
727
733
|
}
|
|
728
734
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/store-conformance",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.82.0",
|
|
4
4
|
"description": "Rulvar executable store conformance kit (DEF-4).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/core": "1.
|
|
25
|
+
"@rulvar/core": "1.82.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.0",
|