Known Issue: Tenancy End Date Passes But Status Stays 'active'
Known Issue: Tenancy End Date Passes But Status Stays 'active'
Status: Identified — remediation in progress (v0.1.334)
Severity: High
Affects: Tenancy lifecycle automation, work queue overdue check-out bucket
Summary
When a tenancy's endDate passes, the platform is designed to automatically move the tenancy from status: active to status: ended. This transition should kick off the check-out overdue workflow without any agent intervention.
As of v0.1.334, this automatic transition is not reliably occurring. Tenancies can silently remain in active status past their end date, which causes them to fall out of the work queue's 'Overdue Check-Out' filter — meaning no one is prompted to act.
Root Cause
Two separate gaps were identified:
1. updateTenancyStatus is never called
The mutation responsible for transitioning tenancy status lives in:
src/lib/routers/properties.ts (~line 1020)
However, a codebase-wide search for updateTenancyStatus returns zero results from component or consumer code. The mutation is defined but never invoked — neither from the UI nor from any confirmed background job.
2. Inngest cron wiring is unverified
An Inngest function designed to handle automatic tenancy ending exists at:
src/inngest/functions/tenancy-auto-end.ts
It is currently unclear whether this function's cron trigger is:
- Registered with the Inngest client
- Scheduled to fire on the correct daily cadence
- Actually calling
updateTenancyStatuswhen it runs
Impact
| Scenario | Expected behaviour | Actual behaviour |
|---|---|---|
endDate passes | Status transitions to ended, check-out overdue workflow triggers | Status stays active, no workflow triggered |
| Agent views work queue | Tenancy appears under 'Overdue Check-Out' | Tenancy silently absent from work queue |
| Compliance audit | Automated status trail | Gap in status history — manual update required |
Workaround (Until Fix is Deployed)
Agents and property managers should periodically review tenancies where the end date has passed but status has not yet changed. These will not surface automatically in the work queue until the defensive query described below is in place.
Manual check: Filter tenancies by endDate < today AND status = active to identify affected records, then update status manually.
Recommended Fix
Step 1 — Verify Inngest cron registration
Confirm that tenancy-auto-end.ts is imported and registered in the Inngest client setup, and that the cron expression is set to fire daily.
Step 2 — Confirm updateTenancyStatus is called
Ensure the auto-end function calls updateTenancyStatus for all tenancies where endDate < today and status = 'active'.
Step 3 — Add defensive work-queue query
Add a secondary query to the work queue that surfaces tenancies matching all of the following:
status = 'active'endDate < today- No check-out report linked
These records should appear in the work queue under the label:
"End date passed — status pending update"
This ensures agents have visibility and can act even if the automation has not yet run.
Related Files
| File | Purpose |
|---|---|
src/lib/routers/properties.ts | updateTenancyStatus tRPC mutation (~line 1020) |
src/inngest/functions/tenancy-auto-end.ts | Daily cron to auto-end tenancies |