Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(control-ui): hide Publisher tab when publisherUiEnabled is false

Jose Ramirezdfa2b04382fb
diff --git a/control-ui/components/__tests__/PublisherView.test.tsx b/control-ui/components/__tests__/PublisherView.test.tsx
index 4d0f5f10d..f9ad1ea5d 100644
--- a/control-ui/components/__tests__/PublisherView.test.tsx
+++ b/control-ui/components/__tests__/PublisherView.test.tsx
@@ -38,6 +38,16 @@ describe('PublisherView', () => {
expect(screen.getByText(/not available on this deployment/i)).toBeInTheDocument()
})
+ it('renders unavailable when publisherUiEnabled is false (self-hosted default), even for an org-bound non-curator deploy (fails closed)', () => {
+ vi.mocked(hook.usePublishScope).mockReturnValue({
+ scope: { scope: 'acme', curator: false, orgName: 'Acme', publisherUiEnabled: false },
+ loading: false,
+ error: false,
+ })
+ render(<PublisherView activeTab="entries" />)
+ expect(screen.getByText(/not available on this deployment/i)).toBeInTheDocument()
+ })
+
it('renders the owned-entries panel for an org-bound deploy on the entries tab', async () => {
vi.mocked(hook.usePublishScope).mockReturnValue({
scope: { scope: 'acme', curator: false, orgName: 'Acme' },
diff --git a/control-ui/components/__tests__/Sidebar.test.tsx b/control-ui/components/__tests__/Sidebar.test.tsx
index ea95284e1..21f8e1a03 100644
--- a/control-ui/components/__tests__/Sidebar.test.tsx
+++ b/control-ui/components/__tests__/Sidebar.test.tsx
@@ -23,6 +23,16 @@ describe('Sidebar publisher gating', () => {
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({
+ 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({
scope: { scope: null, curator: true, orgName: null },
diff --git a/control-ui/lib/api.ts b/control-ui/lib/api.ts
index 90f1596bc..cebf14c13 100644
--- a/control-ui/lib/api.ts
+++ b/control-ui/lib/api.ts
@@ -2521,6 +2521,9 @@ export type PublishScope = {
scope: string | null
curator: boolean
orgName: string | null
+ // Static config value (not registry-derived); absent/undefined is treated as
+ // enabled for backward compat with a control-api that doesn't send it yet.
+ publisherUiEnabled?: boolean
}
export async function getPublishScope(): Promise<PublishScope> {
diff --git a/control-ui/lib/hooks/__tests__/usePublishScope.test.tsx b/control-ui/lib/hooks/__tests__/usePublishScope.test.tsx
index dd77e4a40..5eccfb69f 100644
--- a/control-ui/lib/hooks/__tests__/usePublishScope.test.tsx
+++ b/control-ui/lib/hooks/__tests__/usePublishScope.test.tsx
@@ -34,6 +34,32 @@ describe('usePublishScope / isPublisherEnabled', () => {
expect(isPublisherEnabled(null)).toBe(false)
})
+ it('isPublisherEnabled: org-bound non-curator, publisherUiEnabled explicitly false → false', () => {
+ expect(
+ isPublisherEnabled({
+ scope: 'acme',
+ curator: false,
+ orgName: 'Acme',
+ publisherUiEnabled: false,
+ })
+ ).toBe(false)
+ })
+
+ it('isPublisherEnabled: org-bound non-curator, publisherUiEnabled explicitly true → true', () => {
+ expect(
+ isPublisherEnabled({
+ scope: 'acme',
+ curator: false,
+ orgName: 'Acme',
+ publisherUiEnabled: true,
+ })
+ ).toBe(true)
+ })
+
+ it('isPublisherEnabled: org-bound non-curator, publisherUiEnabled absent (backward compat) → true', () => {
+ expect(isPublisherEnabled({ scope: 'acme', curator: false, orgName: 'Acme' })).toBe(true)
+ })
+
it('resolves to enabled for an org-bound scope', async () => {
vi.mocked(api.getPublishScope).mockResolvedValue({
scope: 'acme',
diff --git a/control-ui/lib/hooks/usePublishScope.ts b/control-ui/lib/hooks/usePublishScope.ts
index c7a87d77e..203f088bb 100644
--- a/control-ui/lib/hooks/usePublishScope.ts
+++ b/control-ui/lib/hooks/usePublishScope.ts
@@ -40,9 +40,15 @@ export function usePublishScope(): PublishScopeState {
return state
}
-/** Publisher is available only for an org-bound, non-curator deploy. */
+/**
+ * Publisher is available only for an org-bound, non-curator deploy, and only
+ * when the control-api hasn't explicitly disabled the Publisher UI surface
+ * (self-hosted deployments default this off). `publisherUiEnabled` absent —
+ * an older control-api that doesn't send the field — is treated as enabled,
+ * preserving today's behavior.
+ */
export function isPublisherEnabled(
scope: PublishScope | null
): scope is PublishScope & { scope: string } {
- return !!scope && !scope.curator && scope.scope !== null
+ return !!scope && !scope.curator && scope.scope !== null && scope.publisherUiEnabled !== false
}