Repository navigation
Merge compute and disk into Infrastructure - #48370
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change consolidates compute and disk settings under Infrastructure, adds Service Versions to General settings, updates navigation and redirects, centralizes resource-warning routing, and adds tests for the new settings surfaces and behaviors. ChangesSettings consolidation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
🎭 Playwright Test Results (next)Details
Flaky testsFeatures › database.spec.ts › Database › Schema Visualizer › table actions work as expected Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
19e5ec9 to
31ac41e
Compare
1a74c10 to
1bada6b
Compare
## Summary This is a precursor to unifying "compute and disk" and "infrastructure pages". First step is just updating the existing compute and disk page to make use of standard page and form patterns. - Reorganizes the existing Compute and Disk form into the established settings layout pattern, with Scaling, Compute, Disk, and Advanced sections. - Moves billing deltas to section headers while retaining the sticky review footer. - Adds animated notices, validation-error scrolling, and a responsive compute-size selector (2 columns by default, 3 from 680px, and 4 from 900px). - Preserves permissions, entitlements, cooldowns, read-only warnings, replica pricing, GP3 validation, Nano/PITR locks, and the free Micro upgrade treatment. - Keeps the redesigned experience on `/settings/compute-and-disk` so it can be reviewed independently of the route cutover. ## Stack 1. #48368 (this PR) 2. #48369 3. #48370 ## How to test 1. Check out `chore/infra-compute-1-config` and start Studio with `pnpm dev:studio`. 2. Open `/project/<ref>/settings/compute-and-disk`. 3. Confirm the page header and Scaling, Compute, Disk, and Advanced sections follow the standard settings-page spacing, with the plan notice directly below the Scaling header. 4. Change the compute size and disk configuration. Confirm billing deltas appear in the relevant section headers and the sticky review footer summarizes and applies the pending changes. 5. Enter invalid GP3 IOPS or throughput values and submit. Confirm the validation message is shown and the first invalid field is scrolled into view. 6. Exercise representative project states: insufficient permissions, read-only mode, resize cooldown, Nano with PITR, a project with read replicas, and a free Micro upgrade. Confirm the existing locks, warnings, pricing, and upgrade treatment remain intact. 7. Resize the viewport and confirm the compute cards use 2 columns by default, 3 columns from 680px, and no more than 4 columns from 900px. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Reworked the Compute and Disk settings UI into clearer sectioned pages, including smoother navigation to the first validation error. - Added a transitional in-form NoticeBar for consistent alert rendering. - Improved billing change badges to reflect accurate before/after totals. - **Bug Fixes** - Fixed disk IOPS/throughput pricing to include replica-based charges. - Strengthened disk sizing validation (GP3 limits, legacy/size edge cases, spend-cap behavior, and provider-specific constraints). - **Refactor** - Updated key form field layouts for improved readability. - **Tests** - Expanded schema validation and pricing/billing badge test coverage. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <[email protected]>
## Summary This is the second step towards merging compute and disk with infrastructure. There are some usage charts on the current infrastructure page that are useful to have in the context of compute and disk settings. This branch adds two charts which give a general sense of usage and whether an upgrade needs to happen. Other data points in infrastructure can be found within observability and organisation usage. - Adds rolling seven-day Compute and Disk charts to the existing Compute and Disk page. - Shows CPU, memory, optional burstable disk IO, and disk usage split into database, WAL, and system data. - Covers loading, error, empty, warning, and critical states, retaining the 75% warning and 90% critical thresholds. - Uses a dedicated PageSection and keeps the charts in two columns from 680px. - Uses the concise primary labels Compute and Disk, removes the database report link, and removes tooltip icons from secondary metrics. - Adds transformation, summary, and component tests covering dedicated IO behavior, legacy anchors, responsive layout, rolling refetch, and tooltip behavior. ## Stack 1. #48368 2. #48369 (this PR) 3. #48370 ## How to test 1. Check out `chore/infra-compute-2-charts` and start Studio with `pnpm dev:studio`. 2. Open `/project/<ref>/settings/compute-and-disk` on a project with recent metrics. 3. Confirm the charts are in their own page section with standard spacing below the page header. 4. Confirm the Compute chart shows CPU and memory, plus disk IO when applicable, and the Disk chart splits usage into database, WAL, and system data. 5. Confirm the primary labels are Compute and Disk, secondary metrics do not show tooltip icons, and there is no Database Observability/report link. 6. Resize across 680px. The charts should remain in two columns at and above the breakpoint and stack into two rows below it. 7. Exercise loading, error, empty, warning, and critical responses with the metrics mocks or response overrides. Confirm warning styling begins at 75%, critical styling begins at 90%, and an error or empty response does not break the configuration form. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added compute and disk usage charts to the disk management interface, including metric cards for CPU, memory, disk I/O, database, WAL, and system. * Added usage status indicators, peak calculations, tooltips, and a detailed disk breakdown with placeholders when data is missing. * Added special handling for dedicated-I/O instances to hide burst-only disk I/O. * **Style** * Simplified the disk space display by removing supplemental explanatory text. * **Tests** * Added comprehensive test coverage for chart rendering, loading/error/empty states, status/peak calculations, and rolling 7-day data window behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <[email protected]>
- mock ui-patterns/Admonition (shim collapsed on master) - pass required dehydratedState prop to page component
… test
The AutoScaleFields, IOPSField, and ThroughputField inputs had no
accessible name: FormItemLayout renders its label with
htmlFor={name || id} while FormInputGroupInput keeps the auto-generated
form-item id, so the two never matched. Pass id={field.name} on the
inputs (and the Throughput FormItemLayout) like DiskSizeField already
does.
Also await the Advanced section in the infrastructure page test — it
only renders once the project query resolves (isAws).
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/studio/components/interfaces/Support/CategoryAndSeverityInfo.tsx (1)
184-195: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winStale title: still references "infrastructure activity" after content moved to observability.
The admonition body and link were updated to point to database observability reports (
/observability/database), but the title still says "Have you checked your project's infrastructure activity?" — worth aligning the title with the new destination for clarity.✏️ Suggested title update
- title="Have you checked your project's infrastructure activity?" + title="Have you checked your project's database observability reports?"🤖 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/Support/CategoryAndSeverityInfo.tsx` around lines 184 - 195, Update the Admonition title in the DATABASE_UNRESPONSIVE branch to reference the project's database observability reports, aligning it with the existing body text and `/observability/database` link instead of infrastructure activity.
🧹 Nitpick comments (2)
apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx (1)
161-163: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename
onDatabaseSettingsAndInReadOnlyMode— it no longer checks a database-settings route.This variable now guards
router.pathname.endsWith('settings/infrastructure'), not a database-settings page. The name is a holdover from before the compute/disk consolidation and is now misleading for future readers/maintainers of this suppression logic.♻️ Suggested rename
- const onDatabaseSettingsAndInReadOnlyMode = + const onInfrastructurePageWithNoOpCta = router.pathname.endsWith('settings/infrastructure') && (activeWarnings.includes('is_readonly_mode_enabled') || (isComputeUpgradeMetric && !isFreePlan))(update the corresponding usage in the
ifcondition below accordingly)🤖 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/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx` around lines 161 - 163, Rename onDatabaseSettingsAndInReadOnlyMode to reflect that it targets the settings/infrastructure route, and update its corresponding usage in the following if condition. Preserve the existing route and warning conditions unchanged.apps/studio/components/ui/ComputeBadgeWrapper.tsx (1)
198-200: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract a shared
getInfrastructurePath(projectRef)helper instead of hardcoding/settings/infrastructurein four places. This PR already introducedgetServiceVersionsPathto avoid duplicating the Service Versions URL; the same pattern would prevent the four/project/:ref/settings/infrastructureliterals from drifting independently if the route ever changes again.
apps/studio/components/ui/ComputeBadgeWrapper.tsx#L198-L200: replace the inline template literal with a sharedgetInfrastructurePath(projectRef)helper call.apps/studio/components/ui/BannerStack/Banners/BannerFreeMicroUpgrade.tsx#L61-L61: use the same helper (passing through the?upgrade=microquery param) instead of the inline literal.apps/studio/components/ui/UpgradePlanButton.tsx#L70-L76: use the same helper for thecomputeSizeaddon branch instead of the inline literal.apps/studio/pages/project/[ref]/observability/database.tsx#L376-L376: use the same helper for the "Increase disk size" link instead of the inline literal.🤖 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/ui/ComputeBadgeWrapper.tsx` around lines 198 - 200, Extract a shared getInfrastructurePath(projectRef) helper alongside the existing path helpers and replace the hardcoded infrastructure URLs in apps/studio/components/ui/ComputeBadgeWrapper.tsx:198-200, apps/studio/components/ui/BannerStack/Banners/BannerFreeMicroUpgrade.tsx:61, apps/studio/components/ui/UpgradePlanButton.tsx:70-76, and apps/studio/pages/project/[ref]/observability/database.tsx:376. Preserve the existing ?upgrade=micro query parameter when composing the BannerFreeMicroUpgrade link and use the helper for the computeSize and “Increase disk size” links.
🤖 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.
Inline comments:
In
`@apps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.tsx`:
- Around line 26-31: Correct the ProjectUpgradeAlert import in
ServiceVersionsSection by matching the two-level relative path used for
UpgradeWarnings, so it resolves from Settings/General/ServiceVersions to
Settings/Infrastructure. Leave the warning imports unchanged.
---
Outside diff comments:
In `@apps/studio/components/interfaces/Support/CategoryAndSeverityInfo.tsx`:
- Around line 184-195: Update the Admonition title in the DATABASE_UNRESPONSIVE
branch to reference the project's database observability reports, aligning it
with the existing body text and `/observability/database` link instead of
infrastructure activity.
---
Nitpick comments:
In `@apps/studio/components/ui/ComputeBadgeWrapper.tsx`:
- Around line 198-200: Extract a shared getInfrastructurePath(projectRef) helper
alongside the existing path helpers and replace the hardcoded infrastructure
URLs in apps/studio/components/ui/ComputeBadgeWrapper.tsx:198-200,
apps/studio/components/ui/BannerStack/Banners/BannerFreeMicroUpgrade.tsx:61,
apps/studio/components/ui/UpgradePlanButton.tsx:70-76, and
apps/studio/pages/project/[ref]/observability/database.tsx:376. Preserve the
existing ?upgrade=micro query parameter when composing the
BannerFreeMicroUpgrade link and use the helper for the computeSize and “Increase
disk size” links.
In
`@apps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsx`:
- Around line 161-163: Rename onDatabaseSettingsAndInReadOnlyMode to reflect
that it targets the settings/infrastructure route, and update its corresponding
usage in the following if condition. Preserve the existing route and warning
conditions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 260f9c28-0e87-4d67-a030-a899058a4f18
⛔ Files ignored due to path filters (1)
apps/studio/routeTree.gen.tsis excluded by!**/routeTree.gen.ts
📒 Files selected for processing (42)
apps/studio/.github/eslint-rule-baselines.jsonapps/studio/TANSTACK_MIGRATION.mdapps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsxapps/studio/components/interfaces/Database/Backups/RestoreToNewProject/AdditionalMonthlySpend.tsxapps/studio/components/interfaces/Database/RestoreToNewProject/RestoreToNewProject.tsxapps/studio/components/interfaces/DiskManagement/DiskManagementPanelForm.tsxapps/studio/components/interfaces/Integrations/Queues/UpgradeDatabaseAlert.tsxapps/studio/components/interfaces/Integrations/Wrappers/OverviewTab.tsxapps/studio/components/interfaces/Linter/Linter.utils.tsxapps/studio/components/interfaces/Organization/Usage/UsageSection/DiskUsage.tsxapps/studio/components/interfaces/QueryPerformance/IndexAdvisor/IndexAdvisorDisabledState.tsxapps/studio/components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessConfiguration.tsxapps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersions.utils.test.tsapps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersions.utils.tsapps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.test.tsxapps/studio/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection.tsxapps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.constants.tsapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsxapps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxapps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/BucketCallouts.tsxapps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketForm.tsxapps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketCallouts.tsxapps/studio/components/interfaces/Support/CategoryAndSeverityInfo.tsxapps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.selfhosted.test.tsxapps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.test.tsxapps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsxapps/studio/components/ui/BannerStack/Banners/BannerFreeMicroUpgrade.tsxapps/studio/components/ui/ComputeBadgeWrapper.tsxapps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.tsxapps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.utils.test.tsapps/studio/components/ui/ResourceExhaustionWarningBanner/ResourceExhaustionWarningBanner.utils.tsapps/studio/components/ui/UpgradePlanButton.tsxapps/studio/pages/project/[ref]/database/settings.tsxapps/studio/pages/project/[ref]/observability/database.tsxapps/studio/pages/project/[ref]/settings/compute-and-disk.tsxapps/studio/pages/project/[ref]/settings/general.tsxapps/studio/pages/project/[ref]/settings/infrastructure.tsxapps/studio/redirects.shared.test.tsapps/studio/redirects.shared.tsapps/studio/routes/project/$ref/settings/compute-and-disk.tsxapps/studio/state/shortcuts/registry/project-settings-nav.tsapps/studio/tests/pages/project/[ref]/settings/infrastructure.test.tsx
💤 Files with no reviewable changes (9)
- apps/studio/routes/project/$ref/settings/compute-and-disk.tsx
- apps/studio/.github/eslint-rule-baselines.json
- apps/studio/TANSTACK_MIGRATION.md
- apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.utils.tsx
- apps/studio/components/layouts/ProjectSettingsLayout/SettingsMenu.selfhosted.test.tsx
- apps/studio/pages/project/[ref]/settings/compute-and-disk.tsx
- apps/studio/components/interfaces/Settings/Infrastructure/Infrastructure.constants.ts
- apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx
- apps/studio/state/shortcuts/registry/project-settings-nav.ts
- align support admonition title with its observability link - rename onDatabaseSettingsAndInReadOnlyMode to shouldSuppressOnInfrastructurePage to match the route it now guards - extract getInfrastructurePath helper for the four hardcoded /settings/infrastructure links
Sweep the rest of the concrete /settings/infrastructure link literals onto the shared helper. Route-pattern matchers, redirect config, and test expectations keep their literals intentionally. Also drops the [ref]-templating in getResourceWarningCorrectionUrl in favor of building concrete paths directly.
alaister
left a comment
There was a problem hiding this comment.
Preview + local test — ✅ all pass
Tested this on both runtimes – the "How to test" list on the studio-staging preview (Next, with the /dashboard prefix), and the same checklist locally on TanStack after merging in latest master. Everything checks out on both:
| # | Test | Next (preview) | TanStack (local) |
|---|---|---|---|
| 1 | Infrastructure page: charts + Scaling/Compute size/Disk/Advanced sections in order | ✅ | ✅ |
| 2 | Service versions moved to General, gone from Infrastructure | ✅ | ✅ |
| 3 | /settings/compute-and-disk?upgrade=micro#disk redirect preserves query + hash |
✅ (server 308) | ✅ |
| 4 | Bare /settings/compute-and-disk redirect |
✅ | ✅ |
| 5 | Legacy #cpu / #ram / #disk_io anchors scroll correctly |
✅ | ✅ |
| 6 | Settings menu shows Infrastructure, no Compute and Disk entry | ✅ | ✅ |
| 7 | Charts render (real data on preview; error/empty/warning/critical states exercised locally via mocked responses – 75%/90% thresholds correct, error state doesn't break the form) | ✅ | ✅ |
| 8 | Form smoke: tier prices, disk size validation, sticky footer, review dialog open/cancel, clean reset | ✅ | ✅ |
| 9 | No new console errors | ✅ | ✅ |
Also fixed on the branch while testing:
- The two failing unit tests in
infrastructure.test.tsx– one was a timing bug in the test (Advanced section renders after the project query resolves), but the other caught a real a11y bug: the autoscale/IOPS/throughput inputs had no accessible name (labelhtmlFornever matched the input id). Fixed by passingid={field.name}on the inputs, same as DiskSizeField already does. - CodeRabbit feedback: stale support admonition title, renamed the banner suppression variable, and extracted a
getInfrastructurePathhelper (then swept all remaining literal links onto it).
Notes:
- The vitest suites from the test plan were run locally (infrastructure page, DiskManagement, redirects, ServiceVersions, banner utils – all green); CI on the latest push is still running as I write this.
- No side effects on staging – reused an existing project, nothing submitted or created.
The lowercase admonition shim was removed on master; this was the last test still mocking the old path.
Braintrust eval report
|
Follow-up to #48370, which merged the Compute and Disk settings page into Infrastructure and made `/settings/compute-and-disk` a permanent redirect. **Changed:** - Retargeted all 17 dashboard links from `/dashboard/project/_/settings/compute-and-disk` to `/dashboard/project/_/settings/infrastructure` (15 files across guides, troubleshooting entries, and the `migration_warnings` partial) - Updated link text that named the old page ("Compute and Disk settings" → "Infrastructure settings", plus one stale "Database Settings" label in the compute-and-disk guide) Links to the `/docs/guides/platform/compute-and-disk` docs guide are untouched — that page still exists; only dashboard deep links changed. > [!NOTE] > Best merged after #48370 — until then the Infrastructure page doesn't host the compute and disk config (the old URL keeps working either way via the redirect). ## To test - Spot-check a few changed pages on the preview (e.g. `/guides/platform/database-size`, `/guides/troubleshooting/high-cpu-usage`) and confirm the dashboard links land on the Infrastructure settings page - Confirm the compute-and-disk guide page itself still renders and its docs-internal links are unchanged <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Documentation** - Updated migration and troubleshooting guidance to direct users to the **Infrastructure** settings page, replacing outdated **Compute and Disk** links. - Refreshed platform/database/performance links for resizing, disk throughput/IOPS, upgrade steps, and related troubleshooting to use the updated **Infrastructure** routes and anchors. - Adjusted “Using the CLI” to point to the current local development getting-started page, and refined wording in the “Hit rate” section. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <[email protected]>
Summary
This is the final step in merging compute and disk with infrastructure to become a single place to manage everything. This moves everything we've done in compute and disk over to infrastructure along with redirects.
/settings/compute-and-diskredirect, removes its Next and TanStack routes, regenerates the route tree, and updates the migration checklist.#cpu.Stack
How to test
chore/infra-compute-3-cutover.pnpm dev:studio, then stop it and test TanStack withSTUDIO_FRAMEWORK=tanstack pnpm dev:studio./project/<ref>/settings/infrastructure. Confirm the page contains the usage charts and the Scaling, Compute, Disk, and Advanced configuration sections./project/<ref>/settings/general. Confirm Service Versions appears there with its existing name, content, and styling, and no longer appears on Infrastructure./project/<ref>/settings/compute-and-disk?upgrade=micro#disk. Confirm it permanently redirects to/project/<ref>/settings/infrastructure?upgrade=micro#disk, preserving the query string and hash.#cpu.Summary by CodeRabbit