diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 0e009d6c046..33e9b4f22e9 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -3608,7 +3608,7 @@ "providers": ["local", "daemon", "ssh"], "coveredPlatforms": ["linux"], "coveredProviders": [], - "coverageNotes": "Audit4362 intentionally deletes the imported stale-waiter retry and manually assembled OSC9999 mobile-republish cases, plus the mocked missing-worktree cleanup suite (4 authored / 5 finite cases in three suites). Lost alarms include repeated unread worker_done pointers, working-to-waiting mobile status publication, missing-worktree filtering, and scoped daemon shutdown with unrelated duplicate identities. No replacement coverage or new platform proof is claimed. Audit3994 retires two authored callbacks imported by the shared construction test driver: split OSC 9999 carry and rendererless status ownership, plus OpenCode permission text taking priority in status and tui-idle refusal. Remaining imports and selectors keep their scope. No equivalent replacement or fresh gate execution is claimed. Audit3417 composes root-adopted3415v2/independent3416v2: intentionally removes117authored/173potential expanded registrations from12semantic sources, deleting4whole conventional suites and3registration modules and retaining4authored/5expanded cases, without equivalent replacement or fresh execution. The whole main-window attach-services suite is removed: runtime/window attach, notifier wiring, reload/teardown and permission-handler mock orchestration alarms are intentionally lost. Prune its exact deleted command selectors, testFiles entries and notifier assertionRef where present; complete prior selectors/ref are archived. Unrelated dated receipts remain exact and retain their original scope; no fresh reduced-selector, native-window or remote execution is claimed. Audit3403 composes root-adopted3393/3394,3400/3401 and3398/3399: intentionally retires167 authored registrations/196 potential expanded cases across93 whole suites without equivalent replacement or fresh execution. Retained65 registrations/79 potential cases include one conditional missing-input failure sentinel; potential counts are not executions. Historical notes and complete dated receipts retain their exact original scopes. The retained runtime registration driver loses three complete imported fragments: changed-working-label title facts and suppressed-frame tracked snapshots; refusing SSH GitLab MR-base lookup before local Git/glab calls; and missing folder-workspace path creation/update refusal before spawn/store mutation. These alarms are intentionally lost. Other imported fragments and separately rooted dated receipts are unchanged; they are not equivalent replacement coverage. Audit2271: Linux coverage is limited to the unchanged serve-signal-exit-diagnostic supervisor selector and the late-handoff-after-child-exit assertion recorded below. It does not cover desktop promotion, renderer continuity, persistent PTYs or native updater behavior. No current local, daemon or SSH provider execution is established; coveredProviders is empty. Historical macOS/provider scope remains only in preserved prior accounts and archived receipts. Audit2252 removes the entire handassembled serve promotion/renderer hydration suite. Retired alarms: queued and repeated activation coalescing, duplicate serve suppression, unavailable-provider diagnostic, and zero resume/replacement accounting on independently supplied renderer state. The fixture never joined actual daemon-to-renderer delivery. These exact alarms have no equivalent replacement assigned. Remaining gate selectors keep their existing narrower scope; historical dated receipts remain verbatim and do not validate this changed selector set. No fresh runtime, native/provider, live remote/mobile, cross-platform or performance result is claimed. Archived removed active entries verbatim: commands: \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\"\ntestFiles: \"src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\"\nassertionRefs: {\n \"file\": \"src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\",\n \"assertions\": [\n \"a forced desktop relaunch reaching the headless lock owner opens exactly one window, and only after the persistent provider settles\",\n \"a duplicate `orca serve` launch never promotes the headless owner\",\n \"the renderer promoted inside the serve process resumes zero agents while daemon panes survive, before and after those panes rebind their PTYs\",\n \"no replacement resume tab, startup command, or automatic-resume claim is created, and every surviving session record is left untouched\"\n ]\n } Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2020: Retire CLI supervisor outcome, local-open promotion and paired-open projection alarms; launch retains only the two referenced stream-framing cases. Remaining CLI refusal/timeout cases do not replace headless-promotion coverage. Preserve both independent dated receipts at their original commands. Reduced selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1589 removes mock-only CLI forwarding, canned provisioning/catalog/error projections and private inventories without equivalent replacement coverage. Retained cases exercise actual local markdown/paste/reconciliation, stream framing/backpressure/output-drain, temporary directory cleanup and persisted handoff with injected host/provider/process boundaries. No real Jira, provisioning, remote launch, native pipe/process-tree authority or deployed provider catalog proof. Assertion references use the surviving handoff registration titles; changed-selector historical receipts are retired and unaffected receipts remain unchanged. Historical scope before this audit: Deterministic unit coverage exercises activation gating, single-instance ownership, local/remote CLI status, headless binding persistence, local daemon identity, SSH identity transfer, the promoted renderer's agent-resume accounting, and the macOS serve update handoff from staged installer through atomic bundle replacement and target-version readiness. Supervisor settlement coverage prevents a late handoff-completion failure from rearming termination after the replacement child exits. A macOS Electron journey covers headless promotion and persistent PTY identity. A disposable locally signed Electron canary exercised real ShipIt and a temporary LaunchAgent with the compiled production supervisor; full packaged Orca and Linux/Windows serve updates remain uncollected. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", + "coverageNotes": "Audit4891 removes two isolated serve activation gate cases for coalescing/ready state and blocked-request cancellation/counts. Their exact alarms are intentionally lost. Retain the newly added queued foreground-over-background priority case, which exercises a new request-selection decision; it does not replace blocked/provider/native-window coverage. Historical receipts remain verbatim. Audit4362 intentionally deletes the imported stale-waiter retry and manually assembled OSC9999 mobile-republish cases, plus the mocked missing-worktree cleanup suite (4 authored / 5 finite cases in three suites). Lost alarms include repeated unread worker_done pointers, working-to-waiting mobile status publication, missing-worktree filtering, and scoped daemon shutdown with unrelated duplicate identities. No replacement coverage or new platform proof is claimed. Audit3994 retires two authored callbacks imported by the shared construction test driver: split OSC 9999 carry and rendererless status ownership, plus OpenCode permission text taking priority in status and tui-idle refusal. Remaining imports and selectors keep their scope. No equivalent replacement or fresh gate execution is claimed. Audit3417 composes root-adopted3415v2/independent3416v2: intentionally removes117authored/173potential expanded registrations from12semantic sources, deleting4whole conventional suites and3registration modules and retaining4authored/5expanded cases, without equivalent replacement or fresh execution. The whole main-window attach-services suite is removed: runtime/window attach, notifier wiring, reload/teardown and permission-handler mock orchestration alarms are intentionally lost. Prune its exact deleted command selectors, testFiles entries and notifier assertionRef where present; complete prior selectors/ref are archived. Unrelated dated receipts remain exact and retain their original scope; no fresh reduced-selector, native-window or remote execution is claimed. Audit3403 composes root-adopted3393/3394,3400/3401 and3398/3399: intentionally retires167 authored registrations/196 potential expanded cases across93 whole suites without equivalent replacement or fresh execution. Retained65 registrations/79 potential cases include one conditional missing-input failure sentinel; potential counts are not executions. Historical notes and complete dated receipts retain their exact original scopes. The retained runtime registration driver loses three complete imported fragments: changed-working-label title facts and suppressed-frame tracked snapshots; refusing SSH GitLab MR-base lookup before local Git/glab calls; and missing folder-workspace path creation/update refusal before spawn/store mutation. These alarms are intentionally lost. Other imported fragments and separately rooted dated receipts are unchanged; they are not equivalent replacement coverage. Audit2271: Linux coverage is limited to the unchanged serve-signal-exit-diagnostic supervisor selector and the late-handoff-after-child-exit assertion recorded below. It does not cover desktop promotion, renderer continuity, persistent PTYs or native updater behavior. No current local, daemon or SSH provider execution is established; coveredProviders is empty. Historical macOS/provider scope remains only in preserved prior accounts and archived receipts. Audit2252 removes the entire handassembled serve promotion/renderer hydration suite. Retired alarms: queued and repeated activation coalescing, duplicate serve suppression, unavailable-provider diagnostic, and zero resume/replacement accounting on independently supplied renderer state. The fixture never joined actual daemon-to-renderer delivery. These exact alarms have no equivalent replacement assigned. Remaining gate selectors keep their existing narrower scope; historical dated receipts remain verbatim and do not validate this changed selector set. No fresh runtime, native/provider, live remote/mobile, cross-platform or performance result is claimed. Archived removed active entries verbatim: commands: \"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\"\ntestFiles: \"src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\"\nassertionRefs: {\n \"file\": \"src/renderer/src/lib/serve-desktop-promotion-session-continuity.test.ts\",\n \"assertions\": [\n \"a forced desktop relaunch reaching the headless lock owner opens exactly one window, and only after the persistent provider settles\",\n \"a duplicate `orca serve` launch never promotes the headless owner\",\n \"the renderer promoted inside the serve process resumes zero agents while daemon panes survive, before and after those panes rebind their PTYs\",\n \"no replacement resume tab, startup command, or automatic-resume claim is created, and every surviving session record is left untouched\"\n ]\n } Historical prior account (preserved verbatim): Audit2133 current-parent preparation: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2095 current-parent preparation2126: Current reduced sources/selectors intentionally retire the alarms listed in knownGaps; prior dated runs and replacement claims do not validate the changed set. Historical prior account (preserved verbatim): Audit2090 (sources2088/2089): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2086 (sources2082/2083): Current reduced suites intentionally retire the alarms listed in knownGaps; prior dated execution and replacement claims do not validate changed source bytes or selectors. Historical prior account (preserved verbatim): Audit2076 (sources2073/2074): Intentionally retire these low-value alarms without replacement: src/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.ts: recovers a moved SSH pane through the tab it now sits in, not the one its lease froze; reports a plain expired orphan; does not report a pane whose only recent lease was superseded; does not report a pane whose only recent lease had its relay id recycled; picks the eligible orphan over a superseded predecessor that matches first; collects the same tabs the per-tab reader reports, in one sweep of the leases; reports no candidate when no lease names any of the worktree tabs. src/main/runtime/orca-runtime-tests/runtime-availability.spec.ts: starts unavailable with no authoritative window; reports the configured Windows terminal shell on status; reports floating workspace availability from settings on status; polls floating tabs with targeted PTY liveness and no repo/provider inventory; hydrates persisted tabs when the store cannot report repos; advertises browser screencast only when a renderer window is available; routes mobile Codex reset consumption through the account mutation coordinator; maps a definite pre-provider rejection into an authoritative current snapshot. Existing unrelated evidenceRuns retain their original scope; unchanged dated receipt objects do not validate changed source bytes or reduced selectors. No fresh gate execution or historical import-closure equivalence is claimed. Frozen current literal-import graph reaches these changed test bytes; unresolved local and computed edges remain debt, and current reachability is not historical execution or equivalent replacement evidence. Historical prior account (preserved verbatim): Audit2020: Retire CLI supervisor outcome, local-open promotion and paired-open projection alarms; launch retains only the two referenced stream-framing cases. Remaining CLI refusal/timeout cases do not replace headless-promotion coverage. Preserve both independent dated receipts at their original commands. Reduced selectors have no fresh result or equivalent replacement claim. Historical prior account (preserved verbatim): Audit1589 removes mock-only CLI forwarding, canned provisioning/catalog/error projections and private inventories without equivalent replacement coverage. Retained cases exercise actual local markdown/paste/reconciliation, stream framing/backpressure/output-drain, temporary directory cleanup and persisted handoff with injected host/provider/process boundaries. No real Jira, provisioning, remote launch, native pipe/process-tree authority or deployed provider catalog proof. Assertion references use the surviving handoff registration titles; changed-selector historical receipts are retired and unaffected receipts remain unchanged. Historical scope before this audit: Deterministic unit coverage exercises activation gating, single-instance ownership, local/remote CLI status, headless binding persistence, local daemon identity, SSH identity transfer, the promoted renderer's agent-resume accounting, and the macOS serve update handoff from staged installer through atomic bundle replacement and target-version readiness. Supervisor settlement coverage prevents a late handoff-completion failure from rearming termination after the replacement child exits. A macOS Electron journey covers headless promotion and persistent PTY identity. A disposable locally signed Electron canary exercised real ShipIt and a temporary LaunchAgent with the compiled production supervisor; full packaged Orca and Linux/Windows serve updates remain uncollected. Audit1383: src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts reduced. Lose command-list/receipt/default/background activation matrices whose provider spawn returns canned IDs. Retained test proves actual tab allocation separation, not terminal startup. No equivalent replacement coverage is claimed. Existing exact unaffected receipts and their platform/provider/budget claims remain scoped to unchanged selectors. Changed optional selectors have no new execution result. Audit1401: src/main/runtime/orca-runtime-tests/mobile-session-tabs-duplicate-pty-repair.spec.ts removed. Loses listing-on-already-repaired-data alarm; it never established runtime repair invocation. src/main/runtime/orca-runtime-tests/mobile-session-tabs-split-agent-tab.spec.ts removed. Loses actual mobile split sibling shell versus recorded-agent resume command alarms; no equivalent coverage asserted. src/main/runtime/orca-runtime-tests/worktree-native-chat-setup.spec.ts removed. Loses separate setup/startup tab result in that manually assembled path. src/main/runtime/orca-runtime.test.ts reduced. Driver registration/import of a whole-deleted selected spec is removed; directly authored cases remain unchanged. No extra authored removal credit. No equivalent replacement coverage is claimed. Existing exact unaffected receipts remain unchanged and apply only to their unchanged selectors. Changed optional selectors have no new execution result.", "motivatingLinks": [ "https://github.com/stablyai/orca/issues/8457", "https://github.com/stablyai/orca/issues/9563" @@ -3666,10 +3666,7 @@ }, { "file": "src/main/startup/serve-launch/serve-desktop-activation.test.ts", - "assertions": [ - "early activation requests coalesce until the persistent provider is ready", - "a blocked provider drops pending activation and never opens a window" - ] + "assertions": ["lets a queued user activation keep the foreground over a background open"] }, { "file": "tests/e2e/headless-serve-desktop-activation.spec.ts", diff --git a/src/main/github/accounts/account-binding-required-host.test.ts b/src/main/github/accounts/account-binding-required-host.test.ts deleted file mode 100644 index bf4fb4140a7..00000000000 --- a/src/main/github/accounts/account-binding-required-host.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { resolveGhAccountRequiredHost } from './account-binding-required-host' - -function repoFor(remoteUrl: string, canonicalHost?: string) { - const host = - canonicalHost ?? - remoteUrl - .replace(/^git@/, '') - .replace(/^ssh:\/\/(?:[^@]+@)?/, '') - .split(/[:/]/)[0] - ?.toLowerCase() ?? - 'github.com' - return { - path: '/repos/sample-app', - connectionId: null, - gitRemoteIdentity: { - canonicalKey: `${host}/example/sample-app`, - remoteUrl - } - } -} - -describe('resolveGhAccountRequiredHost', () => { - it('keeps a dotted enterprise host literal unless ssh config points it at github.com', async () => { - for (const resolveAlias of [ - async () => ({ hostname: '10.0.0.5' }), - async () => ({ hostname: null }), - async () => { - throw new Error('ssh -G failed') - } - ]) { - await expect( - resolveGhAccountRequiredHost( - repoFor('git@ghe.example.com:example/sample-app.git'), - {}, - resolveAlias - ) - ).resolves.toBe('ghe.example.com') - } - }) - - it('filters a dotted alias that resolves to github.com to github.com', async () => { - const resolveAlias = vi.fn(async () => ({ hostname: 'github.com' })) - await expect( - resolveGhAccountRequiredHost( - repoFor('git@work.github.com:example/sample-app.git'), - {}, - resolveAlias - ) - ).resolves.toBe('github.com') - expect(resolveAlias).toHaveBeenCalledWith('work.github.com', { - repoPath: '/repos/sample-app', - connectionId: null - }) - }) - - it('expands an SCP alias whose path has a leading slash', async () => { - await expect( - resolveGhAccountRequiredHost( - repoFor('git@github-work:/example/sample-app.git', 'github-work'), - {}, - async () => ({ hostname: 'github.com' }) - ) - ).resolves.toBe('github.com') - }) -}) diff --git a/src/main/github/accounts/auth-diagnose.test.ts b/src/main/github/accounts/auth-diagnose.test.ts index b8664916037..2718a6326c8 100644 --- a/src/main/github/accounts/auth-diagnose.test.ts +++ b/src/main/github/accounts/auth-diagnose.test.ts @@ -1,12 +1,5 @@ -import { describe, expect, it, vi } from 'vitest' - -const { ghExecFileAsyncMock } = vi.hoisted(() => ({ ghExecFileAsyncMock: vi.fn() })) - -vi.mock('../../git/command-runner/hosted-cli/gh-exec-file', async (importOriginal) => ({ - ...(await importOriginal>()), - ghExecFileAsync: ghExecFileAsyncMock -})) -import { diagnoseGhAuth, parseAuthStatus } from './auth-diagnose' +import { describe, expect, it } from 'vitest' +import { parseAuthStatus } from './auth-diagnose' describe('parseAuthStatus', () => { it('parses an env-shadowed login alongside a keyring login (real gh output)', () => { @@ -39,49 +32,4 @@ describe('parseAuthStatus', () => { source: 'keyring' }) }) - - it('parses a ported GHES auth-status section', () => { - const text = `ghe.acme.io:8443 - ✓ Logged in to ghe.acme.io:8443 account bob (keyring) - - Active account: true - - Token scopes: 'project', 'repo' -` - - expect(parseAuthStatus(text)).toEqual([ - expect.objectContaining({ host: 'ghe.acme.io:8443', user: 'bob', active: true }) - ]) - }) -}) - -describe('diagnoseGhAuth host scoping', () => { - const TWO_HOST_STATUS = `github.com - ✓ Logged in to github.com account alice (keyring) - - Active account: true - - Token scopes: 'project', 'read:org', 'repo' -ghe.acme.io - ✓ Logged in to ghe.acme.io account bob (keyring) - - Active account: true - - Token scopes: 'repo' -` - - it('reports an unauthenticated required host and keeps scope advice host-scoped', async () => { - ghExecFileAsyncMock.mockResolvedValue({ stdout: TWO_HOST_STATUS, stderr: '' }) - - const diag = await diagnoseGhAuth('github.other-corp.com') - - expect(diag.requiredHost).toBe('github.other-corp.com') - expect(diag.requiredHostAuthenticated).toBe(false) - expect(diag.activeAccount).toBeNull() - }) - - it("scopes the diagnosis to the required host's account", async () => { - ghExecFileAsyncMock.mockResolvedValue({ stdout: TWO_HOST_STATUS, stderr: '' }) - - const diag = await diagnoseGhAuth('GHE.Acme.IO') - - expect(diag.requiredHost).toBe('ghe.acme.io') - expect(diag.requiredHostAuthenticated).toBe(true) - expect(diag.activeAccount?.user).toBe('bob') - expect(diag.missingScopes).toEqual(['project', 'read:org']) - }) }) diff --git a/src/main/github/accounts/github-project-account.test.ts b/src/main/github/accounts/github-project-account.test.ts index ebc0ff09c2b..c7dbd39f91e 100644 --- a/src/main/github/accounts/github-project-account.test.ts +++ b/src/main/github/accounts/github-project-account.test.ts @@ -20,7 +20,6 @@ import { registerGitHubPRReviewHandlers } from '../../ipc/source-control/github- import { ghPullRequestsAndWorkItemsApi } from '../../../preload/api/github/gh-bridge-pull-requests-and-work-items' import { ghMutationsAndProjectsApi } from '../../../preload/api/github/gh-bridge-mutations-and-projects' import type { GhAccountBinding } from '../../../shared/github/accounts/account-binding' -import { RPC_PARAMS_BY_METHOD } from '../../../shared/rpc-contract/rpc-params-catalog.generated' const { exec, handle, invoke } = vi.hoisted(() => ({ exec: vi.fn(), @@ -60,8 +59,6 @@ import type { Project } from '../../../shared/project-types' import type { Repo } from '../../../shared/repo-types' import { ghRepoExecOptions, githubRepoContext } from '../repositories/github-repository-identity' import { installGitHubProjectAccounts } from './github-project-account' -import { codeHostReadExecutionScope as githubReadExecutionScope } from '../../source-control/code-host-read-execution-scope' -import { resolveGitHubRepoExecution } from '../repositories/github-api-repository' let release: (() => void) | undefined afterEach(() => release?.()) @@ -82,20 +79,6 @@ function options(path: string, connectionId?: string | null, extra = {}) { return ghRepoExecOptions(githubRepoContext(path, connectionId, extra)) } -it('uses the saved bound or unbound selection over stale caller options, and isolates cache keys', () => { - let current = repo() - release = installGitHubProjectAccounts({ getRepos: () => [current] }) - const first = options('/repo', null, { ghAccount: bob }) - expect(first.ghAccount).toEqual(alice) - current = repo({ ghAccount: bob }) - const second = options('/repo', null, { ghAccount: alice }) - expect(second.ghAccount).toEqual(bob) - expect(githubReadExecutionScope(first, {})).not.toBe(githubReadExecutionScope(second, {})) - current = repo({ ghAccount: undefined }) - expect(options('/repo', null, { ghAccount: alice }).ghAccount).toBeUndefined() - expect(first.ghAccount).toEqual(alice) -}) - it.each(['cold', 'warm'] as const)( 'resolves a %s child worktree by its host-qualified owning project', (mode) => { @@ -117,23 +100,6 @@ it.each(['cold', 'warm'] as const)( } ) -it('selects before an asynchronous repository lookup and retains that account for execution', async () => { - let current = repo() - release = installGitHubProjectAccounts({ getRepos: () => [current] }) - let finish: () => void = () => {} - const waiting = new Promise((resolve) => { - finish = resolve - }) - const pending = resolveGitHubRepoExecution('/repo', async () => { - await waiting - return { owner: 'acme', repo: 'widgets', host: 'github.com' } - }) - current = repo({ ghAccount: bob }) - finish() - expect((await pending).ghOptions.ghAccount).toEqual(alice) - expect(options('/repo').ghAccount).toEqual(bob) -}) - it('derives runtime ownership again after project runtime changes', () => { const platform = process.platform Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' }) @@ -300,88 +266,6 @@ describe('host account expectation through registered RPC and local preload', () rmSync(testState.dir, { recursive: true, force: true }) }) - it('validates all four schemas and rejects mismatches before provider work on RPC and IPC without changing omission', async () => { - applied(bob) - for (const operation of operations) { - const payload = { - repo: 'id:repo', - ...operation.params, - expectedGhAccount: { host: ' GitHub.COM ', user: ' Bob ' } - } - expect(RPC_PARAMS_BY_METHOD[operation.method].parse(payload)).toEqual({ - ...payload, - expectedGhAccount: bob - }) - for (const malformed of [ - { host: 'github.com' }, - { host: 'bad/host', user: 'Alice' }, - false - ]) { - expect( - RPC_PARAMS_BY_METHOD[operation.method].safeParse({ - ...payload, - expectedGhAccount: malformed - }).success - ).toBe(false) - } - exec.mockClear() - expect( - await dispatcher.dispatch({ - id: 'malformed', - authToken: 'fixture', - method: operation.method, - params: { ...payload, expectedGhAccount: false } - }) - ).toMatchObject({ ok: false, error: { code: 'invalid_argument' } }) - expect(exec).not.toHaveBeenCalled() - expect(await dispatch(operation, alice)).toMatchObject({ - ok: false, - error: { message: expect.stringContaining('GitHub account changed') } - }) - expect(exec).not.toHaveBeenCalled() - await expect(operation.local(alice)).rejects.toThrow('GitHub account changed') - expect(exec).not.toHaveBeenCalled() - expect(await dispatch(operation, bob)).toMatchObject({ ok: true }) - expect(exec).toHaveBeenCalled() - expect(exec.mock.calls.every(([, options]) => options?.ghAccount?.user === 'Bob')).toBe(true) - exec.mockClear() - await operation.local(bob) - expect(exec).toHaveBeenCalled() - expect(exec.mock.calls.every(([, options]) => options?.ghAccount?.user === 'Bob')).toBe(true) - exec.mockClear() - expect(await dispatch(operation)).toMatchObject({ ok: true }) - expect(exec).toHaveBeenCalled() - expect(exec.mock.calls.every(([, options]) => options?.ghAccount?.user === 'Bob')).toBe(true) - } - exec.mockClear() - expect(await dispatch(operations[1], null)).toMatchObject({ ok: false }) - expect(exec).not.toHaveBeenCalled() - applied(null) - expect(await dispatch(operations[1], null)).toMatchObject({ ok: true, result: ['bug'] }) - expect(exec.mock.calls.at(-1)?.[1]?.ghAccount).toBeUndefined() - await expect(operations[1].local(null)).resolves.toEqual(['bug']) - expect(exec.mock.calls.at(-1)?.[1]?.ghAccount).toBeUndefined() - exec.mockClear() - expect(await dispatch(operations[3], alice)).toMatchObject({ ok: false }) - expect(exec).not.toHaveBeenCalled() - await expect( - invoke('gh:listLabels', { - ...local, - ownerRepo: repository, - expectedGhAccount: { user: 'Alice' } - }) - ).rejects.toThrow('Invalid GitHub account expectation') - expect(exec).not.toHaveBeenCalled() - applied(alice) - expect(await dispatch(operations[0], alice)).toMatchObject({ - ok: true, - result: { item: { number: 7, type: 'issue' }, body: 'Alice' } - }) - expect( - await dispatch({ ...operations[0], params: { ...item, canonical: false } }, alice) - ).toMatchObject({ ok: true, result: { body: 'Alice' } }) - }) - it('keeps the actual admitted A capture through a later B update for full details and Viewed, then fails a fresh stale-A request', async () => { for (const operation of [operations[0], operations[3]]) { applied(alice) diff --git a/src/main/orcad/browser-providers/chromium/external-chromium-profile-path.test.ts b/src/main/orcad/browser-providers/chromium/external-chromium-profile-path.test.ts index e614c67986c..49531682b86 100644 --- a/src/main/orcad/browser-providers/chromium/external-chromium-profile-path.test.ts +++ b/src/main/orcad/browser-providers/chromium/external-chromium-profile-path.test.ts @@ -94,11 +94,4 @@ describe.skipIf(process.platform === 'win32')('external Chromium profile path', await expect(resolve(launcher)).resolves.toBe(stateProfile) }) - - it('leaves non-Linux hosts on the state profile', async () => { - const launcher = await installSnap('chromium', 'name: chromium\n') - environment = { ...environment, platform: 'darwin' } - - await expect(resolve(launcher)).resolves.toBe(join(root, 'state', 'browser-chromium')) - }) }) diff --git a/src/main/orcad/credentials/orcad-plaintext-credential-migration.test.ts b/src/main/orcad/credentials/orcad-plaintext-credential-migration.test.ts index d47691a4db1..156e48ab1a6 100644 --- a/src/main/orcad/credentials/orcad-plaintext-credential-migration.test.ts +++ b/src/main/orcad/credentials/orcad-plaintext-credential-migration.test.ts @@ -55,16 +55,6 @@ describe('migratePlaintextCredentials', () => { expect(logs.join('\n')).not.toContain('lin_api_plaintext') }) - it("stages in its own temp file, never a concurrent writer's shared one", () => { - const path = join(dir, 'linear-token.enc') - writeFileSync(path, 'lin_api_plaintext', 'utf8') - writeFileSync(`${path}.tmp`, 'other-writer-in-progress', 'utf8') - - migratePlaintextCredentials(store, [{ path, raw: true }], log) - expect(readFileSync(`${path}.tmp`, 'utf8')).toBe('other-writer-in-progress') - expect(readStoredCredentialToken('Linear', readFileSync(path))).toBe('lin_api_plaintext') - }) - it('rewrites a plaintext envelope as an encrypted one', () => { const path = join(dir, 'minimax-api-key.enc') const prefix = 'orca-minimax-api-key:v1:' diff --git a/src/main/startup/serve-launch/serve-desktop-activation.test.ts b/src/main/startup/serve-launch/serve-desktop-activation.test.ts index d83c32ad844..0b508d474dd 100644 --- a/src/main/startup/serve-launch/serve-desktop-activation.test.ts +++ b/src/main/startup/serve-launch/serve-desktop-activation.test.ts @@ -2,43 +2,6 @@ import { describe, expect, it, vi } from 'vitest' import { createServeDesktopActivationGate } from './serve-desktop-activation' describe('createServeDesktopActivationGate', () => { - it('coalesces activation requests while serve is initializing and drains once when ready', () => { - const activateWindow = vi.fn() - const gate = createServeDesktopActivationGate({ - initialState: 'initializing', - activateWindow - }) - - gate.requestActivation() - gate.requestActivation() - - expect(activateWindow).not.toHaveBeenCalled() - expect(gate.getState()).toBe('initializing') - - gate.markReady() - - expect(activateWindow).toHaveBeenCalledOnce() - expect(gate.getState()).toBe('ready') - }) - - it('drops pending activation and fails closed when promotion is blocked', () => { - const activateWindow = vi.fn() - const onBlocked = vi.fn() - const gate = createServeDesktopActivationGate({ - initialState: 'initializing', - activateWindow, - onBlocked - }) - - gate.requestActivation() - gate.markBlocked('persistent PTY provider unavailable') - gate.requestActivation() - - expect(activateWindow).not.toHaveBeenCalled() - expect(onBlocked).toHaveBeenCalledTimes(2) - expect(gate.getState()).toBe('blocked') - }) - it('lets a queued user activation keep the foreground over a background open', () => { const activateWindow = vi.fn() const gate = createServeDesktopActivationGate({ initialState: 'initializing', activateWindow }) diff --git a/src/main/startup/serve-launch/serve-mode-argv.test.ts b/src/main/startup/serve-launch/serve-mode-argv.test.ts index 398880d84a8..81215fb19fc 100644 --- a/src/main/startup/serve-launch/serve-mode-argv.test.ts +++ b/src/main/startup/serve-launch/serve-mode-argv.test.ts @@ -47,24 +47,6 @@ describe('serve-mode-argv', () => { ]) }) - it('leaves real GUI launch argv alone', () => { - // False serve detection replaces a desktop window with a listening runtime; exercise actual desktop argv shapes. - for (const argv of [ - ['/Applications/Orca.app/Contents/MacOS/Orca', '-psn_0_123456'], - ['C:\\Program Files\\Orca\\Orca.exe', '--squirrel-firstrun'], - ['C:\\Program Files\\Orca\\Orca.exe', 'orca://worktree/serve'], - ['/opt/orca/orca-ide', '/home/u/serve'], - // Value tokens named serve are never subcommands. - ['/opt/orca/orca-ide', '--pairing-code', 'serve'], - ['/opt/orca/orca-ide', '--environment=serve'], - ['/opt/orca/orca-ide', '--', 'serve'], - ['/opt/orca/orca-ide', 'Serve'] - ]) { - expect(argvRequestsServeMode(argv), argv.join(' ')).toBe(false) - expect(normalizeServeModeArgv(argv)).toEqual(argv) - } - }) - it('does not treat a later positional serve as the subcommand after another command', () => { expect(findServeSubcommandIndex(['app', 'status', 'serve'])).toBe(-1) expect(argvRequestsServeMode(['app', 'status', 'serve'])).toBe(false) @@ -78,14 +60,6 @@ describe('serve-mode-argv', () => { ]) }) - it('does not splice prototype members onto argv for stray positionals', () => { - expect(normalizeServeModeArgv(['/AppRun', 'serve', 'toString'])).toEqual([ - '/AppRun', - '--serve', - 'toString' - ]) - }) - it('passes args after `--` through verbatim', () => { expect(normalizeServeModeArgv(['/AppRun', 'serve', '--json', '--', '--port', '1'])).toEqual([ '/AppRun', diff --git a/src/main/startup/serve-launch/serve-pinned-bind-host.test.ts b/src/main/startup/serve-launch/serve-pinned-bind-host.test.ts index 3d30df04722..2068b0e8ead 100644 --- a/src/main/startup/serve-launch/serve-pinned-bind-host.test.ts +++ b/src/main/startup/serve-launch/serve-pinned-bind-host.test.ts @@ -5,13 +5,7 @@ import { getServeOptions } from './serve-options' import './serve-pinned-bind-host' describe('Electron serve listener pin', () => { - it('rejects hostnames, empty values and --mobile-pairing with a narrower bind', () => { - expect(() => getServeOptions(['/AppRun', '--serve', '--serve-bind'])).toThrow( - 'Missing value for --serve-bind.' - ) - expect(() => getServeOptions(['/AppRun', '--serve', '--serve-bind', 'host.example'])).toThrow( - /literal IP address/ - ) + it('rejects --mobile-pairing with a narrower bind', () => { expect(() => getServeOptions(['/AppRun', '--serve', '--serve-bind', '127.0.0.1', '--serve-mobile-pairing']) ).toThrow(/--mobile-pairing needs --bind 0\.0\.0\.0/) diff --git a/src/main/startup/serve-launch/serve-user-data-path-guard.test.ts b/src/main/startup/serve-launch/serve-user-data-path-guard.test.ts index e5be57f3dcd..23c90ed011a 100644 --- a/src/main/startup/serve-launch/serve-user-data-path-guard.test.ts +++ b/src/main/startup/serve-launch/serve-user-data-path-guard.test.ts @@ -2,14 +2,6 @@ import { describe, expect, it, vi } from 'vitest' import { checkServeUserDataPath } from './serve-user-data-path-guard' describe('checkServeUserDataPath', () => { - it('refuses a serve that landed on a profile other than the one the CLI chose', () => { - const env: NodeJS.ProcessEnv = { ORCA_SERVE_USER_DATA_PATH: '/isolated/profile' } - expect( - checkServeUserDataPath({ isServeMode: true, userDataPath: '/default/orca', env }) - ).toContain('/isolated/profile') - expect(env.ORCA_SERVE_USER_DATA_PATH).toBeUndefined() - }) - it('allows the chosen profile, including another spelling of it', () => { expect( checkServeUserDataPath({ @@ -27,13 +19,6 @@ describe('checkServeUserDataPath', () => { }) ).toBeNull() }) - - it('leaves launches without a CLI choice, or outside serve, alone', () => { - expect(checkServeUserDataPath({ isServeMode: true, userDataPath: '/a', env: {} })).toBeNull() - const env: NodeJS.ProcessEnv = { ORCA_SERVE_USER_DATA_PATH: '/b' } - expect(checkServeUserDataPath({ isServeMode: false, userDataPath: '/a', env })).toBeNull() - expect(env.ORCA_SERVE_USER_DATA_PATH).toBeUndefined() - }) }) describe('configureOrcaUserDataPathEnv on a serve launch', () => {