Repository navigation
fix(frontend): don't offer Exchange for reshape rows with no target - #1468
Conversation
The reshape analyzer returns target_instance_type "" and target_count 0 when it has no exchange target for an RI (a completely unused RI, or, since the go bump in LeanerCloud#1246, a target capped at the units the account owns). The table rendered those rows as "0x " under Suggested and kept a live Exchange button that opened the modal with a target count of 0. Such rows now say "No exchange target" (the Reason column already explains why) and get a disabled Exchange button with no quote action. A no-target row that still carries cross-family alternatives keeps a live button, since the modal can preselect from them, and opens it with a count of 1 instead of 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 2 billable files and costs up to $0.50. Or wait 58 minutes for your next included review. View limit details
Comment |
|
Opened as a draft at d951229. Reshape rows with no target now say "No exchange target" and get a disabled Exchange button. Rows that have alternatives keep a live button, and the modal opens with a count of 1. Label note: #1410 has no triage labels (priority/severity/type/...), so there was nothing to mirror onto this PR. The issue needs triage first. |
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Reviewer: rE3. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Local verification at |
|
Merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), under the bar IAmJSD set: 1 approving independent review(s) on |
Closes #1410
Root cause
The reshape analyzer in cloud-commitments-go returns
target_instance_type: ""andtarget_count: 0when it has no exchange target for an RI. That happens for a completely unused RI, and, since the go bump in #1246, for a target capped at the units the account owns.renderRecommendationsinfrontend/src/riexchange.tsprinted${target_count}x ${target_instance_type}unconditionally, which gave "0x ", and always rendered a live Exchange button. That button opened the exchange modal with a target count of 0.Fix
text-muted). The Reason column already carries the analyzer's explanation.data-action, so no quote handler is attached. Atitle/aria-labelgives the reason: "No exchange target available for this RI".alternative_targetskeeps a live Exchange button, because the modal's picker can preselect from those alternatives. The modal now opens with a count of 1 instead of 0. Manual exchange of any RI is still available from the Active Convertible RIs table.Verification
frontend/src/__tests__/riexchange-no-target.test.ts(4 tests). Against main'sriexchange.ts, 3 fail (Expected: "No exchange target" Received: "0x", and the button not disabled). With the fix, all 4 pass.npm run -s lint(0 errors, existing warnings only, none in the changed files),npm run -s typecheck,npm run -s build, andnpx jest --no-coverage --silent(172 suites, 4507 passed, 1 skipped).a11y-focus-return.spec.ts› Escape in the Active RI filter popover). That spec doesn't touch the reshape table. It passed when rerun alone, and 15/15 with--repeat-each=5, so the failure looks like flakiness under full-suite load.scripts/test-git-secrets-allowlist.sh(183 PASS).🤖 Generated with Claude Code