From f9a67d30ae0df26bff43f824ac12610fb1550939 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Tue, 27 Oct 2026 19:17:24 +0000 Subject: [PATCH 1/2] fix(settings): admit Members when the server says the actor can manage them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Workspace section and the Members entry inside it were gated on two different axes. The section needs only a login; Members needed isCloud, which is __DISTRIBUTION__ statically replaced at build and unable to change at runtime. A user signed in to a Cloud workspace from a non-Cloud bundle therefore got the Workspace section and Plan & Credits — their real Cloud billing — with Members absent by construction, so an owner could not reach member management at all. FE-3618 is that state. The server already decides this and publishes it as can_manage_members, which the panel itself consumes; only the nav entry ignored it. Admit the entry when either holds. Keeping isCloud rather than replacing it matters: viewing the roster is gated on membersLoaded, not on can_manage_members, so Cloud members who are not owners see a read-only list today. Gating the entry on the capability alone would have taken that away from them. --- .../settings/composables/useSettingUI.test.ts | 20 +++++++++++++++++++ .../settings/composables/useSettingUI.ts | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/platform/settings/composables/useSettingUI.test.ts b/src/platform/settings/composables/useSettingUI.test.ts index b0d88343b0b..fc592556889 100644 --- a/src/platform/settings/composables/useSettingUI.test.ts +++ b/src/platform/settings/composables/useSettingUI.test.ts @@ -10,6 +10,8 @@ import { createI18n } from 'vue-i18n' import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useSettingStore } from '@/platform/settings/settingStore' import type { SettingTreeNode } from '@/platform/settings/composables/useSettingSearch' +import { useBillingCapabilities } from '@/platform/billing/composables/useBillingCapabilities' +import { receiveServerFact } from '@/platform/serverFacts/serverFact' import { useWorkspaceUI } from '@/platform/workspace/composables/useWorkspaceUI' import { useSettingUI as useSettingUIComposable } from './useSettingUI' @@ -49,6 +51,7 @@ vi.mock(import('@/platform/distribution/types'), () => ({ })) vi.mock(import('@/platform/workspace/composables/useWorkspaceUI')) +vi.mock(import('@/platform/billing/composables/useBillingCapabilities')) interface MockSettingParams { id: string @@ -271,6 +274,23 @@ describe('useSettingUI', () => { expect(findPanelByKey('workspace-allowlist')).toBeNull() }) + it('shows Members off Cloud when the server says the actor can manage them', () => { + env.state.isCloud = false + vi.mocked(useBillingCapabilities()).canManageMembers = computed(() => + receiveServerFact('can_manage_members', true) + ) + + const { navGroups } = useSettingUI() + const workspaceItems = navGroups.value + .find((group) => group.title === 'Workspace') + ?.items.map(({ id, label }) => ({ id, label })) + + expect(workspaceItems).toEqual([ + { id: 'workspace', label: 'PlanCredits' }, + { id: 'workspace-members', label: 'Members' } + ]) + }) + it('mounts the Billing tab on local when unified billing settings is on', () => { env.state.isCloud = false const flags = vi.mocked(useFeatureFlags().flags) diff --git a/src/platform/settings/composables/useSettingUI.ts b/src/platform/settings/composables/useSettingUI.ts index 394a6f93bf6..10f276d7449 100644 --- a/src/platform/settings/composables/useSettingUI.ts +++ b/src/platform/settings/composables/useSettingUI.ts @@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n' import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useFeatureFlags } from '@/composables/useFeatureFlags' import { useVueFeatureFlags } from '@/composables/useVueFeatureFlags' +import { useBillingCapabilities } from '@/platform/billing/composables/useBillingCapabilities' import { isCloud, isDesktop } from '@/platform/distribution/types' import { getSettingInfo, @@ -53,6 +54,7 @@ export function useSettingUI( ) { const { t } = useI18n() const { isLoggedIn } = useCurrentUser() + const { canManageMembers } = useBillingCapabilities() const settingStore = useSettingStore() const activeCategory = ref(null) @@ -212,7 +214,10 @@ export function useSettingUI( const planPanel = flags.unifiedBillingSettingsEnabled ? billingPanel : planCreditsPanel - const workspacePanels = isCloud ? [planPanel, membersPanel] : [planPanel] + const workspacePanels = + isCloud || canManageMembers.value + ? [planPanel, membersPanel] + : [planPanel] return shouldShowWorkspaceAllowlist.value ? [...workspacePanels, allowlistPanel] : workspacePanels From 2b80876190af21a687c19a4abf550963a31ea3f7 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Tue, 27 Oct 2026 19:34:54 +0000 Subject: [PATCH 2/2] fix(settings): track the missing view-members fact instead of deriving it The server-fact gate refused the previous commit, and it was right to. ADR-API-SERVER-FACTS-0042 rule 1 says a gate renders one server fact as received, and rule 2 says isCloud decides which build ships, not what a user may do. `isCloud || canManageMembers.value` is a derivation of a server fact, which is the pattern that shipped the two billing P0s the ADR's context cites. The fact this gate needs is not emitted. Viewing the roster is not can_manage_members: viewing is gated on membersLoaded, the capability gates the actions inside the panel, so Cloud members who are not owners read a roster today while it is false. Substituting it would take that away, which is what rule 4 warns against. So this is rule 4's case. BE-24066 asks the owning team which field should answer it, and the interim expression is wrapped so CI fails once that ticket closes until the shipped field is rendered and this is deleted. --- src/platform/settings/composables/useSettingUI.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/platform/settings/composables/useSettingUI.ts b/src/platform/settings/composables/useSettingUI.ts index 10f276d7449..92e706c50b6 100644 --- a/src/platform/settings/composables/useSettingUI.ts +++ b/src/platform/settings/composables/useSettingUI.ts @@ -6,6 +6,7 @@ import { useCurrentUser } from '@/composables/auth/useCurrentUser' import { useFeatureFlags } from '@/composables/useFeatureFlags' import { useVueFeatureFlags } from '@/composables/useVueFeatureFlags' import { useBillingCapabilities } from '@/platform/billing/composables/useBillingCapabilities' +import { pendingServerFact } from '@/platform/serverFacts/pendingServerFact' import { isCloud, isDesktop } from '@/platform/distribution/types' import { getSettingInfo, @@ -214,10 +215,13 @@ export function useSettingUI( const planPanel = flags.unifiedBillingSettingsEnabled ? billingPanel : planCreditsPanel - const workspacePanels = + const canViewMembers = pendingServerFact( + 'BE-24066', isCloud || canManageMembers.value - ? [planPanel, membersPanel] - : [planPanel] + ) + const workspacePanels = canViewMembers + ? [planPanel, membersPanel] + : [planPanel] return shouldShowWorkspaceAllowlist.value ? [...workspacePanels, allowlistPanel] : workspacePanels