Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): make the API-keys auth-disabled banner mode-aware
Jose Ramirez0e567c5bdd36
diff --git a/control-ui/components/RegistryApiKeysPanel.tsx b/control-ui/components/RegistryApiKeysPanel.tsxindex 0ab464ad8..727357a27 100644--- a/control-ui/components/RegistryApiKeysPanel.tsx+++ b/control-ui/components/RegistryApiKeysPanel.tsx@@ -7,6 +7,7 @@ import {type CreatedRegistryApiKey,type RegistryApiKey,createRegistryApiKey,+ getRegistryConnection,listRegistryApiKeys,revokeRegistryApiKey,} from '../lib/api'@@ -54,6 +55,16 @@ export default function RegistryApiKeysPanel() {const [view, setView] = useState<View>({ kind: 'loading' })const [creating, setCreating] = useState(false)const [revealed, setRevealed] = useState<string | null>(null)+ // The auth-disabled view needs mode-specific copy: self-hosted fixes it by+ // connecting, managed fixes it via CLERUM_REGISTRY_AUTH_ENABLED (no connect+ // flow exists there). Same best-effort detection RegistryCatalog uses for its+ // Connect button — getRegistryConnection() 409s not_self_hosted in managed+ // mode. Fail-open to 'self-hosted' (treat 'unknown' like RegistryCatalog does+ // via its `!== 'managed'` check) since a transient error here is far more+ // likely than a real managed deployment misreporting its own mode.+ const [connectionMode, setConnectionMode] = useState<'self-hosted' | 'managed' | 'unknown'>(+ 'unknown'+ )const load = useCallback(async () => {try {@@ -71,9 +82,19 @@ export default function RegistryApiKeysPanel() {}}, [])+ const loadConnectionMode = useCallback(async () => {+ try {+ await getRegistryConnection()+ setConnectionMode('self-hosted')+ } catch (e) {+ setConnectionMode((e as { code?: string }).code === 'not_self_hosted' ? 'managed' : 'unknown')+ }+ }, [])+useEffect(() => {void load()- }, [load])+ void loadConnectionMode()+ }, [load, loadConnectionMode])async function handleCreate(input: CreateRegistryApiKeyInput) {const created: CreatedRegistryApiKey = await createRegistryApiKey(input)@@ -138,8 +159,18 @@ export default function RegistryApiKeysPanel() {) : null}{view.kind === 'auth-disabled' ? (<p className="cu-banner cu-banner--info">- API keys become available once this deployment is connected to the registry.{' '}- <a href={CONTROL_ROUTES.marketplace.connect}>Connect to Evenfire Registry</a>.+ {connectionMode === 'managed' ? (+ <>+ Registry authentication for this deployment is controlled by{' '}+ <code>CLERUM_REGISTRY_AUTH_ENABLED</code>. An operator must enable it and restart+ control-api before API keys can be created here.+ </>+ ) : (+ <>+ API keys become available once this deployment is connected to the registry.{' '}+ <a href={CONTROL_ROUTES.marketplace.connect}>Connect to Evenfire Registry</a>.+ </>+ )}</p>) : null}{view.kind === 'error' ? (diff --git a/control-ui/components/__tests__/RegistryApiKeysPanel.test.tsx b/control-ui/components/__tests__/RegistryApiKeysPanel.test.tsxindex 52adc6c57..62f30ae48 100644--- a/control-ui/components/__tests__/RegistryApiKeysPanel.test.tsx+++ b/control-ui/components/__tests__/RegistryApiKeysPanel.test.tsx@@ -10,6 +10,7 @@ vi.mock('../../lib/api', () => ({listRegistryApiKeys: vi.fn(),createRegistryApiKey: vi.fn(),revokeRegistryApiKey: vi.fn(),+ getRegistryConnection: vi.fn(),}))vi.mock('../ConfirmDialog', () => ({@@ -68,15 +69,38 @@ describe('RegistryApiKeysPanel', () => {expect(await screen.findByText(/not bound to a registry org/i)).toBeInTheDocument()})- it('shows guidance to connect the registry on 409 registry_auth_disabled', async () => {+ // self-hosted: getRegistryConnection() resolves (it's only a 409 in managed).+ // Regression guard: the old env-var copy must NOT reappear on this branch —+ // scoped to self-hosted only, since the managed branch below legitimately+ // shows CLERUM_REGISTRY_AUTH_ENABLED again.+ it('self-hosted + 409 registry_auth_disabled → shows connect guidance, no env-var copy', async () => {vi.mocked(api.listRegistryApiKeys).mockRejectedValue(Object.assign(new Error('x'), { status: 409, code: 'registry_auth_disabled' }))+ vi.mocked(api.getRegistryConnection).mockResolvedValue({ state: 'disconnected' })render(<RegistryApiKeysPanel />)expect(await screen.findByText(/API keys become available once this deployment is connected/i)).toBeInTheDocument()expect(screen.getByRole('link', { name: /connect to evenfire registry/i })).toBeInTheDocument()+ expect(screen.queryByText(/CLERUM_REGISTRY_AUTH_ENABLED/)).toBeNull()+ })++ // managed: getRegistryConnection() 409s not_self_hosted (RegistryCatalog's own+ // mode-detection convention). Managed has no connect flow, so the banner must+ // point at the env var instead, and never link to the connect panel — that+ // panel tells a managed deployment there's nothing to configure (dead end).+ it('managed + 409 registry_auth_disabled → shows env-var guidance, no connect link', async () => {+ vi.mocked(api.listRegistryApiKeys).mockRejectedValue(+ Object.assign(new Error('x'), { status: 409, code: 'registry_auth_disabled' })+ )+ vi.mocked(api.getRegistryConnection).mockRejectedValue(+ Object.assign(new Error('x'), { code: 'not_self_hosted' })+ )+ render(<RegistryApiKeysPanel />)+ expect(await screen.findByText(/CLERUM_REGISTRY_AUTH_ENABLED/)).toBeInTheDocument()+ expect(screen.getByText(/an operator must enable it/i)).toBeInTheDocument()+ expect(screen.queryByRole('link', { name: /connect to evenfire registry/i })).toBeNull()})it('on create success, shows the reveal modal then refetches', async () => {diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 8ac83eda0..6d62431ec 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.358",+ "version": "0.1.359","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.358",+ "version": "0.1.359","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 4ce50a655..5afbcdb83 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.358",+ "version": "0.1.359","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",