mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
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.
72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { executeCommand } from '../../src/utils/process'
|
|
import { logger } from '../../src/utils/logger'
|
|
|
|
describe('executeCommand signal handling', () => {
|
|
it('reports a signal-terminated child as a non-zero exit code when exit codes are ignored', async () => {
|
|
const result = await executeCommand(['sh', '-c', 'kill -KILL $$'], {
|
|
ignoreExitCode: true,
|
|
silent: true,
|
|
})
|
|
const structured = typeof result === 'string' ? { exitCode: 0, stdout: result, stderr: '' } : result
|
|
|
|
expect(structured.exitCode).not.toBe(0)
|
|
expect(structured.stderr).toContain('Command terminated by signal SIGKILL')
|
|
})
|
|
|
|
it('rejects a signal-terminated child when exit codes are enforced', async () => {
|
|
await expect(executeCommand(['sh', '-c', 'kill -KILL $$'], { silent: true })).rejects.toThrow(
|
|
'Command failed with signal SIGKILL',
|
|
)
|
|
})
|
|
|
|
it('resolves a zero exit code as success when exit codes are ignored', async () => {
|
|
const result = await executeCommand(['sh', '-c', 'true'], { ignoreExitCode: true, silent: true })
|
|
|
|
expect(result).toEqual({ exitCode: 0, stdout: '', stderr: '' })
|
|
})
|
|
|
|
it('truncates stdout at maxOutputChars and resolves instead of rejecting', async () => {
|
|
const result = await executeCommand(
|
|
['sh', '-c', 'i=0; while [ $i -lt 1000 ]; do printf "0123456789"; i=$((i+1)); done'],
|
|
{ maxOutputChars: 100, silent: true },
|
|
)
|
|
|
|
expect(typeof result).toBe('string')
|
|
expect(result).toHaveLength(100)
|
|
})
|
|
|
|
it('flags truncated output on the structured result when exit codes are ignored', async () => {
|
|
const result = await executeCommand(
|
|
['sh', '-c', 'i=0; while [ $i -lt 1000 ]; do printf "0123456789"; i=$((i+1)); done'],
|
|
{ maxOutputChars: 100, silent: true, ignoreExitCode: true },
|
|
)
|
|
|
|
expect(result.truncated).toBe(true)
|
|
expect(result.stdout).toHaveLength(100)
|
|
})
|
|
|
|
it('returns the full stdout when it stays within maxOutputChars', async () => {
|
|
const result = await executeCommand(['sh', '-c', 'printf "hello"'], { maxOutputChars: 100, silent: true })
|
|
|
|
expect(result).toBe('hello')
|
|
})
|
|
|
|
it('logs a git command as one debug line and never at info level', async () => {
|
|
const infoSpy = vi.spyOn(logger, 'info').mockImplementation(() => {})
|
|
const debugSpy = vi.spyOn(logger, 'debug').mockImplementation(() => {})
|
|
|
|
try {
|
|
await executeCommand(['git', '--version'], { silent: true })
|
|
|
|
expect(infoSpy).not.toHaveBeenCalled()
|
|
expect(debugSpy).toHaveBeenCalledTimes(1)
|
|
expect(debugSpy.mock.calls[0]).toHaveLength(1)
|
|
expect(debugSpy.mock.calls[0]?.[0]).toContain('git --version')
|
|
} finally {
|
|
infoSpy.mockRestore()
|
|
debugSpy.mockRestore()
|
|
}
|
|
})
|
|
})
|