mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
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:
1 parent
1c22ef6ea1
commit
4ec62cd4e7
191 files changed
+6674
-696
No files matched your search
@@ -46,7 +46,7 @@ const generatingWalkthrough: ChangeWalkthrough = {
|
||||
}
|
||||
|
||||
function state(overrides: Partial<ChangeWalkthroughState> = {}): ChangeWalkthroughState {
|
||||
return { walkthrough, currentDiffHash: 'hash-1', stale: false, generating: false, running: false, error: null, ...overrides }
|
||||
return { walkthrough, currentDiffHash: 'hash-1', hasChanges: true, stale: false, generating: false, running: false, error: null, ...overrides }
|
||||
}
|
||||
|
||||
function createWrapper() {
|
||||
@@ -490,6 +490,37 @@ describe('ChangesWalkthroughSheet', () => {
|
||||
expect(screen.getByRole('button', { name: 'Generate walkthrough' })).toBeEnabled()
|
||||
})
|
||||
|
||||
it('shows an upfront empty state when the session has no changes', async () => {
|
||||
mocks.getChangeWalkthrough.mockResolvedValue(
|
||||
state({ walkthrough: null, currentDiffHash: 'e3b0c44298fc1c149afbf4c8996fb924', hasChanges: false }),
|
||||
)
|
||||
renderSheet()
|
||||
|
||||
expect(await screen.findByText('No changes in this session')).toBeInTheDocument()
|
||||
expect(screen.queryByRole('button', { name: 'Generate walkthrough' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('hides the refine form until a walkthrough is published', async () => {
|
||||
mocks.getChangeWalkthrough.mockResolvedValue(
|
||||
state({
|
||||
walkthrough: {
|
||||
...walkthrough,
|
||||
status: 'failed',
|
||||
artifactPath: null,
|
||||
publishedAt: null,
|
||||
error: { message: 'The walkthrough session did not publish within 15 minutes', code: 'WALKTHROUGH_TIMEOUT' },
|
||||
},
|
||||
error: { message: 'The walkthrough session did not publish within 15 minutes', code: 'WALKTHROUGH_TIMEOUT' },
|
||||
}),
|
||||
)
|
||||
renderSheet()
|
||||
|
||||
expect(
|
||||
await screen.findByText('The walkthrough session did not publish within 15 minutes'),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.queryByLabelText('Refine walkthrough')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it.each([
|
||||
['WALKTHROUGH_NO_CHANGES', 'This session has no changes to walk through', 'This session has no changes to walk through'],
|
||||
['WALKTHROUGH_NO_CHANGES', 'The staged changes contain no changes to walk through', 'The staged changes contain no changes to walk through'],
|
||||
|
||||
@@ -49,6 +49,7 @@ function walkthroughErrorMessage(error: unknown): string {
|
||||
interface ChangesWalkthroughContextValue {
|
||||
isLoading: boolean
|
||||
walkthrough: ChangeWalkthrough | null
|
||||
hasChanges: boolean
|
||||
stale: boolean
|
||||
generating: boolean
|
||||
running: boolean
|
||||
@@ -239,6 +240,7 @@ export function ChangesWalkthroughProvider({
|
||||
const value: ChangesWalkthroughContextValue = {
|
||||
isLoading: stateQuery.isLoading,
|
||||
walkthrough,
|
||||
hasChanges: state?.hasChanges ?? true,
|
||||
stale,
|
||||
generating,
|
||||
running,
|
||||
@@ -309,6 +311,7 @@ export const ChangesWalkthroughView = memo(function ChangesWalkthroughView() {
|
||||
const {
|
||||
isLoading,
|
||||
walkthrough,
|
||||
hasChanges,
|
||||
stale,
|
||||
generating,
|
||||
running,
|
||||
@@ -325,6 +328,7 @@ export const ChangesWalkthroughView = memo(function ChangesWalkthroughView() {
|
||||
|
||||
const artifactPath = walkthrough?.artifactPath ?? null
|
||||
const published = walkthrough?.publishedAt != null && artifactPath !== null
|
||||
const noChanges = !hasChanges && !generating && !published
|
||||
const artifactUrl = artifactPath === null ? null : getFileApiUrl(artifactPath, { params: { raw: true } })
|
||||
const walkthroughSessionId = walkthrough?.walkthroughSessionId ?? null
|
||||
|
||||
@@ -346,7 +350,7 @@ export const ChangesWalkthroughView = memo(function ChangesWalkthroughView() {
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
|
||||
<WalkthroughSourceInputs />
|
||||
|
||||
{error ? <p className="text-sm text-destructive">{walkthroughErrorMessage(error)}</p> : null}
|
||||
{error && !noChanges ? <p className="text-sm text-destructive">{walkthroughErrorMessage(error)}</p> : null}
|
||||
|
||||
{stale && !generating ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 rounded-md border border-warning/40 bg-warning/10 px-3 py-2">
|
||||
@@ -367,12 +371,23 @@ export const ChangesWalkthroughView = memo(function ChangesWalkthroughView() {
|
||||
) : null}
|
||||
|
||||
{!isLoading && !walkthrough && !generating ? (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Build an interactive walkthrough of {describeWalkthroughSource(source)}.
|
||||
</p>
|
||||
<Button onClick={generate}>Generate walkthrough</Button>
|
||||
</div>
|
||||
noChanges ? (
|
||||
<div className="space-y-1">
|
||||
<p className="text-sm font-medium text-foreground">
|
||||
{source.kind === 'session' ? 'No changes in this session' : 'No changes to walk through'}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
A walkthrough covers changed files. Change something, then generate one.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Build an interactive walkthrough of {describeWalkthroughSource(source)}.
|
||||
</p>
|
||||
<Button onClick={generate}>Generate walkthrough</Button>
|
||||
</div>
|
||||
)
|
||||
) : null}
|
||||
|
||||
{generating && !published ? (
|
||||
@@ -426,7 +441,7 @@ export const ChangesWalkthroughView = memo(function ChangesWalkthroughView() {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{walkthroughSessionId && !generating && !running ? (
|
||||
{published && walkthroughSessionId && !generating && !running ? (
|
||||
<form
|
||||
className="space-y-2"
|
||||
onSubmit={(event) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('PermissionModeToggle', () => {
|
||||
mockHooks()
|
||||
render(<PermissionModeToggle sessionID="ses_1" directory="/repo" />)
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Permissions: ask every time' })).toBeEnabled()
|
||||
expect(screen.getByRole('button', { name: 'Permissions: follow configured rules' })).toBeEnabled()
|
||||
})
|
||||
|
||||
it('switches to accept-everything with the directory when clicked', async () => {
|
||||
@@ -50,7 +50,7 @@ describe('PermissionModeToggle', () => {
|
||||
mockHooks({ mutate })
|
||||
render(<PermissionModeToggle sessionID="ses_1" directory="/repo" />)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: ask every time' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: follow configured rules' }))
|
||||
|
||||
expect(mutate).toHaveBeenCalledWith({ directory: '/repo', mode: 'auto' })
|
||||
})
|
||||
@@ -61,7 +61,7 @@ describe('PermissionModeToggle', () => {
|
||||
mockHooks({ state: { mode: 'auto' }, mutate })
|
||||
render(<PermissionModeToggle sessionID="ses_1" directory="/repo" />)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: accept everything' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: auto-accept all' }))
|
||||
|
||||
expect(mutate).toHaveBeenCalledWith({ directory: '/repo', mode: 'ask' })
|
||||
})
|
||||
@@ -114,7 +114,7 @@ describe('PermissionModeToggle', () => {
|
||||
mockHooks({ data: { ...baseState, mode: 'auto' }, mutate })
|
||||
render(<PermissionModeToggle sessionID="ses_1" directory="/repo" />)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: accept everything' }))
|
||||
await user.click(screen.getByRole('button', { name: 'Permissions: auto-accept all' }))
|
||||
|
||||
expect(mutate).toHaveBeenCalledWith({ directory: '/repo', mode: 'ask' })
|
||||
})
|
||||
|
||||
@@ -123,6 +123,14 @@ describe('PermissionRequestDialog', () => {
|
||||
expect(screen.queryByRole('button', { name: 'Open session' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('focuses the allow action instead of the optional reason field', async () => {
|
||||
render(<PermissionRequestDialog permission={permission} pendingCount={1} onRespond={vi.fn()} />)
|
||||
|
||||
const allowOnce = screen.getByRole('button', { name: 'Allow Once' })
|
||||
await waitFor(() => expect(allowOnce).toHaveFocus())
|
||||
expect(screen.getByLabelText('Reason (optional)')).not.toHaveFocus()
|
||||
})
|
||||
|
||||
it('replies with the selected decision for the permission request', async () => {
|
||||
const onRespond = vi.fn().mockResolvedValue(undefined)
|
||||
render(<PermissionRequestDialog permission={permission} pendingCount={1} onRespond={onRespond} />)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useId, useState } from 'react'
|
||||
import { useEffect, useId, useRef, useState } from 'react'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -51,6 +51,7 @@ export function PermissionRequestDialog({
|
||||
const [loadingAction, setLoadingAction] = useState<PermissionResponse | null>(null)
|
||||
const [rejectReason, setRejectReason] = useState('')
|
||||
const reasonInputId = useId()
|
||||
const allowOnceRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
setRejectReason('')
|
||||
@@ -81,7 +82,13 @@ export function PermissionRequestDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={parentOpen ?? true} onOpenChange={onOpenChange ?? (() => {})}>
|
||||
<DialogContent className="max-w-[calc(100vw-2rem)] sm:max-w-md p-4 sm:p-6">
|
||||
<DialogContent
|
||||
className="max-w-[calc(100vw-2rem)] sm:max-w-md p-4 sm:p-6"
|
||||
onOpenAutoFocus={(event) => {
|
||||
event.preventDefault()
|
||||
allowOnceRef.current?.focus()
|
||||
}}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2 flex-wrap">
|
||||
<span>Permission Request</span>
|
||||
@@ -215,6 +222,7 @@ export function PermissionRequestDialog({
|
||||
variant="default"
|
||||
onClick={() => handleResponse('once')}
|
||||
disabled={isLoading}
|
||||
ref={allowOnceRef}
|
||||
className={cn(
|
||||
"w-full sm:flex-1 text-sm h-9 sm:h-10",
|
||||
loadingAction === 'once' && "opacity-70"
|
||||
|
||||
@@ -58,6 +58,10 @@ vi.mock('@/hooks/useSessionPins', () => ({
|
||||
useToggleSessionPin: () => ({ mutate: togglePinMock }),
|
||||
}))
|
||||
|
||||
vi.mock('@/hooks/useChangeWalkthrough', () => ({
|
||||
useWalkthroughHelperSessionIds: () => new Set<string>(),
|
||||
}))
|
||||
|
||||
describe('SessionList', () => {
|
||||
beforeEach(() => {
|
||||
sessionsData.splice(0, sessionsData.length,
|
||||
|
||||
Reference in new issue
Block a user