mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix: accept inconsistent casing in incident regions (#43492)
Bug fix ## What is the current behavior? The `affected_regions` generated by the AI sometimes have inconsistent casing, causing validation to fail. ## What is the new behavior? The system now accepts `affected_regions` that match case-insensitively, allowing for variations in casing.
This commit is contained in:
1 parent
efa40ea0e4
commit
14b2af415f
2 files changed
+31
-1
No files matched your search
@@ -145,6 +145,21 @@ describe('shouldShowBanner', () => {
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('shows when affected region has inconsistent casing (AI-generated cache)', () => {
|
||||
expect(
|
||||
shouldShowBanner({
|
||||
incidents: [
|
||||
{
|
||||
id: 'test',
|
||||
cache: { affected_regions: ['US-East-1'], affects_project_creation: false },
|
||||
},
|
||||
],
|
||||
hasProjects: true,
|
||||
userRegions: new Set(['us-east-1']),
|
||||
})
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('does not show when user has no databases in any affected region', () => {
|
||||
expect(
|
||||
shouldShowBanner({
|
||||
@@ -280,6 +295,21 @@ describe('getRelevantIncidentIds', () => {
|
||||
).toEqual(expect.arrayContaining(['ap-southeast-1-only', 'eu-west-1-only']))
|
||||
})
|
||||
|
||||
it('returns the ID of a relevant incident when affected_regions has inconsistent casing', () => {
|
||||
expect(
|
||||
getRelevantIncidentIds({
|
||||
incidents: [
|
||||
{
|
||||
id: 'mixed-case-region',
|
||||
cache: { affected_regions: ['US-East-1'], affects_project_creation: false },
|
||||
},
|
||||
],
|
||||
hasProjects: true,
|
||||
userRegions: new Set(['us-east-1']),
|
||||
})
|
||||
).toEqual(['mixed-case-region'])
|
||||
})
|
||||
|
||||
it('excludes incidents irrelevant to the user from the result', () => {
|
||||
// User is in eu-west-1; us-east-1-only incident should not be included
|
||||
expect(
|
||||
|
||||
@@ -40,7 +40,7 @@ export function shouldShowBanner({
|
||||
if (hasUnknownRegions) return true
|
||||
|
||||
// Region restriction: only show if the user has a database in an affected region
|
||||
return affectedRegions.some((region) => userRegions.has(region))
|
||||
return affectedRegions.some((region) => userRegions.has(region.toLowerCase()))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user