Skip to content

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

TypeScript

fix(desktop): remove create share action

M9eb589255481
diff --git a/desktop-app/test/e2e-playwright/gfs-desktop-operator-parity.test.ts b/desktop-app/test/e2e-playwright/gfs-desktop-operator-parity.test.ts
index d322c7654..3d31fe280 100644
--- a/desktop-app/test/e2e-playwright/gfs-desktop-operator-parity.test.ts
+++ b/desktop-app/test/e2e-playwright/gfs-desktop-operator-parity.test.ts
@@ -461,7 +461,7 @@ test.describe.serial('GFS Desktop linked-operator parity', () => {
await expect.poll(() => operatorJourney.findGrant(ordinaryFolder.resourceId)).toBeNull()
})
- test('@gfs-operator/grant-share-lifecycle visible Desktop grant/share create, list, revoke removes recipient access', async ({
+ test('@gfs-operator/grant-lifecycle Desktop hides share creation and revokes grants', async ({
operatorJourney,
}, testInfo) => {
const page = await operatorJourney.launchOperatorDesktop()
@@ -497,18 +497,7 @@ test.describe.serial('GFS Desktop linked-operator parity', () => {
await dialog
.getByRole('button', { name: `Options for ${shareFolder.name}`, exact: true })
.click()
- await dialog.getByRole('menuitem', { name: 'Create share', exact: true }).click()
- await expectToast(page, '1 share created')
- await expect
- .poll(() => operatorJourney.findShare(shareFolder.resourceId), {
- timeout: 30_000,
- intervals: [250, 500, 1_000],
- })
- .not.toBeNull()
- const share = operatorJourney.findShare(shareFolder.resourceId)!
- await expect(page.getByTestId(`gfs-access-row-share-${share.id}`)).toContainText(
- operatorJourney.ordinaryName
- )
+ await expect(dialog.getByRole('menuitem', { name: 'Create share', exact: true })).toHaveCount(0)
await closeManageDialog(page)
const ordinary = await operatorJourney.launchOrdinaryDesktop(testInfo)
@@ -516,7 +505,7 @@ test.describe.serial('GFS Desktop linked-operator parity', () => {
await operatorJourney.openFiles(ordinary.page)
await expect(ordinary.page.getByTestId('gfs-view-shared')).toBeVisible()
await expect(resourceRow(ordinary.page, grantFolder)).toBeVisible()
- await expect(resourceRow(ordinary.page, shareFolder)).toBeVisible()
+ await expect(resourceRow(ordinary.page, shareFolder)).toHaveCount(0)
await ensureOperatorRoot(page)
await openResourceManage(page, grantFolder)
@@ -525,13 +514,6 @@ test.describe.serial('GFS Desktop linked-operator parity', () => {
await expect.poll(() => operatorJourney.findGrant(grantFolder.resourceId)).toBeNull()
await closeManageDialog(page)
- await ensureOperatorRoot(page)
- await openResourceManage(page, shareFolder)
- await page.getByTestId(`gfs-revoke-share-${share.id}`).click()
- await expectToast(page, `Shared access revoked for ${operatorJourney.ordinaryName}`)
- await expect.poll(() => operatorJourney.findShare(shareFolder.resourceId)).toBeNull()
- await closeManageDialog(page)
-
await ordinary.page.getByTestId('nav-chat').click()
await operatorJourney.openFiles(ordinary.page)
await expect(resourceRow(ordinary.page, grantFolder)).toHaveCount(0)
@@ -552,14 +534,7 @@ test.describe.serial('GFS Desktop linked-operator parity', () => {
.map(row => row.op),
{ timeout: 30_000, intervals: [250, 500, 1_000] }
)
- .toEqual(
- expect.arrayContaining([
- 'grant.put[read]',
- 'grant.delete',
- 'share.create[read]',
- 'share.delete',
- ])
- )
+ .toEqual(expect.arrayContaining(['grant.put[read]', 'grant.delete']))
})
test('@gfs-operator/live-control-ui-unlink visible Control UI revoke immediately denies same Electron session', async ({
diff --git a/desktop-app/test/e2e-playwright/gfs-user-journey.test.ts b/desktop-app/test/e2e-playwright/gfs-user-journey.test.ts
index a2dfcc846..043147340 100644
--- a/desktop-app/test/e2e-playwright/gfs-user-journey.test.ts
+++ b/desktop-app/test/e2e-playwright/gfs-user-journey.test.ts
@@ -591,7 +591,7 @@ test.describe('GFS Desktop user journey', () => {
})
})
- await test.step('user with the share bit creates a read share through Desktop UI', async () => {
+ await test.step('user with the share bit cannot create a share through Desktop UI', async () => {
const shared = ownerSession.page.getByRole('region', {
name: 'GFS resources shared with you',
})
@@ -602,34 +602,7 @@ test.describe('GFS Desktop user journey', () => {
await expect(browser).toContainText(shareChainFixture.childName, { timeout: 30_000 })
const delegation = ownerSession.page.getByRole('region', { name: 'Delegate access' })
- await expect(delegation.getByRole('button', { name: 'Create share' })).toBeVisible()
- await expect(
- delegation.getByRole('group', { name: 'permissions' }).getByRole('button', {
- name: 'share',
- })
- ).toBeVisible()
- await delegation.getByLabel('Subject type').selectOption('user')
- await delegation.getByLabel('subject', { exact: true }).selectOption(delegateUserId)
- await delegation.getByRole('button', { name: 'Create share' }).click()
- await expect(ownerSession.page.getByText('Share created')).toBeVisible({
- timeout: 20_000,
- })
-
- await expect
- .poll(
- () =>
- getGfsShareSummary({
- resourceId: shareChainFixture.resourceId,
- subjectType: 'user',
- subjectId: delegateUserId,
- }),
- { timeout: 15_000, intervals: [250, 500, 1_000] }
- )
- .toMatchObject({
- permissions: ['read'],
- includeDescendants: true,
- createdBy: `user:${ownerUserId}`,
- })
+ await expect(delegation.getByRole('button', { name: 'Create share' })).toHaveCount(0)
})
await test.step('user delegates read access to a visible team through Desktop UI', async () => {
diff --git a/desktop-app/ui/src/components/GfsResourceMenu/index.tsx b/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
index 49768733a..c6fb50056 100644
--- a/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
+++ b/desktop-app/ui/src/components/GfsResourceMenu/index.tsx
@@ -6,11 +6,9 @@ import { useClickOutside } from '@hooks/useClickOutside'
import type { GfsResourceMenuProps } from './types'
export function GfsResourceMenu({
- createShareDisabled = false,
resourceName,
onManage,
onCopyLink,
- onCreateShare,
onCreateFolder,
onDelete,
onOpen,
@@ -108,15 +106,6 @@ export function GfsResourceMenu({
Manage
</MenuItem>
) : null}
- {onCreateShare ? (
- <MenuItem
- disabled={createShareDisabled}
- role="menuitem"
- onClick={() => runAction(onCreateShare)}
- >
- Create share
- </MenuItem>
- ) : null}
{onOpen ? (
<MenuItem role="menuitem" onClick={() => runAction(onOpen)}>
Open folder
diff --git a/desktop-app/ui/src/components/GfsResourceMenu/types.ts b/desktop-app/ui/src/components/GfsResourceMenu/types.ts
index de3ea3000..b4ca9834d 100644
--- a/desktop-app/ui/src/components/GfsResourceMenu/types.ts
+++ b/desktop-app/ui/src/components/GfsResourceMenu/types.ts
@@ -1,9 +1,7 @@
export type GfsResourceMenuProps = {
- createShareDisabled?: boolean
resourceName: string
onManage?: () => void
onCopyLink: () => void
- onCreateShare?: () => void
onCreateFolder?: () => void
onDelete?: () => void
onOpen?: () => void
diff --git a/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx b/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
index 0cb560ce0..3bdfe6e58 100644
--- a/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/delegation.test.tsx
@@ -61,36 +61,6 @@ describe('GfsDelegationPanel', () => {
await waitFor(() => expect(onGrant).toHaveBeenCalledWith(['user:u2'], ['read'], false))
})
- it('registers Create share only when the caller holds the share bit', async () => {
- const onCreateShare = vi.fn().mockResolvedValue(undefined)
- let createShareAction: (() => void) | null = null
- let createShareDisabled = true
- render(
- <GfsDelegationPanel
- affordances={{ canDelegate: true, grantableBits: ['read', 'share'], canCreateShare: true }}
- subjectOptions={[{ type: 'team', id: 'team-1', label: 'Core Team', description: 'member' }]}
- isDirectory={false}
- onGrant={vi.fn()}
- onCreateShare={onCreateShare}
- onCreateShareActionChange={(action, disabled) => {
- createShareAction = action
- createShareDisabled = disabled
- }}
- />
- )
- expect(screen.queryByRole('button', { name: 'Create share' })).toBeNull()
- expect(createShareDisabled).toBe(true)
-
- fireEvent.focus(screen.getByRole('combobox', { name: PICKER_LABEL }))
- fireEvent.click(screen.getByRole('option', { name: /Core Team/ }))
- await waitFor(() => {
- expect(createShareDisabled).toBe(false)
- expect(createShareAction).not.toBeNull()
- })
- createShareAction?.()
- await waitFor(() => expect(onCreateShare).toHaveBeenCalledWith(['team:team-1']))
- })
-
it('surfaces a server no-escalation rejection mapped to its human message (fail-loud)', async () => {
const onGrant = vi.fn().mockRejectedValue(new Error('403 Forbidden: escalation_rejected'))
render(
@@ -192,7 +162,6 @@ describe('GfsDelegationPanel', () => {
]}
isDirectory={false}
onGrant={onGrant}
- onCreateShare={vi.fn().mockResolvedValue(undefined)}
/>
)
diff --git a/desktop-app/ui/src/gfs/delegation.tsx b/desktop-app/ui/src/gfs/delegation.tsx
index 7563d927f..1ce190f70 100644
--- a/desktop-app/ui/src/gfs/delegation.tsx
+++ b/desktop-app/ui/src/gfs/delegation.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useRef, useState } from 'react'
+import { useState } from 'react'
import { Button, StatusBanner } from '@components/Common'
import { describeGfsGrantError } from '@lib/gfsGrantErrors'
import { GfsPermissionDropdown } from '@/gfs/GfsPermissionDropdown'
@@ -24,8 +24,7 @@ const HOST_SUBJECT_KEY_PREFIX = 'host:'
* Subjects are unified — people, teams, and the caller's own agents appear in a
* single picker, mirroring Control UI. A bulk grant is atomic (all or none), so
* when a host is part of the selection the whole grant is capped to the host
- * permission set (read/write) and stripped of anything else. Hosts cannot be
- * share recipients, so Create share is disabled while a host is selected.
+ * permission set (read/write) and stripped of anything else.
*
* Composes the shared Common primitives through the GFS picker controls per the
* desktop-app/ui frontend rules — no raw inputs/buttons.
@@ -38,8 +37,6 @@ export function GfsDelegationPanel({
subjectOptionsError = null,
isDirectory,
onGrant,
- onCreateShare,
- onCreateShareActionChange,
}: GfsDelegationPanelProps) {
const [subjectKeys, setSubjectKeys] = useState<string[]>([])
const [bits, setBits] = useState<string[]>(() =>
@@ -48,7 +45,6 @@ export function GfsDelegationPanel({
const [inherit, setInherit] = useState(true)
const [busy, setBusy] = useState(false)
const [error, setError] = useState<string | null>(null)
- const createShareActionRef = useRef<() => void>(() => undefined)
const grantableBits = affordances.grantableBits
const hasHost = subjectKeys.some(key => key.startsWith(HOST_SUBJECT_KEY_PREFIX))
@@ -58,12 +54,6 @@ export function GfsDelegationPanel({
const visiblePermissionBits = hasHost
? HOST_PERMISSION_BITS.filter(bit => grantableBits.includes(bit))
: grantableBits
- const canCreateShare =
- Boolean(onCreateShare && affordances.canCreateShare) &&
- !busy &&
- !hasHost &&
- subjectKeys.length > 0
-
function changeSubjects(nextKeys: string[]) {
setSubjectKeys(nextKeys)
const nextHasHost = nextKeys.some(key => key.startsWith(HOST_SUBJECT_KEY_PREFIX))
@@ -83,8 +73,8 @@ export function GfsDelegationPanel({
await action()
setSubjectKeys([])
} catch (e) {
- // The bulk grant/share is atomic — a failure means NONE of the subjects
- // landed, so keep the whole selection for a retry. Surface the server's
+ // The bulk grant is atomic — a failure means NONE of the subjects landed,
+ // so keep the whole selection for a retry. Surface the server's
// verdict (escalation_rejected, subjects_invalid with 1-based positions, a
// rate-limit retry, …) via the shared presentation map — never swallow it.
setError(describeGfsGrantError(e).message)
@@ -93,17 +83,6 @@ export function GfsDelegationPanel({
}
}
- createShareActionRef.current = () => {
- if (!onCreateShare || !canCreateShare) return
- void run(() => onCreateShare(subjectKeys))
- }
-
- useEffect(() => {
- if (!onCreateShareActionChange) return
- onCreateShareActionChange(() => createShareActionRef.current(), !canCreateShare)
- return () => onCreateShareActionChange(null, true)
- }, [canCreateShare, onCreateShareActionChange])
-
// A Leader without manage_acl (canDelegate=false) sees no controls.
if (!affordances.canDelegate) {
return (
@@ -167,7 +146,6 @@ export function GfsDelegationPanel({
export type {
DelegationAffordances,
- GfsCreateShareActionChange,
GfsAgentSubjectOption,
GfsDelegationPanelProps,
GfsDelegationSubjectOption,
diff --git a/desktop-app/ui/src/gfs/delegation.types.ts b/desktop-app/ui/src/gfs/delegation.types.ts
index d49166da3..e692a1c54 100644
--- a/desktop-app/ui/src/gfs/delegation.types.ts
+++ b/desktop-app/ui/src/gfs/delegation.types.ts
@@ -15,8 +15,6 @@ export interface GfsDelegationSubjectOption {
badge?: string
}
-export type GfsCreateShareActionChange = (action: (() => void) | null, disabled: boolean) => void
-
export interface GfsDelegationPanelProps {
affordances: DelegationAffordances
subjectOptions: GfsDelegationSubjectOption[]
@@ -25,8 +23,6 @@ export interface GfsDelegationPanelProps {
/** Directories offer the "Include contents" toggle (default ON); files always send inherit=false. */
isDirectory: boolean
onGrant: (subjectKeys: string[], bits: string[], inherit: boolean) => Promise<void>
- onCreateShare?: (subjectKeys: string[]) => Promise<void>
- onCreateShareActionChange?: GfsCreateShareActionChange
}
/**
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 160e82c46..70521f720 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -35,7 +35,6 @@ import { formatSharedFileSize } from '@lib/sharedFiles'
import { GfsGrantList } from '@/gfs/GfsGrantList'
import {
type GfsAgentSubjectOption,
- type GfsCreateShareActionChange,
GfsDelegationPanel,
type GfsDelegationSubjectOption,
} from '@/gfs/delegation'
@@ -133,15 +132,6 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
const [renameDraft, setRenameDraft] = useState('')
const [openLinkOpen, setOpenLinkOpen] = useState(false)
const [manageOpen, setManageOpen] = useState(false)
- const createShareActionRef = useRef<(() => void) | null>(null)
- const [createShareDisabled, setCreateShareDisabled] = useState(true)
- const handleCreateShareActionChange = useCallback<GfsCreateShareActionChange>(
- (action, disabled) => {
- createShareActionRef.current = action
- setCreateShareDisabled(disabled)
- },
- []
- )
const [filePreview, setFilePreview] = useState<GfsPreviewResource | null>(null)
const [dragActive, setDragActive] = useState(false)
const [droppedUploadCount, setDroppedUploadCount] = useState(0)
@@ -380,23 +370,6 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
}
}
- const handleCreateShare = async (subjectKeys: string[]) => {
- try {
- await ctrl.createShare(subjectKeys)
- } catch (error) {
- // A session-authority rejection fails the browser closed; anything
- // else re-throws to the delegation panel's own error surface.
- if (!failClosedOnAuthorizationError(error)) throw error
- return
- }
- pushToast?.(
- `${subjectKeys.length} ${subjectKeys.length === 1 ? 'share' : 'shares'} created`,
- 'success'
- )
- // List-after-write: make the new share row visible without a remount.
- await ctrl.refreshShares()
- }
-
const handleRevokeShare = async (shareId: string, label: string) => {
try {
await ctrl.revokeShare(shareId)
@@ -1091,10 +1064,8 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
<span className="da-gfs-manage-dialog__title-row">
<h3>{current.name}</h3>
<GfsResourceMenu
- createShareDisabled={createShareDisabled}
resourceName={current.name}
onCopyLink={() => void handleCopyLink(current.gfsUri)}
- onCreateShare={() => createShareActionRef.current?.()}
onCreateFolder={
currentIsFolder && canWriteCurrent
? () => {
@@ -1255,8 +1226,6 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
)}
isDirectory={currentIsFolder}
onGrant={handleGrant}
- onCreateShare={affordances.canCreateShare ? handleCreateShare : undefined}
- onCreateShareActionChange={handleCreateShareActionChange}
/>
</>
) : (
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index 4453c782c..4a39a7d0b 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -1030,7 +1030,7 @@ describe('FilesPage', () => {
expect(pushToast).toHaveBeenCalledWith('Access granted to 1 subject', 'success')
})
- it('creates a share from the manage dialog resource menu', async () => {
+ it('does not offer Create share from the manage dialog resource menu', async () => {
Object.defineProperty(window, 'clerum', {
configurable: true,
value: {
@@ -1058,7 +1058,6 @@ describe('FilesPage', () => {
},
},
})
- const createShare = vi.fn(async () => undefined)
const pushToast = vi.fn()
hookMock.useGfsBrowserController.mockReturnValue({
...baseController(),
@@ -1074,7 +1073,6 @@ describe('FilesPage', () => {
grantableBits: ['read', 'share'],
canCreateShare: true,
},
- createShare,
})
renderFilesPage(pushToast)
@@ -1085,29 +1083,7 @@ describe('FilesPage', () => {
await act(async () => {
fireEvent.click(menuTrigger)
})
- expect(within(dialog).getByRole('menuitem', { name: 'Create share' })).toHaveProperty(
- 'disabled',
- true
- )
- await act(async () => {
- fireEvent.click(menuTrigger)
- })
-
- const picker = await screen.findByRole('combobox', { name: 'Add people, teams, or agents' })
- fireEvent.focus(picker)
- fireEvent.click(await screen.findByRole('option', { name: /Test Two/ }))
-
- await act(async () => {
- fireEvent.click(menuTrigger)
- })
- const createShareItem = within(dialog).getByRole('menuitem', { name: 'Create share' })
- expect(createShareItem).toHaveProperty('disabled', false)
- await act(async () => {
- fireEvent.click(createShareItem)
- })
-
- await waitFor(() => expect(createShare).toHaveBeenCalledWith(['user:user-2']))
- expect(pushToast).toHaveBeenCalledWith('1 share created', 'success')
+ expect(within(dialog).queryByRole('menuitem', { name: 'Create share' })).toBeNull()
})
it('issues ONE atomic bulk grant and does not refetch or toast when it is rejected', async () => {