refactor: extract hardcoded thresholds and magic numbers to named constants#4024
Conversation
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @Copilot — thanks for opening this PR!
This is an automated message. |
❌ PR Title Verification FailedYour PR title does not follow the required format. Current title: Required FormatPR titles must start with one of these emoji prefixes:
How to FixEdit your PR title to start with the appropriate emoji. For example:
You can edit the title by clicking the Edit button next to your PR title. This comment was automatically posted by the PR Title Verifier workflow. |
…onstants Fixes #3476 - CardHistory.tsx: MS_PER_MINUTE/HOUR/DAY/WEEK replace raw ms literals - Tour.tsx: TOOLTIP_GAP and NEAR_TOP_THRESHOLD replace inline numbers - RunbookProgress.tsx: MS_PER_SECOND replaces literal 1000 - GPUDetailModal.tsx: GPU_UTIL_HIGH/WARN replace repeated 90/70 thresholds - ClusterGrid.tsx: MIN_SPIN_DURATION_MS replaces default param literal 1000 Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Agent-Logs-Url: https://github.com/kubestellar/console/sessions/863a8e7c-ce05-4f76-9a06-80c9542a9e7d Co-authored-by: clubanderson <407614+clubanderson@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits. 📝 Please follow instructions in the contributing guide to update your commits with the DCO Full details of the Developer Certificate of Origin can be found at developercertificate.org. The list of commits missing DCO signoff:
DetailsInstructions 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. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Auto-QA flagged raw numeric literals scattered across five files that would be difficult to tune or reason about at a glance. All numbers are replaced with named, commented constants at the top of their respective files — zero behaviour change.
📌 Fixes
📝 Summary of Changes
Five files had inline magic numbers replaced with named module-level constants:
CardHistory.tsxMS_PER_MINUTE,MS_PER_HOUR,MS_PER_DAY,MS_PER_WEEKTour.tsxTOOLTIP_GAP(was inline12),NEAR_TOP_THRESHOLD(was inline100)RunbookProgress.tsxMS_PER_SECONDGPUDetailModal.tsxGPU_UTIL_HIGH = 90,GPU_UTIL_WARN = 70— used ingetUtilizationColor()and both progress-bar JSX expressionsClusterGrid.tsxMIN_SPIN_DURATION_MS(default param foruseMinSpin)AlertRuleEditor.tsxandAlertDetail.tsxalready had their numbers in named constants; no changes needed there.Example —
GPUDetailModal.tsxbefore/after:Changes Made
CardHistory.tsxtoMS_PER_*constantsgap = 12local var and inline100threshold inTour.tsxto module-level constantsMS_PER_SECONDtoRunbookProgress.tsxfor duration display thresholdGPUDetailModal.tsxtoGPU_UTIL_HIGH/GPU_UTIL_WARNuseMinSpindefault parameter literal inClusterGrid.tsxwithMIN_SPIN_DURATION_MSChecklist
git commit -s)Screenshots or Logs (if applicable)
N/A — pure refactor, no visual changes.
👀 Reviewer Notes
Pure rename refactor — no logic changes. Each constant is co-located with the code that uses it (not moved to a central file) since they are domain-specific to their component.