Skip to content

Add audit template versioning and multi-year audit lifecycle#6

Open
jonbur wants to merge 6 commits into
cursor/audit-wizard-af56from
cursor/audit-template-versioning-af56
Open

Add audit template versioning and multi-year audit lifecycle#6
jonbur wants to merge 6 commits into
cursor/audit-wizard-af56from
cursor/audit-template-versioning-af56

Conversation

@jonbur

@jonbur jonbur commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

Adds two management surfaces for audits and templates:

Audits (/premises/[id]/audit)

  • Historic audits table with status filter (all / draft / complete)
  • Start new audit against a chosen template version from the catalog (or active template by default)
  • Resume in-progress draft or open completed audit read-only

Templates (/templates)

  • Template catalog showing version, revision, change type, active status
  • Upload JSON to publish a new template release (with optional “set as active”)
  • Activate an existing template for new audits

API

  • GET/POST /api/audit-templates — list catalog, import release
  • POST /api/audit-templates/[templateId]/activate — set active template
  • GET/POST /api/premises/[id]/audit — returns templates list; start accepts templateId

Other

  • Home and app nav link to templates library
  • Premises nav tab renamed to “Audits”
  • Removed superseded AuditStartPanel in favor of AuditsManager
Open in Web Open in Cursor 

cursoragent and others added 6 commits July 1, 2026 19:33
Introduce version + revision on AuditTemplate (RELEASE vs PATCH) so question
sets can evolve atomically or be corrected in place. Each audit is pinned to
a template revision and compliance year, with a sectionsSnapshot frozen on
completion so historical answers stay stable.

Draft audits sync to the latest active template revision; completed audits are
read-only. The audit start page shows template info and per-year history, and
the wizard supports finishing an audit when all sections are complete.

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Use auditDate (PostgreSQL DATE) instead of auditYear so audits are not
tied to calendar years. Multiple audits can exist for any date; only one
draft at a time is still enforced. The start panel lets users pick the
audit date, defaulting to today.

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
The button was disabled until React re-rendered after radio selection, and
focus changes from radio inputs could swallow the first mouse click. Validate
on press instead of disabling, and handle mouse activation on pointer down.

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Toggle fields now update on pointer down so values are set before Continue
is pressed. The wizard also auto-saves to the API on each step and keeps a
form ref so the latest answers are always persisted.

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
Re-merge the actions summary/editor from the actions-tracker branch: home
page link, /premises/[id]/actions page, ActionTracker, PremisesNav tabs,
and shared lib/actions API helpers.

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
- AuditsManager: historic audits table, status filter, start audit against chosen template
- TemplateManager: upload JSON templates, publish releases, activate catalog entries
- API routes for audit-templates list/import and template activation
- startNewAudit accepts optional templateId; premises audit API returns template catalog
- Nav and home links to /templates and updated Audits page

Co-authored-by: jonbur <jonbur@users.noreply.github.com>
@jonbur jonbur marked this pull request as ready for review July 1, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants