mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 02:57:36 +00:00
Backlog chunks 06-11, six auditors at 84 files each. All six read their full scope
case-by-case against production — the second consecutive wave with no disclosed gap. 68 case
declarations removed across 49 files, 2 test files deleted, 1,159 lines gone.
The sharpest deletion is also the audit's best detection signal.
`getFolderWorkspacePrimaryActionLabel(): string` takes zero parameters and returns a constant
`translate(...)`. Its test, titled "uses a stable workspace creation label independent of
quick agent selection", called it as
(getFolderWorkspacePrimaryActionLabel as (...args: unknown[]) => string)({ id: 'codex' })
The cast is the evidence: the author had to defeat the type system to express the premise,
because the dimension the title names cannot reach the function. That shape is greppable,
and it is already against house style — AGENTS.md permits no type assertions but `as const`,
and "production accepts an argument it does not declare" is not a defensible SAFETY
rationale.
Other removals, each with the owner named in the report:
- `metaKey`/`ctrlKey`/`shiftKey` varied across 8 cases against an onClick handler that calls
only `stopPropagation()` and `onOpenHostedReviewInChecks()` and inspects no modifier;
GitHub and GitLab share one branch there.
- `resolveVisibleCreatePrHeaderAction` is `return createPrHeaderAction`, an identity function,
behind two titles naming "the body composer is open" — a dimension its one-field signature
cannot express. Whole file.
- `statPath` returning `{isDirectory:false}` means the `loadDir` branch is never entered, so
"falls back when directory loading fails" is unreachable.
- A "hide sleeping" case that searched a test-local literal array which itself hardcodes the
key being looked for, so the knob was always defined.
- `updater.startup-scheduling`: production has no platform branch — `verifyUpdateCodeSignature`
appears only inside a security comment — so the darwin case asserted the same absence as the
win32 case. The win32 case stays; it is what makes that comment fail CI.
- Logical subsumption rather than textual: a case asserting `shallow` equality where its
neighbour asserts `toBe` on identical fixtures. `toBe` implies `shallow`, so it cannot fail
where the survivor passes.
- Replays across bare re-exports and one-line adapters, including a 3-case describe over
`return selectWorktreeAgentOrchestration(state, worktreeId)` whose owner runs 300 seeds
against an independently transcribed oracle.
One production line goes: a test-only `export { getSetupGuideSidebarEntryReady,
shouldShowSetupGuideEntry } from './SetupGuideSidebarEntry'` in `SidebarNav.tsx`. Both symbols
now appear only at their definition site, with zero importers.
Kept after checking production rather than shape, and reported: GitHub and GitLab
ready-for-review pairs that route through different APIs and negotiate different capability
tokens; the `windows-process-tree-kill` / `windows-live-tree-kill.win32` pair, whose win32
header argues the duality including a disclosed refusal-orphans-descendants asymmetry; and a
fake-`closest` test that looks like a previously-deleted shape but whose predicate really does
read the attribute the test sets.
Verified: 5,005 test files / 50,332 cases pass across the touched areas; `pnpm tc` clean after
clearing `.tsbuildinfo`; `check-reliability-gates.mjs` 140 gates; both deleted files absent
from the gate manifest, `cloud/package.json` and `mobile/tests-typecheck-baseline.txt`.
Four failing files were checked and none is in this diff: `session-scanner-codex-workers`,
`browser-manager-tab-identity` and `browser-manager-viewport-ownership` fail identically on a
pristine `origin/main` worktree, and `structured-chat-coordinator-mail` is a load-sensitive
`vi.waitFor` that passes in isolation and on CI re-run.
145 lines
5.9 KiB
TypeScript
145 lines
5.9 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import type * as UpdaterModule from './updater'
|
|
import { loadUpdaterModule, warmUpdaterModule } from './updater-test-module-loader'
|
|
import type { LinuxRootPackageType, UpdateStatus } from '../shared/update-status-types'
|
|
|
|
const {
|
|
autoUpdaterMock,
|
|
getLinuxRootPackageTypeMock,
|
|
isExternallyManagedLinuxInstallMock,
|
|
recordUpdaterLifecycleMock,
|
|
fetchNewerReleaseTagsMock,
|
|
moduleFactories,
|
|
resetUpdaterMocks
|
|
} = await vi.hoisted(async () => (await import('./updater-test-harness')).createUpdaterMocks())
|
|
|
|
vi.mock('electron', () => moduleFactories.electron())
|
|
vi.mock('electron-updater', () => moduleFactories.electronUpdater())
|
|
vi.mock('./electron-updater-loader', () => moduleFactories.electronUpdaterLoader())
|
|
vi.mock('@electron-toolkit/utils', () => moduleFactories.electronToolkitUtils())
|
|
vi.mock('./ipc/pty', () => moduleFactories.ipcPty())
|
|
vi.mock('./linux-update-package-type', () => moduleFactories.linuxUpdatePackageType())
|
|
vi.mock('./updater-lifecycle-diagnostics', () => moduleFactories.updaterLifecycleDiagnostics())
|
|
vi.mock('./updater-changelog', () => moduleFactories.updaterChangelog())
|
|
vi.mock('./updater-nudge', () => moduleFactories.updaterNudge())
|
|
vi.mock('./update-install-exit-watchdog', () => moduleFactories.updateInstallExitWatchdog())
|
|
vi.mock('./updater-prerelease-feed', () => moduleFactories.updaterPrereleaseFeed())
|
|
vi.mock('./local-builds/local-build-switch', () => moduleFactories.localBuildSwitch())
|
|
vi.mock('./local-builds/local-build-feed-server', () => moduleFactories.localBuildFeedServer())
|
|
|
|
const EXTERNALLY_MANAGED_MESSAGE =
|
|
'This copy of Orca is managed by your system package manager, so Orca cannot install updates itself. Update Orca through your distribution instead.'
|
|
|
|
/** #17702: a repackaged install (AUR, Nix, container rebuild) inherits the .deb `package-type`
|
|
* marker but has no package manager that can apply an Orca-downloaded package. */
|
|
warmUpdaterModule()
|
|
|
|
describe('updater externally managed Linux installs', () => {
|
|
beforeEach(() => {
|
|
resetUpdaterMocks()
|
|
})
|
|
|
|
async function startUpdater(options: {
|
|
packageType: LinuxRootPackageType | null
|
|
externallyManaged: boolean
|
|
}): Promise<{ send: ReturnType<typeof vi.fn>; updater: typeof UpdaterModule }> {
|
|
getLinuxRootPackageTypeMock.mockReturnValue(options.packageType)
|
|
isExternallyManagedLinuxInstallMock.mockReturnValue(options.externallyManaged)
|
|
vi.useFakeTimers()
|
|
fetchNewerReleaseTagsMock.mockResolvedValue({ tags: ['v1.0.61'], state: 'ready' })
|
|
autoUpdaterMock.checkForUpdates.mockImplementation(() => {
|
|
autoUpdaterMock.emit('checking-for-update')
|
|
queueMicrotask(() => autoUpdaterMock.emit('update-available', { version: '1.0.61' }))
|
|
return Promise.resolve(undefined)
|
|
})
|
|
const send = vi.fn()
|
|
const updater = await loadUpdaterModule()
|
|
updater.setupAutoUpdater({ webContents: { send } } as never, {
|
|
getLastUpdateCheckAt: () => Date.now(),
|
|
installMode: 'interactive'
|
|
})
|
|
return { send, updater }
|
|
}
|
|
|
|
function lastStatus(send: ReturnType<typeof vi.fn>): UpdateStatus | undefined {
|
|
return send.mock.calls.findLast(([channel]) => channel === 'updater:status')?.[1]
|
|
}
|
|
|
|
it('still reports the available release so the user can update through their distribution', async () => {
|
|
const { send, updater } = await startUpdater({ packageType: 'deb', externallyManaged: true })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
expect(lastStatus(send)).toEqual({
|
|
state: 'available',
|
|
version: '1.0.61',
|
|
changelog: null,
|
|
externallyManaged: true
|
|
})
|
|
})
|
|
|
|
it('does not flag a real deb host', async () => {
|
|
const { send, updater } = await startUpdater({ packageType: 'deb', externallyManaged: false })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
const status = lastStatus(send)
|
|
expect(status).toEqual({ state: 'available', version: '1.0.61', changelog: null })
|
|
expect(status && 'externallyManaged' in status).toBe(false)
|
|
})
|
|
|
|
it('refuses the download instead of spending it on a package it can never install', async () => {
|
|
const { send, updater } = await startUpdater({ packageType: 'deb', externallyManaged: true })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
updater.downloadUpdate()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
expect(autoUpdaterMock.downloadUpdate).not.toHaveBeenCalled()
|
|
expect(lastStatus(send)).toEqual({
|
|
state: 'error',
|
|
message: EXTERNALLY_MANAGED_MESSAGE,
|
|
version: '1.0.61',
|
|
retryable: false
|
|
})
|
|
})
|
|
|
|
it('records the blocked download for field diagnosis', async () => {
|
|
const { updater } = await startUpdater({ packageType: 'deb', externallyManaged: true })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
updater.downloadUpdate()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
expect(recordUpdaterLifecycleMock).toHaveBeenCalledWith(
|
|
'linux_package_externally_managed_download_blocked',
|
|
{ version: '1.0.61' }
|
|
)
|
|
})
|
|
|
|
it('leaves an ordinary deb host able to download', async () => {
|
|
const { updater } = await startUpdater({ packageType: 'deb', externallyManaged: false })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
autoUpdaterMock.downloadUpdate.mockResolvedValue([])
|
|
|
|
updater.downloadUpdate()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
expect(autoUpdaterMock.downloadUpdate).toHaveBeenCalled()
|
|
})
|
|
|
|
it('leaves an AppImage host able to download', async () => {
|
|
const { updater } = await startUpdater({ packageType: null, externallyManaged: false })
|
|
updater.checkForUpdatesFromMenu()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
autoUpdaterMock.downloadUpdate.mockResolvedValue([])
|
|
|
|
updater.downloadUpdate()
|
|
await vi.advanceTimersByTimeAsync(0)
|
|
|
|
expect(autoUpdaterMock.downloadUpdate).toHaveBeenCalled()
|
|
})
|
|
})
|