Skip to content

Conversation

@Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Dec 11, 2025

closes #2546

Greptile Overview

Greptile Summary

This PR makes the CPU column behavior consistent with the RAM column by displaying "no data" when PoolStats is unavailable, instead of showing a dash.

Key changes:

  • Removed early return that displayed placeholder when PoolStats was missing
  • Added condition to only calculate pool-based CPU usage when PoolStats exists
  • Disabled popover tooltip when PoolStats is unavailable
  • Used optional chaining for PoolStats?.map() to safely handle undefined values
  • The ProgressViewer component now properly displays "no data" when totalPoolUsage is undefined

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are minimal, focused, and correctly implement the desired behavior. The logic properly handles edge cases using optional chaining and conditional checks. The implementation is consistent with how the RAM column works.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/components/nodesColumns/columns.tsx 5/5 Changed CPU column to display "no data" placeholder when PoolStats is unavailable, consistent with RAM column behavior

Sequence Diagram

sequenceDiagram
    participant Table as Nodes Table
    participant Column as getCpuColumn
    participant Cell as CellWithPopover
    participant Progress as ProgressViewer
    
    Table->>Column: render({row})
    
    alt CoresUsed and CoresTotal available
        Column->>Column: Calculate totalPoolUsage from cores
    else PoolStats available
        Column->>Column: Calculate totalPoolUsage from PoolStats
    else No data available
        Column->>Column: totalPoolUsage = undefined
    end
    
    Column->>Cell: Create CellWithPopover
    Cell->>Cell: Set disabled={!row.PoolStats}
    
    Column->>Progress: Pass totalPoolUsage
    
    alt totalPoolUsage is numeric
        Progress->>Table: Display progress bar
    else totalPoolUsage is undefined
        Progress->>Table: Display "no data"
    end
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 375 0 1 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: ✅

Current: 62.48 MB | Main: 62.48 MB
Diff: 0.04 KB (-0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

Copilot AI review requested due to automatic review settings December 11, 2025 13:57
@Raubzeug Raubzeug enabled auto-merge December 11, 2025 13:57
content={
<DefinitionList responsive>
{row.PoolStats.map((pool) =>
{row.PoolStats?.map((pool) =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

we check row.PoolStats in upper code - looks like ? is redundant

Copy link
Collaborator

Choose a reason for hiding this comment

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

mislooked - my bad

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the CPU column's fallback behavior to properly handle missing PoolStats data by allowing the column to display CPU usage calculated from CoresUsed and CoresTotal when available. Previously, the column would immediately show a placeholder when PoolStats was missing, even if alternative data sources were available.

Key Changes

  • Removed early return when PoolStats is missing, allowing calculation from CoresUsed/CoresTotal
  • Added conditional check to only calculate from PoolStats when it exists
  • Disabled popover tooltip when PoolStats is unavailable
  • Added optional chaining for safer array mapping
Comments suppressed due to low confidence (1)

src/components/nodesColumns/columns.tsx:251

  • Potential division by zero when totalThreadsCount is 0. This can happen if PoolStats is an empty array or if all pools have 0 threads. The division would result in Infinity or NaN. Consider adding a check to ensure totalThreadsCount is greater than 0 before performing the division, or provide a fallback value.
            if (totalPoolUsage === undefined && row.PoolStats) {
                let totalThreadsCount = 0;
                totalPoolUsage = row.PoolStats.reduce((acc, pool) => {
                    totalThreadsCount += Number(pool.Threads);
                    return acc + Number(pool.Usage) * Number(pool.Threads);
                }, 0);

                totalPoolUsage = totalPoolUsage / totalThreadsCount;

@Raubzeug Raubzeug changed the title fix: CPU and RAM columns fallback fix: cpu and ram columns fallback Dec 11, 2025
@Raubzeug Raubzeug added this pull request to the merge queue Dec 11, 2025
Merged via the queue into main with commit 4349acc Dec 11, 2025
12 of 14 checks passed
@Raubzeug Raubzeug deleted the storage-columns branch December 11, 2025 14:09
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.

Unify behavior for CPU and RAM columns when no data is available

3 participants