@cosmicdrift/kumiko-framework 0.215.1 → 0.215.3
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.215.
|
|
3
|
+
"version": "0.215.3",
|
|
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.215.
|
|
197
|
+
"@cosmicdrift/kumiko-types": "0.215.3",
|
|
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.215.
|
|
213
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.215.3",
|
|
214
214
|
"bun-types": "^1.3.13",
|
|
215
215
|
"pino-pretty": "^13.1.3"
|
|
216
216
|
},
|
|
@@ -151,6 +151,47 @@ describe("upgrade command — framework core changelog", () => {
|
|
|
151
151
|
expect(spy.errs.join("\n")).toContain("Invalid version format");
|
|
152
152
|
expect(spy.logs).toEqual([]);
|
|
153
153
|
});
|
|
154
|
+
|
|
155
|
+
test("--json installedVersion reflects the actually installed version, not an echo of --from", async () => {
|
|
156
|
+
const cwd = tmp({
|
|
157
|
+
"packages/framework/src/changes.json": CORE_ENTRY,
|
|
158
|
+
"packages/bundled-features/package.json": JSON.stringify({ version: "0.190.0" }),
|
|
159
|
+
});
|
|
160
|
+
const spy = makeSpyOutput();
|
|
161
|
+
|
|
162
|
+
const exit = await runUpgradeCli(["--from", "0.165.0", "--json"], cwd, spy.out);
|
|
163
|
+
|
|
164
|
+
expect(exit).toBe(0);
|
|
165
|
+
const result = JSON.parse(spy.logs.join("\n"));
|
|
166
|
+
expect(result.currentVersion).toBe("0.165.0");
|
|
167
|
+
expect(result.installedVersion).toBe("0.190.0");
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test("--json without --from: currentVersion and installedVersion both come from the installed package", async () => {
|
|
171
|
+
const cwd = tmp({
|
|
172
|
+
"packages/framework/src/changes.json": CORE_ENTRY,
|
|
173
|
+
"packages/bundled-features/package.json": JSON.stringify({ version: "0.190.0" }),
|
|
174
|
+
});
|
|
175
|
+
const spy = makeSpyOutput();
|
|
176
|
+
|
|
177
|
+
const exit = await runUpgradeCli(["--json"], cwd, spy.out);
|
|
178
|
+
|
|
179
|
+
expect(exit).toBe(0);
|
|
180
|
+
const result = JSON.parse(spy.logs.join("\n"));
|
|
181
|
+
expect(result.currentVersion).toBe("0.190.0");
|
|
182
|
+
expect(result.installedVersion).toBe("0.190.0");
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test("--json installedVersion is null when nothing is installed and --from is given", async () => {
|
|
186
|
+
const cwd = tmp({ "packages/framework/src/changes.json": CORE_ENTRY });
|
|
187
|
+
const spy = makeSpyOutput();
|
|
188
|
+
|
|
189
|
+
const exit = await runUpgradeCli(["--from", "0.165.0", "--json"], cwd, spy.out);
|
|
190
|
+
|
|
191
|
+
expect(exit).toBe(0);
|
|
192
|
+
const result = JSON.parse(spy.logs.join("\n"));
|
|
193
|
+
expect(result.installedVersion).toBeNull();
|
|
194
|
+
});
|
|
154
195
|
});
|
|
155
196
|
|
|
156
197
|
describe("upgrade command — enterprise package layout", () => {
|
|
@@ -44,3 +44,41 @@ export async function nullBlindIndexesForSubject(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
// Tenant-scope oracle for crypto-shredding's forget-subject (mh#349): a
|
|
49
|
+
// "user"-kind subject id is often not a real user (share-token recipient,
|
|
50
|
+
// email subscriber, ...) — those entities self-own their PII (`personal:
|
|
51
|
+
// "self"`, i.e. their own row id IS the subject) and carry a real tenant_id,
|
|
52
|
+
// unlike read_users (systemStream, tenant_id always SYSTEM_TENANT_ID). This
|
|
53
|
+
// checks whether the subject row lives in the given tenant, so a tenant-
|
|
54
|
+
// scoped DPO can still forget subjects it truly owns without needing a
|
|
55
|
+
// tenant-membership row (which only exists for real users).
|
|
56
|
+
export async function subjectRowExistsInTenant(
|
|
57
|
+
db: DbRunner,
|
|
58
|
+
features: ReadonlyMap<string, FeatureDefinition>,
|
|
59
|
+
subjectId: string,
|
|
60
|
+
tenantId: string,
|
|
61
|
+
): Promise<boolean> {
|
|
62
|
+
for (const feature of features.values()) {
|
|
63
|
+
for (const [entityName, entity] of Object.entries(feature.entities ?? {})) {
|
|
64
|
+
const hasSelfPiiField = Object.values(entity.fields).some(
|
|
65
|
+
(field) => "pii" in field && field.pii === true,
|
|
66
|
+
);
|
|
67
|
+
if (!hasSelfPiiField) continue;
|
|
68
|
+
const tableName = resolveTableName(entityName, entity, undefined);
|
|
69
|
+
try {
|
|
70
|
+
const rows = await executeRawQuery(
|
|
71
|
+
db,
|
|
72
|
+
`SELECT 1 FROM ${quoteIdent(tableName)} WHERE id = $1 AND tenant_id = $2 LIMIT 1`,
|
|
73
|
+
[subjectId, tenantId],
|
|
74
|
+
);
|
|
75
|
+
if (rows.length > 0) return true;
|
|
76
|
+
} catch {
|
|
77
|
+
// Table missing, id-type mismatch, ... — not evidence the subject is
|
|
78
|
+
// owned here. Fail-closed must come from an honest "not found" across
|
|
79
|
+
// every entity, never from a query blowing up on one of them.
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
package/src/db/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { assertExistsIn } from "./assert-exists-in";
|
|
2
|
-
export { nullBlindIndexesForSubject } from "./blind-index-cleanup";
|
|
2
|
+
export { nullBlindIndexesForSubject, subjectRowExistsInTenant } from "./blind-index-cleanup";
|
|
3
3
|
export { collectTableMetas } from "./collect-table-metas";
|
|
4
4
|
export { flattenCompoundTypes, rehydrateCompoundTypes } from "./compound-types";
|
|
5
5
|
export { seedConfigValues } from "./config-seed";
|
package/src/upgrade-cli.ts
CHANGED
|
@@ -355,7 +355,10 @@ export async function runUpgradeCli(
|
|
|
355
355
|
const verbose = getFlag(args, "verbose");
|
|
356
356
|
const fromFlag = getStringFlag(args, "from");
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
// Always resolve the actually installed version, even when --from is set,
|
|
359
|
+
// so --json can report both the filter baseline and what's really there.
|
|
360
|
+
const installedVersion = readCurrentVersion(cwd);
|
|
361
|
+
const currentVersion = fromFlag ?? installedVersion;
|
|
359
362
|
if (!currentVersion) {
|
|
360
363
|
out.err("");
|
|
361
364
|
out.err(" Could not detect Kumiko version.");
|
|
@@ -401,7 +404,7 @@ export async function runUpgradeCli(
|
|
|
401
404
|
}
|
|
402
405
|
|
|
403
406
|
if (jsonMode) {
|
|
404
|
-
out.log(JSON.stringify({ currentVersion, pending }, null, 2));
|
|
407
|
+
out.log(JSON.stringify({ currentVersion, installedVersion, pending }, null, 2));
|
|
405
408
|
return 0;
|
|
406
409
|
}
|
|
407
410
|
|