Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

test: remove low-value copy, layout, and equivalence checks (#36192)

OrcaWin6be126d65fab
diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json
index dd0e310bfe3..391a825ed05 100644
--- a/config/scripts/ci-shard-timings.json
+++ b/config/scripts/ci-shard-timings.json
@@ -9137,7 +9137,6 @@
"src/renderer/src/components/sidebar/worktree-list/rows/ProjectHeaderHostLabel.test.tsx": 714,
"src/renderer/src/components/sidebar/worktree-list/rows/RepoScanUnavailableIndicator.test.tsx": 1417,
"src/renderer/src/components/sidebar/worktree-list/rows/host-header-detail.test.ts": 128,
- "src/renderer/src/components/sidebar/worktree-list/rows/indentation.test.ts": 34,
"src/renderer/src/components/sidebar/worktree-list/rows/option-dom-host-collision.test.ts": 125,
"src/renderer/src/components/sidebar/worktree-list/rows/project-header-host-context.test.ts": 103,
"src/renderer/src/components/sidebar/worktree-list/rows/use-project-group-dialogs-owner-host.test.tsx": 732,
diff --git a/mobile/src/tasks/mobile-tasks-hosted-review.test.ts b/mobile/src/tasks/mobile-tasks-hosted-review.test.ts
deleted file mode 100644
index 7b087344df4..00000000000
--- a/mobile/src/tasks/mobile-tasks-hosted-review.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { describe, expect, it, vi } from 'vitest'
-import { getGitHubMergeLabel } from './mobile-tasks-hosted-review'
-import type { GitHubWorkItem } from './mobile-tasks-provider-detail-types'
-
-vi.mock('./mobile-tasks-item-mapping', () => ({ projectRowType: vi.fn() }))
-
-const item: GitHubWorkItem = {
- id: 'pr:30140',
- type: 'pr',
- number: 30140,
- title: 'Page GitHub tasks by number',
- state: 'merged',
- url: 'https://github.com/stablyai/orca/pull/30140',
- labels: [],
- updatedAt: '2026-10-16T00:00:00Z',
- author: null,
- repoId: 'orca',
- repoName: 'orca'
-}
-
-describe('mobile Tasks GitHub merge label', () => {
- it.each(['merged', 'closed'] as const)('uses %s state without merge enrichment', (state) => {
- expect(getGitHubMergeLabel({ ...item, state })).toBe(state === 'merged' ? 'Merged' : 'Closed')
- })
-
- it('hides the merge label for open list rows without merge enrichment', () => {
- expect(getGitHubMergeLabel({ ...item, state: 'open' })).toBeNull()
- })
-})
diff --git a/src/main/ipc/worktrees/listing/detected-worktree-classification.test.ts b/src/main/ipc/worktrees/listing/detected-worktree-classification.test.ts
index 0e9ab76f811..71eefd521aa 100644
--- a/src/main/ipc/worktrees/listing/detected-worktree-classification.test.ts
+++ b/src/main/ipc/worktrees/listing/detected-worktree-classification.test.ts
@@ -28,20 +28,6 @@ vi.mock('node:crypto', async (importOriginal) => ({
const { buildDetectedGitWorktrees } = await import('./ssh-worktree-fallback')
const { getProjectHostSetupWorktreeMeta } =
await import('../../../../shared/project-host-setup-lookup')
-const { mergeWorktree } = await import('../../worktree-metadata-merge')
-const { resolveWorktreeMetaWithDiscoveryBackfill } = await import('./worktree-discovery-metadata')
-const ownership = await import('../../../../shared/worktree/ownership')
-const { projectResolvedWorktreeLineage } =
- await import('../../../../shared/resolved-worktree-lineage')
-const { createWorktreeVisibilitySourceMatcher, resolveCustomWorktreeVisibilitySources } =
- await import('../../../../shared/worktree/visibility-sources')
-const { resolveConfiguredWorktreeBasePaths } =
- await import('../../../../shared/worktree/configured-worktree-base-path')
-const { dedupeWorktreesByPath } = await import('../../../git/worktree-path-comparison')
-const { readWorktreeMetaForHost } =
- await import('../../../persistence/host-qualified-worktree-meta')
-const { getRepoOwnedWorktreeMeta } = await import('../../../worktree-metadata-ownership')
-const { getRepoExecutionHostId } = await import('../../../../shared/execution-host')
const repo: Repo = {
id: 'repo-1',
@@ -94,68 +80,9 @@ function createStore(meta: Record<string, WorktreeMeta>, repos: Repo[] = [repo])
} as unknown as Store
}
-/** Preserve the original two-pass implementation as the equivalence oracle. */
-function buildDetectedGitWorktreesTwoPass(
- store: Store,
- target: Repo,
- gitWorktrees: GitWorktreeInfo[],
- allMetaOverride?: Record<string, WorktreeMeta>
-) {
- const settings = store.getSettings()
- const knownOrcaLayouts = ownership.buildKnownOrcaWorkspaceLayouts(settings, target)
- const isLegacyRepoForVisibility = ownership.isLegacyRepoForExternalWorktreeVisibility(target)
- const liveWorktrees = dedupeWorktreesByPath(gitWorktrees.filter((info) => !info.prunable))
- const worktreeVisibilitySourceMatcher = createWorktreeVisibilitySourceMatcher(
- [target.path, ...liveWorktrees.map((worktree) => worktree.path)],
- resolveCustomWorktreeVisibilitySources(target, settings.worktreeVisibilityDefaults),
- resolveConfiguredWorktreeBasePaths(target)
- )
- const allMeta = allMetaOverride ?? store.getAllWorktreeMeta?.()
- const repoOwnerCount = store.getRepos().filter((candidate) => candidate.id === target.id).length
- const detectedRows = liveWorktrees.map((info) => {
- const worktreeId = `${target.id}::${info.path}`
- const legacyMeta = store.getWorktreeMeta?.(worktreeId)
- const metaById = allMeta ?? (legacyMeta ? { [worktreeId]: legacyMeta } : {})
- let meta =
- readWorktreeMetaForHost(store, worktreeId, getRepoExecutionHostId(target)) ??
- getRepoOwnedWorktreeMeta(target, worktreeId, metaById, repoOwnerCount)
- const worktree = mergeWorktree(target.id, info, meta, target.displayName)
- const detected = ownership.toDetectedWorktree({
- repo: target,
- worktree,
- meta,
- settings,
- knownOrcaLayouts,
- isLegacyRepoForVisibility,
- worktreeVisibilitySourceMatcher
- })
- if (!detected.visible) {
- return detected
- }
- meta = resolveWorktreeMetaWithDiscoveryBackfill(
- store,
- target,
- worktreeId,
- allMeta,
- repoOwnerCount
- )
- return ownership.toDetectedWorktree({
- repo: target,
- worktree: mergeWorktree(target.id, info, meta, target.displayName),
- meta,
- settings,
- knownOrcaLayouts,
- isLegacyRepoForVisibility,
- worktreeVisibilitySourceMatcher
- })
- })
- return projectResolvedWorktreeLineage(detectedRows, store.getAllWorktreeLineage?.() ?? {})
-}
-
describe('buildDetectedGitWorktrees classification passes', () => {
beforeEach(() => {
toDetectedWorktreeSpy.mockClear()
- // Freeze activity-backfill timestamps to make equivalence deterministic.
vi.spyOn(Date, 'now').mockReturnValue(1_700_000_000_000)
})
@@ -198,31 +125,4 @@ describe('buildDetectedGitWorktrees classification passes', () => {
expect(partialLegacyReads).toHaveBeenCalledWith(worktreeId)
expect(rows[0]).toMatchObject({ id: worktreeId, lastActivityAt: 5 })
})
-
- it.each([
- ['settled metadata', () => settledMeta()],
- ['metadata needing discovery backfill', () => ({ orcaCreatedAt: 1 }) as WorktreeMeta],
- ['no metadata at all', () => undefined]
- ])('emits a catalog deep-equal to the two-pass build for %s', (_label, makeMeta) => {
- const worktreeId = `${repo.id}::/workspace/one`
- const seed = makeMeta()
- const build = (fn: typeof buildDetectedGitWorktrees) =>
- fn(
- createStore(seed ? { [worktreeId]: seed } : {}),
- repo,
- [gitWorktree('/workspace/one'), gitWorktree('/workspace/hidden-external')],
- seed ? { [worktreeId]: seed } : {}
- )
-
- expect(build(buildDetectedGitWorktrees)).toEqual(build(buildDetectedGitWorktreesTwoPass))
- })
-
- it('emits a catalog deep-equal to the two-pass build for a folder-style listing with no host snapshot', () => {
- const worktreeId = `${repo.id}::/workspace/one`
- const seed = settledMeta()
- const build = (fn: typeof buildDetectedGitWorktrees) =>
- fn(createStore({ [worktreeId]: seed }), repo, [gitWorktree('/workspace/one')], undefined)
-
- expect(build(buildDetectedGitWorktrees)).toEqual(build(buildDetectedGitWorktreesTwoPass))
- })
})
diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/indentation.test.ts b/src/renderer/src/components/sidebar/worktree-list/rows/indentation.test.ts
deleted file mode 100644
index a9c93606c37..00000000000
--- a/src/renderer/src/components/sidebar/worktree-list/rows/indentation.test.ts
+++ /dev/null
@@ -1,239 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import {
- FLUSH_CARD_CONTENT_PULLBACK,
- FLUSH_CARD_MIN_CONTENT_INSET,
- NEW_CARD_STYLE_STATUS_LANE_EXTRA_PULLBACK,
- LINEAGE_CHILDREN_INLINE_OFFSET,
- WORKTREE_CARD_SURFACE_MARGIN,
- WORKTREE_SECTION_HEADER_PADDING_LEFT,
- getFolderBackedRepoWorktreeCardContentIndent,
- getFolderBackedRepoWorktreeCardSurfaceInset,
- getFolderWorkspaceCardContentIndent,
- getFolderWorkspaceCardSurfaceInset,
- getFolderWorkspaceRowGeometry,
- getFlushWorktreeCardPaddingLeft,
- getLineageChildrenInlineStyle,
- getProjectGroupHeaderPaddingLeft,
- getWorktreeCardContentIndent,
- getWorktreeCardSurfaceInset
-} from './indentation'
-
-function getFlushCardContentStart(args: {
- surfaceInset: number
- cardContentIndent: number
-}): number {
- return (
- args.surfaceInset +
- WORKTREE_CARD_SURFACE_MARGIN +
- Math.max(FLUSH_CARD_MIN_CONTENT_INSET, args.cardContentIndent - FLUSH_CARD_CONTENT_PULLBACK)
- )
-}
-
-describe('worktree list indentation', () => {
- it('keeps ungrouped workspaces flush with the list', () => {
- expect(getWorktreeCardContentIndent({ isGrouped: false, groupDepth: 4, lineageDepth: 0 })).toBe(
- 0
- )
- })
-
- it('keeps ungrouped lineage indentation on the base tree step', () => {
- expect(getWorktreeCardContentIndent({ isGrouped: false, groupDepth: 4, lineageDepth: 2 })).toBe(
- 36
- )
- })
-
- it('indents workspace content one step deeper than its containing project header', () => {
- expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 0, lineageDepth: 0 })).toBe(
- 20
- )
- expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 1, lineageDepth: 0 })).toBe(
- 38
- )
- })
-
- it('adds lineage depth after project/group depth', () => {
- expect(getWorktreeCardContentIndent({ isGrouped: true, groupDepth: 1, lineageDepth: 2 })).toBe(
- 74
- )
- })
-
- it('uses compact header rhythm for folder-scanned repo worktree content', () => {
- expect(getFolderBackedRepoWorktreeCardContentIndent({ groupDepth: 1, lineageDepth: 0 })).toBe(
- 30
- )
- expect(getFolderBackedRepoWorktreeCardContentIndent({ groupDepth: 2, lineageDepth: 0 })).toBe(
- 40
- )
- expect(getFolderBackedRepoWorktreeCardContentIndent({ groupDepth: 1, lineageDepth: 1 })).toBe(
- 48
- )
- })
-
- it('caps folder-scanned repo worktree surfaces before they overshoot the compact anchor', () => {
- expect(getFolderBackedRepoWorktreeCardSurfaceInset({ groupDepth: 1, lineageDepth: 0 })).toBe(14)
- expect(getFolderBackedRepoWorktreeCardSurfaceInset({ groupDepth: 4, lineageDepth: 0 })).toBe(54)
- expect(getFolderBackedRepoWorktreeCardSurfaceInset({ groupDepth: 4, lineageDepth: 1 })).toBe(56)
- })
-
- it('keeps folder workspace content one step under its owning group', () => {
- expect(getFolderWorkspaceCardContentIndent({ groupDepth: 1 })).toBe(20)
- expect(getFolderWorkspaceCardContentIndent({ groupDepth: 2 })).toBe(30)
- })
-
- it('caps folder workspace surfaces before they overshoot the compact content anchor', () => {
- expect(getFolderWorkspaceCardSurfaceInset({ isGrouped: true, groupDepth: 1 })).toBe(14)
- expect(getFolderWorkspaceCardSurfaceInset({ isGrouped: true, groupDepth: 2 })).toBe(24)
- expect(getFolderWorkspaceCardSurfaceInset({ isGrouped: false, groupDepth: 2 })).toBe(0)
- })
-
- it('preserves legacy folder-scanned folder workspace row geometry', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: false,
- isFolderBackedWorkspaceChild: true,
- isGrouped: true,
- groupDepth: 1,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 14,
- cardContentIndent: 6
- })
- expect(getFlushCardContentStart(geometry)).toBe(20)
- })
-
- it('preserves legacy nested folder-scanned folder workspace row geometry', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: false,
- isFolderBackedWorkspaceChild: true,
- isGrouped: true,
- groupDepth: 2,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 24,
- cardContentIndent: 6
- })
- expect(getFlushCardContentStart(geometry)).toBe(30)
- })
-
- it('preserves legacy manual grouped folder workspace row geometry', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: false,
- isFolderBackedWorkspaceChild: false,
- isGrouped: true,
- groupDepth: 1,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 14,
- cardContentIndent: 24
- })
- expect(getFlushCardContentStart(geometry)).toBe(38)
- })
-
- it('uses comparable repo worktree geometry for experimental folder-scanned folder workspaces', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: true,
- isFolderBackedWorkspaceChild: true,
- isGrouped: true,
- groupDepth: 1,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 14,
- cardContentIndent: 16
- })
- expect(getFlushCardContentStart(geometry)).toBe(30)
- })
-
- it('uses comparable repo worktree geometry for experimental nested folder workspaces', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: true,
- isFolderBackedWorkspaceChild: true,
- isGrouped: true,
- groupDepth: 4,
- lineageDepth: 3
- })
-
- expect(geometry).toEqual({
- surfaceInset: 54,
- cardContentIndent: 6
- })
- expect(getFlushCardContentStart(geometry)).toBe(60)
- })
-
- it('keeps experimental manual grouped folder workspaces on normal worktree geometry', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: true,
- isFolderBackedWorkspaceChild: false,
- isGrouped: true,
- groupDepth: 1,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 14,
- cardContentIndent: 24
- })
- expect(getFlushCardContentStart(geometry)).toBe(38)
- })
-
- it('keeps experimental flat folder workspaces on normal worktree geometry', () => {
- const geometry = getFolderWorkspaceRowGeometry({
- experimentalNewWorktreeCardStyle: true,
- isFolderBackedWorkspaceChild: false,
- isGrouped: false,
- groupDepth: 3,
- lineageDepth: 0
- })
-
- expect(geometry).toEqual({
- surfaceInset: 0,
- cardContentIndent: 0
- })
- expect(getFlushCardContentStart(geometry)).toBe(6)
- })
-
- it('caps header indentation separately from workspace content indentation', () => {
- expect(getProjectGroupHeaderPaddingLeft(100)).toBe(70)
- })
-
- it('aligns flat section headers with top-level project headers', () => {
- expect(WORKTREE_SECTION_HEADER_PADDING_LEFT).toBe(getProjectGroupHeaderPaddingLeft(0))
- })
-
- it('keeps root repo cards flush but insets cards inside project groups', () => {
- expect(getWorktreeCardSurfaceInset({ isGrouped: true, groupDepth: 0 })).toBe(0)
- expect(getWorktreeCardSurfaceInset({ isGrouped: true, groupDepth: 1 })).toBe(14)
- })
-
- it('does not inset card surfaces outside grouped views', () => {
- expect(getWorktreeCardSurfaceInset({ isGrouped: false, groupDepth: 4 })).toBe(0)
- })
-
- it('pulls flush card content back by the tuned inset gap', () => {
- expect(getFlushWorktreeCardPaddingLeft(20)).toBe('max(2px, calc(20px - 4px))')
- })
-
- it('pulls experimental flush cards back further for the fixed status lane', () => {
- expect(getFlushWorktreeCardPaddingLeft(20, true)).toBe(
- `max(2px, calc(20px - ${FLUSH_CARD_CONTENT_PULLBACK + NEW_CARD_STYLE_STATUS_LANE_EXTRA_PULLBACK}px))`
- )
- })
-
- it('keeps flush card content off the sidebar edge without indentation', () => {
- expect(getFlushWorktreeCardPaddingLeft(0)).toBe('2px')
- expect(getFlushWorktreeCardPaddingLeft(0, true)).toBe('2px')
- })
-
- it('expresses lineage child wrapper width from the resolved inline offset', () => {
- expect(getLineageChildrenInlineStyle(LINEAGE_CHILDREN_INLINE_OFFSET)).toEqual({
- marginLeft: '14px',
- width: 'calc(100% - 14px)'
- })
- })
-})
diff --git a/src/renderer/src/components/sidebar/worktree-sort-label-ordering.test.ts b/src/renderer/src/components/sidebar/worktree-sort-label-ordering.test.ts
index d8c9f0ad6c5..5cd9fec4382 100644
--- a/src/renderer/src/components/sidebar/worktree-sort-label-ordering.test.ts
+++ b/src/renderer/src/components/sidebar/worktree-sort-label-ordering.test.ts
@@ -1,12 +1,9 @@
import { describe, expect, it } from 'vitest'
-import type { Repo } from '../../../../shared/repo-types'
import type { Worktree } from '../../../../shared/worktree/types'
import {
- buildWorktreeComparator,
buildWorktreeSortLabels,
compareWorktreeSortLabel,
- getWorktreeSortLabel,
- type SortBy
+ getWorktreeSortLabel
} from '../../../../shared/sidebar-list/smart-sort'
import { compareCodePoints, compareSidebarText } from '../../../../shared/sidebar-list/text-order'
import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity'
@@ -88,59 +85,7 @@ function makeWorktree(index: number, displayName: string | null): Worktree {
}
}
-const corpus: Worktree[] = TRICKY_LABELS.flatMap((label, index) => [
- makeWorktree(index * 2, label),
- // Second row per label with a blank displayName, so `basename(path)` decides.
- makeWorktree(index * 2 + 1, index % 2 === 0 ? '' : null)
-])
-
-const repoMap = new Map<string, Repo>([
- [
- 'repo1',
- { id: 'repo1', path: '/repo1', displayName: 'Ångström', badgeColor: '#000', addedAt: 0 }
- ],
- [
- 'repo2',
- { id: 'repo2', path: '/repo2', displayName: 'angstrom', badgeColor: '#111', addedAt: 0 }
- ]
-])
-
-const SORT_MODES: readonly SortBy[] = ['name', 'smart', 'recent', 'repo', 'manual']
-const NOW = 1_700_000_000_000
-
describe('worktree sort label ordering', () => {
- it('matches the pre-precompute comparator on every pair', () => {
- const labels = buildWorktreeSortLabels(corpus)
- for (const a of corpus) {
- for (const b of corpus) {
- expect(Math.sign(compareWorktreeSortLabel(a, b, labels))).toBe(
- Math.sign(legacyCompareWorktreeSortLabel(a, b))
- )
- }
- }
- })
-
- it('produces byte-for-byte identical sort output in every mode', () => {
- for (const sortBy of SORT_MODES) {
- const attention = new Map()
- const withLabels = [...corpus].sort(
- buildWorktreeComparator(sortBy, repoMap, NOW, attention, buildWorktreeSortLabels(corpus))
- )
- const withoutLabels = [...corpus].sort(
- buildWorktreeComparator(sortBy, repoMap, NOW, attention)
- )
- expect(withLabels.map((w) => w.id)).toEqual(withoutLabels.map((w) => w.id))
- }
- })
-
- it('falls back to deriving labels for rows missing from the precomputed map', () => {
- const [first, second] = corpus
- const partial = buildWorktreeSortLabels([first])
- expect(Math.sign(compareWorktreeSortLabel(first, second, partial))).toBe(
- Math.sign(legacyCompareWorktreeSortLabel(first, second))
- )
- })
-
it('keys labels by row so a two-host id collision keeps each row its own label', () => {
const local: Worktree = { ...makeWorktree(0, null), id: 'shared', path: '/tmp/aaa' }
const remote: Worktree = { ...makeWorktree(1, null), id: 'shared', path: '/tmp/zzz' }
diff --git a/src/shared/agent-session-availability-sentences-wsl.test.ts b/src/shared/agent-session-availability-sentences-wsl.test.ts
deleted file mode 100644
index ca229ba8eb7..00000000000
--- a/src/shared/agent-session-availability-sentences-wsl.test.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { expect, it } from 'vitest'
-import { cliMissingSentence } from './agent-session-availability-sentences'
-import { sayAgentSessionFailureEnglish } from './agent-session-failure-copy'
-
-it('names the WSL distro an agent is missing from, keeping the command retry', () => {
- expect(
- cliMissingSentence(
- { agentName: 'Codex', wslDistro: 'Debian', command: 'compact' },
- sayAgentSessionFailureEnglish
- )
- ).toBe(
- "Codex isn't installed in the WSL distro Debian. Install it inside Debian, or check its Command in Settings → Agents. Run /compact again."
- )
-})
-
-it('keeps "the computer running this chat" off a WSL host', () => {
- expect(cliMissingSentence({ agentName: 'Codex' }, sayAgentSessionFailureEnglish)).toBe(
- "Codex wasn't found on the computer running this chat. Install it, or check its Command in Settings → Agents."
- )
-})