Skip to content

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

TypeScript

fix(desktop): harden drop-refusal UX after review

M5876a1960a21
diff --git a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx
index aa1a9bcba..a93515849 100644
--- a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx
+++ b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/__tests__/FileExplorerTree.test.tsx
@@ -1648,9 +1648,16 @@ describe('FileExplorerTree — drag-and-drop moves', () => {
fireEvent.dragOver(bRow, { dataTransfer })
fireEvent.drop(bRow, { dataTransfer })
+ // The sentence appears on BOTH refusal surfaces: the gated
+ // callback-local banner AND the revoked tree surface, which owns it
+ // unconditionally and outlives the dead gesture's ownership (A11).
+ const sessionEnded = await screen.findAllByText(
+ 'Your session ended. Sign in again to continue moving files.'
+ )
+ expect(sessionEnded.length).toBeGreaterThanOrEqual(2)
expect(
- await screen.findByText('Your session ended. Sign in again to continue moving files.')
- ).toBeTruthy()
+ sessionEnded.some(element => element.closest('.da-file-explorer__revoked') !== null)
+ ).toBe(true)
// The revoked surface stays visible alongside the refusal banner.
expect(await screen.findByText('File access is not authorized')).toBeTruthy()
// A dead session is not a one-shot toast.
diff --git a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx
index b8541b29f..380b1571c 100644
--- a/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx
+++ b/desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx
@@ -25,6 +25,7 @@ import {
GFS_DROP_SESSION_LOST_MESSAGE,
gfsDropVerdictLiveAnnouncement,
gfsDropVerdictReason,
+ mayPaintGfsSessionLostBanner,
presentGfsDropRefusal,
sameGfsDropVerdict,
} from '@/gfs/dropVerdict'
@@ -477,8 +478,10 @@ export function FileExplorerTree({
// screen reader as well (RP-026).
const [dropVerdictAnnouncement, setDropVerdictAnnouncement] = useState('')
// A drop refused by a dead session must stay visible AFTER the revocation
- // has already invalidated the gesture's ownership (UX matrix A11): the
- // banner outlives the drop callback, until the next gesture or scope.
+ // has already invalidated the gesture's ownership (UX matrix A11). The
+ // revoked surface below carries the sentence unconditionally; this
+ // callback-local banner is gated by the captured scope/session identity so
+ // a superseded call cannot paint it over a new, healthy session.
const [dropSessionLost, setDropSessionLost] = useState(false)
// Display name of the live gesture's source, for reason copy that names it.
const [dragSourceName, setDragSourceName] = useState<string | null>(null)
@@ -522,8 +525,11 @@ export function FileExplorerTree({
adjudication.endDragSession()
setPendingFolderMove(null)
setDropStatesByResourceId({})
- setDropSessionLost(false)
setDragSourceName(null)
+ // A NEW live session makes any session-ended refusal stale. A transition
+ // TO revoked (scope null) must NOT clear it: that is exactly when the
+ // message has to survive (A11), and the revoked surface below carries it.
+ if (liveDragScope !== null) setDropSessionLost(false)
}, [adjudication.endDragSession, liveDragScope])
const ownsDrop = useCallback(
@@ -691,6 +697,10 @@ export function FileExplorerTree({
event.preventDefault()
event.stopPropagation()
hoverOwnerRef.current = source
+ // The gesture may have started on ANOTHER surface (Files ↔ tree): the
+ // resolved shared source — not a local dragstart — owns the name the
+ // reason copy interpolates.
+ setDragSourceName(previous => (previous === source.name ? previous : source.name))
const verdict = adjudication.hoverVerdict(source, {
resourceId: node.resourceId,
name: node.name,
@@ -801,6 +811,7 @@ export function FileExplorerTree({
if (!source || node.kind !== 'directory' || movingResourceIdRef.current) return
const epoch = dragSessionEpochRef.current
const sessionGeneration = dragSession?.currentGeneration() ?? null
+ const scopeAtDrop = liveDragScopeRef.current
try {
const decision = await adjudication.adjudicateDrop(source, {
resourceId: node.resourceId,
@@ -809,12 +820,27 @@ export function FileExplorerTree({
ancestorIds,
})
if (!decision.allowed && decision.reason === 'session-lost') {
- // Presented BEFORE the ownership guard, and as a persistent banner:
- // the revocation that caused this refusal has already invalidated
- // the gesture's ownership, so the normal callback path would return
- // silently — the session's death must stay explained (A11).
- setDropSessionLost(true)
- setDropVerdictAnnouncement(GFS_DROP_SESSION_LOST_MESSAGE)
+ // Presented BEFORE the ownership guard: the revocation that caused
+ // this refusal has already invalidated the gesture's ownership, so
+ // the normal callback path would return silently. The revoked
+ // surface below carries the sentence persistently; this local
+ // banner/announcement is gated by the captured scope/session
+ // identity so a superseded call cannot declare a NEW, healthy
+ // session ended (A11).
+ if (
+ mayPaintGfsSessionLostBanner({
+ capturedScope: scopeAtDrop,
+ liveScope: liveDragScopeRef.current,
+ capturedEpoch: epoch,
+ liveEpoch: dragSessionEpochRef.current,
+ capturedSessionGeneration: sessionGeneration,
+ liveSessionGeneration: dragSession?.currentGeneration() ?? null,
+ hasSharedSession: dragSession != null,
+ })
+ ) {
+ setDropSessionLost(true)
+ setDropVerdictAnnouncement(GFS_DROP_SESSION_LOST_MESSAGE)
+ }
return
}
if (!ownsDrop(source, epoch, sessionGeneration)) return
@@ -953,6 +979,10 @@ export function FileExplorerTree({
// discovery error and roots, so an unauthorized drive would read empty.
<div className="da-file-explorer__revoked" role="alert">
<p className="da-file-explorer__revoked-title">File access is not authorized</p>
+ {/* The revoked surface owns the session-ended sentence (A11): it
+ outlives any gesture's ownership, so a drag whose probe died
+ stays explained even after the revocation invalidated it. */}
+ <p className="da-file-explorer__revoked-body">{GFS_DROP_SESSION_LOST_MESSAGE}</p>
<p className="da-file-explorer__revoked-body">
Your current session cannot access these files. Sign in again or contact an
administrator.
diff --git a/desktop-app/ui/src/gfs/__tests__/dragOwnership.test.tsx b/desktop-app/ui/src/gfs/__tests__/dragOwnership.test.tsx
index 7e6743206..9c337cce5 100644
--- a/desktop-app/ui/src/gfs/__tests__/dragOwnership.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/dragOwnership.test.tsx
@@ -334,6 +334,36 @@ for (const surface of ['sidebar', 'files'] as const) {
expect(h.api().activeSource()?.resourceId).toBe('external')
})
+ it('names the cross-surface source in the denied hover tooltip (UX matrix §5.1)', async () => {
+ // The gesture begins on the OTHER surface through the shared session —
+ // no local dragstart ever fires here, so the tooltip's source name must
+ // come from the hover-resolved shared source, not a local dragstart.
+ // Runs for both surfaces: files→sidebar and sidebar→files.
+ const h = await setup('file')
+ expect(
+ h.api().beginDrag({
+ resourceId: 'external',
+ gfsUri: 'gfs://main/external',
+ drive: 'main',
+ kind: 'file',
+ name: 'external.txt',
+ parentKnown: true,
+ // The external source already lives in Hover: structure denies
+ // same-parent immediately, no probe needed.
+ parentResourceId: 'hover',
+ knownAncestorIds: ['hover'],
+ origin: 'files',
+ scope: 'env-1:user-1:team-1',
+ })
+ ).toBe(true)
+ fireEvent.dragOver(h.row('Hover'), { dataTransfer: h.dataTransfer })
+ expect(h.dropState('Hover')).toBe('denied')
+ expect(h.row('Hover').getAttribute('data-drop-reason')).toBe('same-parent')
+ // Not "This item is already in Hover." — the resolved source's own name.
+ expect(h.row('Hover').getAttribute('title')).toBe('external.txt is already in Hover.')
+ expect(screen.getByText('external.txt is already in Hover.')).toBeTruthy()
+ })
+
it('reports an already dispatched move without clearing newer hover work', async () => {
const h = await setup('file')
let finish!: () => void
diff --git a/desktop-app/ui/src/gfs/__tests__/dropVerdict.test.ts b/desktop-app/ui/src/gfs/__tests__/dropVerdict.test.ts
index 8696cb102..3c810837a 100644
--- a/desktop-app/ui/src/gfs/__tests__/dropVerdict.test.ts
+++ b/desktop-app/ui/src/gfs/__tests__/dropVerdict.test.ts
@@ -6,6 +6,7 @@ import {
gfsDropReasonTone,
gfsDropVerdictAnnouncement,
gfsDropVerdictReason,
+ mayPaintGfsSessionLostBanner,
presentGfsDropRefusal,
sameGfsDropVerdict,
} from '../dropVerdict'
@@ -215,3 +216,53 @@ describe('presentGfsDropRefusal — the drop-time presentation', () => {
})
})
})
+
+describe('mayPaintGfsSessionLostBanner — superseded calls cannot end a healthy session (A11)', () => {
+ const admitted = {
+ capturedScope: 'env-1:user-1:team-1',
+ liveScope: 'env-1:user-1:team-1',
+ capturedEpoch: 3,
+ liveEpoch: 3,
+ capturedSessionGeneration: 7,
+ liveSessionGeneration: 7,
+ hasSharedSession: true,
+ }
+
+ it('paints while the admitted gesture is still the live one', () => {
+ expect(mayPaintGfsSessionLostBanner(admitted)).toBe(true)
+ })
+
+ it('paints when the session is observably dead (live scope null), even after the revocation invalidated everything', () => {
+ expect(
+ mayPaintGfsSessionLostBanner({
+ ...admitted,
+ liveScope: null,
+ liveEpoch: 4,
+ liveSessionGeneration: 8,
+ })
+ ).toBe(true)
+ })
+
+ it('does not paint when a new, healthy scope is live', () => {
+ expect(mayPaintGfsSessionLostBanner({ ...admitted, liveScope: 'env-2:user-1:team-1' })).toBe(
+ false
+ )
+ })
+
+ it('does not paint when a newer gesture on the same surface superseded the drop', () => {
+ expect(mayPaintGfsSessionLostBanner({ ...admitted, liveEpoch: 4 })).toBe(false)
+ })
+
+ it('does not paint when the shared session generation moved on', () => {
+ expect(mayPaintGfsSessionLostBanner({ ...admitted, liveSessionGeneration: 8 })).toBe(false)
+ })
+
+ it('without a shared session, the surface epoch alone decides', () => {
+ expect(
+ mayPaintGfsSessionLostBanner({ ...admitted, hasSharedSession: false, liveEpoch: 3 })
+ ).toBe(true)
+ expect(
+ mayPaintGfsSessionLostBanner({ ...admitted, hasSharedSession: false, liveEpoch: 4 })
+ ).toBe(false)
+ })
+})
diff --git a/desktop-app/ui/src/gfs/__tests__/moveCommit.test.ts b/desktop-app/ui/src/gfs/__tests__/moveCommit.test.ts
index b0277c2ce..694b31497 100644
--- a/desktop-app/ui/src/gfs/__tests__/moveCommit.test.ts
+++ b/desktop-app/ui/src/gfs/__tests__/moveCommit.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
-import { commitGfsMove, suggestNumberedMoveName } from '../moveCommit'
+import { commitGfsMove, suggestNumberedMoveName, toastMoveOutcome } from '../moveCommit'
import type { MoveCommitSourceSnapshot } from '../moveCommit'
-import type { MoveCommitDeps, MoveCommitPlan } from '../moveCommit'
+import type { MoveCommitDeps, MoveCommitOutcome, MoveCommitPlan } from '../moveCommit'
function resolved(overrides: Partial<MoveCommitSourceSnapshot> = {}): MoveCommitSourceSnapshot {
return {
@@ -251,6 +251,24 @@ describe('commitGfsMove — server verdicts', () => {
if (outcome.status === 'rate-limited') expect(outcome.retryAfterSeconds).toBe(7)
})
+ it('a 403 explains unconfirmed permission without raw HTTP prose or a named bit (B6)', async () => {
+ const outcome = await commitGfsMove(
+ deps({
+ moveResource: vi.fn(async () => {
+ throw new Error('403 Forbidden: manage_acl_required httpStatus=403')
+ }),
+ }),
+ plan()
+ )
+ expect(outcome.status).toBe('unconfirmed')
+ if (outcome.status !== 'unconfirmed') return
+ expect(outcome.message).toBe(
+ 'EvenDrive could not confirm permission for this move. Refresh and try again.'
+ )
+ expect(outcome.message).not.toContain('403')
+ expect(outcome.message).not.toContain('manage_acl_required')
+ })
+
it('transport loss after dispatch verifies by resolve and never repeats the PATCH', async () => {
const moveResource = vi.fn(async () => {
throw new Error('network error')
@@ -422,3 +440,43 @@ describe('suggestNumberedMoveName', () => {
)
})
})
+
+describe('toastMoveOutcome — unknown outcomes warn, definite negatives error (B6–B8)', () => {
+ const present = (outcome: MoveCommitOutcome) => {
+ const pushToast = vi.fn()
+ toastMoveOutcome(pushToast, outcome, 'report.md', 'Dest', 'file')
+ return pushToast.mock.calls as Array<[string, string]>
+ }
+
+ it('an unconfirmed outcome (transport loss, 403) warns instead of erroring', () => {
+ const calls = present({
+ status: 'unconfirmed',
+ message: 'Couldn’t confirm the move. Refresh before trying again.',
+ })
+ expect(calls).toEqual([['Couldn’t confirm the move. Refresh before trying again.', 'warn']])
+ })
+
+ it('a rate-limited outcome warns', () => {
+ const calls = present({
+ status: 'rate-limited',
+ message: 'Too many file requests — try again in 7s.',
+ retryAfterSeconds: 7,
+ })
+ expect(calls).toEqual([['Too many file requests — try again in 7s.', 'warn']])
+ })
+
+ it('definite negatives stay errors and successes stay successes', () => {
+ expect(present({ status: 'conflict-stopped', message: 'blocked' })).toEqual([
+ ['blocked', 'error'],
+ ])
+ expect(present({ status: 'target-unavailable', message: 'gone' })).toEqual([['gone', 'error']])
+ expect(present({ status: 'committed', version: 8, previousParentId: 'p' })).toEqual([
+ ['Moved report.md to Dest', 'success'],
+ ])
+ })
+
+ it('a dead or superseded gesture stays silent', () => {
+ expect(present({ status: 'session-lost' })).toEqual([])
+ expect(present({ status: 'gesture-lost' })).toEqual([])
+ })
+})
diff --git a/desktop-app/ui/src/gfs/__tests__/moveProducerErrors.test.ts b/desktop-app/ui/src/gfs/__tests__/moveProducerErrors.test.ts
index 84b1d69e2..a9be45654 100644
--- a/desktop-app/ui/src/gfs/__tests__/moveProducerErrors.test.ts
+++ b/desktop-app/ui/src/gfs/__tests__/moveProducerErrors.test.ts
@@ -111,8 +111,14 @@ describe('real move producer verdicts (R1-M3)', () => {
expect(result.outcome.message).toBe('Too many file requests — try again in 7s.')
}
if (result.outcome.status === 'unconfirmed') {
- expect(result.outcome.message).toContain('move rejected')
- expect(result.outcome.message).not.toMatch(/httpStatus=|retryAfterSeconds=/)
+ // B6 (refusal UX matrix): a 403 explains that permission could not be
+ // confirmed — generic re-check copy, never the raw server verdict or
+ // plumbing markers. The trusted STATUS still drives the verdict and
+ // the no-retry contract asserted above.
+ expect(result.outcome.message).toBe(
+ 'EvenDrive could not confirm permission for this move. Refresh and try again.'
+ )
+ expect(result.outcome.message).not.toMatch(/httpStatus=|retryAfterSeconds=|move rejected/)
}
if (result.outcome.status === 'destination-rejected') {
expect(result.outcome.message).toBe(
diff --git a/desktop-app/ui/src/gfs/dropVerdict.ts b/desktop-app/ui/src/gfs/dropVerdict.ts
index 38b64eed1..4667e8204 100644
--- a/desktop-app/ui/src/gfs/dropVerdict.ts
+++ b/desktop-app/ui/src/gfs/dropVerdict.ts
@@ -1,5 +1,16 @@
import { sanitizeAppTabTitle } from '@lib/sanitizeAppTabTitle'
import type { GfsDropDenialReason, GfsDropRejection, GfsDropVerdict } from './dragSession.types'
+import type {
+ GfsDropFeedbackTone,
+ GfsDropReasonNames,
+ GfsDropRefusalPresentation,
+} from './dropVerdict.types'
+
+export type {
+ GfsDropFeedbackTone,
+ GfsDropReasonNames,
+ GfsDropRefusalPresentation,
+} from './dropVerdict.types'
/**
* The spoken + written form of a drop verdict (RP-026, refusal UX matrix §5).
@@ -14,9 +25,6 @@ import type { GfsDropDenialReason, GfsDropRejection, GfsDropVerdict } from './dr
* reaches a visible string.
*/
-/** Presentation tones (matrix §5.2): deny=error, no-op=info, unknown=warn. */
-export type GfsDropFeedbackTone = 'error' | 'info' | 'warn'
-
/** A11: the drop-refusal surface for a dead session — a persistent banner,
* never a one-shot toast (matrix §5.3). */
export const GFS_DROP_SESSION_LOST_MESSAGE =
@@ -46,11 +54,6 @@ function displayTarget(name: string | undefined): string {
return sanitizeAppTabTitle(name ?? '') || 'this folder'
}
-export interface GfsDropReasonNames {
- source: string
- target: string
-}
-
/**
* One sentence per reason (matrix §3/§6): names the missing access as
* "edit access"/"delete access" (never the wire bit), and distinguishes the
@@ -153,9 +156,38 @@ export function sameGfsDropVerdict(
return left.reason === (right as typeof left).reason
}
-export interface GfsDropRefusalPresentation {
- message: string
- tone: GfsDropFeedbackTone
+export interface GfsSessionLostBannerGateInput {
+ /** The surface's live drag scope captured when the drop was admitted. */
+ capturedScope: string | null
+ /** The surface's live drag scope NOW (null while revoked). */
+ liveScope: string | null
+ /** The surface's local gesture counter captured at admission. */
+ capturedEpoch: number
+ /** The surface's local gesture counter now. */
+ liveEpoch: number
+ /** The shared session generation captured at admission (null without one). */
+ capturedSessionGeneration: number | null
+ /** The shared session generation now (null without one). */
+ liveSessionGeneration: number | null
+ /** Whether the shared drag-session provider is present. */
+ hasSharedSession: boolean
+}
+
+/**
+ * May a drop callback that answered `session-lost` still paint the local
+ * banner and announcement? Only when the surface's session is observably dead
+ * now (live scope null — the revocation itself proves it), or when the very
+ * gesture that asked is still the live one. A call superseded by a newer
+ * gesture or a new, healthy scope must not declare that session ended (A11).
+ */
+export function mayPaintGfsSessionLostBanner(input: GfsSessionLostBannerGateInput): boolean {
+ if (input.liveScope === null) return true
+ if (input.liveScope !== input.capturedScope) return false
+ if (input.liveEpoch !== input.capturedEpoch) return false
+ if (input.hasSharedSession) {
+ return input.liveSessionGeneration === input.capturedSessionGeneration
+ }
+ return true
}
/**
diff --git a/desktop-app/ui/src/gfs/dropVerdict.types.ts b/desktop-app/ui/src/gfs/dropVerdict.types.ts
new file mode 100644
index 000000000..37776458b
--- /dev/null
+++ b/desktop-app/ui/src/gfs/dropVerdict.types.ts
@@ -0,0 +1,14 @@
+/** Presentation tones (matrix §5.2): deny=error, no-op=info, unknown=warn. */
+export type GfsDropFeedbackTone = 'error' | 'info' | 'warn'
+
+/** Sanitized display names the reason sentences interpolate. */
+export interface GfsDropReasonNames {
+ source: string
+ target: string
+}
+
+/** The drop-time presentation of a refused move (message + tone). */
+export interface GfsDropRefusalPresentation {
+ message: string
+ tone: GfsDropFeedbackTone
+}
diff --git a/desktop-app/ui/src/gfs/moveCommit.ts b/desktop-app/ui/src/gfs/moveCommit.ts
index bb6120943..ddb7c8199 100644
--- a/desktop-app/ui/src/gfs/moveCommit.ts
+++ b/desktop-app/ui/src/gfs/moveCommit.ts
@@ -235,9 +235,14 @@ export async function commitGfsMove(
}
}
if (status === 403) {
- // Generic unless a successful permission recheck proves the missing bit;
- // the pre-commit probes own the exact-reason copy.
- return { status: 'unconfirmed', message: describeGfsReadError(error).message }
+ // Generic unless a successful permission recheck proves the missing
+ // bit; the pre-commit probes own the exact-reason copy. B6: a 403
+ // explains that permission could not be confirmed — never raw HTTP
+ // prose, and never a named parent bit without fresh proof.
+ return {
+ status: 'unconfirmed',
+ message: 'EvenDrive could not confirm permission for this move. Refresh and try again.',
+ }
}
if (status === 429 || (!status && /too many/i.test(message))) {
return {
@@ -317,9 +322,12 @@ export function suggestNumberedMoveName(
return nextAvailableGfsResourceName(sourceName, occupiedDestinationNames)
}
-export type MoveToast = (message: string, tone: 'success' | 'error' | 'info') => void
+export type MoveToast = (message: string, tone: 'success' | 'error' | 'info' | 'warn') => void
-/** Presented outcome toasts (rev-2 §8 UX matrix) shared by every surface. */
+/** Presented outcome toasts (rev-2 §8 UX matrix) shared by every surface.
+ * Unknown-outcome statuses present as WARNINGS, never errors: an
+ * unconfirmed or rate-limited move has not been shown to fail (B7/B8), and
+ * claiming failure would invite a duplicate dispatch. */
export function toastMoveOutcome(
pushToast: MoveToast | undefined,
outcome: MoveCommitOutcome,
@@ -345,6 +353,13 @@ export function toastMoveOutcome(
case 'no-op':
pushToast?.(outcome.message, 'info')
break
+ case 'unconfirmed':
+ // The dispatch's outcome is unknown: verify-by-identity already ran and
+ // could not settle it. Warn — do not report a failure that was not shown.
+ case 'rate-limited':
+ // A metered refusal is a "try again" verdict, not a failed move.
+ pushToast?.(outcome.message, 'warn')
+ break
case 'session-lost':
// A superseded gesture never reached the server: there is nothing to
// report and nothing to apologize for.
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 084f88bd8..f327870ad 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -72,6 +72,7 @@ import {
GFS_DROP_SESSION_LOST_MESSAGE,
gfsDropVerdictLiveAnnouncement,
gfsDropVerdictReason,
+ mayPaintGfsSessionLostBanner,
presentGfsDropRefusal,
sameGfsDropVerdict,
} from '@/gfs/dropVerdict'
@@ -359,7 +360,10 @@ export function FilesPage({
// pointer accepts the move (RP-026).
const [dropVerdictAnnouncement, setDropVerdictAnnouncement] = useState('')
// A drop refused by a dead session must stay visible AFTER the revocation
- // has already invalidated the gesture's ownership (UX matrix A11).
+ // has already invalidated the gesture's ownership (UX matrix A11). The
+ // revoked surface below carries the sentence unconditionally; this
+ // callback-local banner is gated by the captured scope/session identity so
+ // a superseded call cannot paint it over a new, healthy session.
const [dropSessionLost, setDropSessionLost] = useState(false)
// Display name of the live gesture's source, for reason copy that names it.
const [dragSourceName, setDragSourceName] = useState<string | null>(null)
@@ -448,8 +452,11 @@ export function FilesPage({
setDragOverFolderId(null)
setDropStatesById({})
setDropVerdictAnnouncement('')
- setDropSessionLost(false)
setDragSourceName(null)
+ // A NEW live session makes any session-ended refusal stale. A transition
+ // TO revoked (scope null) must NOT clear it: that is exactly when the
+ // message has to survive (A11), and the revoked surface carries it.
+ if (liveDragScope !== null) setDropSessionLost(false)
}, [adjudication.endDragSession, liveDragScope])
const ownsDrop = (source: GfsDragSource, epoch: number, sharedGeneration: number | null) =>
@@ -1360,6 +1367,10 @@ export function FilesPage({
event.stopPropagation()
hoveredFolderRef.current = folder.resourceId
hoverOwnerRef.current = source
+ // The gesture may have started on ANOTHER surface (tree ↔ Files): the
+ // resolved shared source — not a local dragstart — owns the name the
+ // reason copy interpolates.
+ setDragSourceName(previous => (previous === source.name ? previous : source.name))
const target = {
resourceId: folder.resourceId,
name: folder.name,
@@ -1466,6 +1477,7 @@ export function FilesPage({
const dragGeneration = dragSessionRef.current
const sessionGeneration = dragSession?.currentGeneration() ?? null
+ const scopeAtDrop = liveDragScopeRef.current
try {
const decision = await adjudication.adjudicateDrop(source, {
resourceId: destination.resourceId,
@@ -1474,12 +1486,27 @@ export function FilesPage({
ancestorIds: rowTargetAncestorIds(),
})
if (!decision.allowed && decision.reason === 'session-lost') {
- // Presented BEFORE the ownership guard, and as a persistent banner:
- // the revocation that caused this refusal has already invalidated
- // the gesture's ownership, so the normal callback path would return
- // silently — the session's death must stay explained (A11).
- setDropSessionLost(true)
- setDropVerdictAnnouncement(GFS_DROP_SESSION_LOST_MESSAGE)
+ // Presented BEFORE the ownership guard: the revocation that caused
+ // this refusal has already invalidated the gesture's ownership, so
+ // the normal callback path would return silently. The revoked
+ // surface below carries the sentence persistently; this local
+ // banner/announcement is gated by the captured scope/session
+ // identity so a superseded call cannot declare a NEW, healthy
+ // session ended (A11).
+ if (
+ mayPaintGfsSessionLostBanner({
+ capturedScope: scopeAtDrop,
+ liveScope: liveDragScopeRef.current,
+ capturedEpoch: dragGeneration,
+ liveEpoch: dragSessionRef.current,
+ capturedSessionGeneration: sessionGeneration,
+ liveSessionGeneration: dragSession?.currentGeneration() ?? null,
+ hasSharedSession: dragSession != null,
+ })
+ ) {
+ setDropSessionLost(true)
+ setDropVerdictAnnouncement(GFS_DROP_SESSION_LOST_MESSAGE)
+ }
return
}
if (!ownsDrop(source, dragGeneration, sessionGeneration)) return
@@ -2047,6 +2074,10 @@ export function FilesPage({
{accessRevoked ? (
<>
+ {/* The revoked surface owns the session-ended sentence (A11): it
+ outlives any gesture's ownership, so a drag whose probe died
+ stays explained even after the revocation invalidated it. */}
+ <StatusBanner tone="error" text={GFS_DROP_SESSION_LOST_MESSAGE} />
<EmptyState
title="File access is not authorized"
body="Your current Desktop session cannot access this location. Sign in again or contact an administrator."
diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
index 3f7224a6b..6bb0d0c47 100644
--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx
@@ -4685,6 +4685,168 @@ describe('FilesPage', () => {
expect(moveResource).not.toHaveBeenCalled()
})
+ it('renders the session-ended sentence on the revoked surface with no gesture at all (A11)', async () => {
+ // The revoked surface owns the sentence unconditionally: it needs no
+ // drop callback, so nothing about gesture ownership can hide it.
+ const pushToast = vi.fn()
+ const controller = {
+ ...baseController(),
+ current: {
+ resourceId: 'folder-1',
+ gfsUri: 'gfs://main/folder-1',
+ name: 'Product',
+ kind: 'directory',
+ version: 1,
+ },
+ }
+ hookMock.useGfsBrowserController.mockReturnValue(controller)
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ const view = render(
+ <QueryClientProvider client={queryClient}>
+ <FilesPage pushToast={pushToast} />
+ </QueryClientProvider>
+ )
+
+ expect(
+ screen.queryByText('Your session ended. Sign in again to continue moving files.')
+ ).toBeNull()
+
+ // Re-render with the controller reporting the revoked session.
+ hookMock.useGfsBrowserController.mockReturnValue({
+ ...controller,
+ accessState: 'revoked',
+ })
+ view.rerender(
+ <QueryClientProvider client={queryClient}>
+ <FilesPage pushToast={pushToast} />
+ </QueryClientProvider>
+ )
+
+ expect(
+ await screen.findByText('Your session ended. Sign in again to continue moving files.')
+ ).toBeTruthy()
+ expect(await screen.findByText('File access is not authorized')).toBeTruthy()
+ expect(pushToast).not.toHaveBeenCalled()
+ })
+
+ it('a session-lost decision superseded by a new healthy scope paints nothing (A11)', async () => {
+ // The drop's adjudication parks on a gated probe; the session then
+ // changes to a NEW, healthy scope before the 401 resolves. The stale
+ // callback must not declare that new session ended — no banner, no
+ // announcement, no toast.
+ const pushToast = vi.fn()
+ const moveResource = vi.fn(async () => ({}))
+ let release401!: () => void
+ const gated = new Promise<void>(resolve => {
+ release401 = resolve
+ })
+ let parked = true
+ const affordances = vi.fn(() => {
+ if (parked) {
+ parked = false
+ return gated.then(() => {
+ throw new Error('401 Unauthorized httpStatus=401')
+ })
+ }
+ return Promise.resolve({
+ held: ['read', 'write', 'delete'],
+ canDelegate: false,
+ grantableBits: [],
+ canCreateShare: false,
+ })
+ })
+ Object.defineProperty(window, 'clerum', {
+ configurable: true,
+ value: { gfs: { affordances } },
+ })
+ const healthyController = {
+ ...baseController(),
+ current: {
+ resourceId: 'folder-1',
+ gfsUri: 'gfs://main/folder-1',
+ name: 'Product',
+ kind: 'directory',
+ version: 1,
+ },
+ items: [
+ {
+ resourceId: 'file-1',
+ rid: 'file-1',
+ gfsUri: 'gfs://main/file-1',
+ drive: 'main',
+ parentResourceId: 'folder-1',
+ name: 'notes.txt',
+ kind: 'file',
+ path: '/Product/notes.txt',
+ version: 3,
+ bytes: 12,
+ },
+ {
+ resourceId: 'private-1',
+ rid: 'private-1',
+ gfsUri: 'gfs://main/private-1',
+ drive: 'main',
+ parentResourceId: 'folder-1',
+ name: 'Private',
+ kind: 'directory',
+ path: '/Product/Private',
+ version: 2,
+ bytes: 0,
+ },
+ ],
+ moveResource,
+ }
+ hookMock.useGfsBrowserController.mockReturnValue(healthyController)
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ const view = render(
+ <QueryClientProvider client={queryClient}>
+ <FilesPage pushToast={pushToast} />
+ </QueryClientProvider>
+ )
+
+ const sourceRow = screen.getByRole('button', { name: 'Open notes.txt' })
+ const destinationRow = screen.getByRole('button', { name: 'Open Private' })
+ const dataTransfer = {
+ types: ['application/x-evenfire-gfs-resource'],
+ files: [],
+ effectAllowed: 'none',
+ dropEffect: 'none',
+ setData: vi.fn(),
+ }
+
+ fireEvent.dragStart(sourceRow, { dataTransfer })
+ fireEvent.dragEnter(destinationRow, { dataTransfer })
+ await waitFor(() => expect(affordances).toHaveBeenCalledWith('private-1', 'main'))
+ fireEvent.drop(destinationRow, { dataTransfer })
+
+ // The session switches to a new, healthy scope while the probe is parked.
+ hookMock.useGfsBrowserController.mockReturnValue({
+ ...healthyController,
+ sessionScope: 'env-2:user-1:team-1',
+ })
+ await act(async () => {
+ view.rerender(
+ <QueryClientProvider client={queryClient}>
+ <FilesPage pushToast={pushToast} />
+ </QueryClientProvider>
+ )
+ })
+
+ // The stale 401 resolves against the new, healthy session.
+ await act(async () => {
+ release401()
+ })
+ await act(async () => {
+ await Promise.resolve()
+ })
+
+ expect(
+ screen.queryByText('Your session ended. Sign in again to continue moving files.')
+ ).toBeNull()
+ expect(pushToast).not.toHaveBeenCalled()
+ expect(moveResource).not.toHaveBeenCalled()
+ })
+
it('renames a folder child from its row menu once write affordances resolve', async () => {
const pushToast = vi.fn()
const renameResource = vi.fn(async () => ({}))
diff --git a/desktop-app/ui/src/pages/__tests__/gfsDropTintCascade.test.ts b/desktop-app/ui/src/pages/__tests__/gfsDropTintCascade.test.ts
new file mode 100644
index 000000000..de281fd89
--- /dev/null
+++ b/desktop-app/ui/src/pages/__tests__/gfsDropTintCascade.test.ts
@@ -0,0 +1,281 @@
+// @vitest-environment node
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+
+/**
+ * Cascade guard for the Files-grid drop-verdict tints (refusal UX matrix §5).
+ *
+ * The tone rules for `.da-gfs-drive__grid` rows compete inside ONE real
+ * stylesheet with several later/equal-specificity backgrounds: the grid's own
+ * `.da-grid__row { background: transparent }` (equal specificity to a bare
+ * `.da-grid__row--compact[data-drop-state=…]` selector — later wins) and the
+ * clickable-hover backgrounds (higher specificity while hovered). The first
+ * implementation of the grid tints lost exactly that race: the inset survived
+ * (nothing else sets box-shadow) while the tint background was flattened back
+ * to transparent.
+ *
+ * jsdom cannot adjudicate this (it does not resolve `var(--)` in computed
+ * styles), and a browser run is not part of this lane, so this test runs a
+ * minimal, grammar-bounded cascade over the REAL `src/styles.css`: it parses
+ * the sheet, matches every rule that can apply to a Files grid row, and
+ * computes the specificity + sheet-order winner for the tone-carrying
+ * properties — non-hovered AND hovered.
+ */
+
+interface ParsedRule {
+ index: number
+ selector: string
+ specificity: number
+ declarations: Map<string, string>
+}
+
+interface ElementSignature {
+ classes: string[]
+ attrs: Record<string, string | true>
+}
+
+const ANCESTOR_CHAIN: ElementSignature[] = [{ classes: ['da-gfs-drive__grid'], attrs: {} }]
+
+function parseSheet(css: string): ParsedRule[] {
+ const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, '')
+ const rules: ParsedRule[] = []
+ let index = 0
+ let cursor = 0
+ while (cursor < withoutComments.length) {
+ const open = withoutComments.indexOf('{', cursor)
+ if (open === -1) break
+ const selector = withoutComments.slice(cursor, open).trim()
+ // Find the matching close brace for this block.
+ let depth = 1
+ let scan = open + 1
+ while (scan < withoutComments.length && depth > 0) {
+ if (withoutComments[scan] === '{') depth += 1
+ else if (withoutComments[scan] === '}') depth -= 1
+ scan += 1
+ }
+ const body = withoutComments.slice(open + 1, scan - 1)
+ cursor = scan
+ // At-rules (@media, @keyframes, …) are skipped whole: none of the drop
+ // tints or their competitors live inside one, and partially parsing
+ // nested blocks would misattribute sheet order.
+ if (selector.startsWith('@')) continue
+ const declarations = new Map<string, string>()
+ for (const declaration of body.split(';')) {
+ const colon = declaration.indexOf(':')
+ if (colon === -1) continue
+ const property = declaration.slice(0, colon).trim()
+ const value = declaration.slice(colon + 1).trim()
+ if (property) declarations.set(property, value)
+ }
+ for (const complex of selector.split(',')) {
+ const trimmed = complex.trim()
+ if (!trimmed) continue
+ const specificity = countSpecificity(trimmed)
+ if (specificity === null) continue
+ rules.push({ index: index++, selector: trimmed, specificity, declarations })
+ }
+ }
+ return rules
+}
+
+/**
+ * Specificity (class/attribute/pseudo-class count) for the selector grammar
+ * used by this sheet's row rules. Returns null for a selector using syntax
+ * outside the grammar, so unsupported rules simply never match.
+ */
+function countSpecificity(complex: string): number | null {
+ // Tokenize explicitly: this sheet uses .class, [attr] and [attr='value'],
+ // :pseudo, plus element names only in low-level reset rules we skip.
+ const tokens = complex.match(/(\.[-\w]+)|(\[[^\]]+\])|(:[A-Za-z-]+)|(\b[a-z][-\w]*\b)|\*/g) ?? []
+ let count = 0
+ for (const token of tokens) {
+ if (token.startsWith('.')) count += 1
+ else if (token.startsWith('[')) count += 1
+ else if (token.startsWith(':')) count += 1
+ else return null // element name / universal — outside the guarded grammar
+ }
+ return count
+}
+
+function compoundMatches(
+ compound: string,
+ signature: ElementSignature,
+ hoverActive: boolean
+): boolean {
+ const classTokens = compound.match(/\.[-\w]+/g) ?? []
+ for (const classToken of classTokens) {
+ if (!signature.classes.includes(classToken.slice(1))) return false
+ }
+ const attrTokens = compound.match(/\[[^\]]+\]/g) ?? []
+ for (const attrToken of attrTokens) {
+ const match = /^\[([\w-]+)(?:=['"]?([^'"\]]+)['"]?)?\]$/.exec(attrToken)
+ if (!match?.[1]) return false
+ const name = match[1]
+ const value = match[2]
+ const held = signature.attrs[name]
+ if (held === undefined) return false
+ if (value !== undefined && held !== true && held !== value) return false
+ }
+ const pseudoTokens = compound.match(/:[A-Za-z-]+/g) ?? []
+ for (const pseudo of pseudoTokens) {
+ if (pseudo === ':hover') {
+ if (!hoverActive) return false
+ } else if (pseudo === ':enabled' || pseudo === ':disabled') {
+ // Worst case for the tints: treat both as matching a hovered row, so
+ // the assertions hold even where a browser evaluates them on the div.
+ if (!hoverActive) return false
+ } else {
+ return false
+ }
+ }
+ return true
+}
+
+function selectorMatches(
+ complex: string,
+ element: ElementSignature,
+ ancestors: readonly ElementSignature[],
+ hoverActive: boolean
+): boolean {
+ const compounds = complex.split(/\s+/).filter(Boolean)
+ const last = compounds[compounds.length - 1]
+ if (last === undefined || !compoundMatches(last, element, hoverActive)) return false
+ // Descendant matching against the fixed ancestor chain (nearest-first).
+ let ancestorCursor = 0
+ for (let i = compounds.length - 2; i >= 0; i -= 1) {
+ let matched = false
+ const compound = compounds[i]
+ if (compound === undefined) return false
+ while (ancestorCursor < ancestors.length) {
+ const candidate = ancestors[ancestorCursor]
+ ancestorCursor += 1
+ if (candidate !== undefined && compoundMatches(compound, candidate, hoverActive)) {
+ matched = true
+ break
+ }
+ }
+ if (!matched) return false
+ }
+ return true
+}
+
+function winningDeclaration(
+ rules: readonly ParsedRule[],
+ element: ElementSignature,
+ property: string,
+ hoverActive: boolean
+): { value: string; selector: string } | undefined {
+ let winner: ParsedRule | undefined
+ for (const rule of rules) {
+ if (!rule.declarations.has(property)) continue
+ if (!selectorMatches(rule.selector, element, ANCESTOR_CHAIN, hoverActive)) continue
+ if (
+ !winner ||
+ rule.specificity > winner.specificity ||
+ (rule.specificity === winner.specificity && rule.index > winner.index)
+ ) {
+ winner = rule
+ }
+ }
+ if (!winner) return undefined
+ return { value: winner.declarations.get(property) ?? '', selector: winner.selector }
+}
+
+const sheet = parseSheet(readFileSync(new URL('../../styles.css', import.meta.url), 'utf8'))
+
+const GRID_ROW: ElementSignature = {
+ classes: ['da-grid__row', 'da-grid__row--clickable', 'da-grid__row--compact'],
+ attrs: {},
+}
+
+function rowWith(attrs: Record<string, string | true>): ElementSignature {
+ return { classes: GRID_ROW.classes, attrs }
+}
+
+function expectWinner(
+ element: ElementSignature,
+ property: 'background' | 'box-shadow',
+ hoverActive: boolean,
+ value: string
+) {
+ const winner = winningDeclaration(sheet, element, property, hoverActive)
+ expect(
+ winner,
+ `no ${property} winner for ${JSON.stringify(element.attrs)} (hover=${hoverActive})`
+ ).toBeDefined()
+ expect(
+ winner!.value,
+ `${property} winner for ${JSON.stringify(element.attrs)} (hover=${hoverActive}) via ${winner!.selector}`
+ ).toBe(value)
+}
+
+describe('Files-grid drop-verdict tint cascade (refusal UX matrix §5)', () => {
+ it('parses the sheet: the grid tone rules are actually present', () => {
+ const selectors = new Set(sheet.map(rule => rule.selector))
+ expect(
+ [...selectors].some(
+ selector =>
+ selector.includes("data-drop-state='denied'") && selector.includes('da-gfs-drive__grid')
+ )
+ ).toBe(true)
+ expect(
+ [...selectors].some(
+ selector =>
+ selector.includes("data-drop-state='checking'") && selector.includes('da-gfs-drive__grid')
+ )
+ ).toBe(true)
+ })
+
+ it('a denied row paints the danger tint over the transparent base AND the hover background', () => {
+ const denied = rowWith({ 'data-drop-state': 'denied' })
+ expectWinner(denied, 'background', false, 'rgba(var(--danger-rgb), 0.1)')
+ expectWinner(denied, 'background', true, 'rgba(var(--danger-rgb), 0.1)')
+ expectWinner(denied, 'box-shadow', false, 'inset 2px 0 0 rgba(var(--danger-rgb), 0.72)')
+ })
+
+ it('the no-op reason repaints as informational, never error-red', () => {
+ const noOp = rowWith({ 'data-drop-state': 'denied', 'data-drop-reason': 'same-parent' })
+ expectWinner(noOp, 'background', false, 'rgba(var(--edge-rgb), 0.12)')
+ expectWinner(noOp, 'background', true, 'rgba(var(--edge-rgb), 0.12)')
+ })
+
+ it.each(['unavailable', 'target-unavailable', 'source-location-unknown'] as const)(
+ 'the unknown reason %s repaints as a warning',
+ reason => {
+ const unknown = rowWith({ 'data-drop-state': 'denied', 'data-drop-reason': reason })
+ expectWinner(unknown, 'background', false, 'rgba(var(--warning-rgb), 0.1)')
+ expectWinner(unknown, 'background', true, 'rgba(var(--warning-rgb), 0.1)')
+ }
+ )
+
+ it('the unavailable verdict state paints the warning tint', () => {
+ const unavailable = rowWith({ 'data-drop-state': 'unavailable' })
+ expectWinner(unavailable, 'background', false, 'rgba(var(--warning-rgb), 0.1)')
+ expectWinner(unavailable, 'background', true, 'rgba(var(--warning-rgb), 0.1)')
+ })
+
+ it('a checking row paints the neutral tint over base and hover', () => {
+ const checking = rowWith({ 'data-drop-state': 'checking' })
+ expectWinner(checking, 'background', false, 'rgba(var(--edge-rgb), 0.08)')
+ expectWinner(checking, 'background', true, 'rgba(var(--edge-rgb), 0.08)')
+ })
+
+ it('only allowed stays blue: the data-drop-target highlight owns an allowed row', () => {
+ const allowed = rowWith({ 'data-drop-state': 'allowed', 'data-drop-target': 'true' })
+ for (const hoverActive of [false, true]) {
+ const winner = winningDeclaration(sheet, allowed, 'background', hoverActive)
+ expect(winner).toBeDefined()
+ // `--grid-card-bg-hover` is itself rgba(var(--accent-rgb), 0.36) in
+ // tokens.css: both winners are the accent blue.
+ expect(winner!.value).toMatch(/accent-rgb|--grid-card-bg-hover/)
+ }
+ })
+
+ it('a row with no verdict keeps the plain base/hover background — tints do not leak', () => {
+ const plain = rowWith({})
+ expectWinner(plain, 'background', false, 'transparent')
+ const hovered = winningDeclaration(sheet, plain, 'background', true)
+ expect(hovered).toBeDefined()
+ expect(hovered!.value).not.toMatch(/danger-rgb|warning-rgb/)
+ })
+})
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 1de5ed149..fc7cf59d3 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -1984,9 +1984,9 @@ h3 {
inset unless its reason re-maps the tone — `same-parent` is the no-op
(info, edge tokens) and the unknown family is a warning, never a deny
look. Labels stay readable: the tint + inset carry the verdict, not label
- dimming (the old dim-only treatment was the invisible one). The row-level
- attribute also styles Files-page rows which reuse the same attribute
- names on their grid rows. */
+ dimming (the old dim-only treatment was the invisible one). The Files
+ grid's own tone rules live with the grid block further down the sheet,
+ where they out-rank its row and hover backgrounds. */
.da-file-explorer__row[data-drop-state='checking'] {
background: rgba(var(--edge-rgb), 0.08);
}
@@ -2000,15 +2000,13 @@ h3 {
}
/* Deny = error inset + tint (UX matrix A1–A8). */
-.da-file-explorer__row[data-drop-state='denied'],
-.da-grid__row--compact[data-drop-state='denied'] {
+.da-file-explorer__row[data-drop-state='denied'] {
background: rgba(var(--danger-rgb), 0.1);
box-shadow: inset 2px 0 0 rgba(var(--danger-rgb), 0.72);
}
/* A4 no-op: informational, never error-red. */
-.da-file-explorer__row[data-drop-state='denied'][data-drop-reason='same-parent'],
-.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='same-parent'] {
+.da-file-explorer__row[data-drop-state='denied'][data-drop-reason='same-parent'] {
background: rgba(var(--edge-rgb), 0.12);
box-shadow: inset 2px 0 0 rgba(var(--edge-rgb), 0.6);
}
@@ -2017,24 +2015,11 @@ h3 {
.da-file-explorer__row[data-drop-state='denied'][data-drop-reason='unavailable'],
.da-file-explorer__row[data-drop-state='denied'][data-drop-reason='target-unavailable'],
.da-file-explorer__row[data-drop-state='denied'][data-drop-reason='source-location-unknown'],
-.da-file-explorer__row[data-drop-state='unavailable'],
-.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='unavailable'],
-.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='target-unavailable'],
-.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='source-location-unknown'],
-.da-grid__row--compact[data-drop-state='unavailable'] {
+.da-file-explorer__row[data-drop-state='unavailable'] {
background: rgba(var(--warning-rgb), 0.1);
box-shadow: inset 2px 0 0 rgba(var(--warning-rgb), 0.72);
}
-/* Files-page grid rows use the same attribute vocabulary. */
-.da-grid__row--compact[data-drop-state='checking'] {
- background: rgba(var(--edge-rgb), 0.08);
-}
-
-.da-grid__row--compact[data-drop-state='allowed'] {
- background: rgba(var(--accent-rgb), 0.12);
-}
-
/* Draggable tree labels and grid rows show the grab affordance. */
.da-file-explorer__label.ui-button[draggable='true'] {
cursor: grab;
@@ -15479,6 +15464,39 @@ pre {
border-color: var(--grid-card-border);
}
+/* ── Files-grid drop-verdict tints (refusal UX matrix §5) ──────────────────
+ Grid- AND clickable-scoped so every tone out-ranks BOTH the base row
+ background above (`background: transparent`) and the clickable-hover
+ background: the verdict must stay readable on the hovered row too. Only
+ `allowed` stays blue — through the data-drop-target highlight above,
+ unchanged. Tone keys on the reason: deny=error, same-parent=info (the
+ no-op), unknown/unavailable=warning. */
+.da-gfs-drive__grid .da-grid__row--clickable.da-grid__row--compact[data-drop-state='checking'] {
+ background: rgba(var(--edge-rgb), 0.08);
+}
+
+.da-gfs-drive__grid .da-grid__row--clickable.da-grid__row--compact[data-drop-state='denied'] {
+ background: rgba(var(--danger-rgb), 0.1);
+ box-shadow: inset 2px 0 0 rgba(var(--danger-rgb), 0.72);
+}
+
+.da-gfs-drive__grid
+ .da-grid__row--clickable.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='same-parent'] {
+ background: rgba(var(--edge-rgb), 0.12);
+ box-shadow: inset 2px 0 0 rgba(var(--edge-rgb), 0.6);
+}
+
+.da-gfs-drive__grid
+ .da-grid__row--clickable.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='unavailable'],
+.da-gfs-drive__grid
+ .da-grid__row--clickable.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='target-unavailable'],
+.da-gfs-drive__grid
+ .da-grid__row--clickable.da-grid__row--compact[data-drop-state='denied'][data-drop-reason='source-location-unknown'],
+.da-gfs-drive__grid .da-grid__row--clickable.da-grid__row--compact[data-drop-state='unavailable'] {
+ background: rgba(var(--warning-rgb), 0.1);
+ box-shadow: inset 2px 0 0 rgba(var(--warning-rgb), 0.72);
+}
+
.da-gfs-current-file {
min-height: 220px;
display: flex;
diff --git a/docs/design/gfs-move-forbidden-ux-matrix.md b/docs/design/gfs-move-forbidden-ux-matrix.md
index b0cd8bb3f..1baaaed29 100644
--- a/docs/design/gfs-move-forbidden-ux-matrix.md
+++ b/docs/design/gfs-move-forbidden-ux-matrix.md
@@ -17,14 +17,14 @@ or mutate the dev cluster.
The deny **reason is computed and then thrown away** at the UI layer:
-| Layer | File | What it does |
-|---|---|---|
-| Structure decision | `packages/gfs-interaction-policy/dragPolicy.cjs` → `decideDragStructure` | returns `{kind:'deny', reason:'self'│'cross-drive'│'root-source'│'same-parent'│'descendant'}` or `server-check-required` |
-| Authority decision | `dragPolicy.cjs` → `decideDragAuthority` | returns `{kind:'deny', reason:'destination-write'│'source-write'│'source-delete'}`, `checking`, `unavailable`, `observed-allowed` |
-| Adjudication | `desktop-app/ui/src/gfs/dragAdjudication.ts` | maps probes/session loss to `session-lost`, `unavailable`, `target-unavailable`, `source-location-unknown` |
-| Paint | `desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx:314-315` | row gets `data-drop-state={allowed│denied│checking│unavailable}` — **reason collapsed to a boolean-ish state** |
-| Speech | `desktop-app/ui/src/gfs/dropVerdict.ts:14-27` (RP-026) | generic only: *"You cannot move into {target}."* — no reason |
-| CSS | `desktop-app/ui/src/styles.css:1987-2011` | **Tree:** `denied` only de-emphasizes the label (1999) — nearly invisible. **Files grid:** `checking`/`allowed` styles exist; **`denied` has NO style at all** → this is the "no blue highlight and no idea why" bug |
+| Layer | File | What it does |
+| ------------------ | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Structure decision | `packages/gfs-interaction-policy/dragPolicy.cjs` → `decideDragStructure` | returns `{kind:'deny', reason:'self'│'cross-drive'│'root-source'│'same-parent'│'descendant'}` or `server-check-required` |
+| Authority decision | `dragPolicy.cjs` → `decideDragAuthority` | returns `{kind:'deny', reason:'destination-write'│'source-write'│'source-delete'}`, `checking`, `unavailable`, `observed-allowed` |
+| Adjudication | `desktop-app/ui/src/gfs/dragAdjudication.ts` | maps probes/session loss to `session-lost`, `unavailable`, `target-unavailable`, `source-location-unknown` |
+| Paint | `desktop-app/ui/src/components/SidebarNav/FileExplorerTree/index.tsx:314-315` | row gets `data-drop-state={allowed│denied│checking│unavailable}` — **reason collapsed to a boolean-ish state** |
+| Speech | `desktop-app/ui/src/gfs/dropVerdict.ts:14-27` (RP-026) | generic only: _"You cannot move into {target}."_ — no reason |
+| CSS | `desktop-app/ui/src/styles.css:1987-2011` | **Tree:** `denied` only de-emphasizes the label (1999) — nearly invisible. **Files grid:** `checking`/`allowed` styles exist; **`denied` has NO style at all** → this is the "no blue highlight and no idea why" bug |
`GfsDropVerdict` already carries denied/unavailable reasons in
`desktop-app/ui/src/gfs/dragSession.types.ts:61-65`. Both surfaces discard
@@ -36,12 +36,13 @@ Self-hover is skipped entirely (tree `:650`, FilesPage `:1339`). Both use
can prevent Chromium from delivering the refused drop at all.
**The two symptoms are:**
+
- Sidebar tree: `denied` ≈ invisible (label dimming only) → "nothing happens".
- Files panel: `allowed` paints the blue highlight; `denied` has no CSS → no highlight,
no explanation.
-Design rule already in the codebase (RP-026 header comment): *paint the verdict on the
-row for sighted users, speak it for SR users*. The fix keeps that shape but carries the
+Design rule already in the codebase (RP-026 header comment): _paint the verdict on the
+row for sighted users, speak it for SR users_. The fix keeps that shape but carries the
**reason** through and adds a **persistent, readable explanation at drop time** (row
tints alone are too subtle to read a reason from).
@@ -68,20 +69,20 @@ on 409).
## 3. Phase-A matrix — every drag-time forbidden case
-| # | Reason (code) | Trigger — what the user did | Underlying rule | Sidebar tree feedback | Files panel feedback | Persistent message (drop) | SR announcement |
-|---|---|---|---|---|---|---|---|
-| A1 | `self` | Drop onto the dragged item itself | `dragPolicy.cjs:59` | row `denied` + tooltip | row `denied` | Banner/toast: "You dropped {name} onto itself. Pick a destination folder." | "You cannot move {name} into itself." |
-| A2 | `cross-drive` | Drop across drives | `dragPolicy.cjs:60` | same as A1 | same | "Moving between drives isn't supported." | same, spoken |
-| A3 | `root-source` | Source is the drive root (or virtual root item that is physically root) | `dragPolicy.cjs:61-62` | show `denied` on targets when the source is observed to be root | same | "This location is the top level — it can't be moved." | spoken |
-| A4 | `same-parent` | Target IS the physical parent (no-op move) | `dragPolicy.cjs:64-65` + path form `:118` | row `denied` | row `denied` | "{name} is already in {target}." — **NOT an error tone; info**. Critical with the flat sidebar: e.g. `Assets` physically lives in `Product`, so dragging Assets→Product is a no-op even though it *looks* like a real move | "{name} is already in {target}." |
-| A5 | `descendant` | Folder dropped into its own subtree | `dragPolicy.cjs:73` | row `denied` on the whole subtree | row `denied`, no blue | "You can't move {name} into a folder inside itself." | spoken |
-| A6 | `destination-write` | No `write` on destination (e.g. read-only share) | `dragPolicy.cjs:146` — checked FIRST (surface the user acts on) | row `denied` — this is the case where the blue highlight must NOT appear | row `denied`, no blue | "You don't have permission to move items into {target}. You need edit access to the destination folder." | spoken with reason |
-| A7 | `source-write` | No `write` on the physical **source parent** | `dragPolicy.cjs:147` | row `denied` | row `denied`, no blue | "You can’t move {name} out of its current folder because you don’t have edit access to the folder that contains it." | spoken |
-| A8 | `source-delete` | `write` but no `delete` on the source parent | `dragPolicy.cjs:148` | row `denied` | row `denied`, no blue | "You can’t move {name} out of its current folder because you don’t have delete access to the folder that contains it." | spoken |
-| A9 | `checking` | Bits not yet known (cold hover) | `dragPolicy.cjs:140` | neutral spinner-tint row | neutral | none (transient) | "Checking whether you can move into {target}…" |
-| A10 | `unavailable` / `target-unavailable` / `source-location-unknown` | Required drop probe failed (network/5xx/429/404); exhausted hover budget stays `checking` | `dragAdjudication.ts:58-98` | failed cold hover currently remains `checking`; any `unavailable` paint must NOT look denied | row `unavailable` | "EvenDrive couldn’t verify this move. Check your connection and try again." For target disappearance: "This folder is no longer available." For an unknown source location: "EvenDrive cannot verify this item’s current location. Refresh and try again." Drop checks remain available after inconclusive hover; a failed required drop check refuses admission. | spoken |
-| A11 | `session-lost` | 401 during probe | `dragAdjudication.ts:58` | gesture ends; re-auth prompt | same | "Your session ended. Sign in again to continue moving files." (session revoked per med-probe-401) | spoken |
-| A12 | `server-check-required` | Ancestry unproved (grants start below root) | `dragPolicy.cjs:82` | row `checking` — NOT denied; stays landable | neutral | none at hover; drop proceeds to server verdict (Phase B) | "Checking…" |
+| # | Reason (code) | Trigger — what the user did | Underlying rule | Sidebar tree feedback | Files panel feedback | Persistent message (drop) | SR announcement |
+| --- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
+| A1 | `self` | Drop onto the dragged item itself | `dragPolicy.cjs:59` | row `denied` + tooltip | row `denied` | Banner/toast: "You dropped {name} onto itself. Pick a destination folder." | "You cannot move {name} into itself." |
+| A2 | `cross-drive` | Drop across drives | `dragPolicy.cjs:60` | same as A1 | same | "Moving between drives isn't supported." | same, spoken |
+| A3 | `root-source` | Source is the drive root (or virtual root item that is physically root) | `dragPolicy.cjs:61-62` | show `denied` on targets when the source is observed to be root | same | "This location is the top level — it can't be moved." | spoken |
+| A4 | `same-parent` | Target IS the physical parent (no-op move) | `dragPolicy.cjs:64-65` + path form `:118` | row `denied` | row `denied` | "{name} is already in {target}." — **NOT an error tone; info**. Critical with the flat sidebar: e.g. `Assets` physically lives in `Product`, so dragging Assets→Product is a no-op even though it _looks_ like a real move | "{name} is already in {target}." |
+| A5 | `descendant` | Folder dropped into its own subtree | `dragPolicy.cjs:73` | row `denied` on the whole subtree | row `denied`, no blue | "You can't move {name} into a folder inside itself." | spoken |
+| A6 | `destination-write` | No `write` on destination (e.g. read-only share) | `dragPolicy.cjs:146` — checked FIRST (surface the user acts on) | row `denied` — this is the case where the blue highlight must NOT appear | row `denied`, no blue | "You don't have permission to move items into {target}. You need edit access to the destination folder." | spoken with reason |
+| A7 | `source-write` | No `write` on the physical **source parent** | `dragPolicy.cjs:147` | row `denied` | row `denied`, no blue | "You can’t move {name} out of its current folder because you don’t have edit access to the folder that contains it." | spoken |
+| A8 | `source-delete` | `write` but no `delete` on the source parent | `dragPolicy.cjs:148` | row `denied` | row `denied`, no blue | "You can’t move {name} out of its current folder because you don’t have delete access to the folder that contains it." | spoken |
+| A9 | `checking` | Bits not yet known (cold hover) | `dragPolicy.cjs:140` | neutral spinner-tint row | neutral | none (transient) | "Checking whether you can move into {target}…" |
+| A10 | `unavailable` / `target-unavailable` / `source-location-unknown` | Required drop probe failed (network/5xx/429/404); exhausted hover budget stays `checking` | `dragAdjudication.ts:58-98` | failed cold hover currently remains `checking`; any `unavailable` paint must NOT look denied | row `unavailable` | "EvenDrive couldn’t verify this move. Check your connection and try again." For target disappearance: "This folder is no longer available." For an unknown source location: "EvenDrive cannot verify this item’s current location. Refresh and try again." Drop checks remain available after inconclusive hover; a failed required drop check refuses admission. | spoken |
+| A11 | `session-lost` | 401 during probe | `dragAdjudication.ts:58` | gesture ends; re-auth prompt | same | "Your session ended. Sign in again to continue moving files." (session revoked per med-probe-401) | spoken |
+| A12 | `server-check-required` | Ancestry unproved (grants start below root) | `dragPolicy.cjs:82` | row `checking` — NOT denied; stays landable | neutral | none at hover; drop proceeds to server verdict (Phase B) | "Checking…" |
---
@@ -94,18 +95,24 @@ There is no `presentMoveCommitOutcome` symbol. The table records the required
user-facing semantics; the notes distinguish existing behavior and safe copy
limits from proposed improvements.
-| # | Outcome | Trigger | Message (toast) | Tone |
-|---|---|---|---|---|
-| B1 | `committed` (+ optional `renamedTo`) | PATCH 200 | "Moved {source} to {destination}." / "…as {renamed}." | success |
-| B2 | numbered-name conflict resolved | 409 → ladder accepted | same as B1 with "as {renamed}" | success |
-| B3 | conflict ladder exhausted | 409 × N > limit | Existing bounded-ladder result: "The destination changed. Refresh it or choose another folder." Without rename consent: choose another folder or use Move to rename if permitted. | error |
-| B4 | source vanished (404 on source re-resolve/dispatch) | rp-027 | "EvenDrive cannot verify this item’s current location. Refresh and try again." (404 may also mean hidden; do not claim deletion.) | error |
-| B5 | destination vanished (404 on destination) | rp-027 | "This folder is no longer available." (source re-resolve distinguishes the sides; do not claim deletion.) | error |
-| B6 | server structural deny (cycle/kind/parent-permission re-check) | PATCH 403/400 | 400: "The server rejected this destination. Refresh and choose a different folder." 403: explain that permission could not be confirmed; do not invent which parent bit is missing without fresh proof. | error |
-| B7 | transport loss, outcome unknown | fetch threw after dispatch | Existing verification resolves by identity once → B1 or "Couldn’t confirm the move. Refresh before trying again." Do not repeat PATCH. An in-progress notice may precede this verification. | warning when unconfirmed; success if verified |
-| B8 | 5xx | server error | Verify by identity → B1 or "Couldn’t confirm the move. Refresh before trying again." A 5xx does not prove nothing changed. | error |
-| B9 | `session-lost` | 401 at commit | Persistent revoked-session surface: "Your session ended. Sign in again to continue moving files." Do not claim a dispatched move failed if its outcome is unknown. | error |
-| B10 | user stopped / canceled dialog | Stop / Esc / backdrop | silent or "Move canceled." (per PR's stop-notice pattern) | info |
+| # | Outcome | Trigger | Message (toast) | Tone |
+| --- | -------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
+| B1 | `committed` (+ optional `renamedTo`) | PATCH 200 | "Moved {source} to {destination}." / "…as {renamed}." | success |
+| B2 | numbered-name conflict resolved | 409 → ladder accepted | same as B1 with "as {renamed}" | success |
+| B3 | conflict ladder exhausted | 409 × N > limit | Existing bounded-ladder result: "The destination changed. Refresh it or choose another folder." Without rename consent: choose another folder or use Move to rename if permitted. | error |
+| B4 | source vanished (404 on source re-resolve/dispatch) | rp-027 | "EvenDrive cannot verify this item’s current location. Refresh and try again." (404 may also mean hidden; do not claim deletion.) | error |
+| B5 | destination vanished (404 on destination) | rp-027 | "This folder is no longer available." (source re-resolve distinguishes the sides; do not claim deletion.) | error |
+| B6 | server structural deny (cycle/kind/parent-permission re-check) | PATCH 403/400 | 400: "The server rejected this destination. Refresh and choose a different folder." 403 (implemented): "EvenDrive could not confirm permission for this move. Refresh and try again." — never names a parent bit without fresh proof, never raw HTTP prose. | 403 → warn (unknown outcome); 400 → error |
+| B7 | transport loss, outcome unknown | fetch threw after dispatch | Existing verification resolves by identity once → B1 or "Couldn’t confirm the move. Refresh before trying again." Do not repeat PATCH. An in-progress notice may precede this verification. | warn when unconfirmed; success if verified |
+| B8 | 5xx | server error | Verify by identity → B1 or "Couldn’t confirm the move. Refresh before trying again." A 5xx does not prove nothing changed. | warn when unconfirmed; success if verified |
+
+> Tone baseline (implemented in `toastMoveOutcome`): the unknown-outcome
+> statuses — `unconfirmed` (B6-403/B7/B8) and `rate-limited` — present as
+> `warn`, because an unconfirmed move has not been shown to fail; every
+> definite negative (B3/B4/B5, B6-400) stays `error`. Dispatch, retry and
+> verification safety are unchanged.
+> | B9 | `session-lost` | 401 at commit | Persistent revoked-session surface: "Your session ended. Sign in again to continue moving files." Do not claim a dispatched move failed if its outcome is unknown. | error |
+> | B10 | user stopped / canceled dialog | Stop / Esc / backdrop | silent or "Move canceled." (per PR's stop-notice pattern) | info |
---
@@ -169,13 +176,34 @@ in `bf469d7d8`. Other agents may commit on this same branch; never reset or
amend their work. Report tests, commit IDs and any unresolved limitation to
the supervisor for review before push.
+### Desktop implementation baseline (2026-10-23, local commits)
+
+Implemented in `desktop-app/ui` only: the shared presenter
+`src/gfs/dropVerdict.ts` (+ `dropVerdict.types.ts`) owns tone, sentences,
+announcements and the drop-refusal presentation; the tree and the Files grid
+carry the full verdict (`data-drop-state` + `data-drop-reason`), keep denied
+internal hovers deliverable, gate the session-ended banner by the captured
+scope/session identity, and render the session-ended sentence on the revoked
+surfaces themselves. Grid tone tints are grid-scoped in `src/styles.css` so
+they out-rank the row base and hover backgrounds (guarded by
+`src/pages/__tests__/gfsDropTintCascade.test.ts`). Covered by focused unit
+regressions: reason retention, same-state reason changes, no-op info tone,
+missing source/destination access, self/descendant/root-source, unknown
+warning, denied drop-delivery without mutation, SR announcements, and both
+cross-surface tooltip directions. No live-cluster lane was run for this
+baseline; the manual matrix below remains unchecked until it is.
+
## 8. Manual test matrix (maps to your PR checklist lane 1/3)
+Not executed against a live cluster yet — unit-regression coverage for A1/A3–A8
+and A10 exists (see §7); the checkboxes stay open until the manual lane runs.
+
- ☐ A4 drag `Assets` onto `Product` (physically already inside) → info "already there", NOT red
-- ☐ A7 drag `live tests` onto any folder → refused drop + banner naming "the folder that contains it"
+- ☐ A7 drag `live tests` onto any folder → refused drop + toast naming "the folder that contains it"
- ☐ A6 read-only destination share → no blue, reason names destination
- ☐ A5 folder into own subfolder → refusal names self-containment
- ☐ A10 kill network mid-hover → warning tone, drop still attempts
- ☐ B4/B5 vanish source/destination via second user → distinct messages
- ☐ B7 drop during network cut → "checking whether it completed", then converge
- ☐ SR: every refused drop announces reason; sighted: every denied row readable
+ (row tints, incl. hovered grid rows, verified by the cascade guard unit test)