Skip to content

Commit 49f00d1

Browse files
committed
test(dogfood): the cold-boot catalog control writes its built-in position rows the way an older release left them; the hatch no longer opens that save (ADR-0131 D6)
#22365's control saved stored definitions under two built-in position names through OS_METADATA_WRITABLE=position. The positions are shipped by the platform's own package, so the seal now refuses that save with the hatch set too. The control pins the 403 NOT_OVERRIDABLE refusal, writes the rows at the driver as the file's legacy-row case already does, and keeps its assertions: the restart boots and the stored definition answers. Claude-Session: https://claude.ai/code/session_01EUBvqtauTDmHi2ZgY759p2 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 63ea4b2 commit 49f00d1

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

‎packages/qa/dogfood/test/security-catalog-cold-boot-environment-holder.dogfood.test.ts‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
// an older release left it, and the restart is refused;
3535
// - CONTROL: stored definitions under two built-in position names — the
3636
// platform's own declaration sits beside them (ADR-0005), and the restart
37-
// boots;
37+
// boots. The save door refuses that write now, with the hatch set too
38+
// (ADR-0131 D6: managed content is sealed), so the rows are written at the
39+
// driver the way an older release left them;
3840
// - CONTROL: a package whose names the environment does not hold boots on a
3941
// database whose environment holds others, and restarts.
4042
//
@@ -115,7 +117,9 @@ describe('ADR-0048 N.3: a package-held position or permission-set name the envir
115117
});
116118

117119
// The built-in control saves under two built-in position names, which the
118-
// platform's package registers, so the save needs the documented hatch. The
120+
// platform's package registers. Before ADR-0131 D6 that save needed the
121+
// documented hatch; the hatch no longer opens an item a managed package
122+
// ships, and the control pins that it stays shut with the hatch set. The
119123
// protocol reads `OS_METADATA_WRITABLE` ONCE per process and memoises it, so
120124
// it is set for the whole file, before the first boot: set inside the one
121125
// case, a save in an earlier case would already have memoised it closed. No
@@ -204,9 +208,22 @@ describe('ADR-0048 N.3: a package-held position or permission-set name the envir
204208
const db = databaseFile();
205209
stack = await bootStack(baseApp, { databaseFile: db });
206210
const saveToken = await stack.signIn();
211+
// [ADR-0131 D6] The save door refuses the write, with the hatch set too...
207212
for (const name of ['org_admin', 'everyone']) {
208-
const saved = await stack.apiAs(saveToken, 'PUT', `/meta/position/${name}`, { name, label: `Repurposed ${name}` });
209-
expect(saved.status, JSON.stringify(await saved.clone().json().catch(() => ({})))).toBe(200);
213+
const refused = await stack.apiAs(saveToken, 'PUT', `/meta/position/${name}`, { name, label: `Repurposed ${name}` });
214+
const envelope: any = await refused.clone().json().catch(() => ({}));
215+
expect(refused.status, JSON.stringify(envelope)).toBe(403);
216+
expect(envelope?.code ?? envelope?.error?.code).toBe('NOT_OVERRIDABLE');
217+
}
218+
// ...so the rows are written the way an older release left them: active,
219+
// environment-wide, bound to no package.
220+
const ql: any = await stack.kernel.getServiceAsync('objectql');
221+
const now = new Date().toISOString();
222+
for (const name of ['org_admin', 'everyone']) {
223+
await ql.insert('sys_metadata', {
224+
type: 'position', name, organization_id: null, package_id: null, state: 'active', version: 1, checksum: null,
225+
created_at: now, updated_at: now, metadata: JSON.stringify({ name, label: `Repurposed ${name}` }),
226+
}, SYS);
210227
}
211228
await stack.stop();
212229
stack = undefined;

0 commit comments

Comments
 (0)