Skip to content

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

TypeScript

fix(desktop-app): r8-l9 drop denied GFS ancestors from trail

Josuéd3bd378965d1
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 f8c551852..9b2aa3d56 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/useGfsBrowserController.test.tsx
@@ -2311,6 +2311,54 @@ describe('useGfsBrowserController', () => {
expect(screen.getByTestId('crumbs').textContent).toBe('Parent / Leaf')
})
+ it('drops only an authoritatively denied ancestor while keeping the readable location open', async () => {
+ const parent = await resolveResource(
+ resolvedDirectory('parent', 'Parent', { gfsUri: 'gfs://main/parent', path: '/Parent' })
+ )
+ const leaf = await resolveResource(
+ resolvedDirectory('leaf', 'Leaf', {
+ gfsUri: 'gfs://main/root',
+ path: '/Parent/Leaf',
+ parentResourceId: 'parent',
+ })
+ )
+ const resolve = vi
+ .fn()
+ .mockResolvedValueOnce(leaf)
+ .mockResolvedValueOnce(parent)
+ .mockResolvedValueOnce(leaf)
+ .mockRejectedValueOnce(new Error('403 Forbidden: httpStatus=403'))
+ Object.defineProperty(window, 'clerum', {
+ configurable: true,
+ value: {
+ gfs: {
+ resolve,
+ listChildren: vi.fn(async () => ({ items: [], nextCursor: null })),
+ affordances: vi.fn(async () => ({
+ held: [],
+ canDelegate: false,
+ grantableBits: [],
+ canCreateShare: false,
+ })),
+ },
+ },
+ })
+
+ render(<Probe />, { wrapper: Harness })
+ await act(async () => screen.getByRole('button', { name: 'open' }).click())
+ await waitFor(() => expect(screen.getByTestId('current').textContent).toBe('leaf'))
+ expect(screen.getByTestId('crumbs').textContent).toBe('Parent / Leaf')
+
+ await act(async () => {
+ screen.getByRole('button', { name: 'background refresh current location' }).click()
+ })
+ await waitFor(() => expect(resolve).toHaveBeenCalledTimes(4))
+
+ expect(screen.getByTestId('current').textContent).toBe('leaf')
+ expect(screen.getByTestId('crumbs').textContent).toBe('Leaf')
+ expect(screen.getByTestId('open-error').textContent).toBe('none')
+ })
+
it('revalidates accessible resources on remount even under production cache defaults', async () => {
const listAccessible = vi.fn(async () => ({ items: [], nextCursor: null }))
Object.defineProperty(window, 'clerum', {
diff --git a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
index 1df7a7861..749fac91f 100644
--- a/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
+++ b/desktop-app/ui/src/hooks/domain/useGfsBrowserController.ts
@@ -1021,6 +1021,14 @@ export function useGfsBrowserController(options: GfsBrowserControllerOptions = {
}
parentResourceId = parent.parentResourceId
} catch (error) {
+ const status = parseHttpStatus(toMessage(error))
+ if (status === 403 || status === 404) {
+ // The leaf already resolved authoritatively. A denied or deleted
+ // ancestor must disappear from its path without closing a leaf
+ // that remains directly readable; a later scope tick can restore
+ // the breadcrumb if visibility returns.
+ break
+ }
if (background) {
backgroundOpenErrorRef.current = true
setOpenError(toPresentedMessage(error))
diff --git a/docs/architecture/live-entity-change-consumer-semantics.md b/docs/architecture/live-entity-change-consumer-semantics.md
index 47b287946..521da99a1 100644
--- a/docs/architecture/live-entity-change-consumer-semantics.md
+++ b/docs/architecture/live-entity-change-consumer-semantics.md
@@ -32,7 +32,8 @@ may coalesce intermediate changes while disconnected or under load.
- An unchanged authoritative preview retains its identity and bytes. A relevant version, content,
or metadata change uses the same generic preview reload boundary for every preview type.
- Transient failures never prove revocation. Only authoritative deletion or 403/404 purges the
- affected resource; session-wide 401 follows the authentication-expiry path.
+ affected resource; an independently readable leaf remains open while denied ancestors are
+ removed from its breadcrumb. Session-wide 401 follows the authentication-expiry path.
- Unknown or malformed frames are non-destructive and do not reset reconnect backoff.
- User event delivery must not disclose unauthorized resource identity or change timing.