Smarter Compliance Checks: No More Manual First Click
Smarter Compliance Checks: No More Manual First Click
Release: v0.1.230
What Changed
The Compliance tab in the Intelligence panel now automatically runs a compliance check the moment it loads for a tenancy that has no prior compliance records — no button click required.
Previously, if the server-side check hadn't yet completed by the time an agent opened the Compliance tab, they would be greeted with an empty state and a "Run Compliance Checks" button. This was confusing: the system is supposed to run checks automatically on tenancy creation (via Inngest), yet agents were being asked to manually kick off a process that should already be in flight.
How It Works Now
- Agent opens the Compliance tab for a newly created tenancy.
- The tab checks whether any compliance results exist (
results.length === 0). - If no results are found on first mount, the tab automatically fires the compliance check in the background.
- A loading skeleton is shown while the check runs — the empty state no longer appears.
- Results render as soon as the check completes.
- The "Re-check" button remains visible at all times for agents who want to explicitly trigger a fresh check.
Why This Matters
The Inngest tenancy.created event listener, the compliance-nightly-sweep, and the compliance-check-on-event handler already run compliance checks server-side. The client-side auto-trigger is a safety net — it catches edge cases where:
- The on-event Inngest function experienced a timing delay.
- The function missed the event due to a transient error.
- The agent opens the tab before the background job has completed.
In the normal case (where Inngest has already done its job), results will already be present and the auto-trigger never fires.
What Stays the Same
- The "Re-check" button — still available for on-demand refreshes.
- Server-side Inngest logic — no changes to
compliance-nightly-sweep,compliance-check-on-event, or any database schema. - All existing compliance rules and scoring — no behavioural changes to what is checked or how results are evaluated.
Summary
| Before | After |
|---|---|
| Empty state shown if no results on load | Loading skeleton shown; check auto-fires |
| Agent must click "Run Compliance Checks" | No click needed for first check |
| Manual "Re-check" button available | Manual "Re-check" button still available |
| Friction on timing delays | Seamless experience regardless of Inngest timing |