Skip to content

Commit 580cf6d

Browse files
committed
test(auth): pin the two posture-blind guard suites to single explicitly
The guard's grant-anchored grade is posture-keyed now, so a suite that leaves the tenancy inputs unset measures whatever the box exports rather than the posture its cases were written against. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019hBqDVrwbijUCoK9qsss2E
1 parent 840c16d commit 580cf6d

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

packages/plugins/plugin-auth/src/last-admin-guard.re-pricing.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,34 @@ beforeEach(() => {
102102
resetPlatformAdminEmailMemo();
103103
});
104104

105+
/**
106+
* [#11663 L5] The tenancy posture is PINNED to `single` for this whole file, and
107+
* it is pinned rather than inherited because the answer now depends on it: the
108+
* guard's grant-anchored grade is posture-keyed, so a suite that leaves
109+
* `OS_TENANCY_POSTURE` / `OS_MULTI_ORG_ENABLED` unset measures whatever the box
110+
* exports. `single` is the posture every case here was written against — the
111+
* default, and the one Choice 4A keeps the grant anchor for. The WALLED half is
112+
* covered next door in `last-admin-guard.config-anchor.test.ts`.
113+
*/
114+
const POSTURE_ENV = 'OS_TENANCY_POSTURE';
115+
const MULTI_ORG_ENV = 'OS_MULTI_ORG_ENABLED';
116+
let ambientPosture: string | undefined;
117+
let ambientMultiOrg: string | undefined;
118+
119+
beforeEach(() => {
120+
ambientPosture = process.env[POSTURE_ENV];
121+
ambientMultiOrg = process.env[MULTI_ORG_ENV];
122+
process.env[POSTURE_ENV] = 'single';
123+
delete process.env[MULTI_ORG_ENV];
124+
});
125+
105126
afterEach(async () => {
106127
if (ambient === undefined) delete process.env[ENV];
107128
else process.env[ENV] = ambient;
129+
if (ambientPosture === undefined) delete process.env[POSTURE_ENV];
130+
else process.env[POSTURE_ENV] = ambientPosture;
131+
if (ambientMultiOrg === undefined) delete process.env[MULTI_ORG_ENV];
132+
else process.env[MULTI_ORG_ENV] = ambientMultiOrg;
108133
resetPlatformAdminEmailMemo();
109134
const open = engines;
110135
engines = [];

packages/plugins/plugin-auth/src/last-admin-guard.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,32 @@ interface BootOptions {
182182

183183
let engines: ObjectQL[] = [];
184184

185+
/**
186+
* [#11663 L5] The tenancy posture is PINNED to `single` for this whole file, and
187+
* it is pinned rather than inherited because the answer now depends on it: the
188+
* guard's grant-anchored grade is posture-keyed, so a suite that leaves
189+
* `OS_TENANCY_POSTURE` / `OS_MULTI_ORG_ENABLED` unset measures whatever the box
190+
* exports. `single` is the posture every case here was written against — the
191+
* default, and the one Choice 4A keeps the grant anchor for. The WALLED half is
192+
* covered next door in `last-admin-guard.config-anchor.test.ts`.
193+
*/
194+
const POSTURE_ENV = 'OS_TENANCY_POSTURE';
195+
const MULTI_ORG_ENV = 'OS_MULTI_ORG_ENABLED';
196+
let ambientPosture: string | undefined;
197+
let ambientMultiOrg: string | undefined;
198+
199+
beforeEach(() => {
200+
ambientPosture = process.env[POSTURE_ENV];
201+
ambientMultiOrg = process.env[MULTI_ORG_ENV];
202+
process.env[POSTURE_ENV] = 'single';
203+
delete process.env[MULTI_ORG_ENV];
204+
});
205+
185206
afterEach(async () => {
207+
if (ambientPosture === undefined) delete process.env[POSTURE_ENV];
208+
else process.env[POSTURE_ENV] = ambientPosture;
209+
if (ambientMultiOrg === undefined) delete process.env[MULTI_ORG_ENV];
210+
else process.env[MULTI_ORG_ENV] = ambientMultiOrg;
186211
// `:memory:` dies with its connection; closing keeps one live database per
187212
// test from piling up in a file this size.
188213
const open = engines;

0 commit comments

Comments
 (0)