Compliance Check Behaviour — On Demand vs. Auto-Sweep
Compliance Check Behaviour — On Demand vs. Auto-Sweep
Version introduced: v0.1.335
Overview
The platform performs automated compliance checks to evaluate whether a tenancy meets legal requirements — including deposit protection deadlines, prescribed information deadlines, and other time-sensitive obligations under the Renters' Rights Act.
This page documents when compliance checks run, what triggers them, and the current known limitation around time-based rule staleness.
When Compliance Checks Run
Compliance checks are currently triggered on demand, specifically when:
| Event | Compliance Check Triggered? |
|---|---|
| Tenancy created | ✅ Yes |
| Tenancy updated / edited | ✅ Yes |
| Daily scheduled sweep | ❌ No (not currently active) |
The trigger is implemented in src/lib/routers/properties.ts via the triggerComplianceCheck function (~line 98).
Time-Sensitive Compliance Rules
Certain compliance rules are inherently time-based and depend on how many days have elapsed since the tenancy start date:
- Deposit protection deadline — must be registered within 30 days of receipt
- Prescribed information deadline — prescribed information must be served within the statutory window
Because checks only run on tenancy mutation, these rules are only re-evaluated when an edit occurs. If no edit is made after tenancy creation, the compliance status can go stale.
Example Scenario
- A tenancy is created on Day 1. The deposit protection compliance rule evaluates as compliant (deadline not yet reached).
- No further edits are made to the tenancy.
- On Day 30, the deposit protection deadline is reached — but because no mutation event has occurred, no new compliance check is run and the result remains as it was on Day 1.
The compliance-auto-check Function
A background function (src/inngest/functions/compliance-auto-check.ts) exists in the codebase and is designed to sweep all active tenancies and re-evaluate compliance rules. This function is not currently scheduled to run on a daily cron.
Activating this sweep would resolve the staleness issue described above by ensuring time-based rules are re-evaluated daily, independent of whether a tenancy has been recently edited.
Current Limitation
⚠️ Known limitation: Compliance results for time-based rules may be stale if a tenancy has not been edited since it was created. Landlords, agents, and tenants should be aware that the compliance status shown reflects the last point at which the tenancy was mutated — not necessarily today's date.
Planned Improvement
A future release will activate the daily cron schedule in compliance-auto-check.ts to sweep all active tenancies. Once live, this will ensure:
- Deposit protection deadlines are flagged on Day 30 automatically
- Prescribed information deadlines are evaluated daily regardless of edit history
- Compliance status always reflects the current date
Summary
| Attribute | Current Behaviour |
|---|---|
| Trigger | Tenancy create / update only |
| Daily sweep | Not active |
| Time-based rule freshness | Only updated on mutation |
| Auto-check function available | Yes (compliance-auto-check.ts) |
| Cron registered | No |