mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 00:02:10 +00:00
test: retire backlog cases that assert a shim, a literal, or an unread branch (#24120)
Deep-reads the 596 files earlier auditors explicitly disclosed as reviewed at
title-and-import level only, never against production. Six ~100-file chunks, chosen so
depth was achievable rather than optional. 27 case declarations removed across 19 files,
1 test file deleted, 522 lines gone. No production code touched.
Two chunks found nothing, and that is reported as the result rather than padded:
`src/main/agent-hooks` (89 files, 50 read case-by-case in full) returned zero deletions;
`src/main/claude` (90 files, 44 read in full) found three near-identical pairs via a
normalized case-body hash and kept all three after reading them.
What went:
- Identity copiers with a type-level title. `ui-new-workspace-draft.test.ts` (deleted, 3
cases) tested `setNewWorkspaceDraft: (draft) => set({ newWorkspaceDraft: draft })` — a
bare pass-through — by passing a literal in and asserting a subset of that literal back.
Its titles named field-shape facts that the typed parameter at
`ui-slice-contract-core.ts:197` already enforces in production, so the annotation that
does the work lives in production, not the test.
- A test that asserted its own mock. `destroyRemovedBrowserWebview(id)` is literally
`destroyPersistentWebview(id)`, and the case mocked `destroyPersistentWebview` — so it
checked that the mock received the argument the shim passed through.
- Replays across a bare re-export. `pane-tree-ops.ts:18` is
`export { equalizePaneSplitSizes, findPaneChildren } from './pane-tree-equalization'`;
two cases used `MockHTMLElement` with no dividers while the owner asserts concrete flex
values on real happy-dom elements and runs a 400-seed differential against an
independently reimplemented weight walk.
- Table rows varying a value production never branches on.
`mergeCurrentOrchestrationContext` tests only `dispatchStatus !== undefined`, so
`it.each(['failed','circuit_broken'])` ran the path the surviving `'completed'` case
already proves. Per-value behavior is owned by the one consumer that reads those
literals.
- Duplicate invocations whose surviving sibling asserts strictly more, including a push
error case differing from its neighbour only in which verb produced the same error
string.
Kept deliberately: bound and cap guards (a 50-entry nav-history cap, a skill-cache
eviction pinned to size 2 after 512 retired runtimes, a cleanup-concurrency ceiling);
`buildDefaultTerminalOptions` cases restating declared constants, because each records a
cross-cutting UX decision whose comment preserves the v1.4.51 ZWJ table-corruption history
that once forced scrollbar width 0; three per-grammar `tokenizer.root` invariants for
astro, svelte and vue, which are separate grammars rather than replays; and a test reading
`@xterm/{headless,xterm}/package.json` out of node_modules to prove both were built from
the same upstream commit, which is legitimate because the installed package is the shipped
contract.
Six `src/shared` files were trimmed, and each was checked against the risk that matters
there: `src/shared` is the OWNER four earlier waves deferred to when deleting
main/renderer/mobile tests, so hollowing one out would orphan several callers at once.
Each retains 9 to 46 cases after removing 1 or 2.
Coverage is partial and stated as such. Read case-by-case: pane-manager 81 of 81, slices-a
96 of 121, slices-b 94 of 121, agent-hooks 50 of 89, claude 44 of 90. Every auditor listed
the paths it did not reach.
Verified: 1,294 test files / 14,257 cases pass across the touched areas, plus one
pre-existing `it.fails` marker; `check-reliability-gates.mjs` 140 gates; the deleted file
is absent from the gate manifest, `cloud/package.json` and
`mobile/tests-typecheck-baseline.txt`.
This commit is contained in:
@@ -96,25 +96,6 @@ describe('claude background task terminal frames', () => {
|
||||
expect(items).toEqual([])
|
||||
})
|
||||
|
||||
it('leaves legacy local_subagent tasks to the subagent roster', () => {
|
||||
const { rows, items } = harness()
|
||||
rows.observe({
|
||||
type: 'system',
|
||||
subtype: 'task_started',
|
||||
task_id: 'task-legacy-agent',
|
||||
task_type: 'local_subagent',
|
||||
subagent_type: 'explorer'
|
||||
})
|
||||
rows.observe({
|
||||
type: 'system',
|
||||
subtype: 'task_notification',
|
||||
task_id: 'task-legacy-agent',
|
||||
status: 'failed',
|
||||
summary: 'the child failed'
|
||||
})
|
||||
expect(items).toEqual([])
|
||||
})
|
||||
|
||||
it('writes nothing for ambient housekeeping the user never asked for', () => {
|
||||
const { rows, items } = harness()
|
||||
rows.observe({ ...START_BASH, task_id: 'ambient-1', ambient: true })
|
||||
|
||||
@@ -157,21 +157,6 @@ describe('claudeContextWindowFromResult', () => {
|
||||
).toBe(200_000)
|
||||
})
|
||||
|
||||
it('keeps the main thread window when a subagent ran on a larger one', () => {
|
||||
const modelUsage = {
|
||||
'claude-sonnet-5': { contextWindow: 200_000 },
|
||||
'claude-fable-5-1[1m]': { contextWindow: 1_000_000 }
|
||||
}
|
||||
for (const initModel of ['claude-sonnet-5', null]) {
|
||||
expect(
|
||||
claudeContextWindowFromResult(
|
||||
{ modelUsage },
|
||||
{ initModel, responseModel: 'claude-sonnet-5' }
|
||||
)
|
||||
).toBe(200_000)
|
||||
}
|
||||
})
|
||||
|
||||
it('is null when no entry reports a usable window', () => {
|
||||
expect(claudeContextWindowFromResult({ type: 'result' })).toBeNull()
|
||||
expect(
|
||||
|
||||
@@ -245,31 +245,3 @@ it('reports a description-only change and lets a later report drop the text', ()
|
||||
expect(catalog.observe({ ...changed, commands: [{ name: 'clear' }] })).toBe(true)
|
||||
expect(catalog.commands).toEqual([{ name: 'clear', kind: 'command' }])
|
||||
})
|
||||
|
||||
it('describes nothing when the session reported names only', () => {
|
||||
expect(readClaudeSlashCommands(init())).toEqual([
|
||||
{ name: 'clear', kind: 'command' },
|
||||
{ name: 'ref-oss', kind: 'skill' },
|
||||
{ name: 'opsx:apply', kind: 'command' }
|
||||
])
|
||||
expect(new ClaudeSlashCommandCatalog(init()).commands).toEqual([
|
||||
{ name: 'clear', kind: 'command' },
|
||||
{ name: 'ref-oss', kind: 'skill' },
|
||||
{ name: 'opsx:apply', kind: 'command' }
|
||||
])
|
||||
})
|
||||
|
||||
it('still hides terminal-only names however well the provider describes them', () => {
|
||||
const catalog = new ClaudeSlashCommandCatalog(init())
|
||||
expect(
|
||||
catalog.observe({
|
||||
type: 'system',
|
||||
subtype: 'commands_changed',
|
||||
commands: [
|
||||
{ name: 'doctor', description: 'Diagnose the CLI install' },
|
||||
{ name: 'ref-oss', description: 'A skill' }
|
||||
]
|
||||
})
|
||||
).toBe(true)
|
||||
expect(catalog.commands).toEqual([{ name: 'ref-oss', kind: 'skill', description: 'A skill' }])
|
||||
})
|
||||
|
||||
@@ -216,23 +216,6 @@ describe('claude streamed text checkpoints', () => {
|
||||
expect(stamps).toEqual([CHILD_LINKAGE, { ...CHILD_LINKAGE, agentId: 'task-2' }])
|
||||
})
|
||||
|
||||
it('re-attributes a block that stopped streaming before its announcement', () => {
|
||||
// Nothing revisits such a block: no later checkpoint, no final envelope.
|
||||
// Without this it keeps the provisional id for the life of the journal.
|
||||
const producer = scriptedProducer()
|
||||
const { store, rows, stamps, runWindow } = checkpoints(producer.source)
|
||||
|
||||
store.append(identityOf('block-1'), 'said once', 'toolu_1')
|
||||
runWindow()
|
||||
expect(stamps.at(-1)).toMatchObject({ agentId: 'toolu_1' })
|
||||
|
||||
producer.resolve(CHILD_LINKAGE)
|
||||
store.reattribute()
|
||||
|
||||
expect(rows.at(-1)).toEqual({ uuid: 'block-1', text: 'said once' })
|
||||
expect(stamps.at(-1)).toEqual(CHILD_LINKAGE)
|
||||
})
|
||||
|
||||
it('stops persisting once disposed', () => {
|
||||
const { store, rows, runWindow } = checkpoints()
|
||||
|
||||
|
||||
@@ -121,18 +121,6 @@ describe('Claude message content parts', () => {
|
||||
expect(state.sink.publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not render injected image companions or start a turn', () => {
|
||||
const state = sinkState()
|
||||
const translator = createClaudeJournalTranslator({ sink: state.sink })
|
||||
const event = userMessageWith(null)
|
||||
const content = [{ type: 'text', text: '[Image: source: /tmp/pasted.png]' }]
|
||||
translator.handle({
|
||||
...event,
|
||||
message: { ...event.message, isMeta: true, message: { role: 'user', content } }
|
||||
})
|
||||
expect(state.items).toEqual([])
|
||||
})
|
||||
|
||||
it('does not leak a wire kind for a locally attached image', () => {
|
||||
const state = sinkState()
|
||||
const translator = createClaudeJournalTranslator({ sink: state.sink })
|
||||
|
||||
@@ -807,46 +807,6 @@ describe('safeFit', () => {
|
||||
|
||||
describe('equalizePaneSplitSizes', () => {
|
||||
const pane = (flex = '1 1 0%'): MockHTMLElement => new MockHTMLElement(['pane'], [], flex)
|
||||
const split = (
|
||||
direction: 'vertical' | 'horizontal',
|
||||
children: MockHTMLElement[],
|
||||
flex = '1 1 0%'
|
||||
): MockHTMLElement =>
|
||||
new MockHTMLElement(
|
||||
['pane-split', direction === 'vertical' ? 'is-vertical' : 'is-horizontal'],
|
||||
children,
|
||||
flex
|
||||
)
|
||||
|
||||
it('weights nested same-axis splits so same-axis panes equalize evenly', () => {
|
||||
const left = pane('10 1 0%')
|
||||
const middle = pane('20 1 0%')
|
||||
const right = pane('30 1 0%')
|
||||
const rightSplit = split('vertical', [middle, right], '90 1 0%')
|
||||
const root = split('vertical', [left, rightSplit])
|
||||
|
||||
expect(equalizePaneSplitSizes(root as unknown as HTMLElement)).toBe(true)
|
||||
|
||||
expect(left.style.flex).toBe('1 1 0%')
|
||||
expect(rightSplit.style.flex).toBe('2 1 0%')
|
||||
expect(middle.style.flex).toBe('1 1 0%')
|
||||
expect(right.style.flex).toBe('1 1 0%')
|
||||
})
|
||||
|
||||
it('treats perpendicular child splits as one weighted region', () => {
|
||||
const top = pane('7 1 0%')
|
||||
const bottom = pane('3 1 0%')
|
||||
const leftStack = split('horizontal', [top, bottom], '15 1 0%')
|
||||
const right = pane('85 1 0%')
|
||||
const root = split('vertical', [leftStack, right])
|
||||
|
||||
expect(equalizePaneSplitSizes(root as unknown as HTMLElement)).toBe(true)
|
||||
|
||||
expect(leftStack.style.flex).toBe('1 1 0%')
|
||||
expect(right.style.flex).toBe('1 1 0%')
|
||||
expect(top.style.flex).toBe('1 1 0%')
|
||||
expect(bottom.style.flex).toBe('1 1 0%')
|
||||
})
|
||||
|
||||
it('returns false when there is no split tree to change', () => {
|
||||
expect(equalizePaneSplitSizes(pane() as unknown as HTMLElement)).toBe(false)
|
||||
|
||||
@@ -61,21 +61,6 @@ describe('dropAgentStatus → IPC fan-out', () => {
|
||||
expect(drop).toHaveBeenCalledTimes(1)
|
||||
expect(drop).toHaveBeenCalledWith('tab-missing:0')
|
||||
})
|
||||
|
||||
it('idempotent: repeated drops on the same paneKey fire the IPC each time', () => {
|
||||
// Why: the renderer keeps drop() side-effect free relative to its own
|
||||
// state — sending an extra IPC for an already-dropped paneKey is safe
|
||||
// because main-side dropStatusEntry is a no-op when the entry is gone.
|
||||
// Asserting this contract documents the renderer's hands-off posture.
|
||||
const { drop } = stubWindowApi()
|
||||
const store = createTestStore()
|
||||
store
|
||||
.getState()
|
||||
.setAgentStatus('tab-1:0', { state: 'working', prompt: 'p', agentType: 'claude' })
|
||||
store.getState().dropAgentStatus('tab-1:0')
|
||||
store.getState().dropAgentStatus('tab-1:0')
|
||||
expect(drop).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('dropAgentStatusByTabPrefix -> IPC fan-out', () => {
|
||||
|
||||
@@ -221,33 +221,6 @@ describe('agent status runtime orchestration metadata', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it.each(['failed', 'circuit_broken'] as const)(
|
||||
'updates runtime status to %s for the same dispatch',
|
||||
(dispatchStatus) => {
|
||||
vi.useFakeTimers()
|
||||
const store = createTestStore()
|
||||
const childPaneKey = 'tab-child:11111111-1111-4111-8111-111111111111'
|
||||
|
||||
store.getState().setAgentStatus(childPaneKey, {
|
||||
state: 'done',
|
||||
prompt: 'child agent',
|
||||
agentType: 'claude',
|
||||
orchestration: {
|
||||
taskId: 'task-1',
|
||||
dispatchId: 'ctx-1',
|
||||
dispatchStatus: 'dispatched'
|
||||
}
|
||||
})
|
||||
store.getState().setRuntimeAgentOrchestrationByPaneKey({
|
||||
[childPaneKey]: { taskId: 'task-1', dispatchId: 'ctx-1', dispatchStatus }
|
||||
})
|
||||
|
||||
expect(
|
||||
store.getState().agentStatusByPaneKey[childPaneKey].orchestration?.dispatchStatus
|
||||
).toBe(dispatchStatus)
|
||||
}
|
||||
)
|
||||
|
||||
it('keeps current payload orchestration ahead of a stale runtime map entry', () => {
|
||||
vi.useFakeTimers()
|
||||
const store = createTestStore()
|
||||
|
||||
@@ -7,7 +7,6 @@ vi.mock('../../components/browser-pane/host-guest/webview-registry', () => ({
|
||||
|
||||
import {
|
||||
collectBrowserWebviewIds,
|
||||
destroyRemovedBrowserWebview,
|
||||
destroyWorkspaceWebviews,
|
||||
destroyWorktreeBrowserGuests
|
||||
} from './browser-webview-cleanup'
|
||||
@@ -75,12 +74,6 @@ describe('destroyWorkspaceWebviews', () => {
|
||||
vi.mocked(destroyPersistentWebview).mockClear()
|
||||
})
|
||||
|
||||
it('destroys the webview when the backing page is removed', () => {
|
||||
destroyRemovedBrowserWebview('page-1')
|
||||
|
||||
expect(destroyPersistentWebview).toHaveBeenCalledWith('page-1')
|
||||
})
|
||||
|
||||
it('destroys every page id for a multi-page workspace', () => {
|
||||
destroyWorkspaceWebviews(
|
||||
{ 'workspace-1': [page('page-1', 'workspace-1'), page('page-2', 'workspace-1')] },
|
||||
|
||||
@@ -376,35 +376,6 @@ describe('createEditorSlice remote branch actions', () => {
|
||||
expect(store.getState().isRemoteOperationActive).toBe(false)
|
||||
})
|
||||
|
||||
it('maps publish updates-were-rejected into a clean actionable toast', async () => {
|
||||
const store = createEditorStore()
|
||||
const publishError = new Error(
|
||||
'Updates were rejected because the tip of your current branch is behind its remote counterpart.'
|
||||
)
|
||||
gitPushMock.mockRejectedValueOnce(publishError)
|
||||
|
||||
await expect(store.getState().pushBranch('wt-1', '/repo', true)).rejects.toThrow(
|
||||
publishError.message
|
||||
)
|
||||
|
||||
expect(toastErrorMock).toHaveBeenCalledWith(
|
||||
'Push rejected — remote has changes. Pull first, then try again.'
|
||||
)
|
||||
await flushAsyncRemoteRefresh()
|
||||
|
||||
expect(gitStatusMock).not.toHaveBeenCalled()
|
||||
expect(gitFetchMock).toHaveBeenCalledWith({
|
||||
worktreePath: '/repo',
|
||||
connectionId: undefined,
|
||||
worktreeId: 'wt-1'
|
||||
})
|
||||
expect(gitUpstreamStatusMock).toHaveBeenCalledWith({
|
||||
worktreePath: '/repo',
|
||||
connectionId: undefined
|
||||
})
|
||||
expect(store.getState().isRemoteOperationActive).toBe(false)
|
||||
})
|
||||
|
||||
it('maps raw publish wrapper errors into a cleaner actionable toast', async () => {
|
||||
const store = createEditorStore()
|
||||
const rawPublishError = new Error(
|
||||
@@ -467,33 +438,6 @@ describe('createEditorSlice remote branch actions', () => {
|
||||
expect(store.getState().isRemoteOperationActive).toBe(false)
|
||||
})
|
||||
|
||||
it('maps non-fast-forward keyword push errors into a clean actionable toast', async () => {
|
||||
const store = createEditorStore()
|
||||
const pushError = new Error('Push rejected: remote has newer commits (non-fast-forward).')
|
||||
gitPushMock.mockRejectedValueOnce(pushError)
|
||||
|
||||
await expect(store.getState().pushBranch('wt-1', '/repo', false)).rejects.toThrow(
|
||||
pushError.message
|
||||
)
|
||||
|
||||
expect(toastErrorMock).toHaveBeenCalledWith(
|
||||
'Push rejected — remote has changes. Pull first, then try again.'
|
||||
)
|
||||
await flushAsyncRemoteRefresh()
|
||||
|
||||
expect(gitStatusMock).not.toHaveBeenCalled()
|
||||
expect(gitFetchMock).toHaveBeenCalledWith({
|
||||
worktreePath: '/repo',
|
||||
connectionId: undefined,
|
||||
worktreeId: 'wt-1'
|
||||
})
|
||||
expect(gitUpstreamStatusMock).toHaveBeenCalledWith({
|
||||
worktreePath: '/repo',
|
||||
connectionId: undefined
|
||||
})
|
||||
expect(store.getState().isRemoteOperationActive).toBe(false)
|
||||
})
|
||||
|
||||
it('surfaces submodule push failures with the submodule name', async () => {
|
||||
const store = createEditorStore()
|
||||
const pushError = new Error(
|
||||
|
||||
@@ -95,19 +95,6 @@ describe('createEditorSlice right sidebar state', () => {
|
||||
expect(store.getState().rightSidebarOpen).toBe(false)
|
||||
})
|
||||
|
||||
it('setRightSidebarOpen opens the sidebar', () => {
|
||||
const store = createEditorStore()
|
||||
store.getState().setRightSidebarOpen(true)
|
||||
expect(store.getState().rightSidebarOpen).toBe(true)
|
||||
})
|
||||
|
||||
it('setRightSidebarOpen(false) after open closes it', () => {
|
||||
const store = createEditorStore()
|
||||
store.getState().setRightSidebarOpen(true)
|
||||
store.getState().setRightSidebarOpen(false)
|
||||
expect(store.getState().rightSidebarOpen).toBe(false)
|
||||
})
|
||||
|
||||
it('toggleRightSidebar flips the state', () => {
|
||||
const store = createEditorStore()
|
||||
expect(store.getState().rightSidebarOpen).toBe(false)
|
||||
|
||||
@@ -70,23 +70,6 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('createGitHubSlice.fetchPRChecks checks cache freshness', () => {
|
||||
it('expires empty checks cache entries after the shorter empty TTL', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(1_000)
|
||||
const store = createTestStore()
|
||||
const repoPath = '/repo'
|
||||
const repoId = 'repo-id'
|
||||
const branch = 'feature/test'
|
||||
|
||||
mockApi.gh.prChecks.mockResolvedValue([])
|
||||
|
||||
await store.getState().fetchPRChecks(repoPath, 12, branch, undefined, null, { repoId })
|
||||
vi.setSystemTime(11_001)
|
||||
await store.getState().fetchPRChecks(repoPath, 12, branch, undefined, null, { repoId })
|
||||
|
||||
expect(mockApi.gh.prChecks).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('keeps repeated automatic empty checks refreshes cacheable', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(1_000)
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createUIStore } from './ui-slice-test-harness'
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
sendNotesToActiveAgentSession: vi.fn(),
|
||||
track: vi.fn(),
|
||||
toastMessage: vi.fn(),
|
||||
toastSuccess: vi.fn(),
|
||||
toastError: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/lib/active-agent-note-send', () => ({
|
||||
activeAgentNotesSendFailureMessage: (
|
||||
status: string,
|
||||
options: { explicitTarget?: boolean } = {}
|
||||
) => (options.explicitTarget ? `selected:${status}` : status),
|
||||
sendNotesToActiveAgentSession: mocks.sendNotesToActiveAgentSession
|
||||
}))
|
||||
|
||||
vi.mock('@/lib/telemetry', () => ({
|
||||
track: mocks.track
|
||||
}))
|
||||
|
||||
vi.mock('sonner', () => ({
|
||||
toast: {
|
||||
message: mocks.toastMessage,
|
||||
success: mocks.toastSuccess,
|
||||
error: mocks.toastError
|
||||
}
|
||||
}))
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
mocks.sendNotesToActiveAgentSession.mockReset()
|
||||
mocks.sendNotesToActiveAgentSession.mockResolvedValue({ status: 'sent' })
|
||||
mocks.track.mockReset()
|
||||
mocks.toastMessage.mockReset()
|
||||
mocks.toastSuccess.mockReset()
|
||||
mocks.toastError.mockReset()
|
||||
})
|
||||
|
||||
describe('createUISlice new workspace draft', () => {
|
||||
it('preserves Linear linked work item metadata', () => {
|
||||
const store = createUIStore()
|
||||
|
||||
store.getState().setNewWorkspaceDraft({
|
||||
repoId: 'repo-1',
|
||||
name: 'Fix launch context handoff',
|
||||
prompt: '',
|
||||
note: '',
|
||||
attachments: [],
|
||||
linkedWorkItem: {
|
||||
type: 'issue',
|
||||
number: 0,
|
||||
title: 'Fix launch context handoff',
|
||||
url: 'https://linear.app/acme/issue/ENG-123/fix-launch-context-handoff',
|
||||
linearIdentifier: 'ENG-123'
|
||||
},
|
||||
agent: 'claude',
|
||||
linkedIssue: '',
|
||||
linkedPR: null,
|
||||
linkedGitLabIssue: null,
|
||||
linkedGitLabMR: null
|
||||
})
|
||||
|
||||
expect(store.getState().newWorkspaceDraft?.linkedWorkItem).toMatchObject({
|
||||
linearIdentifier: 'ENG-123'
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps older linked work item drafts without Linear context fields valid', () => {
|
||||
const store = createUIStore()
|
||||
|
||||
store.getState().setNewWorkspaceDraft({
|
||||
repoId: 'repo-1',
|
||||
name: 'Legacy issue',
|
||||
prompt: '',
|
||||
note: '',
|
||||
attachments: [],
|
||||
linkedWorkItem: {
|
||||
type: 'issue',
|
||||
number: 42,
|
||||
title: 'Legacy issue',
|
||||
url: 'https://github.com/acme/repo/issues/42'
|
||||
},
|
||||
agent: 'claude',
|
||||
linkedIssue: '42',
|
||||
linkedPR: null,
|
||||
linkedGitLabIssue: null,
|
||||
linkedGitLabMR: null
|
||||
})
|
||||
|
||||
expect(store.getState().newWorkspaceDraft?.linkedWorkItem).toEqual({
|
||||
type: 'issue',
|
||||
number: 42,
|
||||
title: 'Legacy issue',
|
||||
url: 'https://github.com/acme/repo/issues/42'
|
||||
})
|
||||
})
|
||||
|
||||
it('preserves serializable Jira identity and bound source context in drafts', () => {
|
||||
const store = createUIStore()
|
||||
const linkedTaskSourceContext = {
|
||||
kind: 'task-source' as const,
|
||||
provider: 'jira' as const,
|
||||
projectId: 'project-1',
|
||||
hostId: 'runtime:env-1' as const,
|
||||
providerIdentity: {
|
||||
provider: 'jira' as const,
|
||||
siteId: 'site-1',
|
||||
siteUrl: 'https://company.atlassian.net',
|
||||
projectKey: 'ORCA'
|
||||
},
|
||||
accountLabel: 'ada@example.com'
|
||||
}
|
||||
|
||||
store.getState().setNewWorkspaceDraft({
|
||||
repoId: 'repo-1',
|
||||
name: 'orca-123-link-jira',
|
||||
prompt: '',
|
||||
note: '',
|
||||
attachments: [],
|
||||
linkedWorkItem: {
|
||||
provider: 'jira',
|
||||
type: 'issue',
|
||||
number: 0,
|
||||
title: 'ORCA-123 Link Jira',
|
||||
url: 'https://company.atlassian.net/browse/ORCA-123',
|
||||
jiraIdentifier: 'ORCA-123'
|
||||
},
|
||||
linkedTaskSourceContext,
|
||||
agent: 'claude',
|
||||
linkedIssue: '',
|
||||
linkedPR: null,
|
||||
linkedGitLabIssue: null,
|
||||
linkedGitLabMR: null
|
||||
})
|
||||
|
||||
expect(store.getState().newWorkspaceDraft).toMatchObject({
|
||||
linkedWorkItem: {
|
||||
provider: 'jira',
|
||||
jiraIdentifier: 'ORCA-123'
|
||||
},
|
||||
linkedTaskSourceContext
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -98,14 +98,6 @@ describe('buildSetupRunnerCommand', () => {
|
||||
shell: 'windows'
|
||||
})
|
||||
})
|
||||
|
||||
it('still uses bash for a POSIX runner launched from a POSIX pane', () => {
|
||||
expect(
|
||||
buildSetupRunnerCommand('C:\\repo\\.git\\orca\\setup-runner.sh', 'windows', {
|
||||
family: 'posix'
|
||||
})
|
||||
).toBe('bash /c/repo/.git/orca/setup-runner.sh')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildSetupRunnerCommand cmd metacharacter guard', () => {
|
||||
|
||||
@@ -4,13 +4,7 @@
|
||||
// round-trips without coercion.
|
||||
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
addRepoSetupStepActionSchema,
|
||||
errorClassSchema,
|
||||
eventSchemas,
|
||||
isCohortExtendedEvent
|
||||
} from './telemetry-events'
|
||||
import { appStarSourceSchema } from './gh-star-source'
|
||||
import { errorClassSchema, eventSchemas, isCohortExtendedEvent } from './telemetry-events'
|
||||
|
||||
describe('feature_interaction_usage_bucket_reached schema', () => {
|
||||
it('accepts a valid bucket payload', () => {
|
||||
@@ -106,13 +100,6 @@ describe('feature_interaction_usage_bucket_reached schema', () => {
|
||||
})
|
||||
|
||||
describe('app_starred_orca schema', () => {
|
||||
it('accepts every declared app star source', () => {
|
||||
for (const source of appStarSourceSchema.options) {
|
||||
const parsed = eventSchemas.app_starred_orca.safeParse({ source })
|
||||
expect(parsed.success).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
it('accepts cohort context on successful app star telemetry', () => {
|
||||
const parsed = eventSchemas.app_starred_orca.safeParse({
|
||||
source: 'settings',
|
||||
@@ -471,13 +458,6 @@ describe('agent_hook_unattributed schema', () => {
|
||||
})
|
||||
|
||||
describe('add_repo_setup_step_action schema', () => {
|
||||
it('accepts every Setup-step action declared in the schema', () => {
|
||||
for (const action of addRepoSetupStepActionSchema.options) {
|
||||
const parsed = eventSchemas.add_repo_setup_step_action.safeParse({ action })
|
||||
expect(parsed.success).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects unknown action enum values', () => {
|
||||
const parsed = eventSchemas.add_repo_setup_step_action.safeParse({
|
||||
action: 'export_to_pdf'
|
||||
|
||||
@@ -89,20 +89,6 @@ describe('resolveSynchronizedOutputSafeSplit', () => {
|
||||
expect(resolveSynchronizedOutputSafeSplit(data, 20)).toBe(20)
|
||||
})
|
||||
|
||||
it('degrades to the plain limit when the buffer starts inside a frame', () => {
|
||||
// Callers do not thread prior latch state, so a remainder that begins inside
|
||||
// an already-open frame is scanned as if closed. It must never be WORSE than
|
||||
// the blind offset it replaced: same boundary, byte-exact.
|
||||
const data = `${'z'.repeat(40)}${CLOSE}${'q'.repeat(40)}`
|
||||
const limit = 20
|
||||
const splitAt = resolveSynchronizedOutputSafeSplit(data, limit, '', true)
|
||||
const naive = resolveSynchronizedOutputSafeSplit(data, limit)
|
||||
// With the real prior state it can only do better or the same.
|
||||
expect(splitAt).toBeLessThanOrEqual(limit)
|
||||
expect(naive).toBeLessThanOrEqual(limit)
|
||||
expect(data.slice(0, naive) + data.slice(naive)).toBe(data)
|
||||
})
|
||||
|
||||
it('never returns past the limit or breaks byte-exactness across many shapes', () => {
|
||||
const outputSamples = [
|
||||
`${OPEN}${'a'.repeat(50)}${CLOSE}`,
|
||||
|
||||
@@ -239,18 +239,6 @@ describe('buildGitGrepArgs', () => {
|
||||
expect(args).toContain(':(exclude,glob)dist/**')
|
||||
})
|
||||
|
||||
it('excludes a directory subtree the way rg --glob does', () => {
|
||||
const args = buildGitGrepArgs('q', { excludePattern: 'node_modules' })
|
||||
expect(args).toContain(':(exclude,glob)**/node_modules')
|
||||
expect(args).toContain(':(exclude,glob)**/node_modules/**')
|
||||
})
|
||||
|
||||
it('includes a directory subtree the way rg --glob does', () => {
|
||||
const args = buildGitGrepArgs('q', { includePattern: 'src' })
|
||||
expect(args).toContain(':(glob)**/src')
|
||||
expect(args).toContain(':(glob)**/src/**')
|
||||
})
|
||||
|
||||
it('keeps escaped commas inside one generated folder pathspec', () => {
|
||||
const args = buildGitGrepArgs('q', { includePattern: 'foo\\,bar/**, *.ts' })
|
||||
expect(args).toContain(':(glob)foo\\,bar/**')
|
||||
|
||||
@@ -457,35 +457,6 @@ describe('parseWorkspaceSession sleeping agents', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('preserves legacy live sleeping agent origins across hydration', () => {
|
||||
const result = parseWorkspaceSession({
|
||||
activeRepoId: null,
|
||||
activeWorktreeId: null,
|
||||
activeTabId: null,
|
||||
tabsByWorktree: {},
|
||||
terminalLayoutsByTabId: {},
|
||||
sleepingAgentSessionsByPaneKey: {
|
||||
'tab1:pane-1': {
|
||||
paneKey: 'tab1:pane-1',
|
||||
tabId: 'tab1',
|
||||
worktreeId: 'wt',
|
||||
agent: 'codex',
|
||||
providerSession: { key: 'session_id', id: 'codex-session' },
|
||||
prompt: 'continue',
|
||||
state: 'working',
|
||||
capturedAt: 10,
|
||||
updatedAt: 9,
|
||||
origin: 'live'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
expect(result.ok).toBe(true)
|
||||
if (result.ok) {
|
||||
expect(result.value.sleepingAgentSessionsByPaneKey?.['tab1:pane-1']?.origin).toBe('live')
|
||||
}
|
||||
})
|
||||
|
||||
it('drops malformed sleeping agent resume records without failing the whole session', () => {
|
||||
const result = parseWorkspaceSession({
|
||||
activeRepoId: null,
|
||||
|
||||
@@ -187,27 +187,6 @@ describe('pruneLocalTerminalScrollbackBuffers', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('caps preserved SSH buffers so session JSON cannot scale with raw scrollback', () => {
|
||||
const hugeScrollback = `start-${'x'.repeat(TERMINAL_SCROLLBACK_SESSION_BUFFER_BYTE_LIMIT + 10)}`
|
||||
const result = pruneLocalTerminalScrollbackBuffers(
|
||||
makeSession({
|
||||
terminalLayoutsByTabId: {
|
||||
'remote-tab': {
|
||||
root: null,
|
||||
activeLeafId: null,
|
||||
expandedLeafId: null,
|
||||
buffersByLeafId: { 'pane:1': hugeScrollback }
|
||||
}
|
||||
}
|
||||
}),
|
||||
[{ id: 'remote-repo', connectionId: 'ssh-target-1' }]
|
||||
)
|
||||
|
||||
const buffer = result.terminalLayoutsByTabId['remote-tab'].buffersByLeafId?.['pane:1']
|
||||
expect(buffer).toHaveLength(TERMINAL_SCROLLBACK_SESSION_BUFFER_BYTE_LIMIT)
|
||||
expect(buffer?.startsWith('start-')).toBe(false)
|
||||
})
|
||||
|
||||
it('caps preserved SSH buffers by UTF-8 bytes for multibyte scrollback', () => {
|
||||
const multibyteRow = 'é'.repeat(1024)
|
||||
const hugeScrollback = multibyteRow.repeat(512)
|
||||
|
||||
Reference in New Issue
Block a user