Instant Compliance Re-evaluation on Tenancy Updates
Instant Compliance Re-evaluation on Tenancy Updates
Available from: v0.1.285
Overview
The compliance engine now automatically re-evaluates a tenancy's compliance status whenever a deposit-related field is updated — no manual intervention required. Previously, updated data would only be reflected after the nightly sweep (2 AM UTC) or after an agent clicked Re-check All on the compliance dashboard.
What Triggers an Automatic Re-check
A compliance re-check fires immediately whenever any of the following fields are changed on a tenancy:
| Field | Description |
|---|---|
depositScheme | The deposit protection scheme (e.g. TDS, DPS, mydeposits) |
depositProtectionRef | The scheme's protection reference number |
depositProtectedAt | The date the deposit was registered |
rentAmount | The monthly rent figure |
depositAmount | The total deposit held |
How It Works
When a updateTenancy mutation saves a change to any compliance-relevant field, it emits a tenancy.updated event to Inngest:
inngest.send({
name: 'tenancy.updated',
data: {
tenancyId,
orgId,
trigger: 'manual_update',
},
});
The existing compliance-check-on-event function handler picks this up and runs the full compliance rule set against the tenancy. Results are reflected on the compliance dashboard within seconds.
The 'Re-check All' Button
The Re-check All button on the compliance dashboard remains available as a manual override. It is useful for:
- Bulk re-evaluation after an external data import.
- Verifying compliance across all tenancies after a rule or threshold change.
- Troubleshooting or auditing purposes.
Under normal day-to-day usage, agents should rarely need to use this button.
Scheduled Nightly Sweep
The nightly compliance sweep continues to run at 2 AM UTC and is unchanged by this release. It acts as a safety net to catch any edge cases that may not have been covered by real-time event triggers.
Summary of Compliance Trigger Sources
| Trigger | Timing | Source |
|---|---|---|
| Tenancy field updated (deposit-related) | Immediate (seconds) | updateTenancy mutation → tenancy.updated event |
| Manual Re-check All button | On demand | Compliance dashboard UI |
| Nightly scheduled sweep | 2 AM UTC daily | Inngest cron — compliance-auto-check |