Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(ui): med-unavailable-coverage keep a failed inherited walk retryable
M6ebbd131891f
diff --git a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsxindex 74b2ce28f..416347718 100644--- a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx+++ b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx@@ -782,6 +782,32 @@ describe('GfsGrantPanel inherited access', () => {)})+ // A failed derivation is a FAILURE, not an observation: it must never be+ // cached as if it were authoritative. Reopening Share re-runs the walk.+ it('retries an unavailable inherited derivation when Share is reopened', async () => {+ mockGetGfsResourceByPath.mockImplementation(async () => {+ throw Object.assign(new Error('503 unavailable'), { status: 503 })+ })+ const first = 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()+ const callsAfterFirstOpen = mockGetGfsResourceByPath.mock.calls.length+ expect(callsAfterFirstOpen).toBeGreaterThan(0)++ // Closing Share unmounts the panel; reopening it walks the ancestors+ // again instead of serving the cached failure.+ first.unmount()+ renderPanel()+ await waitFor(() =>+ expect(mockGetGfsResourceByPath.mock.calls.length).toBeGreaterThan(callsAfterFirstOpen)+ )+ })+it.each([403, 429, 500])('keeps a known member and the existing notice after a later %s read failure',async status => {diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 6d25e9544..b11bbefa3 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.740",+ "version": "0.1.741","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.740",+ "version": "0.1.741","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.jsonindex 0178f19a3..8b868dff4 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.740",+ "version": "0.1.741","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsxindex 7d02f7f40..10a633198 100644--- a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx+++ b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx@@ -3226,6 +3226,69 @@ describe('useGfsBrowserController — grants list / revoke / inherit (#826)', ()expect(screen.getByTestId('inherited-error').textContent).toBe('none')})+ // An 'unavailable' coverage is a FAILED walk, not an observation. Caching it+ // under the app's Infinity staleTime would keep the failure on screen as if+ // it were authoritative; reopening Share must retry the walk.+ it('retries an unavailable inherited derivation when Share is reopened', async () => {+ const resolve = vi.fn(async (uri: string) => {+ // The navigation resolve succeeds; every later resolve (the derivation's+ // own walk) fails transiently.+ if (uri.endsWith('/root')) {+ return {+ resourceId: 'file-1',+ parentResourceId: 'folder-1',+ gfsUri: 'gfs://main/file-1',+ name: 'report.txt',+ kind: 'file',+ version: 1,+ }+ }+ throw new Error('Error: 500 resolve_failed')+ })+ Object.defineProperty(window, 'clerum', {+ configurable: true,+ value: {+ gfs: {+ listAccessible: vi.fn(async () => ({ items: [], nextCursor: null })),+ resolve,+ 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-coverage').textContent).toBe('unavailable')+ )++ await act(async () => {+ screen.getByRole('button', { name: 'close manage' }).click()+ })+ const before = resolve.mock.calls.length+ await act(async () => {+ screen.getByRole('button', { name: 'open manage' }).click()+ })++ // The failed walk is retried on reopen instead of being served from cache.+ await waitFor(() => expect(resolve.mock.calls.length).toBeGreaterThan(before))+ })+// A move changes the ANCESTRY of the open resource, and the open// Share/Manage dialog shows rows derived from that ancestry. The dialog must// re-read them: keeping the pre-move observation would present inheriteddiff --git a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.tsindex 6adf973a9..1e42e3ad2 100644--- a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts+++ b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts@@ -17,7 +17,11 @@ import {parseHttpStatus,parseRetryAfterSeconds,} from '@lib/gfsGrantErrors'-import type { GfsGrantListItem, GfsShareListItem } from '@/gfs/delegation.types'+import type {+ GfsGrantListItem,+ GfsInheritedAccessResult,+ GfsShareListItem,+} from '@/gfs/delegation.types'import { deriveGfsInheritedAccess } from '@/gfs/inheritedAccess'import { desktopQueryKeys } from './queryKeys'@@ -502,6 +506,16 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {queryFn: () => deriveGfsInheritedAccess(current!.resourceId, DRIVE),enabled:Boolean(sessionScope) && Boolean(current) && grantsListEnabled && accessState === 'active',+ // An 'unavailable' coverage is a FAILED walk, not an observation: a+ // transient ancestor failure would otherwise be cached forever under the+ // app's Infinity staleTime and reopening Share would keep showing the+ // failure as if it were authoritative. Such a result stays stale, so+ // reopening the dialog retries the walk. A complete observation keeps+ // the app's normal policy (cached until something invalidates it).+ staleTime: query =>+ (query.state.data as GfsInheritedAccessResult | undefined)?.coverage === 'unavailable'+ ? 0+ : Infinity,})const refreshShares = useCallback(async () => {const resourceId = current?.resourceId