@cosmicdrift/kumiko-framework 0.146.0 → 0.146.1

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.146.0",
3
+ "version": "0.146.1",
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>",
@@ -189,7 +189,7 @@
189
189
  "zod": "^4.4.3"
190
190
  },
191
191
  "devDependencies": {
192
- "@cosmicdrift/kumiko-dispatcher-live": "0.146.0",
192
+ "@cosmicdrift/kumiko-dispatcher-live": "0.146.1",
193
193
  "bun-types": "^1.3.13",
194
194
  "pino-pretty": "^13.1.3"
195
195
  },
@@ -0,0 +1,34 @@
1
+ // Regression test for #255-class drift: unmanagedTables must appear in
2
+ // enumerateFeatureTableSources so setupTestStack's auto-push and
3
+ // collectTableMetas see the exact same table set. Before this fix,
4
+ // unmanagedTables were only handled by collectTableMetas directly, so any
5
+ // app relying on setupTestStack's ephemeral DB (Playwright/e2e) never got
6
+ // its unmanaged tables created — e.g. the bundled "sessions" feature's
7
+ // read_user_sessions, breaking every login in an ephemeral test stack.
8
+
9
+ import { describe, expect, test } from "bun:test";
10
+ import { defineFeature } from "../../engine/define-feature";
11
+ import { defineUnmanagedTable } from "../entity-table-meta";
12
+ import { enumerateFeatureTableSources } from "../feature-table-sources";
13
+
14
+ const probeMeta = defineUnmanagedTable({
15
+ tableName: "ftst_probe",
16
+ columns: [{ name: "id", pgType: "text", notNull: true, primaryKey: true }],
17
+ });
18
+
19
+ describe("enumerateFeatureTableSources — unmanagedTables", () => {
20
+ test("includes a feature's unmanagedTable as a table source", () => {
21
+ const feature = defineFeature("probe", (r) => {
22
+ r.unmanagedTable(probeMeta, { reason: "direct-write store" });
23
+ });
24
+ const sources = enumerateFeatureTableSources(feature);
25
+ const entry = sources.find((s) => s.origin.includes("ftst_probe"));
26
+ expect(entry).toBeDefined();
27
+ expect(entry?.table).toBe(probeMeta);
28
+ });
29
+
30
+ test("a feature with no unmanagedTable contributes nothing extra", () => {
31
+ const feature = defineFeature("plain", () => {});
32
+ expect(enumerateFeatureTableSources(feature)).toEqual([]);
33
+ });
34
+ });
@@ -1,7 +1,8 @@
1
1
  // Single enumeration of every table-bearing registration on a feature
2
- // (r.projection, r.multiStreamProjection with table, r.rawTable). Consumed
3
- // by BOTH the setupTestStack auto-push and collectTableMetas — one list, so
4
- // test-DB-push and `kumiko schema generate` cannot drift apart again (#255).
2
+ // (r.projection, r.multiStreamProjection with table, r.rawTable,
3
+ // r.unmanagedTable). Consumed by BOTH the setupTestStack auto-push and
4
+ // collectTableMetas — one list, so test-DB-push and `kumiko schema generate`
5
+ // cannot drift apart again (#255).
5
6
  // A new table-bearing registrar must be added HERE, not in the consumers.
6
7
 
7
8
  import type { FeatureDefinition } from "../engine/types";
@@ -31,5 +32,11 @@ export function enumerateFeatureTableSources(
31
32
  for (const [name, raw] of Object.entries(feature.rawTables)) {
32
33
  sources.push({ table: raw.table, origin: `rawTable "${name}" (${feature.name})` });
33
34
  }
35
+ for (const entry of Object.values(feature.unmanagedTables)) {
36
+ sources.push({
37
+ table: entry.meta,
38
+ origin: `unmanagedTable "${entry.name}" (${feature.name})`,
39
+ });
40
+ }
34
41
  return sources;
35
42
  }