@cosmicdrift/kumiko-framework 0.217.0 → 0.218.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-framework",
3
- "version": "0.217.0",
3
+ "version": "0.218.0",
4
4
  "description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -194,7 +194,7 @@
194
194
  "./package.json": "./package.json"
195
195
  },
196
196
  "dependencies": {
197
- "@cosmicdrift/kumiko-types": "0.217.0",
197
+ "@cosmicdrift/kumiko-types": "0.218.0",
198
198
  "bullmq": "^5.76.7",
199
199
  "bun-types": "^1.3.13",
200
200
  "hono": "^4.13.1",
@@ -210,7 +210,7 @@
210
210
  "zod": "^4.4.3"
211
211
  },
212
212
  "devDependencies": {
213
- "@cosmicdrift/kumiko-dispatcher-live": "0.217.0",
213
+ "@cosmicdrift/kumiko-dispatcher-live": "0.218.0",
214
214
  "bun-types": "^1.3.13",
215
215
  "pino-pretty": "^13.1.3"
216
216
  },
@@ -7,7 +7,13 @@
7
7
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
8
8
  import { type BunTestDb, createTestDb } from "../../bun-db/__tests__/bun-test-db";
9
9
  import { asRawClient } from "../../db/query";
10
- import { createDateField, createEntity, createNumberField, createTextField } from "../../engine";
10
+ import {
11
+ createDateField,
12
+ createEntity,
13
+ createNumberField,
14
+ createTextField,
15
+ SYSTEM_TENANT_ID,
16
+ } from "../../engine";
11
17
  import { UnprocessableError } from "../../errors";
12
18
  import { createEventsTable } from "../../event-store";
13
19
  import { TestUsers, unsafeCreateEntityTable } from "../../stack";
@@ -499,6 +505,45 @@ describe("event-store-executor.list — runtime SearchAdapter (Tier 2.7e Audit-F
499
505
  });
500
506
  expect(res.rows).toHaveLength(0);
501
507
  });
508
+
509
+ test("system-mode list: search uses SYSTEM_TENANT_ID (not session tenant)", async () => {
510
+ const systemTdb = createTenantDb(testDb.db, admin.tenantId, "system");
511
+ let searchedTenant: string | undefined;
512
+ const mockAdapter = {
513
+ configure: async () => {},
514
+ index: async () => {},
515
+ indexBatch: async () => {},
516
+ remove: async () => {},
517
+ search: async (tenantId: string) => {
518
+ searchedTenant = tenantId;
519
+ return [];
520
+ },
521
+ reset: async () => {},
522
+ } as never;
523
+ await exec.list({ limit: 50, search: "x" }, admin, systemTdb, {
524
+ searchAdapter: mockAdapter,
525
+ });
526
+ expect(searchedTenant).toBe(SYSTEM_TENANT_ID);
527
+ });
528
+
529
+ test("tenant-mode list: search still uses session tenantId", async () => {
530
+ let searchedTenant: string | undefined;
531
+ const mockAdapter = {
532
+ configure: async () => {},
533
+ index: async () => {},
534
+ indexBatch: async () => {},
535
+ remove: async () => {},
536
+ search: async (tenantId: string) => {
537
+ searchedTenant = tenantId;
538
+ return [];
539
+ },
540
+ reset: async () => {},
541
+ } as never;
542
+ await exec.list({ limit: 50, search: "x" }, admin, tdb, {
543
+ searchAdapter: mockAdapter,
544
+ });
545
+ expect(searchedTenant).toBe(admin.tenantId);
546
+ });
502
547
  });
503
548
 
504
549
  describe("event-store-executor.list — keyset cursor mit custom sort (#2265)", () => {
@@ -138,7 +138,10 @@ export function createReadVerbs(ctx: ExecutorContext): Pick<EventStoreExecutor,
138
138
  },
139
139
  });
140
140
  }
141
- const results = await effectiveSearchAdapter.search(user.tenantId, payload.search, {
141
+ // system-mode lists (r.systemScope / cross-tenant) index under SYSTEM_TENANT_ID;
142
+ // searching the caller's session tenant misses the roster and can 500 on Meili.
143
+ const searchTenantId = db.mode === "system" ? SYSTEM_TENANT_ID : user.tenantId;
144
+ const results = await effectiveSearchAdapter.search(searchTenantId, payload.search, {
142
145
  filterType: entityName,
143
146
  });
144
147
  filterIds = results.map((r) => r.entityId);