Skip to content

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

TypeScript

fix(evendrive): surface total inherited-derivation failures in share dialogs (R1-M3)

Me96a7feb77ea
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index d7a98a23d..9fe0ccfa3 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -13853,6 +13853,13 @@ button.cu-gfs-tree__button:focus-visible,
font-size: 0.75rem;
}
+/* Quiet notice when the whole inherited-access derivation failed (R1-M3). */
+.cu-gfs-existing-access__notice {
+ margin: 0;
+ color: var(--cu-text-muted);
+ font-size: var(--cu-font-size-xs);
+}
+
.cu-gfs-existing-access__list {
display: grid;
gap: var(--cu-space-2);
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsx
index 9ee85cd14..e940f128b 100644
--- a/control-ui/components/GfsGrantPanel.tsx
+++ b/control-ui/components/GfsGrantPanel.tsx
@@ -125,6 +125,9 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
// the derivation — folder dialogs keep their direct-only behavior.
const [inheritedAccess, setInheritedAccess] = useState<GfsInheritedAccessItem[]>([])
const [inheritedAccessLoading, setInheritedAccessLoading] = useState(true)
+ // True only when the whole derivation failed (R1-M3): the access section
+ // then shows a quiet notice instead of trusting an empty derived list.
+ const [inheritedAccessFailed, setInheritedAccessFailed] = useState(false)
const inheritedAccessRequest = useRef(0)
const inheritedAccessController = useRef<AbortController | null>(null)
// Pending parent-folder confirmation (role change or removal) for a member
@@ -202,6 +205,7 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
const loadInheritedAccess = useCallback(async () => {
inheritedAccessController.current?.abort()
const requestId = ++inheritedAccessRequest.current
+ setInheritedAccessFailed(false)
if (!resourceIsFile || !resource.path) {
inheritedAccessController.current = null
setInheritedAccess([])
@@ -218,6 +222,11 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
} catch {
if (requestId !== inheritedAccessRequest.current) return
setInheritedAccess([])
+ // A TOTAL derivation failure (the walk itself blew up) is surfaced as a
+ // quiet notice; per-ancestor best-effort skipping stays silent by
+ // design. An empty derived list alone would silently read as "no one
+ // else has access" (R1-M3).
+ setInheritedAccessFailed(true)
} finally {
if (requestId === inheritedAccessRequest.current) {
inheritedAccessController.current = null
@@ -672,6 +681,12 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
<div className="cu-gfs-existing-access__header">
<h4>People with access</h4>
</div>
+ {inheritedAccessFailed ? (
+ <p role="status" className="cu-gfs-existing-access__notice">
+ Inherited access could not be loaded. Members with access from a parent folder may be
+ missing.
+ </p>
+ ) : null}
{existingAccessLoading || inheritedAccessLoading ? (
<p className="cu-gfs-existing-access__empty" role="status">
Loading access…
@@ -685,7 +700,9 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme
Retry
</Button>
</div>
- ) : existingAccess.length === 0 && inheritedAccess.length === 0 ? (
+ ) : existingAccess.length === 0 &&
+ inheritedAccess.length === 0 &&
+ !inheritedAccessFailed ? (
<p className="cu-gfs-existing-access__empty">No one has access yet.</p>
) : (
<RecordList className="cu-gfs-existing-access__list" aria-label="Resource access">
diff --git a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx
index a0c1bd9cb..fa63ead01 100644
--- a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx
+++ b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx
@@ -469,6 +469,26 @@ describe('GfsGrantPanel inherited access', () => {
expect(mockGetGfsResourceByPath).not.toHaveBeenCalled()
})
+ // R1-M3 — a total derivation failure is a quiet inline notice, never a
+ // silent "no one has access".
+ it('shows a quiet notice when the inherited derivation fails entirely', async () => {
+ mockGetGfsResourceByPath.mockImplementation(async () => {
+ throw Object.assign(new Error('503 unavailable'), { status: 503 })
+ })
+ renderPanel()
+
+ const existing = await screen.findByRole('region', { name: 'People with access' })
+ expect(
+ await within(existing).findByText(
+ 'Inherited access could not be loaded. Members with access from a parent folder may be missing.'
+ )
+ ).toBeTruthy()
+ expect(within(existing).queryByText('No one has access yet.')).toBeNull()
+ expect(within(existing).getByRole('status').textContent).toContain(
+ 'Inherited access could not be loaded'
+ )
+ })
+
it('merges the same subject inherited through several folders into one row with the strongest source', async () => {
mockGetGfsResourceByPath.mockImplementation(async (_drive, path) => {
if (path === '/team-docs') return byPathView(FOLDER_ID, 'team-docs')
diff --git a/control-ui/components/gfsInheritedAccess.ts b/control-ui/components/gfsInheritedAccess.ts
index 918d10eaa..adc738c13 100644
--- a/control-ui/components/gfsInheritedAccess.ts
+++ b/control-ui/components/gfsInheritedAccess.ts
@@ -83,8 +83,10 @@ async function listInheritingRows(
/**
* Derives the inherited access for one resource path. Ancestors that cannot be
* resolved or listed (moved, deleted, rate-limited) are skipped — the walk is
- * best-effort and never fails the whole derivation. The drive root carries an
- * empty name, so its label falls back to the drive name, matching the browser
+ * best-effort. A walk that resolves NO ancestor at all learned nothing about
+ * the file's ancestry and throws, so the caller can say the derivation failed
+ * instead of trusting an empty list (R1-M3). The drive root carries an empty
+ * name, so its label falls back to the drive name, matching the browser
* breadcrumb.
*/
export async function loadGfsInheritedAccess(
@@ -93,7 +95,9 @@ export async function loadGfsInheritedAccess(
signal?: AbortSignal
): Promise<GfsInheritedAccessItem[]> {
const bySubject = new Map<string, GfsInheritedAccessItem>()
- for (const ancestorPath of gfsAncestorPaths(path)) {
+ const ancestorPaths = gfsAncestorPaths(path)
+ let resolvedAncestors = 0
+ for (const ancestorPath of ancestorPaths) {
let folder: GfsResourceByPathView
try {
folder = await getGfsResourceByPath(drive, ancestorPath, signal)
@@ -101,6 +105,7 @@ export async function loadGfsInheritedAccess(
if (signal?.aborted) throw error
continue
}
+ resolvedAncestors += 1
let rows: InheritingRow[]
try {
rows = await listInheritingRows(folder, drive, signal)
@@ -158,5 +163,11 @@ export async function loadGfsInheritedAccess(
}
}
}
+ // Every ancestor path failed to resolve: the derivation as a whole
+ // failed. An empty list here would silently read as "no inherited
+ // access", so the caller gets a failure it can surface (R1-M3).
+ if (ancestorPaths.length > 0 && resolvedAncestors === 0) {
+ throw new Error('inherited_access_derivation_failed')
+ }
return [...bySubject.values()]
}
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 388568a25..120b830d6 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.588",
+ "version": "0.1.589",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.588",
+ "version": "0.1.589",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index c852dbe31..c36f97bca 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.588",
+ "version": "0.1.589",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
index 14778bb7a..0424f6ed0 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
+++ b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
@@ -93,6 +93,7 @@ export function GfsGrantList({
inheritedItems = [],
mergeInherited = false,
loading = false,
+ derivationNotice = null,
error = null,
shareError = null,
agents,
@@ -147,6 +148,7 @@ export function GfsGrantList({
return (
<>
+ {derivationNotice ? <StatusBanner tone="info" text={derivationNotice} /> : null}
{hasAnyError ? (
<div className="da-gfs-grant-list__errors" data-testid="gfs-access-list-error">
{error ? (
@@ -292,7 +294,7 @@ export function GfsGrantList({
) : !hasAnyError ? (
loading ? (
<p className="muted">Loading access…</p>
- ) : (
+ ) : derivationNotice ? null : (
<p className="muted">No one has access yet.</p>
)
) : null}
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/types.ts b/desktop-app/ui/src/gfs/GfsGrantList/types.ts
index c77702928..d129111b8 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/types.ts
+++ b/desktop-app/ui/src/gfs/GfsGrantList/types.ts
@@ -36,6 +36,12 @@ export interface GfsGrantListProps {
/** File-dialog mode: dedupe members across direct and inherited access. */
mergeInherited?: boolean
loading?: boolean
+ /**
+ * Quiet inline notice shown when the inherited-access derivation failed
+ * entirely (R1-M3): the row list may be incomplete, so the plain empty
+ * claim is suppressed while this is set.
+ */
+ derivationNotice?: string | null
/**
* Mapped list-load failure. Severity 'quiet' (manage_acl_required) renders an
* informational banner instead of the list; 'error' renders an error banner.
diff --git a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
index 13df8c7be..8c23213f6 100644
--- a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
@@ -368,6 +368,24 @@ describe('GfsGrantList', () => {
expect(screen.getByText('No one has access yet.')).toBeTruthy()
})
+ // R1-M3 — a total derivation failure is a quiet notice, never a silent
+ // "no one has access".
+ it('renders the derivation notice and suppresses the empty claim', () => {
+ render(
+ <GfsGrantList
+ agents={agents}
+ derivationNotice="Inherited access could not be loaded. Members with access from a parent folder may be missing."
+ items={[]}
+ onRevoke={vi.fn()}
+ subjects={subjects}
+ />
+ )
+
+ const banner = screen.getByText(/Inherited access could not be loaded/)
+ expect(banner.closest('.status-banner')?.className).toContain('tone-info')
+ expect(screen.queryByText('No one has access yet.')).toBeNull()
+ })
+
it('keeps direct-only rows editable alongside merged rows and never the empty notice', () => {
const onRevoke = vi.fn()
const grant = grantItem({ id: 'grant-1' })
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx
index 7fe05a884..6f8fdcebd 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx
@@ -1497,6 +1497,7 @@ function ManageProbe() {
<div data-testid="current">{ctrl.current?.resourceId ?? 'none'}</div>
<div data-testid="grants-count">{ctrl.grants.length}</div>
<div data-testid="shares-count">{ctrl.shares.length}</div>
+ <div data-testid="inherited-error">{ctrl.inheritedAccessError ?? 'none'}</div>
<button type="button" onClick={() => swallow(ctrl.openUri('gfs://main/root'))}>
open root
</button>
@@ -1925,4 +1926,56 @@ describe('useGfsBrowserController — grants list / revoke / inherit (#826)', ()
await waitFor(() => expect(createShare).toHaveBeenCalledWith('root', ['user:bob'], 'main'))
await waitFor(() => expect(screen.getByTestId('shares-count').textContent).toBe('1'))
})
+
+ // R1-M3 — a total inherited-derivation failure (the file itself cannot be
+ // re-resolved for the walk) must surface as controller error state instead
+ // of silently collapsing to an empty list.
+ it('exposes inheritedAccessError when the derivation fails entirely', async () => {
+ let resolveCalls = 0
+ Object.defineProperty(window, 'clerum', {
+ configurable: true,
+ value: {
+ gfs: {
+ listAccessible: vi.fn(async () => ({ items: [], nextCursor: null })),
+ // The navigation resolve succeeds; the derivation's own resolve of
+ // the same file then fails outright.
+ resolve: vi.fn(async () => {
+ resolveCalls += 1
+ if (resolveCalls > 1) throw new Error('Error: 500 resolve_failed')
+ return {
+ resourceId: 'file-1',
+ parentResourceId: 'folder-1',
+ gfsUri: 'gfs://main/file-1',
+ name: 'report.txt',
+ kind: 'file',
+ version: 1,
+ }
+ }),
+ listChildren: vi.fn(async () => ({ items: [], nextCursor: null })),
+ affordances: vi.fn(async () => ({
+ held: ['read', 'manage_acl'],
+ canDelegate: true,
+ grantableBits: ['read'],
+ canCreateShare: false,
+ })),
+ listGrants: vi.fn(async () => []),
+ listShares: vi.fn(async () => []),
+ },
+ },
+ })
+
+ render(<ManageProbe />, { wrapper: Harness })
+
+ await act(async () => {
+ screen.getByRole('button', { name: 'open root' }).click()
+ })
+ await waitFor(() => expect(screen.getByTestId('current').textContent).toBe('file-1'))
+ await act(async () => {
+ screen.getByRole('button', { name: 'open manage' }).click()
+ })
+
+ await waitFor(() =>
+ expect(screen.getByTestId('inherited-error').textContent).toBe('Error: 500 resolve_failed')
+ )
+ })
})
diff --git a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
index 9360285ec..effc7f898 100644
--- a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
+++ b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
@@ -908,10 +908,15 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {
refreshShares,
// Client-derived ancestor access for FILE Manage dialogs: normal-looking
// toggleable rows whose edits route through the parent-folder
- // confirmation. Failures stay silent — the direct surfaces own error
- // reporting.
+ // confirmation. Per-ancestor failures inside the derivation stay silent;
+ // a total failure is reported through inheritedAccessError.
inheritedAccess,
loadingInheritedAccess: inheritedAccessQuery.isFetching,
+ // A TOTAL derivation failure surfaces as this message; the Share dialog
+ // renders a quiet notice because "no inherited rows" would silently read
+ // as "no one else has access". Per-ancestor best-effort skipping stays
+ // silent by design.
+ inheritedAccessError: inheritedAccessQuery.error ? toMessage(inheritedAccessQuery.error) : null,
refreshInheritedAccess,
revokeShare: (shareId: string) => revokeShareMutation.mutateAsync(shareId),
revokingShare: revokeShareMutation.isPending,
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index bad6c81be..ae86ebb96 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -88,6 +88,9 @@ function hasDraggedFiles(event: ReactDragEvent<HTMLElement>): boolean {
const GFS_RESOURCE_DRAG_TYPE = 'application/x-evenfire-gfs-resource'
+const INHERITED_DERIVATION_NOTICE =
+ 'Inherited access could not be loaded. Members with access from a parent folder may be missing.'
+
function hasDraggedGfsResource(event: ReactDragEvent<HTMLElement>): boolean {
return Array.from(event.dataTransfer.types || []).includes(GFS_RESOURCE_DRAG_TYPE)
}
@@ -428,6 +431,11 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
const canManageCurrent = !accessRevoked && hasBit(affordances, 'manage_acl')
const currentIsFolder = current?.kind === 'directory'
const currentIsFile = current?.kind === 'file'
+ // A total inherited-derivation failure becomes a quiet notice in the Share
+ // dialog: an empty derived list alone would silently read as "no one else
+ // has access" (R1-M3). Per-ancestor best-effort skipping stays silent.
+ const inheritedAccessNotice =
+ currentIsFile && ctrl.inheritedAccessError ? INHERITED_DERIVATION_NOTICE : null
const currentPreviewAvailable = currentIsFile && isGfsPreviewFile(current?.name ?? '')
const droppedUploadRestriction = useMemo(() => {
if (!current) {
@@ -1840,6 +1848,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
</div>
<GfsGrantList
agents={agentSubjects}
+ derivationNotice={inheritedAccessNotice}
error={grantsError}
inheritedItems={ctrl.inheritedAccess}
items={ctrl.grants}
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index debb7a0d4..32ce0e2d3 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -1989,6 +1989,29 @@ describe('FilesPage', () => {
).toContain('Editor')
})
+ // R1-M3 — a total derivation failure must not silently read as "no one".
+ it('shows a quiet notice instead of the empty claim when the derivation fails', async () => {
+ installInheritedDirectoryMocks()
+ hookMock.useGfsBrowserController.mockReturnValue(
+ inheritedFileController({
+ grants: [],
+ inheritedAccess: [],
+ inheritedAccessError: 'Error invoking remote method: 500',
+ })
+ )
+
+ renderFilesPage()
+ await openManageDialog('report.txt')
+
+ const manageDialog = await screen.findByRole('dialog', { name: 'Share file report.txt' })
+ expect(
+ await within(manageDialog).findByText(
+ 'Inherited access could not be loaded. Members with access from a parent folder may be missing.'
+ )
+ ).toBeTruthy()
+ expect(within(manageDialog).queryByText('No one has access yet.')).toBeNull()
+ })
+
it('removes an inherited member from the parent folder after confirmation', async () => {
installInheritedDirectoryMocks()
const revokeGrant = vi.fn(async () => undefined)