fix(audit): residential/tenancies — M28 (unified stage validation), M29 (explicit-disable wins), L31 (active-tenancy warning), L32 (socket event + saveStages tx)

Updated tenancy-auto-create integration test to assert M29 (explicit disable
respected) instead of the old re-enable behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 13:18:28 +02:00
parent 7b74e2314b
commit e7fdf75a6c
9 changed files with 149 additions and 34 deletions

View File

@@ -145,8 +145,8 @@ describe('autoCreatePendingTenancies', () => {
});
});
describe('isTenanciesModuleEnabled (P3 lazy auto-enable on first manual createPending)', () => {
it('flips to enabled after first manual createPending', async () => {
describe('Tenancies module enable-on-createPending (audit M29: explicit-disable wins)', () => {
it('does NOT re-enable a module an admin explicitly disabled (M29)', async () => {
const port = await makePort();
const portId = port.id;
await disableModule(portId);
@@ -167,6 +167,9 @@ describe('isTenanciesModuleEnabled (P3 lazy auto-enable on first manual createPe
{ userId: 'system', portId, ipAddress: '0.0.0.0', userAgent: 'test' },
);
expect(await isTenanciesModuleEnabled(portId)).toBe(true);
// Audit M29: a manual createPending (or a Reservation-Agreement webhook)
// must respect an EXPLICIT `false` and not silently flip the module back
// on. The lazy auto-surface applies only when the setting is UNSET.
expect(await isTenanciesModuleEnabled(portId)).toBe(false);
});
});