Repository navigation
fix: warning for resizes that touch < large - #47509
Conversation
Add a warning that resizes may take additional time if they touch an instance size < large.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughAdds a new ChangesExtended Downtime Warning
Estimated code review effort: 1 (Trivial) | ~5 minutes Sequence Diagram(s)sequenceDiagram
participant Form
participant useDiskManagementReviewChanges
participant DiskManagementReviewAndSubmitDialog
Form->>useDiskManagementReviewChanges: form, numReplicas
useDiskManagementReviewChanges->>useDiskManagementReviewChanges: evaluate compute size vs COMPUTE_SIZES_BELOW_LARGE
useDiskManagementReviewChanges-->>DiskManagementReviewAndSubmitDialog: hasExtendedDowntimeRisk
DiskManagementReviewAndSubmitDialog->>DiskManagementReviewAndSubmitDialog: render warning Alert if risk true
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.hooks.ts (2)
142-151: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueFallback default could cause false-positive warning.
hasExtendedDowntimeRiskdefaults the old compute size to'ci_nano'whendefaultValues?.computeSizeis undefined — which is itself inCOMPUTE_SIZES_BELOW_LARGE. IfdefaultValueshasn't populated yet whilehasComputeChangesevaluates totrue(undefined vs. a real value), this would surface the extended-downtime warning even though the actual old size may not have been belowlarge. This mirrors the existingoldComputeLabelfallback pattern, but here it directly gates user-facing warning copy.💡 Consider guarding on defined defaultValues
const hasExtendedDowntimeRisk = hasComputeChanges && - (COMPUTE_SIZES_BELOW_LARGE.includes( - (form.formState.defaultValues?.computeSize ?? 'ci_nano') as ComputeInstanceAddonVariantId - ) || + (COMPUTE_SIZES_BELOW_LARGE.includes( + form.formState.defaultValues?.computeSize as ComputeInstanceAddonVariantId + ) || COMPUTE_SIZES_BELOW_LARGE.includes( form.getValues('computeSize') as ComputeInstanceAddonVariantId ))🤖 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 `@apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.hooks.ts` around lines 142 - 151, The extended-downtime warning in DiskManagementReviewAndSubmitDialog.hooks.ts can be triggered by a fallback old size of ci_nano when form.formState.defaultValues?.computeSize is still undefined. Update hasExtendedDowntimeRisk so it only evaluates the old compute size after defaultValues has been populated, or otherwise guard that branch before checking COMPUTE_SIZES_BELOW_LARGE, while keeping the existing form.getValues('computeSize') check and the hasComputeChanges condition intact.
142-151: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider unit test coverage for the new derived flag.
hasExtendedDowntimeRiskis pure boolean logic driven by form values, well-suited for a focused unit test (e.g. asserting resize to/fromci_micro/ci_small/ci_mediumtriggers the flag, and resize betweenci_large+ sizes does not). No test coverage is visible for this hook in the provided files.As per path instructions,
apps/studio/**PRs adding a utility/derived-logic function without test coverage should be nudged to add coverage.🤖 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 `@apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.hooks.ts` around lines 142 - 151, Add unit test coverage for the new derived flag in DiskManagementReviewAndSubmitDialog.hooks, specifically `hasExtendedDowntimeRisk`. The logic is pure and driven by form values, so add focused tests that verify resize scenarios involving `ci_micro`, `ci_small`, or `ci_medium` set the flag when `hasComputeChanges` is true, and that resizes among `ci_large` and above do not. Place the coverage near the hook’s existing tests, using the hook/function names from `DiskManagementReviewAndSubmitDialog.hooks` to keep it easy to locate.Source: Coding guidelines
🤖 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.
Nitpick comments:
In
`@apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.hooks.ts`:
- Around line 142-151: The extended-downtime warning in
DiskManagementReviewAndSubmitDialog.hooks.ts can be triggered by a fallback old
size of ci_nano when form.formState.defaultValues?.computeSize is still
undefined. Update hasExtendedDowntimeRisk so it only evaluates the old compute
size after defaultValues has been populated, or otherwise guard that branch
before checking COMPUTE_SIZES_BELOW_LARGE, while keeping the existing
form.getValues('computeSize') check and the hasComputeChanges condition intact.
- Around line 142-151: Add unit test coverage for the new derived flag in
DiskManagementReviewAndSubmitDialog.hooks, specifically
`hasExtendedDowntimeRisk`. The logic is pure and driven by form values, so add
focused tests that verify resize scenarios involving `ci_micro`, `ci_small`, or
`ci_medium` set the flag when `hasComputeChanges` is true, and that resizes
among `ci_large` and above do not. Place the coverage near the hook’s existing
tests, using the hook/function names from
`DiskManagementReviewAndSubmitDialog.hooks` to keep it easy to locate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 711e70f2-4eec-4076-b2d7-4a23f69bca8e
📒 Files selected for processing (2)
apps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.hooks.tsapps/studio/components/interfaces/DiskManagement/DiskManagementReviewAndSubmitDialog/DiskManagementReviewAndSubmitDialog.tsx
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › clicking broadcast message shows detail panel Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Braintrust eval report
|
Add a warning that resizes may take additional time if they touch an instance size < large.
Resolves FE-3746
Summary by CodeRabbit