Skip to content

Commit 9852ed8

Browse files
committed
test(plugin-security): the identity row-scope sweeps run one case per object
The restored-copies sweep read every persona x object pair on two real stacks inside one case: about 400 finds against vitest's 5000ms default. On a loaded runner that single case crossed the default on main as on any branch (24 busy loops on 4 cores: 5.7-7.9s on main and on this branch). Both sweeps now run one case per object, each over the full persona list, with the same reads and the same verdicts. No case carries more than 18 reads; under the same load the slowest case is 463ms, and a failure names its object. No timeout is raised. Claude-Session: https://claude.ai/code/session_01E1oXN1ZJ8NnZKKhzWeCZ6q Co-authored-by: Claude <noreply@anthropic.com>
1 parent 11c1e9f commit 9852ed8

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎packages/plugins/plugin-security/src/objects/shipped-sets-identity-default-row-scope.test.ts‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,26 +380,27 @@ describe.each(SHAPES)('the shipped sets serve the identity objects as before —
380380
restored = await boot(shape, withCopiesRestored(await registeredObjects()));
381381
});
382382

383-
it('every persona is served exactly the listed ids on every touched object', async () => {
383+
// One case per object, not one sweep over all of them: the restored-copies
384+
// sweep was about 400 real-stack reads in a single case, which a loaded
385+
// runner pushed past the 5000ms default on `main` as on any branch (#26065).
386+
// Per object it is one persona column: the same reads and the same verdicts,
387+
// each case a few dozen of them, and a failure names its object.
388+
it.each(TOUCHED)('every persona is served exactly the listed ids on %s', async (object) => {
384389
const wrong: string[] = [];
385390
for (const persona of shape.personas) {
386-
for (const object of TOUCHED) {
387-
const now = await shipped.served(object, PERSONAS[persona]);
388-
const want = expectedServed(shape, persona, object);
389-
if (JSON.stringify(now) !== JSON.stringify(want)) wrong.push(`${persona} on ${object}: ${JSON.stringify(now)} (expected ${JSON.stringify(want)})`);
390-
}
391+
const now = await shipped.served(object, PERSONAS[persona]);
392+
const want = expectedServed(shape, persona, object);
393+
if (JSON.stringify(now) !== JSON.stringify(want)) wrong.push(`${persona} on ${object}: ${JSON.stringify(now)} (expected ${JSON.stringify(want)})`);
391394
}
392395
expect(wrong).toEqual([]);
393396
});
394397

395-
it('…and exactly what the same deployment serves with the dropped copies spread back into the sets', async () => {
398+
it.each([...TOUCHED, ...KEPT_ALL, 'sys_user'])('…and exactly what the same deployment serves on %s with the dropped copies spread back into the sets', async (object) => {
396399
const moved: string[] = [];
397400
for (const persona of shape.personas) {
398-
for (const object of [...TOUCHED, ...KEPT_ALL, 'sys_user']) {
399-
const was = await restored.served(object, PERSONAS[persona]);
400-
const now = await shipped.served(object, PERSONAS[persona]);
401-
if (JSON.stringify(now) !== JSON.stringify(was)) moved.push(`${persona} on ${object}: ${JSON.stringify(was)} -> ${JSON.stringify(now)}`);
402-
}
401+
const was = await restored.served(object, PERSONAS[persona]);
402+
const now = await shipped.served(object, PERSONAS[persona]);
403+
if (JSON.stringify(now) !== JSON.stringify(was)) moved.push(`${persona} on ${object}: ${JSON.stringify(was)} -> ${JSON.stringify(now)}`);
403404
}
404405
expect(moved).toEqual([]);
405406
});

0 commit comments

Comments
 (0)