Skip to content

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

TypeScript

fix(desktop): name directory-less access members as hidden, not raw UUIDs

Mdc3ac20a4139
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
index dd50a301b..9af94c84a 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
+++ b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
@@ -48,10 +48,68 @@ function AccessSubjectIcon({ kind }: { kind: AccessSubjectKind }) {
* "Who has access" — the resource's current grants, sourced from the user-plane
* grants GET (the only revoke-id source: the grant PUT returns no ids). Subject
* labels resolve host ids to agent names via the caller's own agent directory
- * and user/team ids via the visible team directory; anything unresolved shows
- * its raw id so a row is never hidden or mislabeled.
+ * and user/team ids via the visible team directory. A user/team subject outside
+ * that directory renders as "Hidden user"/"Hidden team" — never a raw UUID —
+ * and carries a hover explanation (plus the id for support) on the row; no row
+ * is ever hidden or mislabeled.
*/
+const HIDDEN_USER_LABEL = 'Hidden user'
+const HIDDEN_TEAM_LABEL = 'Hidden team'
+
+/** The hidden-kind of a user/team subject the visible directory cannot name;
+ * null when the subject resolves (or is not a directory-resolved kind). */
+function hiddenSubjectKind(
+ subject:
+ | GfsGrantListItem['subject']
+ | GfsShareListItem['subject']
+ | GfsInheritedAccessItem['subject'],
+ subjects: GfsDelegationSubjectOption[]
+): 'user' | 'team' | null {
+ if ((subject.type === 'user' || subject.type === 'team') && subject.id) {
+ const match = subjects.find(
+ candidate => candidate.type === subject.type && candidate.id === subject.id
+ )
+ if (!match) return subject.type
+ }
+ return null
+}
+
+/** One-phrase hover explanation for a subject the directory cannot name. */
+function hiddenSubjectTitle(
+ subject:
+ | GfsGrantListItem['subject']
+ | GfsShareListItem['subject']
+ | GfsInheritedAccessItem['subject'],
+ subjects: GfsDelegationSubjectOption[]
+): string | null {
+ const kind = hiddenSubjectKind(subject, subjects)
+ if (kind === 'user' && subject.type === 'user' && subject.id) {
+ return `This member isn’t in any of your teams, so EvenDrive can’t show their name. (${subject.id})`
+ }
+ if (kind === 'team' && subject.type === 'team' && subject.id) {
+ return `This team isn’t in your team list, so EvenDrive can’t show its name. (${subject.id})`
+ }
+ return null
+}
+
+/** Accessible name for a hidden subject: the label alone would collide when a
+ * folder has more than one hidden member, so the id disambiguates for screen
+ * readers and menus while the visible row stays clean. */
+function subjectAccessibleName(
+ subject:
+ | GfsGrantListItem['subject']
+ | GfsShareListItem['subject']
+ | GfsInheritedAccessItem['subject'],
+ subjects: GfsDelegationSubjectOption[],
+ label: string
+): string {
+ const hidden = hiddenSubjectKind(subject, subjects)
+ if (!hidden) return label
+ const id = subject.type === 'user' || subject.type === 'team' ? (subject.id ?? '') : ''
+ return id ? `${label} (${id})` : label
+}
+
function subjectLabel(
subject:
| GfsGrantListItem['subject']
@@ -72,6 +130,7 @@ function subjectLabel(
candidate => candidate.type === subject.type && candidate.id === subject.id
)
if (match) return match.label
+ return subject.type === 'user' ? HIDDEN_USER_LABEL : HIDDEN_TEAM_LABEL
}
return subject.id ?? subject.type
}
@@ -178,6 +237,8 @@ export function GfsGrantList({
? items.map(item => {
if (mergedByKey.has(subjectKey(item.subject))) return null
const label = subjectLabel(item.subject, agents, subjects)
+ const accessibleName = subjectAccessibleName(item.subject, subjects, label)
+ const hiddenTitle = hiddenSubjectTitle(item.subject, subjects)
const kind = subjectKind(item.subject)
return (
<li
@@ -193,11 +254,13 @@ export function GfsGrantList({
<AccessSubjectIcon kind={kind} />
</span>
<span className="da-gfs-grant-list__identity">
- <span className="da-gfs-grant-list__label">{label}</span>
+ <span className="da-gfs-grant-list__label" title={hiddenTitle ?? undefined}>
+ {label}
+ </span>
</span>
<span className="da-gfs-grant-list__meta">
<DropdownSelect
- ariaLabel={`Access role for ${label}`}
+ ariaLabel={`Access role for ${accessibleName}`}
className="da-gfs-grant-list__role"
disabled={updatingRole || !onChangeRole}
onChange={value => void onChangeRole?.(item, label, value as GfsAccessRole)}
@@ -209,7 +272,7 @@ export function GfsGrantList({
</span>
<AccessRowMenu
disabled={revoking}
- label={label}
+ label={accessibleName}
onRemove={() => onRevoke(item, label)}
/>
</li>
@@ -219,6 +282,8 @@ export function GfsGrantList({
{showMergedRows
? [...mergedByKey.values()].map(row => {
const label = subjectLabel(row.subject, agents, subjects)
+ const accessibleName = subjectAccessibleName(row.subject, subjects, label)
+ const hiddenTitle = hiddenSubjectTitle(row.subject, subjects)
const kind = subjectKind(row.subject)
return (
<li
@@ -235,13 +300,15 @@ export function GfsGrantList({
<AccessSubjectIcon kind={kind} />
</span>
<span className="da-gfs-grant-list__identity">
- <span className="da-gfs-grant-list__label">{label}</span>
+ <span className="da-gfs-grant-list__label" title={hiddenTitle ?? undefined}>
+ {label}
+ </span>
</span>
<span className="da-gfs-grant-list__meta">
{/* Normal toggleable row: any edit opens the
parent-folder confirmation in the page. */}
<DropdownSelect
- ariaLabel={`Access role for ${label}`}
+ ariaLabel={`Access role for ${accessibleName}`}
className="da-gfs-grant-list__role"
disabled={updatingRole || !onChangeInheritedRole}
onChange={value =>
@@ -255,7 +322,7 @@ export function GfsGrantList({
</span>
<AccessRowMenu
disabled={revoking || !onRemoveInherited}
- label={label}
+ label={accessibleName}
onRemove={() => void onRemoveInherited?.(row, label)}
/>
</li>
@@ -266,6 +333,8 @@ export function GfsGrantList({
? shares.map(item => {
if (mergedByKey.has(subjectKey(item.subject))) return null
const label = subjectLabel(item.subject, agents, subjects)
+ const accessibleName = subjectAccessibleName(item.subject, subjects, label)
+ const hiddenTitle = hiddenSubjectTitle(item.subject, subjects)
const kind = subjectKind(item.subject)
return (
<li
@@ -281,7 +350,9 @@ export function GfsGrantList({
<AccessSubjectIcon kind={kind} />
</span>
<span className="da-gfs-grant-list__identity">
- <span className="da-gfs-grant-list__label">{label}</span>
+ <span className="da-gfs-grant-list__label" title={hiddenTitle ?? undefined}>
+ {label}
+ </span>
</span>
<span className="da-gfs-grant-list__meta">
<span className="da-gfs-grant-list__role-label">
@@ -290,7 +361,7 @@ export function GfsGrantList({
</span>
<AccessRowMenu
disabled={revokingShare || !onRevokeShare}
- label={label}
+ label={accessibleName}
onRemove={() => onRevokeShare?.(item, label)}
/>
</li>
diff --git a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
index 0cb8c8322..c866c918b 100644
--- a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
@@ -11,9 +11,12 @@ import { mergeInheritedAccessItem } from '../inheritedAccessMerge'
/**
* "Who has access" list (Manage modal). Rows resolve host subjects to agent
- * names, user/team subjects through the visible team directory, and fall back
- * to the raw id (a row is never hidden). A manage_acl_required list failure is
- * an expected state and renders as a quiet informational banner, not an error.
+ * names, user/team subjects through the visible team directory. A user/team
+ * outside the directory renders as "Hidden user"/"Hidden team" with a hover
+ * explanation (id included for support) — never a raw UUID in the row, and
+ * never a hidden row. Unresolved host ids keep their raw identifier. A
+ * manage_acl_required list failure is an expected state and renders as a
+ * quiet informational banner, not an error.
*/
afterEach(cleanup)
@@ -99,6 +102,64 @@ describe('GfsGrantList', () => {
expect(workflowRow.querySelector('[data-subject-kind="workflow"] svg')).not.toBeNull()
})
+ it('renders directory-less user and team subjects as hidden labels with a hover explanation', () => {
+ render(
+ <GfsGrantList
+ agents={agents}
+ items={[
+ grantItem({
+ id: 'grant-hidden-user',
+ subject: { type: 'user', id: 'user-outside-directory' },
+ permissions: ['read', 'share'],
+ }),
+ grantItem({
+ id: 'grant-hidden-team',
+ subject: { type: 'team', id: 'team-outside-directory' },
+ permissions: ['read'],
+ }),
+ ]}
+ onRevoke={vi.fn()}
+ subjects={subjects}
+ />
+ )
+
+ const hiddenUserLabel = screen.getByText('Hidden user')
+ expect(screen.queryByText('user-outside-directory')).toBeNull()
+ expect(hiddenUserLabel.getAttribute('title')).toBe(
+ 'This member isn’t in any of your teams, so EvenDrive can’t show their name. (user-outside-directory)'
+ )
+ // The accessible name keeps the id so multiple hidden members stay distinct.
+ expect(
+ screen.getByRole('button', { name: 'Access role for Hidden user (user-outside-directory)' })
+ ).toBeTruthy()
+ expect(
+ screen.getByRole('button', { name: 'Actions for Hidden user (user-outside-directory)' })
+ ).toBeTruthy()
+
+ const hiddenTeamLabel = screen.getByText('Hidden team')
+ expect(screen.queryByText('team-outside-directory')).toBeNull()
+ expect(hiddenTeamLabel.getAttribute('title')).toBe(
+ 'This team isn’t in your team list, so EvenDrive can’t show its name. (team-outside-directory)'
+ )
+
+ // A resolved subject carries no hover explanation.
+ const resolvedRow = render(
+ <GfsGrantList
+ agents={agents}
+ items={[
+ grantItem({
+ id: 'grant-resolved',
+ subject: { type: 'user', id: 'user-2' },
+ permissions: ['read'],
+ }),
+ ]}
+ onRevoke={vi.fn()}
+ subjects={subjects}
+ />
+ ).getByText('Test Two')!
+ expect(resolvedRow.getAttribute('title')).toBeNull()
+ })
+
it('labels a host subject by its displayName, falling back to the identifier when blank', () => {
render(
<GfsGrantList
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index 766f72723..c1a1c60e8 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -3323,12 +3323,15 @@ describe('FilesPage', () => {
const shareRow = await screen.findByTestId('gfs-access-row-share-share-1')
expect(shareRow.textContent).not.toContain('Includes contents')
- fireEvent.click(screen.getByRole('button', { name: 'Actions for user-9' }))
+ // A share subject outside the visible team directory renders as a hidden
+ // label (never a raw UUID); the accessible name keeps the id distinct.
+ expect(screen.getByText('Hidden user')).toBeTruthy()
+ fireEvent.click(screen.getByRole('button', { name: 'Actions for Hidden user (user-9)' }))
fireEvent.click(screen.getByRole('menuitem', { name: 'Remove access' }))
await waitFor(() => expect(revokeShare).toHaveBeenCalledWith('share-1'))
await waitFor(() =>
- expect(pushToast).toHaveBeenCalledWith('Shared access revoked for user-9', 'success')
+ expect(pushToast).toHaveBeenCalledWith('Shared access revoked for Hidden user', 'success')
)
})