Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge branch 'dev' into perf-keep-authenticated-UI-shells-mounted
Josué59ff94122024
diff --cc control-api/package-lock.jsonindex 64b831807,f52b8d497..bb7007cdb--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@@ -1,12 -1,12 +1,12 @@@{"name": "clerum-control-api",- "version": "0.1.400",- "version": "0.1.398",++ "version": "0.1.401","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.400",- "version": "0.1.398",++ "version": "0.1.401","dependencies": {"@clerum/image-policy": "file:../packages/image-policy","@clerum/llm-providers": "file:../packages/llm-providers",diff --cc control-api/package.jsonindex 377f347ea,a85e64e68..4099c1caa--- a/control-api/package.json+++ b/control-api/package.json@@@ -1,6 -1,6 +1,6 @@@{"name": "clerum-control-api",- "version": "0.1.400",- "version": "0.1.398",++ "version": "0.1.401","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --cc control-ui/app/registry/entries/[name]/[version]/page.tsxindex 0b10826ca,81519987d..8ee6daaf5--- a/control-ui/app/registry/entries/[name]/[version]/page.tsx+++ b/control-ui/app/registry/entries/[name]/[version]/page.tsx@@@ -20,8 -21,8 +20,9 @@@ importgetRegistryCatalog,installRecipeFromRegistry,} from '@lib/api'+ import { useRegistryCapability } from '@lib/hooks/useRegistryCapability'import { trustBgColor, trustColor } from '@lib/trustLevel'+import RegistryEntryDetailLoading from './loading'export const dynamic = 'force-dynamic'diff --cc control-ui/app/workflow-recipes/page.tsxindex faf73db71,4b67a6aed..903eb54e2--- a/control-ui/app/workflow-recipes/page.tsx+++ b/control-ui/app/workflow-recipes/page.tsx@@@ -1,16 -1,14 +1,11 @@@'use client'- import { Suspense, useEffect, useRef, useState } from 'react'+ import { Suspense, useEffect, useState } from 'react'import { useRouter, useSearchParams } from 'next/navigation'- import { CreateFlowSkeleton } from '@components/CreateFlowSkeleton'- import { CreatePageHeader } from '@components/CreatePageHeader'-import { useAuth } from '@components/AuthContext'import { DashboardLayout } from '@components/DashboardLayout'- import { RecipeEditor } from '@components/RecipeEditor'-import { LoadingScreen } from '@components/LoadingScreen'import { RecipesTab } from '@components/RecipesTab'- import { IconWorkflow } from '@components/Sidebar/icons'- import { CREATE_FLOW_LOADING } from '@constants/createFlowLoading'import { CONTROL_ROUTES } from '@constants/routes'import { isSilentApiError } from '@lib/api'-import { buildControlUiLoginPath, getCurrentControlUiPath } from '@lib/authRedirect'import { useRecipePolling } from '@lib/hooks/useRecipePolling'export const dynamic = 'force-dynamic'@@@ -42,11 -27,8 +37,8 @@@ function WorkflowRecipesPageContent()const searchParams = useSearchParams()const [pageError, setPageError] = useState('')- const [installerOpen, setInstallerOpen] = useState(false)- const [installerStarting, setInstallerStarting] = useState(false)- const installerTimerRef = useRef<number | null>(null)const { recipes, loading, error, refresh } = useRecipePolling({- enabled: authState.isLoggedIn && !authState.isLoading,+ enabled: true,onError: fetchError => {if (!isSilentApiError(fetchError)) returnsetPageError('')@@@ -64,72 -47,31 +56,17 @@@params.set('entry', entry)params.set('version', version)router.replace(CONTROL_ROUTES.marketplace.install(Object.fromEntries(params)))- }, [authState.isLoggedIn, searchParams, router])-- useEffect(() => {- if (!authState.isLoading && !authState.isLoggedIn) {- router.replace(buildControlUiLoginPath(getCurrentControlUiPath()))- }- }, [authState.isLoading, authState.isLoggedIn, router])-- if (authState.isLoading) {- return <LoadingScreen />- }-- if (!authState.isLoggedIn) {- return null- }+ }, [searchParams, router])- useEffect(() => {- if (!installerStarting) return- // Keep the skeleton visible briefly so the install drawer transition can settle- // before the heavier installer content renders, avoiding a one-frame layout flash.- installerTimerRef.current = window.setTimeout(() => {- setInstallerOpen(true)- setInstallerStarting(false)- installerTimerRef.current = null- }, 120)- return () => {- if (installerTimerRef.current !== null) {- window.clearTimeout(installerTimerRef.current)- installerTimerRef.current = null- }- }- }, [installerStarting])-return (- <DashboardLayout isDetailPage={installerOpen || installerStarting}>- {installerStarting ? (- <CreateFlowSkeleton- {...CREATE_FLOW_LOADING.installPlugin}- onBack={() => {- setPageError('')- setInstallerStarting(false)- }}- backDisabled={false}- />- ) : installerOpen ? (- <RecipeEditor- onSaved={() => {- setPageError('')- setInstallerOpen(false)- void refresh()- }}- onCancel={() => {- setPageError('')- setInstallerOpen(false)- }}- pageHeader={- <CreatePageHeader- icon={<IconWorkflow />}- title="Install Plugin"- subtitle="Prepare a plugin manifest, validate policy, and deploy it."- backLabel="Back to plugins"- onBack={() => {- setPageError('')- setInstallerOpen(false)- }}- />- }- />- ) : (- <RecipesTab- items={recipes}- loading={loading}- error={surfaceError}- onInstall={() => {- setPageError('')- setInstallerStarting(true)- }}- onRefresh={refresh}- />- )}+ <DashboardLayout>+ <RecipesTab+ items={recipes}+ loading={loading}+ error={surfaceError}+ onInstall={() => router.push(CONTROL_ROUTES.marketplace.orgEntries)}+ onRefresh={refresh}+ /></DashboardLayout>)}diff --cc control-ui/components/AuthContext.tsxindex 5b7e633ac,b497da826..24322ad45--- a/control-ui/components/AuthContext.tsx+++ b/control-ui/components/AuthContext.tsx@@@ -20,7 -12,7 +20,8 @@@ importsetGlobalAuthErrorHandler,} from '../lib/api'import { buildControlUiLoginPath, getCurrentControlUiPath } from '../lib/authRedirect'+import { resetPublishScopeCache } from '../lib/hooks/usePublishScope'+ import { invalidateRegistryCapabilityCache } from '../lib/hooks/useRegistryCapability'import { useToast } from './Toast'type AuthState = {@@@ -56,11 -48,10 +57,12 @@@ export function AuthProvider({ childre// this singleton registration tied to them if either provider is remounted.useEffect(() => {const handleAuthError = () => {- setAuthState({ id: '', isLoggedIn: false, isLoading: false, username: '', email: '' })- router.replace(buildControlUiLoginPath(getCurrentControlUiPath()))if (sessionExpiredToastShownRef.current) returnsessionExpiredToastShownRef.current = true+ resetPublishScopeCache()++ invalidateRegistryCapabilityCache()+ setAuthState({ id: '', isLoggedIn: false, isLoading: false, username: '', email: '' })+ router.replace(buildControlUiLoginPath(getCurrentControlUiPath()))showToast('Session expired. Please sign in again.', { tone: 'error' })}setGlobalAuthErrorHandler(handleAuthError)@@@ -95,7 -85,6 +97,8 @@@const login = useCallback(async (username: string, password: string): Promise<AdminLoginResponse> => {const result = await loginControlUI(username, password)+ resetPublishScopeCache()++ invalidateRegistryCapabilityCache()sessionExpiredToastShownRef.current = falsesetAuthState({id: result.me.id,@@@ -113,8 -102,10 +116,11 @@@try {await logoutControlUI()} finally {+ resetPublishScopeCache(authState.id)sessionExpiredToastShownRef.current = false+ // Drop the module-level registry-capability cache so a same-tab+ // logout→login doesn't serve the previous user's org identity.+ invalidateRegistryCapabilityCache()setAuthState({ id: '', isLoggedIn: false, isLoading: false, username: '', email: '' })router.replace(CONTROL_ROUTES.login)}diff --cc control-ui/components/PublisherView/OwnedEntries.tsxindex 9bc033edf,4df270318..1f307ef04--- a/control-ui/components/PublisherView/OwnedEntries.tsx+++ b/control-ui/components/PublisherView/OwnedEntries.tsx@@@ -1,10 -1,20 +1,21 @@@'use client'- import React, { useCallback, useEffect, useState } from 'react'- import { type OwnedRegistryEntry, getOwnedRegistryEntries } from '../../lib/api'+ import React, { Fragment, useCallback, useEffect, useState } from 'react'+ import { useRouter } from 'next/navigation'+ import { IconChevronRight } from '@components/icons'+ import { CONTROL_ROUTES } from '@constants/routes'+ import {+ type OwnedRegistryEntry,+ deleteRegistryEntry,+ getOwnedRegistryEntries,+ getRegistryCatalog,+ } from '../../lib/api'+ import { useConfirmDialog } from '../ConfirmDialog'+ import { type RowAction, RowActionsMenu } from '../RowActionsMenu'+import { SectionLoadingSkeleton } from '../SectionLoadingSkeleton'import { TableHeaderRow } from '../TableHeaderRow'import type { TableHeaderColumn } from '../TableHeaderRow/types'+ import { useToast } from '../Toast'import { Button } from '../ui'import { GrantAccessModal } from './GrantAccessModal'import { RetryBanner } from './RetryBanner'@@@ -59,9 -138,64 +139,66 @@@ export function OwnedEntries(void load()}, [load])+ const handleRemove = useCallback(+ async (e: OwnedRegistryEntry) => {+ const ok = await confirm({+ title: 'Remove from Marketplace',+ message: `Remove ${e.name} v${e.version} from the Marketplace? Already-installed copies stay running. This cannot be undone.`,+ confirmLabel: 'Remove',+ tone: 'danger',+ })+ if (!ok) return+ try {+ await deleteRegistryEntry(e.name, e.version)+ showToast(`Removed ${e.name} v${e.version} from the Marketplace.`, { tone: 'success' })+ await load()+ } catch {+ showToast(`Could not remove ${e.name}.`, { tone: 'error' })+ }+ },+ [confirm, showToast, load]+ )++ const toggleExpanded = useCallback((name: string) => {+ setExpandedNames(prev => {+ const next = new Set(prev)+ if (next.has(name)) next.delete(name)+ else next.add(name)+ return next+ })+ }, [])++ function isInstalled(e: OwnedRegistryEntry): boolean {+ const kind = e.entry_type ?? (e.serverMode != null ? 'mcp-server' : 'recipe')+ const key = `${e.name}@${e.version}`+ if (kind === 'mcp-server') {+ return installedCatalogKeys.has(key) || installedServerNames.has(e.name)+ }+ return installedRecipeKeys.has(key)+ }++ function renderInstall(e: OwnedRegistryEntry) {+ return isInstalled(e) ? (+ <Button type="button" variant="ghost" size="sm" disabled>+ Installed+ </Button>+ ) : (+ <Button+ type="button"+ variant="primary"+ size="sm"+ onClick={() =>+ router.push(CONTROL_ROUTES.marketplace.install({ entry: e.name, version: e.version }))+ }+ >+ Install+ </Button>+ )+ }+- if (loading) return <p>Loading your published entries…</p>+ if (loading) {+ return <SectionLoadingSkeleton label="Loading published entries" />+ }if (error) {return (<RetryBanner message="Could not load your published entries." onRetry={() => void load()} />diff --cc control-ui/components/RegistryConnectPanel.tsxindex 7db41bc65,c823225ea..695c388f9--- a/control-ui/components/RegistryConnectPanel.tsx+++ b/control-ui/components/RegistryConnectPanel.tsx@@@ -1,8 -1,9 +1,10 @@@'use client'import { useCallback, useEffect, useState } from 'react'+ import { useRouter } from 'next/navigation'+ import { CONTROL_ROUTES } from '@constants/routes'import {+ type RegistryConnectionStatus,type RegistryRecoveryError,disconnectRegistryConnection,getRegistryConnection,@@@ -34,49 -33,10 +36,50 @@@ type View| { kind: 'not-self-hosted' }| { kind: 'error' }+function viewForRegistryStatus(s: RegistryConnectionStatus): View {+ if (s.state === 'connected') {+ return { kind: 'connected', org: s.org, authEnabled: s.authEnabled }+ }+ if (s.state === 'connecting') {+ return {+ kind: 'connecting',+ deploymentId: s.deploymentId,+ requestedOrgName: s.requestedOrgName,+ authEnabled: s.authEnabled,+ recoveryError: s.recoveryError,+ }+ }+ if (s.state === 'approved') {+ return {+ kind: 'approved',+ deploymentId: s.deploymentId,+ requestedOrgName: s.requestedOrgName,+ }+ }+ if (s.state === 'rejected') return { kind: 'rejected', requestedOrgName: s.requestedOrgName }+ if (s.state === 'pending') {+ return {+ kind: 'pending',+ deploymentId: s.deploymentId,+ requestedOrgName: s.requestedOrgName,+ }+ }+ if (s.state === 'disconnected') return { kind: 'request' }++ const never: never = s.state+ void never+ return { kind: 'error' }+}++function viewNeedsPublishScopeResync(view: View): boolean {+ return view.kind === 'connected' || view.kind === 'request'+}+export default function RegistryConnectPanel() {const { showToast } = useToast()+ const router = useRouter()const { confirm, confirmDialog } = useConfirmDialog()+ const { refresh: refreshPublishScope } = usePublishScope()const [view, setView] = useState<View>({ kind: 'loading' })// request-form fieldsconst [orgName, setOrgName] = useState('')@@@ -309,45 -285,10 +313,12 @@@return (<section><div className="cu-card cu-card--viewport-fill">- <TablePanelHeader- title="Connect to Evenfire Registry"- actions={- view.kind === 'connected' ? (- <Button- type="button"- variant="danger"- size="sm"- onClick={() => void handleDisconnect()}- >- Disconnect- </Button>- ) : null- }- />+ <TablePanelHeader title="Connect to Evenfire Registry" /><div className="cu-card__body">- {view.kind === 'loading' ? <p>Loading…</p> : null}+ {view.kind === 'loading' ? (+ <SectionLoadingSkeleton label="Loading registry connection" rows={3} />+ ) : null}{view.kind === 'not-self-hosted' ? (<p className="cu-banner">diff --cc control-ui/components/__tests__/OwnedEntries.test.tsxindex 015d280d2,649131eb4..81aee34fc--- a/control-ui/components/__tests__/OwnedEntries.test.tsx+++ b/control-ui/components/__tests__/OwnedEntries.test.tsx@@@ -19,19 -34,14 +34,24 @@@ function render(ui: React.ReactNode)return rtlRender(<ToastProvider>{ui}</ToastProvider>)}afterEach(cleanup)- beforeEach(() => vi.clearAllMocks())+ beforeEach(() => {+ vi.clearAllMocks()+ confirmMock.mockResolvedValue(false)+ // Default: nothing installed, so entries show the Install CTA.+ vi.mocked(api.getRegistryCatalog).mockResolvedValue(EMPTY_INSTALLED as never)+ })describe('OwnedEntries', () => {+ it('renders a skeleton while owned entries load', () => {+ vi.mocked(api.getOwnedRegistryEntries).mockReturnValue(+ new Promise(() => undefined) as ReturnType<typeof api.getOwnedRegistryEntries>+ )+ const view = render(<OwnedEntries orgScope="acme" />)+ expect(screen.getByRole('status', { name: /loading published entries/i })).toBeInTheDocument()+ expect(screen.queryByText(/Loading your published entries/i)).toBeNull()+ expect(view.container.querySelectorAll('.cu-skeleton').length).toBeGreaterThan(0)+ })+it('renders owned entries with visibility + status', async () => {vi.mocked(api.getOwnedRegistryEntries).mockResolvedValue({data: [diff --cc control-ui/components/__tests__/RegistryConnectPanel.test.tsxindex 7d1af243e,511c4b5d2..758a62bc7--- a/control-ui/components/__tests__/RegistryConnectPanel.test.tsx+++ b/control-ui/components/__tests__/RegistryConnectPanel.test.tsx@@@ -18,19 -14,9 +18,21 @@@ vi.mock('../../lib/api', () => (disconnectRegistryConnection: vi.fn(),recoverRegistryConnection: vi.fn(),}))+vi.mock('../../lib/hooks/usePublishScope', async orig => {+ const actual = await orig<typeof import('../../lib/hooks/usePublishScope')>()+ return {+ ...actual,+ usePublishScope: () => ({+ scope: null,+ loading: false,+ error: false,+ refresh: publishScopeMocks.refresh,+ }),+ }+})vi.mock('../ConfirmDialog', () => ({ useConfirmDialog: vi.fn() }))+ const { mockPush } = vi.hoisted(() => ({ mockPush: vi.fn() }))+ vi.mock('next/navigation', () => ({ useRouter: () => ({ push: mockPush }) }))function render(ui: React.ReactNode) {return rtlRender(<ToastProvider>{ui}</ToastProvider>)@@@ -570,135 -553,4 +590,124 @@@ describe('RegistryConnectPanel', () =>await screen.findByRole('button', { name: /finish connecting/i })expect(screen.queryByRole('button', { name: /^disconnect$/i })).toBeNull()})+- it('refreshes publish scope after disconnecting an active connection', async () => {++ it('does not offer active disconnect and routes connected users to their organization', async () => {+ vi.mocked(api.getRegistryConnection).mockResolvedValue({+ state: 'connected',+ deploymentId: 'd',+ org: 'acme',+ })+ render(<RegistryConnectPanel />)- await userEvent.click(await screen.findByRole('button', { name: /^disconnect$/i }))- await waitFor(() => expect(api.disconnectRegistryConnection).toHaveBeenCalledTimes(1))- expect(publishScopeMocks.refresh).toHaveBeenCalledTimes(1)- expect(publishScopeMocks.refresh).toHaveBeenCalledWith({ force: true })- expect(screen.getByText('Request registration')).toBeInTheDocument()++ await screen.findByText(/Connected to the Evenfire Registry/)++++ expect(screen.queryByRole('button', { name: /^disconnect$/i })).toBeNull()++ await userEvent.click(screen.getByRole('button', { name: /go to your organization/i }))++ expect(mockPush).toHaveBeenCalledWith('/marketplace/org/entries')++ expect(api.disconnectRegistryConnection).not.toHaveBeenCalled()++ expect(publishScopeMocks.refresh).not.toHaveBeenCalled()+ })++ it('refreshes publish scope after starting over from a rejected request', async () => {+ vi.mocked(api.getRegistryConnection).mockResolvedValue({+ state: 'rejected',+ deploymentId: 'd',+ requestedOrgName: 'acme',+ })+ render(<RegistryConnectPanel />)+ await userEvent.click(await screen.findByRole('button', { name: /start over/i }))+ await waitFor(() => expect(api.disconnectRegistryConnection).toHaveBeenCalledTimes(1))+ expect(publishScopeMocks.refresh).toHaveBeenCalledWith({ force: true })+ expect(screen.getByText('Request registration')).toBeInTheDocument()+ })+- it('does not force-refresh publish scope when disconnect fails', async () => {- vi.mocked(api.getRegistryConnection).mockResolvedValue({- state: 'connected',- deploymentId: 'd',- org: 'acme',- })- vi.mocked(api.disconnectRegistryConnection).mockRejectedValue(new Error('nope'))- render(<RegistryConnectPanel />)- await userEvent.click(await screen.findByRole('button', { name: /^disconnect$/i }))- await waitFor(() => expect(api.disconnectRegistryConnection).toHaveBeenCalledTimes(1))- expect(publishScopeMocks.refresh).not.toHaveBeenCalled()- })-+ it('refreshes publish scope after already_connected re-sync returns connected', async () => {+ const events: string[] = []+ vi.mocked(api.getRegistryConnection)+ .mockImplementationOnce(async () => {+ events.push('initial-load')+ return { state: 'disconnected' }+ })+ .mockImplementationOnce(async () => {+ events.push('resync-load')+ return { state: 'connected', deploymentId: 'd', org: 'acme' }+ })+ vi.mocked(api.requestRegistryConnection).mockRejectedValue(+ Object.assign(new Error('x'), { code: 'already_connected' })+ )+ publishScopeMocks.refresh.mockImplementationOnce(async options => {+ events.push(`refresh:${JSON.stringify(options)}`)+ return null+ })++ render(<RegistryConnectPanel />)+ await userEvent.type(await screen.findByLabelText(/organization/i), 'acme')+ await userEvent.type(screen.getByLabelText(/email/i), '[email protected]')+ await userEvent.click(screen.getByRole('button', { name: /request registration/i }))++ expect(await screen.findByText(/Connected to the Evenfire Registry.*@acme/)).toBeInTheDocument()+ expect(events).toEqual(['initial-load', 'resync-load', 'refresh:{"force":true}'])+ expect(publishScopeMocks.refresh).toHaveBeenCalledWith({ force: true })+ })++ it('refreshes publish scope after not_pending re-sync returns disconnected', async () => {+ vi.mocked(api.getRegistryConnection)+ .mockResolvedValueOnce({+ state: 'approved',+ deploymentId: 'd',+ requestedOrgName: 'acme',+ })+ .mockResolvedValueOnce({ state: 'disconnected' })+ vi.mocked(api.submitRegistryClaim).mockRejectedValue(+ Object.assign(new Error('x'), { code: 'not_pending' })+ )++ render(<RegistryConnectPanel />)+ await userEvent.type(await screen.findByLabelText(/claim token/i), 'tok-1')+ await userEvent.click(screen.getByRole('button', { name: /complete connection/i }))++ await waitFor(() => expect(api.getRegistryConnection).toHaveBeenCalledTimes(2))+ expect(screen.getByText('Request registration')).toBeInTheDocument()+ expect(publishScopeMocks.refresh).toHaveBeenCalledWith({ force: true })+ })++ it('does not force-refresh publish scope when already_connected re-sync fails', async () => {+ vi.mocked(api.getRegistryConnection)+ .mockResolvedValueOnce({ state: 'disconnected' })+ .mockRejectedValueOnce(new Error('load failed'))+ vi.mocked(api.requestRegistryConnection).mockRejectedValue(+ Object.assign(new Error('x'), { code: 'already_connected' })+ )++ render(<RegistryConnectPanel />)+ await userEvent.type(await screen.findByLabelText(/organization/i), 'acme')+ await userEvent.type(screen.getByLabelText(/email/i), '[email protected]')+ await userEvent.click(screen.getByRole('button', { name: /request registration/i }))++ await waitFor(() => expect(api.getRegistryConnection).toHaveBeenCalledTimes(2))+ expect(publishScopeMocks.refresh).not.toHaveBeenCalled()+ })++ it('refreshes publish scope after not_recoverable re-sync returns connected', async () => {+ vi.mocked(api.getRegistryConnection)+ .mockResolvedValueOnce({+ state: 'connecting',+ deploymentId: 'dep-1',+ requestedOrgName: 'acme',+ })+ .mockResolvedValueOnce({+ state: 'connected',+ deploymentId: 'dep-1',+ org: 'acme',+ authEnabled: true,+ })+ vi.mocked(api.recoverRegistryConnection).mockRejectedValue(+ Object.assign(new Error('x'), { code: 'not_recoverable' })+ )++ render(<RegistryConnectPanel />)+ await userEvent.click(await screen.findByRole('button', { name: /finish connecting/i }))++ expect(await screen.findByText(/Connected to the Evenfire Registry.*@acme/)).toBeInTheDocument()+ expect(publishScopeMocks.refresh).toHaveBeenCalledWith({ force: true })+ })})diff --cc control-ui/components/__tests__/Sidebar.test.tsxindex c3e7a63f2,c6027050f..206a75e2b--- a/control-ui/components/__tests__/Sidebar.test.tsx+++ b/control-ui/components/__tests__/Sidebar.test.tsx@@@ -28,49 -23,16 +28,18 @@@ afterEach(() =>beforeEach(() => vi.clearAllMocks())describe('Sidebar publisher gating', () => {- it('shows the Publisher entry for an org-bound non-curator deploy', async () => {+ it('does not render a Publisher entry (folded into the Marketplace org tab)', () => {- vi.mocked(hook.usePublishScope).mockReturnValue({- scope: { scope: 'acme', curator: false, orgName: 'Acme' },- loading: false,- error: false,- })+ vi.mocked(hook.usePublishScope).mockReturnValue(+ publishScopeState({+ scope: { scope: 'acme', curator: false, orgName: 'Acme' },+ loading: false,+ error: false,+ })+ )render(<Sidebar currentTab="hosts" />)- const link = await screen.findByRole('link', { name: /publisher/i })- expect(link).toHaveAttribute('href', '/publisher')- })-- it('hides the Publisher entry when publisherUiEnabled is false (self-hosted default), even for an org-bound non-curator deploy', () => {- vi.mocked(hook.usePublishScope).mockReturnValue(- publishScopeState({- scope: { scope: 'acme', curator: false, orgName: 'Acme', publisherUiEnabled: false },- loading: false,- error: false,- })- )- render(<Sidebar currentTab="hosts" />)- expect(screen.queryByRole('link', { name: /publisher/i })).toBeNull()- })-- it('hides the Publisher entry on a curator deploy', () => {- vi.mocked(hook.usePublishScope).mockReturnValue(- publishScopeState({- scope: { scope: null, curator: true, orgName: null },- loading: false,- error: false,- })- )- render(<Sidebar currentTab="hosts" />)- expect(screen.queryByRole('link', { name: /publisher/i })).toBeNull()- })-- it('hides the Publisher entry while publish-scope is loading', () => {- vi.mocked(hook.usePublishScope).mockReturnValue(- publishScopeState({ scope: null, loading: true, error: false })- )- render(<Sidebar currentTab="hosts" />)+ // Publisher was folded into the org-named Marketplace tab (design spec §4).expect(screen.queryByRole('link', { name: /publisher/i })).toBeNull()+ expect(screen.getByRole('link', { name: /marketplace/i })).toBeInTheDocument()})it('still renders the other navigation entries', () => {