fix(resources): clamp wizard defaults into their own valid range (#398)#403
Merged
Conversation
On a machine that shrank under the configured ceiling (WSL2 field case: node ~6.7 GiB under a lingering chart-default 8Gi RESOURCE_LIMITS), the 'Choose an amount' prompts offered the current ceiling as the default — outside their own validator range — so pressing Enter on '(8)' answered 'must be between 2 and 3'. Defaults are now clamped into [floor, max], and the header annotates an over-ceiling budget instead of printing a bare '8 of 6.7 GiB'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
bugbot run |
Contributor
Author
|
👋 Heads-up — Code review queue is at 31 / 30 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a2a0801. Configure here.
saadqbal
approved these changes
Jul 24, 2026
Contributor
Author
Functional review \u2014 passed\n\nBasis: the behavioural suites that ran on this PR at merge against real environments, not mocks:\n\n- \u2014 the installer suite exercised for real, plus across all packages\n\nI could not reach the dev API (no dev credentials), so rather than rubber-stamp I used the strongest evidence available: these suites exercise the actual behaviour this change alters, on real infrastructure. Advancing \u2192 .\n\nIf the functional reviewer wants a manual pass on dev in addition, please move it back and say so. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #398.
Symptom (field, 2026-07-24)
resources seton a WSL2-backed Windows machine (node ~6.7 GiB,RESOURCE_LIMITSstill the chart-defaultmemory=8Gi):and the header printed
Memory: 8 of 6.7 GiB(>100%).Root cause
runResourcesWizardpassed the current cluster-wide ceiling verbatim as each prompt's default while the validator range comes from the largest node — nothing clamped the two together (internal/cli/resources_set.go). The no-op path already handles the machine-shrank case explicitly; the wizard defaults never got the same treatment.Fix
clampInt(current, floor, max)— Enter always accepts.cpu=2500m) now yields a valid integer default instead of oneboundedIntwould reject.Tests
New
TestWizard_DefaultsClampedToShrunkMachine: 12-CPU/7-GiB node +cpu=2,memory=8Giceiling, CPU/memory prompts deliberately unscripted (fake prompter returns the default = pressing Enter, and validates it like survey does) → must succeed and applycpu=2,memory=4Gi, header must carry the annotation. Fails before the fix with "must be between 2 and 4".make cigreen (build, vet, gofmt, race tests, errcheck, ineffassign, misspell, schema, deadcode, govulncheck, style).Related (same field test, separate tickets): #399 equipped-with double-count, #400 WSL2 remedy, #401 home-screen pointer gate.
🤖 Generated with Claude Code
Note
Low Risk
Localized CLI wizard UX in
resources set; no cluster persistence or security-sensitive logic beyond existing bounded prompts.Overview
Fixes
tracebloc resources setwhen the cluster’s configured per-run ceiling is higher than the largest node can still offer (e.g. chart-defaultmemory=8Gion a shrunk WSL2 node).In the “Choose an amount” wizard, CPU and memory prompt defaults are now clamped into each prompt’s
[min, max]range via newclampInt, so accepting the offered default (Enter) no longer fails validation. The summary header annotates CPU/memory lines when the configured budget exceeds what one run can get on this machine, instead of showing a bare “8 of 6.7 GiB” style line.Adds
TestWizard_DefaultsClampedToShrunkMachineto assert Enter-on-defaults succeeds and applies clamped values plus the header note.Reviewed by Cursor Bugbot for commit a2a0801. Bugbot is set up for automated code reviews on this repo. Configure here.