Skip to content

Commit e738de9

Browse files
committed
test(dogfood): the no-active-organization control expects the reinstall after a purge to withhold the purged rows in organization B
The install-local reinstall now honours the landed-key record (#34405, ruling 6929076086). The purge deletes organization B's seed rows through the engine and leaves B's sys_seed_landed_key rows in place, so the reinstall after it lands nothing and counts every row in skipped. The control now expects that, and adds the reseed after the reinstall: it brings the 28 rows back in B, and A still holds none. Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 31c96c5 commit e738de9

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

‎packages/qa/dogfood/test/install-local-no-active-organization.dogfood.test.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
// organization; the reseed and the purge answer `403 PERMISSION_DENIED`
3030
// naming it; no seed row lands in either organization (nothing guessed).
3131
// 3. The SAME session once it selects organization B: reseed, purge and a
32-
// reinstall all act in B, as they always have. One fact differs between
33-
// 2 and 3: the active organization.
32+
// reinstall all act in B, never in A. The reinstall after the purge
33+
// honours B's landed-key record (the purge deletes the rows, not the
34+
// record) and withholds every purged row; the reseed is the way back, in
35+
// B (#34405, ruling 6929076086). One fact differs between 2 and 3: the
36+
// active organization.
3437
//
3538
// Boots a walled fixture stack of its own, so it stays out of `SHARED_SHOWCASE`.
3639

@@ -96,11 +99,12 @@ describe('dogfood: install-local under an organization wall, with a session that
9699
let memberships: number;
97100
type Answer = { status: number; body: any };
98101
const orgless: Record<'install' | 'reseed' | 'purge', Answer> = {} as never;
99-
const inOrgB: Record<'reseed' | 'purge' | 'reinstall', Answer> = {} as never;
102+
const inOrgB: Record<'reseed' | 'purge' | 'reinstall' | 'reseedBack', Answer> = {} as never;
100103
let rowsAfterOrgless: number;
101104
let orgBAfterReseed: number;
102105
let orgBAfterPurge: number;
103106
let orgBAfterReinstall: number;
107+
let orgBAfterReseedBack: number;
104108
let orgAAtEnd: number;
105109

106110
async function activeOrganization(): Promise<unknown> {
@@ -147,6 +151,8 @@ describe('dogfood: install-local under an organization wall, with a session that
147151
orgBAfterPurge = await countRows(ql, ORG_B);
148152
inOrgB.reinstall = await json(await stack.apiAs(token, 'POST', BASE, installBody()));
149153
orgBAfterReinstall = await countRows(ql, ORG_B);
154+
inOrgB.reseedBack = await json(await stack.apiAs(token, 'POST', `${BASE}/${CRM}/reseed-sample-data`, {}));
155+
orgBAfterReseedBack = await countRows(ql, ORG_B);
150156
orgAAtEnd = await countRows(ql, ORG_A);
151157
}, 300_000);
152158

@@ -191,7 +197,7 @@ describe('dogfood: install-local under an organization wall, with a session that
191197
expect(rowsAfterOrgless).toBe(0);
192198
});
193199

194-
it('CONTROL: the same session with organization B active — reseed, purge and reinstall act in B, as before', () => {
200+
it('CONTROL: the same session with organization B active — reseed, purge and reinstall act in B; the reinstall withholds the purged rows and the reseed brings them back', () => {
195201
expect(sessionOrgAfter).toBe(ORG_B);
196202
expect(inOrgB.reseed.status, JSON.stringify(inOrgB.reseed.body)).toBe(200);
197203
expect(inOrgB.reseed.body?.data).toMatchObject({ inserted: SEED_TOTAL, errors: 0, withSampleData: true });
@@ -200,8 +206,13 @@ describe('dogfood: install-local under an organization wall, with a session that
200206
expect(inOrgB.purge.body?.data).toMatchObject({ deleted: SEED_TOTAL, skipped: 0, errors: 0, withSampleData: false });
201207
expect(orgBAfterPurge).toBe(0);
202208
expect(inOrgB.reinstall.status, JSON.stringify(inOrgB.reinstall.body)).toBe(200);
203-
expect(inOrgB.reinstall.body?.data?.seeded).toMatchObject({ mode: 'inline', inserted: SEED_TOTAL });
204-
expect(orgBAfterReinstall).toBe(SEED_TOTAL);
209+
// #34405, ruling 6929076086: the reinstall honours B's landed-key record, which the purge leaves in place,
210+
// so it withholds every purged row (`skipped`); the reseed is the way back.
211+
expect(inOrgB.reinstall.body?.data?.seeded).toMatchObject({ mode: 'inline', inserted: 0, skipped: SEED_TOTAL, errors: 0 });
212+
expect(orgBAfterReinstall).toBe(0);
213+
expect(inOrgB.reseedBack.status, JSON.stringify(inOrgB.reseedBack.body)).toBe(200);
214+
expect(inOrgB.reseedBack.body?.data).toMatchObject({ inserted: SEED_TOTAL, errors: 0, withSampleData: true });
215+
expect(orgBAfterReseedBack).toBe(SEED_TOTAL);
205216
expect(orgAAtEnd).toBe(0);
206217
});
207218
});

0 commit comments

Comments
 (0)