fix: address findings from the full Docker evaluation of main

Critical and high:
- repos: unlinking a local repo removes only the Manager reference and alias,
  never the repository files; confirm button reads "Unlink"
- auth: rate-limit by the socket address; trust proxy headers only when
  AUTH_TRUSTED_PROXY_HEADERS is set (documented and forwarded in compose)
- composer: per-session in-memory drafts (text, bash mode, attachments);
  Escape no longer clears the prompt
- url params: compose same-tick updates so schedule dialogs stay closed after
  create/delete; delete dialog names the job

Medium:
- tool rows show failures (non-zero shell exit, failed exploration members)
- voice conversation shows the specific error and a starting state
- settings: Escape in dropdowns and the shortcut recorder no longer closes
  the dialog; mobile deep links open the requested section; one content tree
  per platform
- closing pushed sheets, settings, tool panels and schedule dialogs goes back
  in history
- login returns to the requested page; signed-out pages make no
  authenticated requests
- action terminals keep their output (Manager-side output capture and replay)
- unpushed-commit detection, commit message kept on failure
- binary files with unknown extensions are detected and not editable
- tool panel resizes when docked and floats as a dismissible sheet when the
  page is too narrow
- Docker image runs tini as PID 1

Low: not-found states, add-repo and branch validation errors (4xx),
search-aware empty states, mobile repo sort/filter/select cues, sidebar
resize affordance and collapse shortcut, mobile unread badge, preview port
filtering, terminal close handling, walkthrough empty state and helper
session filtering, placeholder contrast, permission labels and focus,
TTS task-list sanitizing, git identity email validation, quieter git
logging, hermetic worktree tests, and accessible names for icon-only
controls.
This commit is contained in:
ioplex committed 2026-10-23 11:42:37 -04:00
1 parent 1c22ef6ea1
commit 4ec62cd4e7
191 files changed
+6674 -696

No files matched your search

@@ -0,0 +1,91 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { useGitStatus } from '@/api/git'
import type { GitStatusResponse } from '@/types/git'
import { ChangesTab } from './ChangesTab'
const { commitMutate } = vi.hoisted(() => ({ commitMutate: vi.fn() }))
vi.mock('@/hooks/useGit', () => ({
useGit: () => ({
commit: { mutate: commitMutate, isPending: false },
stageFiles: { mutate: vi.fn(), isPending: false },
unstageFiles: { mutate: vi.fn(), isPending: false },
discardFiles: { mutate: vi.fn(), isPending: false },
generateCommitMessage: { mutate: vi.fn(), isPending: false },
}),
}))
vi.mock('@/api/git', () => ({
useGitStatus: vi.fn(),
}))
vi.mock('./RepoGitIdentitySelect', () => ({
RepoGitIdentitySelect: () => null,
}))
vi.mock('@/components/file-browser/FileDiffView', () => ({
FileDiffView: () => null,
}))
const stagedStatus: GitStatusResponse = {
branch: 'main',
ahead: 0,
behind: 0,
hasChanges: true,
operation: null,
files: [
{ path: 'notes.txt', status: 'modified', staged: true },
{ path: 'todo.txt', status: 'modified', staged: false },
],
}
function renderTab() {
vi.mocked(useGitStatus).mockReturnValue({
data: stagedStatus,
isLoading: false,
error: null,
} as unknown as ReturnType<typeof useGitStatus>)
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } })
return render(
<QueryClientProvider client={queryClient}>
<ChangesTab repoId={1} onFileSelect={vi.fn()} isMobile={false} />
</QueryClientProvider>,
)
}
describe('ChangesTab commit message', () => {
beforeEach(() => {
vi.clearAllMocks()
})
it('keeps the message when the commit fails', async () => {
const user = userEvent.setup()
renderTab()
await user.type(screen.getByPlaceholderText('Commit message...'), 'fix the thing')
await user.click(screen.getByRole('button', { name: /^Commit/ }))
expect(commitMutate).toHaveBeenCalledWith(
{ message: 'fix the thing' },
expect.objectContaining({ onSuccess: expect.any(Function) }),
)
expect(screen.getByPlaceholderText('Commit message...')).toHaveValue('fix the thing')
})
it('clears the message after a successful commit', async () => {
const user = userEvent.setup()
commitMutate.mockImplementation((_variables, options?: { onSuccess?: () => void }) => {
options?.onSuccess?.()
})
renderTab()
await user.type(screen.getByPlaceholderText('Commit message...'), 'fix the thing')
await user.click(screen.getByRole('button', { name: /^Commit/ }))
expect(screen.getByPlaceholderText('Commit message...')).toHaveValue('')
})
})
@@ -57,8 +57,10 @@ export function ChangesTab({ repoId, onFileSelect, onClearFileSelection, selecte
}
const handleCommit = () => {
git.commit.mutate({ message: commitMessage.trim() })
setCommitMessage('')
git.commit.mutate(
{ message: commitMessage.trim() },
{ onSuccess: () => setCommitMessage('') },
)
}
const handleGenerateMessage = () => {
@@ -0,0 +1,117 @@
import { describe, it, expect, vi, afterEach } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import type { GitFileStatus } from '@/types/git'
import { GitFlatFileItem } from './GitFlatFileItem'
const defaultViewportWidth = window.innerWidth
function buildFile(overrides: Partial<GitFileStatus> = {}): GitFileStatus {
return { path: 'notes.txt', status: 'modified', staged: false, ...overrides }
}
function setViewportWidth(width: number) {
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: width })
}
describe('GitFlatFileItem', () => {
afterEach(() => {
setViewportWidth(defaultViewportWidth)
})
it('renders an untracked directory once with its trailing slash', () => {
render(
<GitFlatFileItem
file={buildFile({ path: '.ocm/', status: 'untracked' })}
isSelected={false}
onSelect={vi.fn()}
onStage={vi.fn()}
onDiscard={vi.fn()}
/>,
)
expect(screen.getByText('.ocm/')).toBeInTheDocument()
expect(screen.queryByText('.ocm')).toBeNull()
})
it('keeps the parent directory of a nested untracked directory', () => {
render(
<GitFlatFileItem
file={buildFile({ path: 'src/.ocm/', status: 'untracked' })}
isSelected={false}
onSelect={vi.fn()}
onStage={vi.fn()}
/>,
)
expect(screen.getByText('.ocm/')).toBeInTheDocument()
expect(screen.getByText('src')).toBeInTheDocument()
})
it('names the stage and discard actions after the file', async () => {
const user = userEvent.setup()
const onStage = vi.fn()
const onDiscard = vi.fn()
render(
<GitFlatFileItem
file={buildFile({ path: 'src/notes.txt' })}
isSelected={false}
onSelect={vi.fn()}
onStage={onStage}
onDiscard={onDiscard}
/>,
)
await user.click(screen.getByRole('button', { name: 'Stage notes.txt' }))
await user.click(screen.getByRole('button', { name: 'Discard changes to notes.txt' }))
expect(onStage).toHaveBeenCalledWith('src/notes.txt')
expect(onDiscard).toHaveBeenCalledWith('src/notes.txt', false)
})
it('names the unstage action for staged files', () => {
render(
<GitFlatFileItem
file={buildFile({ path: 'notes.txt', staged: true })}
isSelected={false}
onSelect={vi.fn()}
onUnstage={vi.fn()}
/>,
)
expect(screen.getByRole('button', { name: 'Unstage notes.txt' })).toBeInTheDocument()
})
it('reveals the row actions without hovering on touch-sized viewports', () => {
setViewportWidth(500)
render(
<GitFlatFileItem
file={buildFile()}
isSelected={false}
onSelect={vi.fn()}
onStage={vi.fn()}
onDiscard={vi.fn()}
/>,
)
expect(screen.getByRole('button', { name: 'Stage notes.txt' })).toHaveClass('opacity-100')
})
it('reveals hover-only actions when they receive focus', () => {
setViewportWidth(1280)
render(
<GitFlatFileItem
file={buildFile()}
isSelected={false}
onSelect={vi.fn()}
onStage={vi.fn()}
onDiscard={vi.fn()}
/>,
)
const stageButton = screen.getByRole('button', { name: 'Stage notes.txt' })
expect(stageButton).toHaveClass('opacity-0')
expect(stageButton).toHaveClass('focus-visible:opacity-100')
expect(stageButton).toHaveClass('group-focus-within:opacity-100')
})
})
@@ -1,6 +1,7 @@
import { Button } from '@/components/ui/button'
import { Plus, Minus, FileText, FilePlus, FileX, FileSearch, CircleDot, RotateCcw } from 'lucide-react'
import { cn } from '@/lib/utils'
import { useMobile } from '@/hooks/useMobile'
import type { GitFileStatus } from '@/types/git'
import { GIT_STATUS_COLORS, GIT_UI_COLORS } from '@/lib/git-status-styles'
@@ -23,11 +24,21 @@ const statusIcons = {
}
export function GitFlatFileItem({ file, isSelected, onSelect, onStage, onUnstage, onDiscard }: GitFlatFileItemProps) {
const isMobile = useMobile()
const StatusIcon = statusIcons[file.status] || FileText
const statusColor = GIT_STATUS_COLORS[file.status] || 'text-muted-foreground'
const fileName = file.path.split('/').pop() || file.path
const dirPath = file.path.includes('/') ? file.path.substring(0, file.path.lastIndexOf('/')) : ''
const isDirectory = file.path.endsWith('/')
const normalizedPath = file.path.replace(/\/+$/, '')
const baseName = normalizedPath.split('/').pop() || normalizedPath
const fileName = isDirectory ? `${baseName}/` : baseName
const dirPath = normalizedPath.includes('/') ? normalizedPath.substring(0, normalizedPath.lastIndexOf('/')) : ''
const actionButtonClass = cn(
'h-6 w-6 p-0 transition-opacity flex-shrink-0',
isMobile
? 'opacity-100'
: 'opacity-0 group-hover:opacity-100 focus-visible:opacity-100 group-focus-within:opacity-100'
)
const handleAction = (e: React.MouseEvent) => {
e.stopPropagation()
@@ -81,8 +92,9 @@ export function GitFlatFileItem({ file, isSelected, onSelect, onStage, onUnstage
<Button
variant="ghost"
size="sm"
className="h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"
className={actionButtonClass}
onClick={handleAction}
aria-label={file.staged ? `Unstage ${fileName}` : `Stage ${fileName}`}
>
{file.staged ? (
<Minus className={cn('w-3 h-3', GIT_UI_COLORS.unstage)} />
@@ -95,9 +107,10 @@ export function GitFlatFileItem({ file, isSelected, onSelect, onStage, onUnstage
<Button
variant="ghost"
size="sm"
className="h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"
className={actionButtonClass}
onClick={handleDiscard}
title="Discard changes"
aria-label={`Discard changes to ${fileName}`}
>
<RotateCcw className="w-3 h-3 text-destructive" />
</Button>