Skip to content

Commit bf17bb9

Browse files
authored
fix: resolve CI failures on develop (lint, test, DDL) (#1549)
1 parent b603eff commit bf17bb9

3 files changed

Lines changed: 30 additions & 28 deletions

File tree

frontend/src/components/routing.tsx

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ReactNode } from 'react'
1+
import { useEffect, type ReactNode } from 'react'
22
import { Navigate, useLocation } from 'react-router-dom'
33
import { useAuth } from '@/contexts/auth-context'
44
import { useTenantContext } from '@/contexts/tenant-context'
@@ -79,33 +79,32 @@ export function TenantSubdomainEnforcer({ children }: { children: ReactNode }) {
7979
const { pathname, search, hash } = useLocation()
8080
const { tenantSlug } = useTenantContext()
8181

82-
// Skip in local dev — subdomains don't work on localhost
83-
if (isLocalDev()) {
84-
return <>{children}</>
85-
}
86-
87-
// Already on a tenant subdomain — no redirect needed
88-
if (isOnTenantSubdomain()) {
89-
return <>{children}</>
90-
}
91-
92-
// Platform routes stay on root domain
93-
if (isPlatformPath(pathname)) {
94-
return <>{children}</>
95-
}
96-
97-
// Tenant-scoped route on root domain with a tenant selected → redirect
98-
if (tenantSlug) {
99-
const parsed = new URL(apiConfig.baseUrl)
100-
const target = new URL(window.location.href)
101-
target.hostname = `${tenantSlug}.${parsed.hostname}`
102-
target.pathname = pathname
103-
target.search = search
104-
target.hash = hash
105-
window.location.href = target.toString()
82+
// Compute redirect URL only when needed: not local dev, not already on
83+
// subdomain, not a platform path, and a tenant is selected.
84+
const needsRedirect =
85+
!isLocalDev() && !isOnTenantSubdomain() && !isPlatformPath(pathname) && !!tenantSlug
86+
87+
const redirectUrl = needsRedirect
88+
? (() => {
89+
const parsed = new URL(apiConfig.baseUrl)
90+
const target = new URL(window.location.href)
91+
target.hostname = `${tenantSlug}.${parsed.hostname}`
92+
target.pathname = pathname
93+
target.search = search
94+
target.hash = hash
95+
return target.toString()
96+
})()
97+
: null
98+
99+
useEffect(() => {
100+
if (redirectUrl) {
101+
window.location.assign(redirectUrl)
102+
}
103+
}, [redirectUrl])
104+
105+
if (redirectUrl) {
106106
return null
107107
}
108108

109-
// No tenant selected — show content (DevTenantAutoSelector may still be loading)
110109
return <>{children}</>
111110
}

frontend/src/features/cookbook/pages/detail.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ vi.mock('../hooks/use-cookbook', () => ({
3838
useCookbook: () => mockUseCookbook(),
3939
}))
4040

41-
const mockUsePatternFiles = vi.fn<() => { starlarkFiles: Array<{ name: string; content: string }>; manifestContent: string | null; hasSagas: boolean; isLoading: false }>()
41+
const mockUsePatternFiles = vi.fn<() => { starlarkFiles: Array<{ name: string; content: string }>; manifestContent: string | null; manifestSagas: Array<{ name: string; trigger?: string; filter?: string }>; hasSagas: boolean; isLoading: false }>()
4242
vi.mock('../hooks/use-pattern-files', () => ({
4343
usePatternFiles: () => mockUsePatternFiles(),
4444
}))
@@ -82,7 +82,7 @@ describe('CookbookDetailPage', () => {
8282
beforeEach(() => {
8383
vi.clearAllMocks()
8484
mockUseCookbook.mockReturnValue({ items: [patternItem, uiItem], isLoading: false })
85-
mockUsePatternFiles.mockReturnValue({ starlarkFiles: [], manifestContent: null, hasSagas: false, isLoading: false as const })
85+
mockUsePatternFiles.mockReturnValue({ starlarkFiles: [], manifestContent: null, manifestSagas: [], hasSagas: false, isLoading: false as const })
8686
})
8787

8888
it('shows loading skeleton while catalogue is loading', () => {
@@ -141,6 +141,7 @@ describe('CookbookDetailPage', () => {
141141
mockUsePatternFiles.mockReturnValue({
142142
starlarkFiles: [{ name: 'saga.star', content: 'def execute(): pass' }],
143143
manifestContent: 'name: test',
144+
manifestSagas: [],
144145
hasSagas: true,
145146
isLoading: false as const,
146147
})
@@ -177,6 +178,7 @@ describe('CookbookDetailPage', () => {
177178
mockUsePatternFiles.mockReturnValue({
178179
starlarkFiles: [],
179180
manifestContent: 'name: test\ntype: registry:pattern',
181+
manifestSagas: [],
180182
hasSagas: false,
181183
isLoading: false as const,
182184
})

services/control-plane/internal/manifest/repository_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const manifestVersionsDDL = `CREATE TABLE IF NOT EXISTS %s.manifest_versions (
2222
apply_status VARCHAR(20) NOT NULL DEFAULT 'APPLIED',
2323
apply_job_id UUID,
2424
diff_summary TEXT,
25+
relationship_graph JSONB,
2526
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
2627
CONSTRAINT valid_apply_status CHECK (apply_status IN ('APPLIED', 'FAILED', 'ROLLED_BACK'))
2728
)`

0 commit comments

Comments
 (0)