Skip to content

Commit 32048af

Browse files
committed
test(plugin-security): assert the row count before the save argument
The row count is the contract; the save argument is the mechanism, so an ablation's first red names the second row. Claude-Session: https://claude.ai/code/session_011K3zqE8Pv1Evw5hc8tZCnN Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5ecbbcd commit 32048af

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/plugins/plugin-security/src/permission-set-projection.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,9 +1136,9 @@ describe('[#21861] a data-door UPDATE writes back into the stored row it edits
11361136
};
11371137
expect(await run(makeMiddleware(ql, protocol), opCtx)).toBe(false);
11381138

1139-
expect(protocol.saves.map((s: any) => s.packageId), 'the save names the row\'s own package').toEqual([PKG]);
11401139
expect(activeRows(ql, 'support_agent'), 'after: still one row, same binding, carrying the edit')
11411140
.toEqual([{ organization_id: null, package_id: PKG, description: 'edited at the data door' }]);
1141+
expect(protocol.saves.map((s: any) => s.packageId), 'the save names the row\'s own package').toEqual([PKG]);
11421142
expect(opCtx.result?.description, 'the projected record follows').toBe('edited at the data door');
11431143
});
11441144

@@ -1175,12 +1175,12 @@ describe('[#21861] a data-door UPDATE writes back into the stored row it edits
11751175
data: { description: 'bulk' }, options: { where: { name: { $in: ['pkg_set', 'org_set'] } } },
11761176
});
11771177

1178-
expect(protocol.saves.map((s: any) => [s.name, s.packageId ?? null]))
1179-
.toEqual([['pkg_set', PKG], ['org_set', null]]);
1180-
expect({ pkg: activeRows(ql, 'pkg_set'), org: activeRows(ql, 'org_set') }).toEqual({
1178+
expect({ pkg: activeRows(ql, 'pkg_set'), org: activeRows(ql, 'org_set') }, 'after').toEqual({
11811179
pkg: [{ organization_id: null, package_id: PKG, description: 'bulk' }],
11821180
org: [{ organization_id: null, package_id: null, description: 'bulk' }],
11831181
});
1182+
expect(protocol.saves.map((s: any) => [s.name, s.packageId ?? null]))
1183+
.toEqual([['pkg_set', PKG], ['org_set', null]]);
11841184
});
11851185

11861186
it('a set a code package ships is still refused by the lock (403 NOT_OVERRIDABLE) before any binding read or save', async () => {

0 commit comments

Comments
 (0)