Skip to content

feat: show affected device identity on risk cards (#40) - #43

Merged
reloadfast merged 1 commit into
mainfrom
feat/risk-device-identity-40
Feb 28, 2026
Merged

reloadfast merged 1 commit into
mainfrom
feat/risk-device-identity-40

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Closes #40

Changes

Backend — backend/app/api/__init__.py

  • Added ip_address and hostname fields to RiskOut schema
  • Updated all three risk query paths (list_risks, get_risk, device_risks) to eagerly load Risk.device via selectinload — eliminates N+1 queries

Frontend — frontend/src/types/api.ts

  • Added ip_address: string and hostname: string | null to the Risk interface

Frontend — frontend/src/pages/RisksPage.tsx

  • Risk list rows now show hostname (preferred) or ip_address as a clickable link to /devices/:id
  • Risk detail modal shows hostname/IP as a link instead of "Device #id"
  • Removed per-row client-side device lookup (no more devices.find(...) in the list)

Tests — backend/tests/test_api.py

  • Updated test_risk_schema_fields to assert ip_address and hostname keys are present
  • Added test_risk_includes_device_identity asserting ip_address matches the seeded device

- Add ip_address and hostname fields to RiskOut schema
- Eagerly load Risk.device via selectinload in list/get/device_risks queries
- Risk list rows and modal now show hostname (or IP) as a clickable link
- Remove N+1 client-side device lookup from RisksPage

Closes #40

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reloadfast
reloadfast merged commit cfec66c into main Feb 28, 2026
5 checks passed
@reloadfast
reloadfast deleted the feat/risk-device-identity-40 branch February 28, 2026 17:49
@reloadfast
reloadfast restored the feat/risk-device-identity-40 branch March 26, 2026 19:35
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.

feat: show affected device identity on risk cards

1 participant