@cosmicdrift/kumiko-framework 0.199.0 → 0.199.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.199.0",
3
+ "version": "0.199.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>",
@@ -186,7 +186,7 @@
186
186
  "./package.json": "./package.json"
187
187
  },
188
188
  "dependencies": {
189
- "@cosmicdrift/kumiko-types": "0.199.0",
189
+ "@cosmicdrift/kumiko-types": "0.199.1",
190
190
  "bullmq": "^5.76.7",
191
191
  "bun-types": "^1.3.13",
192
192
  "hono": "^4.13.1",
@@ -202,7 +202,7 @@
202
202
  "zod": "^4.4.3"
203
203
  },
204
204
  "devDependencies": {
205
- "@cosmicdrift/kumiko-dispatcher-live": "0.199.0",
205
+ "@cosmicdrift/kumiko-dispatcher-live": "0.199.1",
206
206
  "bun-types": "^1.3.13",
207
207
  "pino-pretty": "^13.1.3"
208
208
  },
@@ -40,6 +40,14 @@ describe("rebuildTablesFromDiff", () => {
40
40
  expect(rebuildTablesFromDiff(diff)).toEqual(["read_b"]);
41
41
  });
42
42
 
43
+ test("managed new _bidx column → rebuild (blind index needs plaintext HMAC, SQL can't backfill)", () => {
44
+ const prev = snapshotFromMetas([meta("read_a")]);
45
+ const next = snapshotFromMetas([
46
+ meta("read_a", { name: "invited_by_bidx", pgType: "text", notNull: false }),
47
+ ]);
48
+ expect(rebuildTablesFromDiff(diffSnapshots(prev, next))).toEqual(["read_a"]);
49
+ });
50
+
43
51
  test("no schema change → empty", () => {
44
52
  const snap = snapshotFromMetas([meta("read_a")]);
45
53
  expect(rebuildTablesFromDiff(diffSnapshots(snap, snap))).toEqual([]);
@@ -49,11 +49,19 @@ function markerPathFor(migrationsDir: string, migrationId: string): string {
49
49
  // If a NEW additive column genuinely needs value-backfill from historical events
50
50
  // (a column DERIVED from existing event fields), opt in explicitly by hand-adding
51
51
  // a `NNNN_<name>.rebuild.json` next to the migration (readRebuildMarker reads it).
52
+ //
53
+ // One built-in exception to the additive-column rule: a new `_bidx` column
54
+ // (blind-index for a field that just became `lookupable: true`, naming
55
+ // convention `${snake}_bidx` from entity-table-meta.ts:111) is always
56
+ // additive SQL-wise but still needs a rebuild — the index is an HMAC over
57
+ // the decrypted value, which SQL cannot backfill.
52
58
  export function rebuildTablesFromDiff(diff: SchemaDiff): readonly string[] {
53
59
  const names = new Set<string>();
54
60
  for (const t of diff.changedTables) {
55
61
  if (t.nextMeta.source !== "managed") continue;
56
- if (managedChangeRequiresRecreate(t)) names.add(t.tableName);
62
+ if (managedChangeRequiresRecreate(t) || t.newColumns.some((c) => c.name.endsWith("_bidx"))) {
63
+ names.add(t.tableName);
64
+ }
57
65
  }
58
66
  for (const t of diff.newTables) {
59
67
  if (t.source === "managed") names.add(t.tableName);