Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(evendrive): treat re-selecting the displayed merged role as a no-op (N1)
Mfee48c0b0c1a
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsxindex 0aeb4c82b..6d9c72954 100644--- a/control-ui/components/GfsGrantPanel.tsx+++ b/control-ui/components/GfsGrantPanel.tsx@@ -828,6 +828,14 @@ export function GfsGrantPanel({ resource }: GfsGrantPanelProps): React.JSX.Elemereturn}const nextRole = (next[0] ?? 'read') as AccessRole+ // N1: the dropdown displays the MERGED+ // effective role (direct ⊔ inherited).+ // Re-selecting the already-displayed role is a+ // no-op — comparing it against the+ // inherited-only floor instead would open the+ // parent-update modal and escalate the parent+ // folder for a non-change.+ if (nextRole === roleForPermissions(row.permissions)) returnconst affected = planInheritedRoleChange(row.inherited as GfsInheritedAccessItem,nextRole === 'editor'diff --git a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsxindex bb9b54ee2..921928f78 100644--- a/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx+++ b/control-ui/components/__tests__/GfsGrantPanel.inherited.test.tsx@@ -731,6 +731,28 @@ describe('GfsGrantPanel inherited access', () => {)})+ // N1 — the dropdown shows the MERGED role (direct ⊔ inherited);+ // re-selecting the already-displayed role must be a no-op, not an+ // inherited-floor comparison that escalates the parent folder.+ it('re-selecting the displayed merged role opens no modal and issues no writes', async () => {+ // Direct Editor grant on the file + inherited Read floor on campaigns:+ // the row displays Editor even though the inherited-only role is Read.+ driveScenario({ campaigns: VIEWER, fileGrant: EDITOR })+ const row = await openRoleDialog()++ expect(+ within(row).getByRole('button', { name: 'Access role for Miguel' }).textContent+ ).toContain('Editor')++ await chooseRole(row, 'Editor')++ // No confirmation, no writes — the displayed role was re-selected.+ expect(screen.queryByRole('alertdialog')).toBeNull()+ expect(mockPutGfsGrant).not.toHaveBeenCalled()+ expect(mockDeleteGfsGrant).not.toHaveBeenCalled()+ expect(mockDeleteGfsShare).not.toHaveBeenCalled()+ })+it('states the true partial outcome when a folder update fails mid-run', async () => {driveScenario({ campaigns: EDITOR, marketing: EDITOR })mockPutGfsGrant.mockImplementation(async body => {diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex ee88e958a..55057f0bb 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.603",+ "version": "0.1.604","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.603",+ "version": "0.1.604","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 4746cc0f1..e5c50bedf 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.603",+ "version": "0.1.604","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsxindex 8eb693be0..9703cf683 100644--- a/desktop-app/ui/src/pages/FilesPage.tsx+++ b/desktop-app/ui/src/pages/FilesPage.tsx@@ -608,6 +608,11 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:const inherited = row.inheritedif (!inherited) returnconst subject = inherited.subject+ // N1: the dropdown displays the MERGED effective role (direct ⊔+ // inherited). Re-selecting the already-displayed role is a no-op —+ // comparing it against the inherited-only floor instead would open the+ // parent-update modal and escalate the parent folder for a non-change.+ if (role === roleForAccessPermissions(row.permissions)) return// R1-H1 plan: downgrade lowers every folder above the target; upgrade// raises the single strongest folder; same-role selection touches none.const affected = planInheritedRoleChange(inherited, role === 'editor')diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsxindex 1cb5aca6e..003ce4ed7 100644--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx@@ -2242,6 +2242,76 @@ describe('FilesPage', () => {)})+ // N1 — the dropdown shows the MERGED role (direct ⊔ inherited);+ // re-selecting the already-displayed role must be a no-op, not an+ // inherited-floor comparison that escalates the parent folder.+ it('re-selecting the displayed merged role opens no modal and issues no writes', async () => {+ installInheritedDirectoryMocks()+ const folderAffordances = (window.clerum.gfs as { affordances: ReturnType<typeof vi.fn> })+ .affordances+ const parentGrant = (window.clerum.gfs as { grant: ReturnType<typeof vi.fn> }).grant+ const pushToast = vi.fn()+ // Direct Editor grant on the file + inherited Read floor: the row+ // displays Editor even though the inherited-only role is Read.+ hookMock.useGfsBrowserController.mockReturnValue(+ inheritedFileController({+ grants: [+ {+ id: 'grant-1',+ drive: 'main',+ resourceId: 'file-1',+ subject: { type: 'user', id: 'user-2' },+ permissions: ['read', 'write', 'delete', 'manage_acl', 'share'],+ inherit: false,+ },+ ],+ inheritedAccess: [+ {+ subject: { type: 'user', id: 'user-2' },+ permissions: ['read'],+ inheritedFrom: ['Team folder'],+ sources: [+ {+ resourceId: 'folder-1',+ name: 'Team folder',+ permissions: ['read'],+ grantId: 'parent-grant-1',+ shareIds: [],+ },+ ],+ },+ ],+ })+ )++ renderFilesPage(pushToast)+ await openManageDialog('report.txt')+ const manageDialog = await screen.findByRole('dialog', { name: 'Share file report.txt' })+ const row = await within(manageDialog).findByTestId('gfs-access-row-inherited-user')+ // The merged row displays the strongest role across sources.+ expect(+ within(row).getByRole('button', { name: 'Access role for Test Two' }).textContent+ ).toContain('Editor')++ await act(async () => {+ fireEvent.click(within(row).getByRole('button', { name: 'Access role for Test Two' }))+ })+ await act(async () => {+ fireEvent.click(screen.getByRole('option', { name: 'Editor' }))+ })++ // No confirmation, no pre-flight, no writes — the displayed role was+ // re-selected.+ expect(screen.queryByRole('alertdialog')).toBeNull()+ expect(folderAffordances).not.toHaveBeenCalled()+ expect(parentGrant).not.toHaveBeenCalled()+ await waitFor(() =>+ expect(+ within(row).getByRole('button', { name: 'Access role for Test Two' }).textContent+ ).toContain('Editor')+ )+ })+it('states the true partial outcome when a folder removal fails mid-run', async () => {installInheritedDirectoryMocks()const revokeGrant = vi.fn(async (grantId: string) => {