mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
## Summary - The Connection management "Allocation strategy" select on the Auth > Performance page called its `onValueChange` handler's conversion logic with whatever value it was given, with no validation. If that handler ever fired with a value outside the `'percent' | 'connections'` enum, it would silently overwrite a correctly loaded config, converting it to the wrong absolute connection count and leaving the strategy dropdown in a blank/inconsistent state. - Extracted the percent/connections conversion into a pure, unit-tested `convertPoolSize()` helper (`PerformanceSettingsForm.utils.ts`) and added a guard so `onValueChange` ignores any value that isn't a recognized allocation unit. ## How to test 1. Under **Connection management**, switch **Allocation strategy** back and forth between "Absolute number of connections" and "Percent of max connections" — the value should convert correctly each time and the dropdown should never render blank. 2. Save, then hard-reload the page — the saved strategy and value should persist as shown. ## Test plan - [x] `PerformanceSettingsForm.utils.test.ts` — unit tests covering both conversion directions, clamping, and the invalid-value guard - [x] `PerformanceSettingsForm.test.tsx` — MSW-backed component test verifying persisted percent/absolute configs render correctly on load - [x] `pnpm test:studio` - [x] `pnpm typecheck` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Switching database pool allocation strategies now automatically converts values between percentage and connection-based units. * Values are rounded and constrained appropriately to remain within supported limits. * Allocation settings now handle invalid or zero values more safely. * **Tests** * Added coverage verifying persisted allocation strategies and pool-size conversion behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->