OU-481: use natural sort for label columns in metrics query table #1462
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 270 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.335
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1462"
general
weight: 0.35
jgbernalp
Summary
naturalSortutility function usinglocaleComparewithnumeric: trueoption to sort strings with embedded numbers in numeric order rather than lexicographic ordernaturalSortfor all label columns (keeps dedicated numeric sort for the Values column)naturalSortcovering numeric strings, mixed alphanumeric, direction, null/undefined handling, case insensitivity, and pure alphabetic stringsProblem
The metrics query table sorted label columns lexicographically, producing incorrect ordering for columns containing numeric values. For example, labels with values
1,10,2,20were sorted as1,10,2,20instead of the expected1,2,10,20. Port numbers, memory values, CPU counts, and any other numeric data in query result labels were affected.Fixes: https://github.com/openshift/console/issues/13543
Test plan
npm run test:unit -- sort-utils.spec.ts— all newnaturalSorttests passnpm run lint:tsc— TypeScript compiles cleanlynpm run lint— ESLint passesupquery, click a label column header, verify port numbers sort numerically (9090, 9091, 9100 not 9090, 9100, 9091)🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Improved metrics table sorting with natural alphanumeric ordering and case-insensitive comparisons, making mixed labels and version-like values easier to scan.
Values sort numerically, with Prometheus positive and negative infinity labels handled correctly.
NaNvalues appear last in either sort direction, while nonnumeric values follow numeric values.Empty and missing values are handled consistently when sorting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->