Skip to content

feat: risk acknowledgement — accept/snooze known risks (#77) - #83

Merged
reloadfast merged 2 commits into
mainfrom
feat/risk-acknowledgement-77
Mar 1, 2026
Merged

reloadfast merged 2 commits into
mainfrom
feat/risk-acknowledgement-77

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Closes #77

What

Lets users mark a risk as accepted (acknowledged) so it's hidden from the active list and excluded from risk counts. Acknowledgements survive re-scans — keyed on (device_id, check_id).

Backend

Change Detail
Risk model +acknowledged_at (DateTime), +acknowledged_note (String)
_migrate_schema Adds the two columns to existing DBs
run_checks Saves ack mapping before deleting rows; re-applies on re-insert
GET /risks New ?acknowledged=true/false filter
GET /risks/summary Counts only non-acknowledged risks
PATCH /risks/{id}/acknowledge Sets acknowledged_at + optional note
PATCH /risks/{id}/unacknowledge Clears both fields

Frontend

  • Active / Accepted tab toggle on the Risks page (default: Active)
  • Summary severity cards shown only on the Active tab
  • Risk detail modal: Acknowledge button → opens note dialog → confirms
  • Accepted risks show an accepted badge, display the note, and have a Reopen risk button
  • Both actions refetch risk list + summary counts immediately

Tests

207 backend tests pass (unchanged — acknowledgement is plumbing-level).

reloadfast and others added 2 commits March 1, 2026 12:10
Backend:
- Add acknowledged_at (DateTime) and acknowledged_note (String) to Risk model
- Migrate existing DBs via _migrate_schema()
- Preserve acknowledgements on re-scan: save (check_id → ack) mapping before
  deleting rows, re-apply when inserting new rows
- GET /risks: add ?acknowledged=true/false filter
- risks_summary: count only non-acknowledged risks (keeps dashboard accurate)
- PATCH /risks/{id}/acknowledge: set acknowledged_at + optional note
- PATCH /risks/{id}/unacknowledge: clear acknowledged_at and note

Frontend:
- Risk type gains acknowledged_at and acknowledged_note fields
- useRisks hook gains acknowledged filter option
- RisksPage: Active/Accepted tab toggle; active tab is default
- Summary cards only shown on Active tab
- Risk detail modal: Acknowledge button opens AcknowledgeModal with optional
  free-text note; accepted risks show 'accepted' badge + note + Reopen button
- Acknowledge and Reopen actions refetch both risk list and summary counts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reloadfast
reloadfast merged commit 6f36096 into main Mar 1, 2026
7 checks passed
@reloadfast
reloadfast deleted the feat/risk-acknowledgement-77 branch March 1, 2026 11:16
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.

Risk acknowledgement: allow users to accept/snooze known risks to reduce alert fatigue

1 participant