Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): p1-h1 retain known inherited access after partial reads
Me26752ba8b2d
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsxindex f9a5ea4c7..b9da5497f 100644--- a/control-ui/components/GfsGrantPanel.tsx+++ b/control-ui/components/GfsGrantPanel.tsx@@ -40,6 +40,7 @@ import type {GfsExistingAccessItem,GfsFileAccessRow,GfsGrantPanelProps,+ GfsInheritedAccessCoverage,GfsInheritedAccessItem,GfsInheritedAccessSource,} from './GfsGrantPanel.types'@@ -130,13 +131,19 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Elemeconst existingAccessRequest = useRef(0)const existingAccessController = useRef<AbortController | null>(null)// Inherited access is derived separately: it comes from ancestor folders,- // not from this resource's direct grant/share rows. Only FILE dialogs use- // the derivation — folder dialogs keep their direct-only behavior.+ // not from this resource's direct grant/share rows. Files and folders use+ // the same retaining walk, with explicit incomplete-coverage feedback.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 [inheritedAccessCoverage, setInheritedAccessCoverage] =+ useState<GfsInheritedAccessCoverage>('complete')+ const inheritedAccessFailed = inheritedAccessCoverage !== 'complete'+ const inheritedAccessNotice =+ inheritedAccessCoverage === 'read-boundary'+ ? 'There may be access from parent folders you cannot see.'+ : inheritedAccessCoverage === 'acl-limited'+ ? 'Sharing details on some parent folders are not visible to you.'+ : 'Inherited access could not be loaded. Members with access from a parent folder may be missing.'const inheritedAccessRequest = useRef(0)const inheritedAccessController = useRef<AbortController | null>(null)// Pending parent-folder confirmation (role change or removal) for a member@@ -243,7 +250,7 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Elemeconst loadInheritedAccess = useCallback(async () => {inheritedAccessController.current?.abort()const requestId = ++inheritedAccessRequest.current- setInheritedAccessFailed(false)+ setInheritedAccessCoverage('complete')// Inherited access is derived for FILES AND FOLDERS: a folder dialog must// show the identities its ancestors grant, not an empty list. The walk// resolves the canonical path itself when the target carries none.@@ -251,21 +258,20 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.ElemeinheritedAccessController.current = controllersetInheritedAccessLoading(true)try {- const items = await loadGfsInheritedAccess(+ const result = await loadGfsInheritedAccess({ path: resource.path, gfsUri: resource.gfsUri },DRIVE,controller.signal)if (requestId !== inheritedAccessRequest.current) return- setInheritedAccess(items)+ setInheritedAccess(result.items)+ setInheritedAccessCoverage(result.coverage)} catch {if (requestId !== inheritedAccessRequest.current) returnsetInheritedAccess([])- // 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)+ // Session expiry and cancellation still reject through the existing+ // API/request boundary; never keep protected rows from a failed session.+ setInheritedAccessCoverage('unavailable')} finally {if (requestId === inheritedAccessRequest.current) {inheritedAccessController.current = null@@ -931,8 +937,7 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Eleme</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.+ {inheritedAccessNotice}</p>) : null}{existingAccessLoading || inheritedAccessLoading ? (diff --git a/control-ui/components/GfsGrantPanel.types.ts b/control-ui/components/GfsGrantPanel.types.tsindex b9e6be9ad..06f1bfa7a 100644--- a/control-ui/components/GfsGrantPanel.types.ts+++ b/control-ui/components/GfsGrantPanel.types.ts@@ -114,3 +114,14 @@ export type GfsInheritedAccessItem = {/** Every contributing ancestor folder, nearest first (R1-H1). */sources: GfsInheritedAccessSource[]}++export type GfsInheritedAccessCoverage =+ | 'complete'+ | 'read-boundary'+ | 'acl-limited'+ | 'unavailable'++export interface GfsInheritedAccessResult {+ items: GfsInheritedAccessItem[]+ coverage: GfsInheritedAccessCoverage+}diff --git a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsxindex d45e8e613..a19d78ae7 100644--- a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx+++ b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx@@ -782,6 +782,31 @@ describe('GfsGrantPanel inherited access', () => {)})+ it.each([403, 429, 500])(+ 'keeps a known member and the existing notice after a later %s read failure',+ async status => {+ const actual = await vi.importActual<typeof import('@lib/api')>('@lib/api')+ const text = JSON.stringify({ error: 'request_failed', message: 'parent read failed' })+ const error = actual.formatApiError(new Response(text, { status }), text)+ mockGetGfsResourceByPath.mockImplementation(async (_drive, path) => {+ if (path === '/team-docs') return byPathView(FOLDER_ID, 'team-docs')+ throw error+ })+ renderPanel()+ const existing = await screen.findByRole('region', { name: 'People with access' })+ const member = await within(existing).findByTestId(miguelRowTestId)+ expect(within(member).getByText('Miguel')).toBeTruthy()+ await waitFor(() => expect(within(existing).queryByText('Loading access…')).toBeNull())+ expect(within(existing).getByRole('status').className).toContain(+ 'cu-gfs-existing-access__notice'+ )+ expect(within(existing).getByRole('status').textContent).toMatch(+ /parent folders|parent folder/+ )+ expect(within(existing).queryByText('No one has access yet.')).toBeNull()+ }+ )+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/__tests__/gfsInheritedAccess.coverage.test.ts b/control-ui/components/__tests__/gfsInheritedAccess.coverage.test.tsnew file mode 100644index 000000000..94e8abe5d--- /dev/null+++ b/control-ui/components/__tests__/gfsInheritedAccess.coverage.test.ts@@ -0,0 +1,172 @@+import { beforeEach, describe, expect, it, vi } from 'vitest'+import { apiGet, getGfsGrants, getGfsResourceByPath, getGfsShares } from '@lib/api'+import { loadGfsInheritedAccess } from '../gfsInheritedAccess'++vi.mock('@lib/api', () => ({+ apiGet: vi.fn(),+ getGfsGrants: vi.fn(),+ getGfsResourceByPath: vi.fn(),+ getGfsShares: vi.fn(),+}))++const getFolder = vi.mocked(getGfsResourceByPath)+const getGrants = vi.mocked(getGfsGrants)+const getShares = vi.mocked(getGfsShares)+const FOLDER = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'+const ROOT = 'cccccccc-cccc-cccc-cccc-cccccccccccc'+const SUBJECT = { type: 'user', id: '11111111-1111-1111-1111-111111111111' } as const+const target = { path: '/team-docs/report.md' }++// Successful rows use the established Control UI API-boundary wire contract.+// Failure shapes come from the actual HTTP error producer, never invented markers.+async function failure(status: number, message = 'request rejected') {+ const api = await vi.importActual<typeof import('@lib/api')>('@lib/api')+ const text = JSON.stringify({ error: 'request_failed', message })+ return api.formatApiError(new Response(text, { status }), text)+}++function grant() {+ return {+ id: '44444444-4444-4444-4444-444444444444',+ drive: 'main',+ resourceId: FOLDER,+ subject: SUBJECT,+ permissions: ['read'],+ inherit: true,+ }+}++describe('Control UI inherited coverage', () => {+ beforeEach(() => {+ vi.resetAllMocks()+ getFolder.mockImplementation(async (_drive, path) => ({+ resourceId: path === '/' ? ROOT : FOLDER,+ rid: (path === '/' ? ROOT : FOLDER).replace(/-/g, ''),+ gfsUri: `gfs://main/${path === '/' ? ROOT : FOLDER}`,+ drive: 'main',+ name: path === '/' ? '' : 'team-docs',+ kind: 'directory',+ path,+ version: 1,+ updatedAt: '2026-01-01T00:00:00Z',+ }))+ getGrants.mockImplementation(async id => ({ items: id === FOLDER ? [grant()] : [] }))+ getShares.mockResolvedValue({ items: [] })+ })++ it.each([+ [403, 'read-boundary'],+ [404, 'unavailable'],+ [429, 'unavailable'],+ [500, 'unavailable'],+ ])('retains a proven member when a later ancestor returns %s', async (status, coverage) => {+ const error = await failure(Number(status))+ const normal = getFolder.getMockImplementation()!+ getFolder.mockImplementation(async (...args) => {+ if (args[1] === '/') throw error+ return normal(...args)+ })+ await expect(loadGfsInheritedAccess(target, 'main')).resolves.toMatchObject({+ coverage,+ items: [{ subject: SUBJECT, permissions: ['read'], inheritedFrom: ['team-docs'] }],+ })+ })++ it('retains the successful grant family and continues after a share denial', async () => {+ const error = await failure(403)+ getShares.mockImplementation(async id => {+ if (id === FOLDER) throw error+ return { items: [] }+ })+ await expect(loadGfsInheritedAccess(target, 'main')).resolves.toMatchObject({+ coverage: 'acl-limited',+ items: [{ subject: SUBJECT, sources: [{ grantId: grant().id }] }],+ })+ expect(getFolder.mock.calls.map(([, path]) => path)).toEqual(['/team-docs', '/'])+ })++ it('retains the successful share family before stopping on a grant failure', async () => {+ const error = await failure(500, 'upstream background job returned 401')+ getGrants.mockRejectedValue(error)+ getShares.mockResolvedValue({+ items: [+ {+ id: '66666666-6666-6666-6666-666666666666',+ drive: 'main',+ resourceId: FOLDER,+ subject: SUBJECT,+ permissions: ['read'],+ includeDescendants: true,+ },+ ],+ })+ await expect(loadGfsInheritedAccess(target, 'main')).resolves.toMatchObject({+ coverage: 'unavailable',+ items: [+ { subject: SUBJECT, sources: [{ shareIds: ['66666666-6666-6666-6666-666666666666'] }] },+ ],+ })+ expect(getFolder.mock.calls.map(([, path]) => path)).toEqual(['/team-docs'])+ })++ it.each(['resolve', 'grants', 'shares'] as const)(+ 'rethrows real session expiry from %s',+ async family => {+ const api = await vi.importActual<typeof import('@lib/api')>('@lib/api')+ const expired = new api.AuthExpiredError()+ if (family === 'resolve') getFolder.mockRejectedValue(expired)+ if (family === 'grants') getGrants.mockRejectedValue(expired)+ if (family === 'shares') getShares.mockRejectedValue(expired)+ await expect(loadGfsInheritedAccess(target, 'main')).rejects.toBe(expired)+ }+ )++ it('rethrows cancellation instead of publishing partial data', async () => {+ const controller = new AbortController()+ controller.abort()+ getFolder.mockRejectedValue(controller.signal.reason)+ await expect(loadGfsInheritedAccess(target, 'main', controller.signal)).rejects.toBe(+ controller.signal.reason+ )+ })++ it('rethrows cancellation during target resolution even when the target is root', async () => {+ const controller = new AbortController()+ vi.mocked(apiGet).mockImplementation(async () => {+ controller.abort()+ return { path: '/', kind: 'directory' }+ })+ await expect(+ loadGfsInheritedAccess(+ { path: null, gfsUri: `gfs://main/${ROOT.replace(/-/g, '')}` },+ 'main',+ controller.signal+ )+ ).rejects.toBe(controller.signal.reason)+ expect(getFolder).not.toHaveBeenCalled()+ })++ it('rethrows real session expiry during target resolution', async () => {+ const api = await vi.importActual<typeof import('@lib/api')>('@lib/api')+ const expired = new api.AuthExpiredError()+ vi.mocked(apiGet).mockRejectedValue(expired)+ await expect(+ loadGfsInheritedAccess({ path: null, gfsUri: `gfs://main/${ROOT.replace(/-/g, '')}` }, 'main')+ ).rejects.toBe(expired)+ })++ it('marks a depth-capped walk unavailable instead of complete', async () => {+ getGrants.mockResolvedValue({ items: [] })+ await expect(+ loadGfsInheritedAccess({ path: '/' + Array(67).fill('folder').join('/') }, 'main')+ ).resolves.toMatchObject({ items: [], coverage: 'unavailable' })+ expect(getFolder).toHaveBeenCalledTimes(64)+ })++ it('returns complete when every ancestor and both families load', async () => {+ await expect(loadGfsInheritedAccess(target, 'main')).resolves.toMatchObject({+ coverage: 'complete',+ items: [{ subject: SUBJECT, permissions: ['read'] }],+ })+ })+})diff --git a/control-ui/components/__tests__/gfsInheritedAccess.test.ts b/control-ui/components/__tests__/gfsInheritedAccess.test.tsindex 19cd83558..40f0f1216 100644--- a/control-ui/components/__tests__/gfsInheritedAccess.test.ts+++ b/control-ui/components/__tests__/gfsInheritedAccess.test.ts@@ -34,7 +34,7 @@ describe('loadGfsInheritedAccess', () => {mockGetGfsShares.mockResolvedValue({ items: [] })})- it('fails when an ancestor ACL read fails instead of returning a partial role', async () => {+ it('continues after an ancestor ACL denial and marks retained rows incomplete', async () => {mockGetGfsResourceByPath.mockImplementation(async (_drive, path) => {if (path === '/nested') return resourceView('nested-folder', 'nested', '/nested')if (path === '/') return resourceView('root-folder', '', '/')@@ -56,22 +56,26 @@ describe('loadGfsInheritedAccess', () => {}})- await expect(loadGfsInheritedAccess({ path: '/nested/report.md' }, 'main')).rejects.toThrow(- 'inherited_access_derivation_failed'- )- expect(mockGetGfsResourceByPath.mock.calls.map(([, path]) => path)).toEqual(['/nested'])+ await expect(+ loadGfsInheritedAccess({ path: '/nested/report.md' }, 'main')+ ).resolves.toMatchObject({+ coverage: 'acl-limited',+ items: [{ subject: { type: 'user', id: 'member-1' }, permissions: ['read'] }],+ })+ expect(mockGetGfsResourceByPath.mock.calls.map(([, path]) => path)).toEqual(['/nested', '/'])})- it('fails when an ancestor cannot be resolved, matching Desktop walk semantics', async () => {+ it('stops at an unreadable ancestor with explicit boundary coverage', async () => {mockGetGfsResourceByPath.mockImplementation(async (_drive, path) => {if (path === '/nested') throw new Error('403 forbidden')if (path === '/') return resourceView('root-folder', '', '/')throw new Error('unexpected path')})- await expect(loadGfsInheritedAccess({ path: '/nested/report.md' }, 'main')).rejects.toThrow(- 'inherited_access_derivation_failed'- )+ await expect(loadGfsInheritedAccess({ path: '/nested/report.md' }, 'main')).resolves.toEqual({+ items: [],+ coverage: 'read-boundary',+ })expect(mockGetGfsResourceByPath.mock.calls.map(([, path]) => path)).toEqual(['/nested'])})@@ -89,8 +93,8 @@ describe('loadGfsInheritedAccess', () => {mockGetGfsGrants.mockResolvedValue({ items: [] })mockGetGfsShares.mockResolvedValue({ items: [] })- const items = await loadGfsInheritedAccess({ path: null, gfsUri: 'gfs://main/abcdef' }, 'main')- expect(items).toEqual([])+ const result = await loadGfsInheritedAccess({ path: null, gfsUri: 'gfs://main/abcdef' }, 'main')+ expect(result).toEqual({ items: [], coverage: 'complete' })expect(apiGet).toHaveBeenCalledWith('/api/v1/gfs/resolve',{ uri: 'gfs://main/abcdef' },@@ -100,19 +104,20 @@ describe('loadGfsInheritedAccess', () => {expect(mockGetGfsResourceByPath.mock.calls.map(([, path]) => path)).toEqual(['/'])})- it('fails the derivation when a path-less target cannot be resolved', async () => {+ it('marks a path-less target boundary explicitly when it cannot be resolved', async () => {apiGet.mockRejectedValue(new Error('403 forbidden') as never)mockGetGfsResourceByPath.mockResolvedValue(resourceView('root-folder', '', '/'))await expect(loadGfsInheritedAccess({ path: null, gfsUri: 'gfs://main/abcdef' }, 'main')- ).rejects.toThrow('inherited_access_derivation_failed')+ ).resolves.toEqual({ items: [], coverage: 'read-boundary' })expect(mockGetGfsResourceByPath).not.toHaveBeenCalled()})- it('fails the derivation when a target has neither a path nor a gfs URI', async () => {- await expect(loadGfsInheritedAccess({ path: null, gfsUri: null }, 'main')).rejects.toThrow(- 'inherited_access_derivation_failed'- )+ it('marks a target without a path or gfs URI unavailable', async () => {+ await expect(loadGfsInheritedAccess({ path: null, gfsUri: null }, 'main')).resolves.toEqual({+ items: [],+ coverage: 'unavailable',+ })})})diff --git a/control-ui/components/gfsInheritedAccess.ts b/control-ui/components/gfsInheritedAccess.tsindex 526cc0047..78a73bb2f 100644--- a/control-ui/components/gfsInheritedAccess.ts+++ b/control-ui/components/gfsInheritedAccess.ts@@ -1,4 +1,9 @@-import { gfsAncestorPathsOf } from '@clerum/gfs-interaction-policy'+import {+ classifyGfsAclReadFailure,+ gfsAncestorPathsOf,+ gfsHttpStatusOf,+ worstGfsCoverageClass,+} from '@clerum/gfs-interaction-policy'import {type GfsResourceByPathView,apiGet,@@ -6,153 +11,139 @@ import {getGfsResourceByPath,getGfsShares,} from '@lib/api'-import type { GfsInheritedAccessItem } from './GfsGrantPanel.types'+import type {+ GfsInheritedAccessCoverage,+ GfsInheritedAccessItem,+ GfsInheritedAccessResult,+} from './GfsGrantPanel.types'import { inheritedSubjectKey, mergeInheritedAccessItem } from './gfsInheritedAccessMerge'export { planInheritedRoleChange, strongestInheritedSource } from './gfsInheritedAccessMerge'-/**- * Frontend inheritance derivation for the Share dialog. The grants/shares GETs- * list only the rows configured directly on one resource, so a file's- * inherited access is derived by walking the ancestor folders of the- * resource's canonical path and keeping the rows that apply to descendants- * (grants with inherit=true, shares with includeDescendants=true — the same- * rule the server's allow() evaluation uses). Rows are merged per subject- * through the shared pure merge core (`@clerum/gfs-interaction-policy`,- * property tested there and in R1-M4); EVERY contributing ancestor folder is- * kept as an editable source (with the grant/share ids to mutate), so a- * confirmed removal revokes all of them and a confirmed downgrade lowers- * each one above the target role (R1-H1). If any required ancestor or ACL- * read fails, the derivation fails visibly instead of returning a result- * that looks complete.- */--/**- * Walk semantics (R1-M1, unified with the desktop walk in- * desktop-app/ui/src/gfs/inheritedAccess.ts):- * - BOUNDED in depth: at most 64 ancestors are visited (the shared policy's- * GFS_INHERITED_WALK_MAX_DEPTH; the desktop rid-chain walk bounds itself- * with the same number via GFS_BREADCRUMB_MAX_DEPTH).- * - COMPLETE or FAILED: every ancestor path must resolve to a directory and- * both ACL lists must load. Any failure throws the same derivation error as- * Desktop, so the UI cannot mistake partial data for no inherited access.- * - This walk addresses ancestors by canonical PATH while Desktop follows- * parent resource IDs. The traversal differs, but the failure contract is- * shared.- */-/** `/docs/report.md` → `['/docs', '/']` (nearest ancestor first, depth-capped). */export function gfsAncestorPaths(path: string): string[] {return gfsAncestorPathsOf(path)}-interface InheritingRow {- subject: { type: string; id?: string }- permissions: string[]- grantId: string | null- shareIds: string[]-}--async function listInheritingRows(- folder: GfsResourceByPathView,- drive: string,- signal?: AbortSignal-): Promise<InheritingRow[]> {- const [grants, shares] = await Promise.all([- getGfsGrants(folder.resourceId, drive, signal),- getGfsShares(folder.resourceId, drive, signal),- ])- return [- ...grants.items- .filter(grant => grant.inherit)- .map(grant => ({- subject: grant.subject,- permissions: grant.permissions,- grantId: grant.id,- shareIds: [],- })),- ...shares.items- .filter(share => share.includeDescendants)- .map(share => ({- subject: share.subject,- permissions: share.permissions,- grantId: null,- shareIds: [share.id],- })),- ]-}-/**- * Derives inherited access for FILES AND FOLDERS only when every ancestor and- * ACL list is available. Any incomplete walk throws- * `inherited_access_derivation_failed`, so the caller can distinguish a read- * failure from a complete empty result. The drive root carries an empty name,- * so its label falls back to the drive name, matching the browser breadcrumb.+ * Reconstruct inherited observations from the operator endpoints' direct rows.+ * A later failed read never removes a member already proved by a readable+ * ancestor. Coverage distinguishes partial observations from a complete empty+ * result; grants and shares settle independently on each ancestor (P1-H1).*- * When the target's canonical path is unknown (for example a Share dialog- * opened on the breadcrumb's current folder, whose crumb carries no path),- * the target is resolved once through `/api/v1/gfs/resolve` to obtain it; a- * target with neither a path nor a resolvable gfs URI fails the derivation so- * the dialog never presents "no ancestors" as fact.+ * Control UI normally has intrinsic operator access, unlike the Desktop+ * folder-owner plane. Rate limits and transient failures can still interrupt+ * this walk. Session/context expiry and cancellation rethrow before publishing+ * any result; apiRead owns the global authentication boundary. Structured+ * producer status wins over error prose, including a 500 body mentioning 401.*/export async function loadGfsInheritedAccess(target: { path: string | null; gfsUri?: string | null },drive: string,signal?: AbortSignal-): Promise<GfsInheritedAccessItem[]> {+): Promise<GfsInheritedAccessResult> {+ const bySubject = new Map<string, GfsInheritedAccessItem>()+ const result = (coverage: GfsInheritedAccessCoverage): GfsInheritedAccessResult => ({+ items: [...bySubject.values()],+ coverage,+ })+ const readFailure = (error: unknown) => {+ if (+ signal?.aborted ||+ (error instanceof DOMException && error.name === 'AbortError') ||+ gfsHttpStatusOf(error) === 401+ ) {+ throw error+ }+ return classifyGfsAclReadFailure(error)+ }+ if (signal?.aborted) throw signal.reason+let canonicalPath = target.pathif (!canonicalPath) {- if (!target.gfsUri) throw new Error('inherited_access_derivation_failed')+ if (!target.gfsUri) return result('unavailable')try {const resolved = (await apiGet('/api/v1/gfs/resolve',{ uri: target.gfsUri },{ signal }- )) as {- path?: string | null- kind?: string- }+ )) as { path?: string | null; kind?: string }+ if (signal?.aborted) throw signal.reasonif (resolved.kind && resolved.kind !== 'directory' && resolved.kind !== 'file') {- throw new Error('unexpected kind')+ return result('unavailable')}canonicalPath = resolved.path ?? null} catch (error) {- if (signal?.aborted) throw error- throw new Error('inherited_access_derivation_failed')+ return result(readFailure(error) === 'denied' ? 'read-boundary' : 'unavailable')}- if (!canonicalPath) throw new Error('inherited_access_derivation_failed')+ if (!canonicalPath) return result('unavailable')}- const bySubject = new Map<string, GfsInheritedAccessItem>()++ let coverage: GfsInheritedAccessCoverage = 'complete'const ancestorPaths = gfsAncestorPaths(canonicalPath)for (const ancestorPath of ancestorPaths) {+ if (signal?.aborted) throw signal.reasonlet folder: GfsResourceByPathViewtry {folder = await getGfsResourceByPath(drive, ancestorPath, signal)} catch (error) {- if (signal?.aborted) throw error- throw new Error('inherited_access_derivation_failed')+ return result(readFailure(error) === 'denied' ? 'read-boundary' : 'unavailable')}- if (folder.kind !== 'directory') {- throw new Error('inherited_access_derivation_failed')+ if (signal?.aborted) throw signal.reason+ if (folder.kind !== 'directory') return result('unavailable')++ const settled = await Promise.allSettled([+ getGfsGrants(folder.resourceId, drive, signal),+ getGfsShares(folder.resourceId, drive, signal),+ ])+ if (signal?.aborted) throw signal.reason+ // Inspect both failures before folding: a fulfilled sibling cannot turn+ // genuine session expiry into a partial-success observation.+ const failures = settled.filter(+ (outcome): outcome is PromiseRejectedResult => outcome.status === 'rejected'+ )+ const worst = worstGfsCoverageClass(failures.map(failure => readFailure(failure.reason)))+ const mustStop = worst !== 'complete' && worst !== 'denied'+ if (worst === 'denied') coverage = 'acl-limited'+ const grants = settled[0].status === 'fulfilled' ? settled[0].value.items : []+ const shares = settled[1].status === 'fulfilled' ? settled[1].value.items : []+ const folderLabel = folder.name || drive+ for (const grant of grants) {+ if (!grant.inherit) continue+ fold(grant.subject, grant.permissions, grant.id, [], folder.resourceId, folderLabel)}- let rows: InheritingRow[]- try {- rows = await listInheritingRows(folder, drive, signal)- } catch (error) {- if (signal?.aborted) throw error- throw new Error('inherited_access_derivation_failed')+ for (const share of shares) {+ if (!share.includeDescendants) continue+ fold(share.subject, share.permissions, null, [share.id], folder.resourceId, folderLabel)}- const folderLabel = folder.name || drive- for (const row of rows) {- const key = inheritedSubjectKey(row.subject)- bySubject.set(- key,- mergeInheritedAccessItem(bySubject.get(key) ?? null, row, {- resourceId: folder.resourceId,- name: folderLabel,- })+ // Preserve the successful family on this ancestor before an unavailable+ // stop; ordinary ACL denials retain that family and allow the walk upward.+ if (mustStop) return result('unavailable')+ }+ // The shared path helper caps its result; no root means traversal stopped+ // at that cap, not that every ancestor was observed.+ if (ancestorPaths.length > 0 && ancestorPaths.at(-1) !== '/') return result('unavailable')+ return result(coverage)++ function fold(+ subject: { type: string; id?: string },+ permissions: string[],+ grantId: string | null,+ shareIds: string[],+ resourceId: string,+ name: string+ ): void {+ const key = inheritedSubjectKey(subject)+ bySubject.set(+ key,+ mergeInheritedAccessItem(+ bySubject.get(key) ?? null,+ { subject, permissions, grantId, shareIds },+ {+ resourceId,+ name,+ })- }+ )}- return [...bySubject.values()]}diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 609d6da58..7496c0a55 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.737",+ "version": "0.1.738","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.737",+ "version": "0.1.738","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 d8f82cb5b..7cd3923b6 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.737",+ "version": "0.1.738","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",