fix: hide empty component names and filter non-alert events from history#89
fix: hide empty component names and filter non-alert events from history#89TerrifiedBug merged 1 commit intomainfrom
Conversation
- Node cards no longer fall back to showing the componentKey when displayName is blank — the name row collapses entirely - Alert History table excludes informational events (deploy_requested, deploy_completed, deploy_rejected, deploy_cancelled, new_version_available); notifications still fire for these events
Greptile SummaryThis PR makes two targeted display-layer fixes: node cards in the pipeline editor no longer fall back to the auto-generated Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[listEvents query] --> B{alertRule.environmentId\nmatches input?}
B -- No --> C[Excluded]
B -- Yes --> D{alertRule.metric\nin HIDDEN_METRICS?}
D -- Yes\ndeploy_requested\ndeploy_completed\ndeploy_rejected\ndeploy_cancelled\nnew_version_available --> E[Excluded from history\nNotifications still fire]
D -- No --> F[Included in Alert History]
subgraph NodeCard [Node Card Rendering]
G{displayName set?} -- Yes --> H[Render name row]
G -- No --> I[Row collapsed — no fallback to componentKey]
end
|
| const HIDDEN_METRICS: AlertMetric[] = [ | ||
| "deploy_requested", | ||
| "deploy_completed", | ||
| "deploy_rejected", | ||
| "deploy_cancelled", | ||
| "new_version_available", | ||
| ]; |
There was a problem hiding this comment.
Hardcoded list diverges from existing EVENT_METRIC_VALUES constant
alert.ts already imports isEventMetric from @/server/services/event-alerts, which is re-exported from src/lib/alert-metrics.ts. That module defines EVENT_METRIC_VALUES with 10 entries — the same 5 deploy/version metrics listed here, plus scim_sync_failed, backup_failed, certificate_expiring, node_joined, and node_left.
The new HIDDEN_METRICS constant duplicates 5 of those 10 values in a separate location. If a new deploy-related metric (e.g. deploy_rolled_back) is added to EVENT_METRIC_VALUES in the future, it won't be automatically excluded from the alert history table, since HIDDEN_METRICS won't be updated alongside it.
Consider extracting a named sub-constant (e.g. DEPLOY_AND_VERSION_METRICS) into src/lib/alert-metrics.ts and importing it here, so both the firing side and the display side share the same authoritative list for this subset.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/server/routers/alert.ts
Line: 670-676
Comment:
**Hardcoded list diverges from existing `EVENT_METRIC_VALUES` constant**
`alert.ts` already imports `isEventMetric` from `@/server/services/event-alerts`, which is re-exported from `src/lib/alert-metrics.ts`. That module defines `EVENT_METRIC_VALUES` with 10 entries — the same 5 deploy/version metrics listed here, plus `scim_sync_failed`, `backup_failed`, `certificate_expiring`, `node_joined`, and `node_left`.
The new `HIDDEN_METRICS` constant duplicates 5 of those 10 values in a separate location. If a new deploy-related metric (e.g. `deploy_rolled_back`) is added to `EVENT_METRIC_VALUES` in the future, it won't be automatically excluded from the alert history table, since `HIDDEN_METRICS` won't be updated alongside it.
Consider extracting a named sub-constant (e.g. `DEPLOY_AND_VERSION_METRICS`) into `src/lib/alert-metrics.ts` and importing it here, so both the firing side and the display side share the same authoritative list for this subset.
How can I resolve this? If you propose a fix, please make it concise.
Summary
componentKey(e.g.,http_server_a1b2c3d4) when no display name is set — the name row collapses entirely, keeping the node compactdeploy_requested,deploy_completed,deploy_rejected,deploy_cancelled,new_version_available) — these events still fire notifications via configured channels but no longer clutter the alert historyTest plan
node_unreachableorcpu_usage— verify those events still appear in history