Skip to content

Commit 2665532

Browse files
committed
test(service-storage): pin that the opt-in leaves the by-id writes' tenant audit armed
Claude-Session: https://claude.ai/code/session_01WMQprn46CND82KmY8sZWBu Co-authored-by: Claude <noreply@anthropic.com>
1 parent c4f1021 commit 2665532

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎packages/services/service-storage/src/tenant-audit-update-delete-half-repairs.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,26 @@ describe('[#21908] D1. the store: the by-id reads carry the opt-in, and the writ
811811
});
812812
});
813813

814+
describe('[#21908] D1b. the opt-in leaves these writes audited — real ObjectQL, recording driver', () => {
815+
it('with no organization: no tenantId reaches the driver, and no tenant-audit bypass is filled in', async () => {
816+
// Both objects are tenant-scoped in the platform's tenancy inventory, so the
817+
// engine fills in no `bypassTenantAudit` for an `isSystem` write on them: an
818+
// unscoped by-id write is still reported on a walled deployment.
819+
const { engine, calls } = await makeEngine();
820+
const store = new StorageMetadataStore(engine as any);
821+
822+
await store.updateFile('f1', { status: 'committed' });
823+
await store.deleteSession('s1');
824+
825+
const writes = calls.filter((x) => x.method === 'update' || x.method === 'delete');
826+
expect(writes.map((w) => w.method)).toEqual(['update', 'delete']);
827+
for (const w of writes) {
828+
expect(w.options?.tenantId ?? undefined).toBeUndefined();
829+
expect(w.options?.bypassTenantAudit ?? undefined).toBeUndefined();
830+
}
831+
});
832+
});
833+
814834
describe('[#21908] D2. ⛔ under the opt-in, a door tenant still cannot reach another organization’s row', () => {
815835
const OLD = process.env.OS_TENANCY_POSTURE;
816836
let ql: ObjectQL;

0 commit comments

Comments
 (0)