-
[NA] [BE] feat: promote severity to first-class field on agent insights issues (#7169)
发布于
2026-06-19 11:43:36 +00:00 - [NA] [BE] feat: promote severity to first-class field on agent insights issues
Add severity as a typed column on agent_insights_issues, promoted from the
free-form metadata JSON blob. Severity is now required on the ingest payload,
returned in both the list and single-issue endpoints, and filterable/sortable
via query params.Changes:
- New AgentInsightsIssueSeverity enum (critical/high/medium/low)
- DB migration 000084: ALTER TABLE adds nullable severity ENUM column
- New AgentInsightsIssueSeverityColumnMapper for bidirectional DB mapping
- ReportedIssue.severity: @NotNull — agent must always report it
- AgentInsightsIssue + AgentInsightsIssueWithDetails: severity in response
- DAO: severity in upsert INSERT/UPDATE, SELECT for all read queries,
optional WHERE filter matching the status filter pattern - Service + Resource: severity filter threaded through findIssues
- SortableFields + AgentInsightsIssueSortingFactory: severity sortable
(ENUM ordinal order = critical→low, matching logical priority)
Co-Authored-By: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
- [NA] [BE] chore: add trailing blank line to migration 000084
Satisfies the Liquibase formatted SQL EOF rule requiring a blank line at end of file.
Co-Authored-By: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
- [NA] [BE] test: add severity integration tests for agent insights
Cover three categories:
- Severity round-trips: reported severity is returned in both GET /issues
(list) and GET /issues/{id} (detail) responses. - Severity filter (parameterized): CRITICAL and HIGH each return only their
matching issues; LOW as an edge case returns zero results. - Sorting by severity ASC: ENUM ordinal order (critical=1 < medium=3 < low=4)
puts critical first. - Invalid severity query param: unknown value returns 400.
- Missing severity on ingest: null severity in ReportedIssue returns 422
(added to the existing invalidReports parameterized set).
Also updates all AgentInsightsResourceClient.findIssues / findIssuesWithResponse
call sites to thread the new severity parameter, and defaults the reportedIssue
test helper to MEDIUM so all pre-existing tests continue to pass.Co-Authored-By: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
- [NA] [BE] fix: add severity to expected issue in reportIssues test
The manual AgentInsightsIssue builder in reportIssues() didn't set severity,
so the recursive comparator saw null vs MEDIUM and failed.Co-Authored-By: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
Co-authored-by: Claude Sonnet 4.6 (1M context) noreply@anthropic.com
下载附件