@cosmicdrift/kumiko-server-runtime 0.310.0 → 0.312.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-server-runtime",
3
- "version": "0.310.0",
3
+ "version": "0.312.0",
4
4
  "description": "Production server-boot runtime for Kumiko apps: connections, schema-drift-gate, seeds, lifecycle, graceful shutdown. Symmetric to kumiko-dev-server's runDevApp, without dev/scaffold/codegen tooling.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -80,9 +80,9 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "@cosmicdrift/kumiko-bundled-features": "0.310.0",
84
- "@cosmicdrift/kumiko-framework": "0.310.0",
85
- "@cosmicdrift/kumiko-headless": "0.310.0",
83
+ "@cosmicdrift/kumiko-bundled-features": "0.312.0",
84
+ "@cosmicdrift/kumiko-framework": "0.312.0",
85
+ "@cosmicdrift/kumiko-headless": "0.312.0",
86
86
  "temporal-polyfill": "^0.3.2"
87
87
  },
88
88
  "publishConfig": {
@@ -994,14 +994,17 @@ describe("runProdApp: lokaler Event-Dispatcher (MSP-Anwendung im Single-Containe
994
994
  // by bun's 5s default before pollFor can give up on its own terms.
995
995
  const BOOT_AND_POLL_TIMEOUT_MS = 20_000;
996
996
 
997
- async function pollFor<T>(probe: () => Promise<T | undefined>, timeoutMs = 8000): Promise<T> {
998
- const deadline = Date.now() + timeoutMs;
999
- for (;;) {
1000
- const result = await probe();
1001
- if (result !== undefined) return result;
1002
- if (Date.now() > deadline) throw new Error("pollFor: timeout");
1003
- await new Promise((resolve) => setTimeout(resolve, 100));
1004
- }
997
+ async function pollFor<T>(probe: () => Promise<T | undefined>): Promise<T> {
998
+ let result: T | undefined;
999
+ await waitFor(
1000
+ async () => {
1001
+ result = await probe();
1002
+ return result !== undefined;
1003
+ },
1004
+ { delays: Array(80).fill(100) },
1005
+ );
1006
+ if (result === undefined) throw new Error("pollFor: timeout");
1007
+ return result;
1005
1008
  }
1006
1009
 
1007
1010
  test(
@@ -1237,11 +1240,17 @@ describe("runProdApp job-lane wiring (runSingleInstance)", () => {
1237
1240
  anonymousAccess: { defaultTenantId: TENANT_ID },
1238
1241
  });
1239
1242
 
1243
+ // Unique per test run: the L1 limiter's Redis bucket is keyed only on
1244
+ // this IP (`l1:${ip}`, globalIpRateLimit in rate-limit/middleware.ts) —
1245
+ // a fixed literal here would collide with whatever this same test's
1246
+ // last run left in a non-ephemeral local Redis, well within the 60s
1247
+ // window, and see 429 on the very first request instead of 200.
1248
+ const probeIp = `203.0.113.${crypto.randomUUID()}`;
1240
1249
  const fetchOnce = () =>
1241
1250
  handle.entrypoint.app.fetch(
1242
1251
  new Request("http://test/api/query", {
1243
1252
  method: "POST",
1244
- headers: { "content-type": "application/json", "x-forwarded-for": "203.0.113.9" },
1253
+ headers: { "content-type": "application/json", "x-forwarded-for": probeIp },
1245
1254
  body: JSON.stringify({ type: "prod-probe:query:ping", payload: {} }),
1246
1255
  }),
1247
1256
  );
@@ -23,6 +23,7 @@ import {
23
23
  createProjectionStateTable,
24
24
  } from "@cosmicdrift/kumiko-framework/pipeline";
25
25
  import { unsafeEnsureEntityTable } from "@cosmicdrift/kumiko-framework/stack";
26
+ import { waitFor } from "@cosmicdrift/kumiko-framework/testing";
26
27
  import postgres from "postgres";
27
28
  import * as z from "zod";
28
29
  import { makeDispatchSystemWrite } from "../extra-routes-deps";
@@ -127,14 +128,17 @@ async function boot(extra?: Partial<Parameters<typeof runWorkerApp>[0]>): Promis
127
128
  }
128
129
  }
129
130
 
130
- async function pollFor<T>(probe: () => T | undefined, timeoutMs = 8000): Promise<T> {
131
- const deadline = Date.now() + timeoutMs;
132
- for (;;) {
133
- const result = probe();
134
- if (result !== undefined) return result;
135
- if (Date.now() > deadline) throw new Error("pollFor: timeout");
136
- await new Promise((resolve) => setTimeout(resolve, 100));
137
- }
131
+ async function pollFor<T>(probe: () => T | undefined): Promise<T> {
132
+ let result: T | undefined;
133
+ await waitFor(
134
+ () => {
135
+ result = probe();
136
+ return result !== undefined;
137
+ },
138
+ { delays: Array(80).fill(100) },
139
+ );
140
+ if (result === undefined) throw new Error("pollFor: timeout");
141
+ return result;
138
142
  }
139
143
 
140
144
  describe("runWorkerApp", () => {