@rulvar/store-conformance 1.252.0 → 1.253.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.
Files changed (2) hide show
  1. package/dist/index.js +76 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -475,6 +475,7 @@ function journalStoreConformance(mk) {
475
475
  maxRatesAgeDays: 30,
476
476
  allowUnpriced: ["local:llama"]
477
477
  },
478
+ clampTurnToExposure: true,
478
479
  segments: 3,
479
480
  argsProvided: true,
480
481
  argsHash: "a".repeat(64),
@@ -497,6 +498,7 @@ function journalStoreConformance(mk) {
497
498
  ensure(roundTripped?.scope?.tenant === "acme" && roundTripped.scope.account === "prod-billing" && roundTripped.scope.project === "audit", "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (scope)");
498
499
  ensure(roundTripped?.scopeNormalize?.version === 1 && roundTripped.scopeNormalize.fields.tenant?.length === 2 && roundTripped.scopeNormalize.fields.tenant[0] === "trim" && roundTripped.scopeNormalize.fields.tenant[1] === "lowercase", "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (scopeNormalize)");
499
500
  ensure(roundTripped?.strictPricing?.maxRatesAgeDays === 30 && roundTripped.strictPricing.allowUnpriced?.[0] === "local:llama", "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (strictPricing)");
501
+ ensure(roundTripped?.clampTurnToExposure === true, "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (clampTurnToExposure)");
500
502
  ensure(roundTripped?.segments === 3, "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (segments)");
501
503
  ensure(roundTripped?.argsProvided === true && roundTripped.argsHash === "a".repeat(64), "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (argsProvided, argsHash)");
502
504
  ensure(roundTripped?.genesis === "g".repeat(26), "meta-separation", "putMeta/listRuns must round-trip optional RunMeta fields (genesis)");
@@ -1124,7 +1126,7 @@ function effectLaneStoreConformance(factory) {
1124
1126
  //#region src/admission-matrix.ts
1125
1127
  /**
1126
1128
  * The durable admission conformance matrix (plan 45, rfcs/admission.md
1127
- * section 7): all twelve rows as named executable checks over a
1129
+ * section 7): all thirteen rows as named executable checks over a
1128
1130
  * scheduler factory, so a deployment proves ITS durable admission
1129
1131
  * behaves like the reference. The fairness rows measure GRANTED RAW
1130
1132
  * SERVICE, which is what the algorithm actually guarantees; wait times
@@ -1316,20 +1318,30 @@ function admissionConformance(options) {
1316
1318
  },
1317
1319
  {
1318
1320
  id: "admission.crash.granted-lease-expiry-settles-conservatively",
1319
- title: "expiry refunds reservation minus the fenced cover; a late settlement lands as debt",
1321
+ title: "expiry refunds reservation minus the fenced cover and parks the slot; a late settlement lands as debt and returns it",
1320
1322
  async run() {
1321
1323
  const now = { ms: 0 };
1322
1324
  const fixture = await options.make({
1323
- levels: { tenant: {
1324
- algorithm: "sliding-window",
1325
- capWires: 4,
1326
- windowMs: 36e5
1327
- } },
1325
+ levels: {
1326
+ tenant: {
1327
+ algorithm: "sliding-window",
1328
+ capWires: 4,
1329
+ windowMs: 36e5
1330
+ },
1331
+ providerAccount: {
1332
+ algorithm: "sliding-window",
1333
+ capWires: 100,
1334
+ concurrency: 1
1335
+ }
1336
+ },
1328
1337
  leaseTtlMs: 3e4
1329
1338
  }, () => now.ms);
1330
1339
  await fixture.scheduler.enqueue(request("holder", {
1331
1340
  reservation: { wires: 4 },
1332
- scope: { tenant: "acme" }
1341
+ scope: {
1342
+ tenant: "acme",
1343
+ providerAccount: "acct-h"
1344
+ }
1333
1345
  }), "op-h");
1334
1346
  await fixture.scheduler.checkpointCover("holder", "g1", { wires: 2 }, "op-c");
1335
1347
  now.ms = 31e3;
@@ -1341,16 +1353,32 @@ function admissionConformance(options) {
1341
1353
  fenced = true;
1342
1354
  }
1343
1355
  ensure(fenced, "admission.crash.5", "the expired lease cover write is fenced off");
1356
+ ensure((await fixture.scheduler.enqueue(request("slot-waiter", {
1357
+ reservation: { wires: 1 },
1358
+ scope: {
1359
+ tenant: "acme",
1360
+ providerAccount: "acct-h"
1361
+ }
1362
+ }), "op-slot")).state === "queued", "admission.crash.5", "the expired slot is parked, never handed out under the holder");
1344
1363
  ensure((await fixture.scheduler.enqueue(request("two", {
1345
1364
  reservation: { wires: 2 },
1346
- scope: { tenant: "acme" }
1365
+ scope: {
1366
+ tenant: "acme",
1367
+ providerAccount: "acct-f1"
1368
+ }
1347
1369
  }), "op-2")).state === "granted", "admission.crash.5", "the provable refund admits");
1348
1370
  ensure((await fixture.scheduler.enqueue(request("probe", {
1349
1371
  reservation: { wires: 1 },
1350
- scope: { tenant: "acme" }
1372
+ scope: {
1373
+ tenant: "acme",
1374
+ providerAccount: "acct-f2"
1375
+ }
1351
1376
  }), "op-probe")).state === "queued", "admission.crash.5", "the refund was exactly the uncovered half, never a blind full refund");
1352
1377
  await fixture.scheduler.release("holder", "g1", { wires: 3 }, "op-late");
1353
1378
  await fixture.scheduler.release("holder", "g1", { wires: 3 }, "op-late");
1379
+ await fixture.scheduler.release("two", "g1", { wires: 0 }, "op-two-done");
1380
+ const seated = await fixture.scheduler.pump("op-seat");
1381
+ ensure(seated.length === 1 && seated[0]?.unitId === "slot-waiter", "admission.crash.5", "the parked slot returned through the holder late settlement");
1354
1382
  await fixture.close?.();
1355
1383
  }
1356
1384
  },
@@ -1576,6 +1604,44 @@ function admissionConformance(options) {
1576
1604
  }), "op-u2")).state === "queued", "admission.tenant.12", "the SAME identity debits the SAME bucket, whatever the project");
1577
1605
  await fixture.close?.();
1578
1606
  }
1607
+ },
1608
+ {
1609
+ id: "admission.concurrency.any-level-semaphore",
1610
+ title: "a tenant level concurrency caps active runs across provider accounts; an expired slot parks until its holder settles or an operator cancels",
1611
+ async run() {
1612
+ const now = { ms: 0 };
1613
+ const fixture = await options.make({
1614
+ levels: { tenant: {
1615
+ algorithm: "sliding-window",
1616
+ capWires: 100,
1617
+ concurrency: 1
1618
+ } },
1619
+ leaseTtlMs: 3e4
1620
+ }, () => now.ms);
1621
+ ensure((await fixture.scheduler.enqueue(request("a", { scope: {
1622
+ tenant: "acme",
1623
+ providerAccount: "acct-1"
1624
+ } }), "op-a")).state === "granted", "admission.concurrency.13", "a holds the tenant slot");
1625
+ ensure((await fixture.scheduler.enqueue(request("b", { scope: {
1626
+ tenant: "acme",
1627
+ providerAccount: "acct-2"
1628
+ } }), "op-b")).state === "queued", "admission.concurrency.13", "b queues on the TENANT semaphore: wires are plentiful and the account differs");
1629
+ ensure((await fixture.scheduler.enqueue(request("c", {
1630
+ resolvedTenant: "globex",
1631
+ scope: {
1632
+ tenant: "globex",
1633
+ providerAccount: "acct-1"
1634
+ }
1635
+ }), "op-c")).state === "granted", "admission.concurrency.13", "another tenant holds its own slot");
1636
+ now.ms = 31e3;
1637
+ const successor = await fixture.reopen();
1638
+ await successor.pump("op-expire");
1639
+ ensure((await successor.recover("a", "g1", "op-ra")).state === "unknown", "admission.concurrency.13", "the holder expired");
1640
+ ensure((await successor.pump("op-p1")).length === 0, "admission.concurrency.13", "the expired slot is parked, never handed out under a possibly live holder");
1641
+ await successor.cancel("a", "g1", "op-operator");
1642
+ ensure((await successor.pump("op-p2")).some((ticket) => ticket.unitId === "b"), "admission.concurrency.13", "the operator cancel by identity returns the parked slot");
1643
+ await fixture.close?.();
1644
+ }
1579
1645
  }
1580
1646
  ]);
1581
1647
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/store-conformance",
3
- "version": "1.252.0",
3
+ "version": "1.253.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.252.0"
25
+ "@rulvar/core": "1.253.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.20.1",