Skip to content

fix: hide empty component names and filter non-alert events from history#89

Merged
TerrifiedBug merged 1 commit intomainfrom
minor-fixes-c39
Mar 11, 2026
Merged

fix: hide empty component names and filter non-alert events from history#89
TerrifiedBug merged 1 commit intomainfrom
minor-fixes-c39

Conversation

@TerrifiedBug
Copy link
Owner

Summary

  • Node cards no longer fall back to displaying the componentKey (e.g., http_server_a1b2c3d4) when no display name is set — the name row collapses entirely, keeping the node compact
  • Alert History table now excludes informational event metrics (deploy_requested, deploy_completed, deploy_rejected, deploy_cancelled, new_version_available) — these events still fire notifications via configured channels but no longer clutter the alert history

Test plan

  • Create a pipeline node without setting a display name — verify the node card shows only the type header with no name/ID row
  • Set a display name on a node — verify it appears in the node body
  • Trigger a deploy and check Alert History — verify deploy events don't appear
  • Create an alert rule for node_unreachable or cpu_usage — verify those events still appear in history

- 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
@github-actions github-actions bot added the fix label Mar 11, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 11, 2026

Greptile Summary

This PR makes two targeted display-layer fixes: node cards in the pipeline editor no longer fall back to the auto-generated componentKey when no display name is set (the row is now hidden entirely), and the Alert History table excludes five deploy/version event metrics that are informational rather than actionable.

Key changes:

  • source-node.tsx, sink-node.tsx, transform-node.tsx: componentKey removed from destructuring; display name paragraph is now conditionally rendered with {displayName && ...}. The componentKey field remains in each node's data type definition and is still passed by the parent — only the fallback rendering is removed.
  • src/server/routers/alert.ts: listEvents adds a HIDDEN_METRICS constant (AlertMetric[]) and applies a notIn filter on alertRule.metric inside the Prisma where clause, keeping the existing environmentId scope intact.
  • The new HIDDEN_METRICS list is a 5-entry subset of the 10-entry EVENT_METRIC_VALUES constant already defined in src/lib/alert-metrics.ts; the intentional divergence (failure/warning events like scim_sync_failed, backup_failed, certificate_expiring are correctly kept visible) should be documented or extracted into a shared named constant to prevent future drift.

Confidence Score: 4/5

  • Safe to merge — changes are UI-only and a read query filter; no mutations, auth, or data integrity paths are affected.
  • Both changes are well-scoped and correctly typed. The Prisma query filter is valid and preserves existing team/environment scoping. The only concerns are (1) an always-present body div that may leave an empty padding block on nameless/metrics-less nodes, and (2) a new hardcoded list that partially mirrors an existing constant, creating a future-drift risk — neither is a blocking correctness issue.
  • src/server/routers/alert.ts — verify the HIDDEN_METRICS list stays in sync with any future deploy-related AlertMetric additions; src/components/flow/sink-node.tsx (and source/transform peers) — body div wrapper is always rendered even when empty.

Important Files Changed

Filename Overview
src/server/routers/alert.ts Adds a HIDDEN_METRICS constant to filter deploy/version event metrics from the listEvents query. Well-typed against the Prisma AlertMetric enum, but the hardcoded list is a partial subset of the existing EVENT_METRIC_VALUES in src/lib/alert-metrics.ts, creating a minor future-drift risk.
src/components/flow/sink-node.tsx Removes componentKey from destructuring and conditionally renders the display name paragraph. The body <div> is still always rendered with py-2.5 padding, which leaves a small empty gap when both displayName and metrics are absent.
src/components/flow/source-node.tsx Same conditional displayName render pattern as sink-node; same body-div-always-present nuance. Change is straightforward and correct.
src/components/flow/transform-node.tsx Identical pattern to source/sink node — removes componentKey from destructuring and conditionally renders displayName. Clean, no issues.

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
Loading

Comments Outside Diff (1)

  1. src/components/flow/sink-node.tsx, line 65-72 (link)

    Body <div> still renders when both displayName and metrics are absent

    When a node has no display name set and no metrics data (the exact "compact" case the PR targets), the wrapper <div className="space-y-2 px-3 py-2.5"> is still rendered unconditionally. The py-2.5 padding (~20 px of vertical space) creates a visible empty gap between the header bar and the shared-component footer (or the card bottom). The same pattern exists in source-node.tsx and transform-node.tsx.

    If neither child will render, the wrapper itself should be suppressed to achieve the compact look described in the PR:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/components/flow/sink-node.tsx
    Line: 65-72
    
    Comment:
    **Body `<div>` still renders when both `displayName` and `metrics` are absent**
    
    When a node has no display name set and no metrics data (the exact "compact" case the PR targets), the wrapper `<div className="space-y-2 px-3 py-2.5">` is still rendered unconditionally. The `py-2.5` padding (~20 px of vertical space) creates a visible empty gap between the header bar and the shared-component footer (or the card bottom). The same pattern exists in `source-node.tsx` and `transform-node.tsx`.
    
    If neither child will render, the wrapper itself should be suppressed to achieve the compact look described in the PR:
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: 5e2074d

Comment on lines +670 to +676
const HIDDEN_METRICS: AlertMetric[] = [
"deploy_requested",
"deploy_completed",
"deploy_rejected",
"deploy_cancelled",
"new_version_available",
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TerrifiedBug TerrifiedBug merged commit f9ee5d7 into main Mar 11, 2026
12 checks passed
@TerrifiedBug TerrifiedBug deleted the minor-fixes-c39 branch March 11, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant