Skip to content

OCPBUGS-12953: Fix missing metrics for Windows nodes on Nodes list and detail pages#16525

Open
sg00dwin wants to merge 3 commits into
openshift:mainfrom
sg00dwin:OCPBUGS-12953-windows-node-cpu-metrics
Open

OCPBUGS-12953: Fix missing metrics for Windows nodes on Nodes list and detail pages#16525
sg00dwin wants to merge 3 commits into
openshift:mainfrom
sg00dwin:OCPBUGS-12953-windows-node-cpu-metrics

Conversation

@sg00dwin
Copy link
Copy Markdown
Member

@sg00dwin sg00dwin commented Jun 1, 2026

Analysis / Root cause:

The CPU column shows - for Windows nodes on the Compute > Nodes list page. This is caused by two issues:

  1. Missing CPU query fallback: The Console's CPU queries rely on Prometheus recording rules (instance:node_cpu:rate:sum and instance:node_num_cpu:sum) created by the kube-prometheus stack for Linux nodes. WMCO creates instance:node_cpu:rate:sum for Windows but does not create instance:node_num_cpu:sum. The CPUCell component requires both values to be finite — missing either shows -. The storage queries in the same function already handle Windows via or fallback, but CPU did not.

  2. Instance label format mismatch: On some platforms (e.g. AWS), the Windows exporter uses IP:port format for the Prometheus instance label (e.g. 10.0.61.250:9182), while Linux node-exporter uses hostnames (e.g. ip-10-0-61-250.us-east-2.compute.internal). The Console maps metrics to nodes by matching the instance label to the node name, so Windows metrics fail to map.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-12953

Solution description:

  1. Add or Windows CPU fallback queries to both the node list page (NodesPage.tsx) and node detail page (queries.ts), matching the existing pattern used for Windows storage metrics:

    • CPU usage: rate(windows_cpu_time_total{mode!="idle"}[3m]) — sums non-idle CPU time, matching the Linux instance:node_cpu:rate:sum semantics
    • CPU total: count ... (windows_cpu_time_total{mode="idle"}) — counts one series per core, matching how the Linux instance:node_num_cpu:sum works
  2. Remap IP:port instance labels to hostnames in fetchNodeMetrics() by building an IP→hostname map from each node's InternalIP address. When a Prometheus result has an instance label containing :, the IP portion is looked up in the map and replaced with the hostname. Falls back to the original label if no match is found.

  3. Extract helpers and add unit testsbuildIPToHostnameMap and resolveInstanceLabel are exported as testable functions with 9 unit tests covering mapping, edge cases (empty nodes, missing IP, unknown IP), and passthrough behavior for Linux nodes.

Screenshots / screen recording:
Before
Screenshot 2026-06-01 at 2 54 42 PM

After
Screenshot 2026-06-01 at 2 50 58 PM

Test setup:

  1. OCP cluster with OVN-Kubernetes hybrid overlay networking (configured at install time)
  2. Install WMCO from OperatorHub
  3. Label the namespace: oc label namespace openshift-windows-machine-config-operator openshift.io/cluster-monitoring="true"
  4. Create a Windows MachineSet to provision a Windows worker node
  5. Wait for the Windows node to reach Ready status

Test cases:

  • Navigate to Compute > Nodes — Windows node should display Memory, CPU, and Filesystem values (not -)
  • Linux nodes should continue to display all metrics correctly (no regressions)
  • Click on the Windows node — the Overview tab's Utilization card should show CPU usage chart
  • Verify in Observe > Metrics that sum by(instance)(instance:node_num_cpu:sum) or count by(instance)(windows_cpu_time_total{mode="idle"}) returns results for both Linux and Windows nodes
  • On a cluster without Windows nodes, verify all node metrics display normally

Additional info:

  • WMCO also has a bug in its instance:node_cpu:rate:sum recording rule — it sums mode="idle" (idle time) instead of mode!="idle" (usage time). This Console fix bypasses that by using raw windows_cpu_time_total metrics directly.
  • The or fallback pattern is proven — storage queries in the same function have used it for Windows metrics without issues.
  • The instance label remapping only triggers for labels containing : (IP:port format). Linux node-exporter in OpenShift always uses hostname-style labels (confirmed via ServiceMonitor relabeling config), so Linux nodes are never affected.

Assisted by: Claude (Opus 4.6)

Summary by CodeRabbit

Release Notes

Bug Fixes

  • Fixed accuracy of node metrics retrieval by properly mapping Prometheus instances to Kubernetes node names, resolving issues with IP:port format translations
  • Improved metric refresh logic to account for changes in the monitored node list

Tests

  • Added comprehensive test coverage for node metric mapping functionality

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sg00dwin: This pull request references Jira Issue OCPBUGS-12953, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:

The CPU column shows - for Windows nodes on the Compute > Nodes list page. This is caused by two issues:

  1. Missing CPU query fallback: The Console's CPU queries rely on Prometheus recording rules (instance:node_cpu:rate:sum and instance:node_num_cpu:sum) created by the kube-prometheus stack for Linux nodes. WMCO creates instance:node_cpu:rate:sum for Windows but does not create instance:node_num_cpu:sum. The CPUCell component requires both values to be finite — missing either shows -. The storage queries in the same function already handle Windows via or fallback, but CPU did not.

  2. Instance label format mismatch: On some platforms (e.g. AWS), the Windows exporter uses IP:port format for the Prometheus instance label (e.g. 10.0.61.250:9182), while Linux node-exporter uses hostnames (e.g. ip-10-0-61-250.us-east-2.compute.internal). The Console maps metrics to nodes by matching the instance label to the node name, so Windows metrics fail to map.

Jira: https://redhat.atlassian.net/browse/OCPBUGS-12953

Solution description:

  1. Add or Windows CPU fallback queries to both the node list page (NodesPage.tsx) and node detail page (queries.ts), matching the existing pattern used for Windows storage metrics:
  • CPU usage: rate(windows_cpu_time_total{mode!="idle"}[3m]) — sums non-idle CPU time, matching the Linux instance:node_cpu:rate:sum semantics
  • CPU total: count ... (windows_cpu_time_total{mode="idle"}) — counts one series per core, matching how the Linux instance:node_num_cpu:sum works
  1. Remap IP:port instance labels to hostnames in fetchNodeMetrics() by building an IP→hostname map from each node's InternalIP address. When a Prometheus result has an instance label containing :, the IP portion is looked up in the map and replaced with the hostname. Falls back to the original label if no match is found.

  2. Extract helpers and add unit testsbuildIPToHostnameMap and resolveInstanceLabel are exported as testable functions with 9 unit tests covering mapping, edge cases (empty nodes, missing IP, unknown IP), and passthrough behavior for Linux nodes.

Screenshots / screen recording:
Before
Screenshot 2026-06-01 at 2 54 42 PM

After
Screenshot 2026-06-01 at 2 50 58 PM

Test setup:

  1. OCP cluster with OVN-Kubernetes hybrid overlay networking (configured at install time)
  2. Install WMCO from OperatorHub
  3. Label the namespace: oc label namespace openshift-windows-machine-config-operator openshift.io/cluster-monitoring="true"
  4. Create a Windows MachineSet to provision a Windows worker node
  5. Wait for the Windows node to reach Ready status

Test cases:

  • Navigate to Compute > Nodes — Windows node should display Memory, CPU, and Filesystem values (not -)
  • Linux nodes should continue to display all metrics correctly (no regressions)
  • Click on the Windows node — the Overview tab's Utilization card should show CPU usage chart
  • Verify in Observe > Metrics that sum by(instance)(instance:node_num_cpu:sum) or count by(instance)(windows_cpu_time_total{mode="idle"}) returns results for both Linux and Windows nodes
  • On a cluster without Windows nodes, verify all node metrics display normally

Additional info:

  • WMCO also has a bug in its instance:node_cpu:rate:sum recording rule — it sums mode="idle" (idle time) instead of mode!="idle" (usage time). This Console fix bypasses that by using raw windows_cpu_time_total metrics directly.
  • The or fallback pattern is proven — storage queries in the same function have used it for Windows metrics without issues.
  • The instance label remapping only triggers for labels containing : (IP:port format). Linux node-exporter in OpenShift always uses hostname-style labels (confirmed via ServiceMonitor relabeling config), so Linux nodes are never affected.

Assisted by: Claude (Opus 4.6)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Walkthrough

This PR improves Prometheus node metrics computation by introducing IP-to-hostname mapping utilities and refining PromQL CPU queries. Exported helper functions translate Prometheus instance labels (including IP:port forms) into Kubernetes node names. PromQL CPU query templates are updated to filter by IP address, and the metrics fetching logic integrates these mappings when storing resolved metric values.

Changes

Node Metrics IP Resolution

Layer / File(s) Summary
IP-to-hostname mapping helpers and tests
frontend/packages/console-app/src/components/nodes/NodesPage.tsx, frontend/packages/console-app/src/components/nodes/__tests__/NodesPage.spec.ts
Exported buildIPToHostnameMap maps each node's InternalIP to its hostname, and resolveInstanceLabel translates Prometheus instance labels (including ip:port forms) into Kubernetes node names. Comprehensive test suite covers normal mapping, empty input, missing node properties, and edge cases.
PromQL CPU query templates with IP address parameter
frontend/packages/console-app/src/components/nodes/node-dashboard/queries.ts
NodeQueries.CPU_USAGE and NodeQueries.CPU_TOTAL templates are updated to use _.template with both node and ipAddress parameters, enabling instance filtering by IP address pattern; getUtilizationQueries now passes both parameters to the templates.
Metrics fetching with hostname resolution
frontend/packages/console-app/src/components/nodes/NodesPage.tsx
The fetchNodeMetrics function derives the IP→hostname map from the input nodes list, applies the updated CPU query definitions, and stores metric values under resolved hostnames instead of raw Prometheus labels.
Metrics refresh effect hook integration
frontend/packages/console-app/src/components/nodes/NodesPage.tsx
The periodic metrics refresh effect is updated to call fetchNodeMetrics(nodes) with the current node list and includes nodes in the effect dependency array, ensuring metrics recompute when the watched node set changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

lgtm, component/core, jira/valid-bug, verified, ok-to-test

Suggested reviewers

  • jseseCCS
🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main fix: addressing missing metrics for Windows nodes, referencing the Jira issue OCPBUGS-12953, and identifying the scope (Nodes list and detail pages).
Description check ✅ Passed The PR description is comprehensive and complete, covering root cause analysis, detailed solution description, before/after screenshots, test setup, test cases, browser conformance checkboxes, and additional context. All required template sections are addressed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed This PR contains only TypeScript/Jest tests, not Ginkgo tests. The check is not applicable as it targets Go/Ginkgo specifically.
Test Structure And Quality ✅ Passed PR adds Jest tests (NodesPage.spec.ts) only; custom check targets Ginkgo tests (Go *_test.go). No Ginkgo tests in this PR, so check is not applicable.
Microshift Test Compatibility ✅ Passed This PR does not add any Ginkgo e2e tests. The check applies only to Ginkgo e2e tests; this PR adds Jest unit tests to a frontend console component, which is outside the scope of the check.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. The test file (NodesPage.spec.ts) uses Jest/Jasmine unit tests only, which is a frontend testing framework. The custom check does not apply to this PR.
Topology-Aware Scheduling Compatibility ✅ Passed This PR only modifies frontend console UI code (NodesPage.tsx, queries.ts, test files). No deployment manifests, operators, controllers, or topology-aware scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed OTE Binary Stdout Contract check is for Go binaries. This PR contains only frontend TypeScript/React code (NodesPage.tsx, NodesPage.spec.ts, queries.ts), not Go binaries.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR contains only frontend TypeScript/React code and Jest unit tests, not Ginkgo e2e tests. The custom check only applies when Ginkgo e2e tests are added, so it is not applicable here.
No-Weak-Crypto ✅ Passed PR contains no weak cryptography, custom crypto implementations, or non-constant-time secret comparisons. It only adds IP→hostname mapping and Prometheus query adjustments for node metrics.
Container-Privileges ✅ Passed PR modifies only frontend TypeScript code. No container manifests, Dockerfiles, or K8s YAML files. Container-privileges check does not apply.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data logging found. Single console.error statement logs generic Prometheus fetch error; processes only non-sensitive infrastructure metadata (IPs, hostnames, metrics).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from cajieh and fsgreco June 1, 2026 19:30
@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Jun 1, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 1, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sg00dwin
Once this PR has been reviewed and has the lgtm label, please assign logonoff for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/packages/console-app/src/components/nodes/NodesPage.tsx (1)

1074-1090: ⚡ Quick win

Depending on the whole nodes array may trigger excessive metric refetches.

nodes comes from useK8sWatchResource, whose reference changes on any watched-node update (status/heartbeat churn), not just when the set of nodes or their IPs change. Each change clears the 30s interval, fires an immediate fetchNodeMetrics (several Prometheus queries), and re-arms the interval. Since the IP→hostname map only needs node name + InternalIP, consider depending on a stable derived key instead of the full array.

♻️ Sketch: derive a stable dependency
+  const nodeIPKey = useMemo(
+    () =>
+      nodes
+        .map((n) => `${n.metadata?.name}:${n.status?.addresses?.find((a) => a.type === 'InternalIP')?.address}`)
+        .sort()
+        .join(','),
+    [nodes],
+  );
   useEffect(() => {
     const updateMetrics = async () => {
       try {
         const metrics = await fetchNodeMetrics(nodes);
         ...
-  }, [dispatch, nodes]);
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, [dispatch, nodeIPKey]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/packages/console-app/src/components/nodes/NodesPage.tsx` around
lines 1074 - 1090, The effect depends on the entire nodes array which changes
frequently; instead derive a stable dependency (e.g. a memoized string or array
of node identifiers composed of node.metadata.name + InternalIP) using useMemo
and replace nodes in the useEffect dependency list with that derived key plus
showMetrics and dispatch; keep the existing updateMetrics (which calls
fetchNodeMetrics and dispatch(setNodeMetrics)) and interval logic but trigger it
only when the derived key changes so you avoid clearing/recreating the 30s
interval on unrelated node status churn.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/packages/console-app/src/components/nodes/NodesPage.tsx`:
- Around line 599-608: The function resolveInstanceLabel's signature understates
its real contract: it can be called with undefined (e.g. callers pass
data.metric.instance || data.metric.node) and can return undefined at runtime.
Change the signature of resolveInstanceLabel to accept instance: string |
undefined and return string | undefined, and update the implementation to
short-circuit when instance is undefined (return undefined); keep existing
behavior for colon-separated instances using ipToHostname.get(ip) || instance.
Ensure any callers/uses expecting a string handle the possible undefined return.

---

Nitpick comments:
In `@frontend/packages/console-app/src/components/nodes/NodesPage.tsx`:
- Around line 1074-1090: The effect depends on the entire nodes array which
changes frequently; instead derive a stable dependency (e.g. a memoized string
or array of node identifiers composed of node.metadata.name + InternalIP) using
useMemo and replace nodes in the useEffect dependency list with that derived key
plus showMetrics and dispatch; keep the existing updateMetrics (which calls
fetchNodeMetrics and dispatch(setNodeMetrics)) and interval logic but trigger it
only when the derived key changes so you avoid clearing/recreating the 30s
interval on unrelated node status churn.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d4b14bf4-e524-4cc3-9886-3b2744ea2f42

📥 Commits

Reviewing files that changed from the base of the PR and between 377ea54 and 9fed223.

📒 Files selected for processing (3)
  • frontend/packages/console-app/src/components/nodes/NodesPage.tsx
  • frontend/packages/console-app/src/components/nodes/__tests__/NodesPage.spec.ts
  • frontend/packages/console-app/src/components/nodes/node-dashboard/queries.ts

Comment on lines +599 to +608
export const resolveInstanceLabel = (
instance: string,
ipToHostname: Map<string, string>,
): string => {
if (instance?.includes(':')) {
const ip = instance.split(':')[0];
return ipToHostname.get(ip) || instance;
}
return instance;
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether strictNullChecks is enabled for this package's TS config
fd -t f 'tsconfig*.json' frontend/packages/console-app frontend 2>/dev/null | xargs -r rg -n 'strict|strictNullChecks'

Repository: openshift/console

Length of output: 407


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Show resolveInstanceLabel + local call sites in NodesPage.tsx
node_file="frontend/packages/console-app/src/components/nodes/NodesPage.tsx"
echo "---- resolveInstanceLabel definition (near lines 580-640) ----"
sed -n '560,640p' "$node_file" | nl -ba

echo "---- usages of resolveInstanceLabel within NodesPage.tsx ----"
rg -n "resolveInstanceLabel" "$node_file" || true

# 2) Locate NodesPage.spec.ts and show the spec that mentions resolveInstanceLabel(undefined,...)
spec_file="frontend/packages/console-app/src/components/nodes/NodesPage.spec.ts"
echo "---- spec file existence / relevant section ----"
if [ -f "$spec_file" ]; then
  sed -n '1,120p' "$spec_file" | nl -ba
  rg -n "resolveInstanceLabel" "$spec_file" || true
else
  echo "Missing: $spec_file"
fi

# 3) Inspect tsconfig files under frontend/packages/console-app (and any that reference it)
echo "---- tsconfig files under frontend/packages/console-app ----"
fd -t f 'tsconfig*.json' frontend/packages/console-app | sort | while read -r f; do
  echo "### $f"
  # print only relevant strict-related lines plus compilerOptions nullability settings if any
  rg -n "strictNullChecks|strict[\"']?|compilerOptions" "$f" || true
done

# 4) If there is a tsconfig specific to this package, show the strict-related block verbatim
echo "---- strict/strictNullChecks blocks verbatim (console-app tsconfigs) ----"
fd -t f 'tsconfig*.json' frontend/packages/console-app | sort | while read -r f; do
  echo "### $f (snippet)"
  sed -n '1,120p' "$f" | nl -ba | sed -n '1,120p' | head -n 120
done

Repository: openshift/console

Length of output: 185


🏁 Script executed:

#!/bin/bash
set -euo pipefail

node_file="frontend/packages/console-app/src/components/nodes/NodesPage.tsx"
spec_file="frontend/packages/console-app/src/components/nodes/NodesPage.spec.ts"

show_numbered() { awk '{printf "%d:%s\n", NR, $0}'; }

echo "---- resolveInstanceLabel definition (NodesPage.tsx, ~580-640) ----"
sed -n '560,640p' "$node_file" | show_numbered

echo "---- usages of resolveInstanceLabel within NodesPage.tsx ----"
rg -n "resolveInstanceLabel" "$node_file" || true

echo "---- spec file section where resolveInstanceLabel is referenced ----"
if [ -f "$spec_file" ]; then
  rg -n "resolveInstanceLabel" "$spec_file" || true
  echo "---- first 120 lines of NodesPage.spec.ts ----"
  sed -n '1,120p' "$spec_file" | show_numbered
else
  echo "Missing: $spec_file"
fi

echo "---- tsconfig files under frontend/packages/console-app ----"
fd -t f 'tsconfig*.json' frontend/packages/console-app | sort | while read -r f; do
  echo "### $f"
  rg -n '"strictNullChecks"|"strict"' "$f" || true
done

echo "---- contents of any tsconfig found that mention strictNullChecks/strict (full line excerpts) ----"
fd -t f 'tsconfig*.json' frontend/packages/console-app | sort | while read -r f; do
  rg -n "strictNullChecks|\"strict\"" "$f" && echo "---" || true
done

Repository: openshift/console

Length of output: 3390


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the call site around the reported usage (~line 656)
node_file="frontend/packages/console-app/src/components/nodes/NodesPage.tsx"
echo "---- resolveInstanceLabel call site (NodesPage.tsx, ~640-700) ----"
sed -n '630,720p' "$node_file" | awk '{print NR ":" $0}'

echo "---- all usages of resolveInstanceLabel in console-app package ----"
rg -n "resolveInstanceLabel" frontend/packages/console-app || true

echo "---- locate NodesPage.*spec.* ----"
fd -t f "NodesPage.*spec.*" frontend/packages/console-app -0 2>/dev/null | xargs -0 -I{} echo "{}" || true

echo "---- global search for resolveInstanceLabel(undefined"  # checks for the spec mention
rg -n "resolveInstanceLabel\s*\(\s*undefined" frontend || true

echo "---- global search for NodesPage.spec mention in repo ----"
rg -n "NodesPage\.spec" frontend/packages/console-app || true

echo "---- tsconfig files relevant to console-app (show extends/strict/null settings) ----"
fd -t f 'tsconfig*.json' frontend/packages/console-app frontend -0 2>/dev/null | xargs -0 -I{} sh -c 'echo "### {}"; rg -n "\"extends\"|\"strict\"|\"strictNullChecks\"|compilerOptions" "{}" || true'

Repository: openshift/console

Length of output: 6542


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg_dir="frontend/packages/console-app"
echo "---- list files in console-app package root (tsconfig-related) ----"
ls -la "$pkg_dir" | head -n 200

echo "---- find tsconfig* under console-app ----"
fd -t f 'tsconfig*.json' "$pkg_dir" || true

echo "---- inspect package.json scripts for console-app (ts-jest/tsc config) ----"
if [ -f "$pkg_dir/package.json" ]; then
  sed -n '1,200p' "$pkg_dir/package.json" | nl -ba
  rg -n "tsconfig|jest|ts-jest|babel-jest|ts-node|tsc" "$pkg_dir/package.json" || true
else
  echo "Missing: $pkg_dir/package.json"
fi

echo "---- locate any tsconfig-base/extends used by console-app ----"
fd -t f 'tsconfig*.json' frontend | rg -n "tsconfig-base|extends" || true

# Search for how NodesPage is compiled/tested (ts-jest config references)
echo "---- search for NodesPage.tsx in repo ----"
rg -n "NodesPage\.tsx" frontend/packages/console-app -S || true

echo "---- inspect NodesPage.spec.ts imports to see test TS config assumptions ----"
spec_file="frontend/packages/console-app/src/components/nodes/__tests__/NodesPage.spec.ts"
if [ -f "$spec_file" ]; then
  sed -n '1,120p' "$spec_file" | nl -ba
fi

Repository: openshift/console

Length of output: 737


🏁 Script executed:

#!/bin/bash
set -euo pipefail

pkg_dir="frontend/packages/console-app"
root_tsconfig="frontend/tsconfig.json"
spec_file="frontend/packages/console-app/src/components/nodes/__tests__/NodesPage.spec.ts"

echo "---- console-app/package.json (scripts/config sections only) ----"
sed -n '1,220p' "$pkg_dir/package.json" | rg -n "scripts|jest|ts-jest|ts-node|test|transform|moduleNameMapper|globals|testRegex|testMatch|setupFiles" || true

echo "---- full scripts block (if present) ----"
node -e "const p=require('./$pkg_dir/package.json'); console.log(JSON.stringify(p.scripts,null,2))" 2>/dev/null || true

echo "---- Does console-app have any tsconfig locally? ----"
fd -t f 'tsconfig*.json' "$pkg_dir" || true

echo "---- frontend/tsconfig.json (compilerOptions strict/strictNullChecks) ----"
sed -n '1,120p' "$root_tsconfig" | rg -n "strictNullChecks|strict|compilerOptions" || true
sed -n '1,140p' "$root_tsconfig" | cat

echo "---- search for strictNullChecks in frontend tsconfigs ----"
rg -n "\"strictNullChecks\"|\"strict\"" frontend/tsconfig.json frontend -S --glob 'tsconfig*.json' || true

echo "---- NodesPage.spec.ts ----"
if [ -f "$spec_file" ]; then
  sed -n '1,120p' "$spec_file" | cat
fi

echo "---- locate any jest/ts-jest config files in console-app or frontend ----"
fd -t f 'jest*.js|jest*.ts|jest*.json' frontend | head -n 50
fd -t f 'ts-jest*|ts-jest*.js|ts-jest*.ts' frontend | head -n 50

Repository: openshift/console

Length of output: 5861


Update resolveInstanceLabel types to match its real contract

resolveInstanceLabel returns undefined when called with undefined (covered by NodesPage.spec.ts), and the caller can pass data.metric.instance || data.metric.node which may be undefined. Since frontend/tsconfig.json has strict: false, this doesn’t currently fail compilation, but the signature understates the runtime behavior.

♻️ Proposed signature change
 export const resolveInstanceLabel = (
-  instance: string,
+  instance: string | undefined,
   ipToHostname: Map<string, string>,
-): string => {
+): string | undefined => {
   if (instance?.includes(':')) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/packages/console-app/src/components/nodes/NodesPage.tsx` around
lines 599 - 608, The function resolveInstanceLabel's signature understates its
real contract: it can be called with undefined (e.g. callers pass
data.metric.instance || data.metric.node) and can return undefined at runtime.
Change the signature of resolveInstanceLabel to accept instance: string |
undefined and return string | undefined, and update the implementation to
short-circuit when instance is undefined (return undefined); keep existing
behavior for colon-separated instances using ipToHostname.get(ip) || instance.
Ensure any callers/uses expecting a string handle the possible undefined return.

@sg00dwin
Copy link
Copy Markdown
Member Author

sg00dwin commented Jun 1, 2026

/label tide/merge-method-squash

@openshift-ci openshift-ci Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 1, 2026
@sg00dwin
Copy link
Copy Markdown
Member Author

sg00dwin commented Jun 1, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@sg00dwin: This pull request references Jira Issue OCPBUGS-12953, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (rrasouli@redhat.com), skipping review request.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@sg00dwin
Copy link
Copy Markdown
Member Author

sg00dwin commented Jun 1, 2026

/retest-required

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jun 1, 2026

@sg00dwin: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-playwright 9fed223 link false /test e2e-playwright
ci/prow/e2e-gcp-console 9fed223 link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/core Related to console core functionality jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants