Repository navigation
[CI] Reduce repeated test imports and unrelated runner allocations - #27222
Conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The package configuration is not shown to be broken, but the removed resource check weakens protection against valid CLI commands failing if a dependency is omitted. Restore that check to keep this coverage gap bounded. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/cli/packaged-cli-assets.test.ts (2)
126-136: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRestore focused assertions for packaged runtime roots.
The removed assertion was the only test that checked ordinary runtime roots such as
tweetnaclandzod. The packaged-CLI fixture copies those packages directly intoresources/node_modules, so it can pass even when the builder mapping omits them. A future omission can then make a packaged CLI path fail when it loads these imports.Add focused assertions to the existing resource-plan test:
Suggested fix
expect(packagedTargets).toContain(join('node_modules', 'proper-lockfile')) + for (const packageName of ['jsonc-parser', 'node-pty', 'tweetnacl', 'yaml', 'zod']) { + expect(packagedTargets).toContain(join('node_modules', packageName)) + }This identifies a regression-coverage gap, not a defect in the current mapping.
138-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a focused macOS packaged-CLI invocation test.
The macOS signal test invokes
darwinLauncherAssetwith no arguments and checks only process and listener behavior. The remaining tests that checkELECTRON_RUN_AS_NODE, the CLI path, and argv uselinuxLauncherAssetonly. A macOS launcher regression can therefore pass the suite while packaged CLI invocation receives incorrect values.Suggested fix
@@ ) + itRunsUnixShell('forwards the macOS packaged CLI invocation', async () => { + const root = await mkdtemp(join(tmpdir(), 'orca-darwin-cli-')) + try { + const appDir = join(root, 'Orca.app') + const launcherPath = join(appDir, 'Contents', 'Resources', 'bin', 'orca') + const electronPath = join(appDir, 'Contents', 'MacOS', 'Orca') + const cliPath = join( + appDir, + 'Contents', + 'Resources', + 'app.asar.unpacked', + 'out', + 'cli', + 'index.js' + ) + + await mkdir(dirname(launcherPath), { recursive: true }) + await mkdir(dirname(electronPath), { recursive: true }) + await mkdir(dirname(cliPath), { recursive: true }) + await copyFile(darwinLauncherAsset, launcherPath) + await writeFile(cliPath, '', 'utf8') + await writeFile( + electronPath, + `#!/usr/bin/env node +console.log(JSON.stringify({ + argv: process.argv.slice(2), + runAsNode: process.env.ELECTRON_RUN_AS_NODE ?? null +})) +`, + { encoding: 'utf8', mode: 0o755 } + ) + + const result = await execFileAsync(launcherPath, ['--help', 'two words']) + const payload = JSON.parse(result.stdout) as { + argv: string[] + runAsNode: string | null + } + + expect(payload.argv).toEqual([cliPath, '--help', 'two words']) + expect(payload.runAsNode).toBe('1') + } finally { + await rm(root, { recursive: true, force: true }) + } + }) + itRunsUnixShell(
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
aa72ca1c-3d02-4a49-a245-33c8c28b6f33
📒 Files selected for processing (7)
config/scripts/pr-code-change-scope.mjsconfig/scripts/pr-codex-unit-only-selection.test.mjssrc/cli/runtime-client.test.tssrc/main/cli/packaged-cli-assets.test.tssrc/main/codex-cli/command.test.tssrc/main/persistence-protected-secret-fail-closed.test.tssrc/main/runtime/multi-client-navigation-isolation.integration.test.ts
💤 Files with no reviewable changes (1)
- src/main/cli/packaged-cli-assets.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Restore the packaged runtime dependency assertion. · packaged-cli-assets.test.ts:87-101
src/main/cli/packaged-cli-assets.test.ts:87-101
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winRestore the packaged runtime dependency assertion.
The fixture manually stages
zodandtweetnacl, then runsworktree create --pr 0. Argument validation returns beforeloadRuntimeClientClass(), so this test can pass when the builder omits a dependency required by a valid runtime-client command. That command can then fail when Node loads the missing module.The deleted resource-plan assertion was the remaining package test that checked these CLI-only resources. Restore it at this test boundary.
Suggested fix
const builderConfig = require('../../../config/electron-builder.config.cjs') as { files?: string[] asarUnpack?: string[] + mac?: { extraResources?: { from?: string; to?: string }[] } + linux?: { extraResources?: { from?: string; to?: string }[] } + win?: { extraResources?: { from?: string; to?: string }[] } } @@ it('loads worktree link validation from the installed CLI', async () => { @@ }) + it('copies runtime dependencies used before Electron asar integration is available', () => { + const runtimeResourceTargets = new Set( + [ + ...(builderConfig.mac?.extraResources ?? []), + ...(builderConfig.linux?.extraResources ?? []), + ...(builderConfig.win?.extraResources ?? []) + ].map((resource) => normalizeResourceTarget(resource.to)) + ) + + expect([...runtimeResourceTargets]).toEqual( + expect.arrayContaining([ + join('node_modules', 'ws'), + join('node_modules', 'tweetnacl'), + join('node_modules', 'zod'), + join('node_modules', '@orca', 'process-host'), + join('node_modules', 'yaml'), + join('node_modules', 'jsonc-parser'), + join('node_modules', 'node-pty'), + join('node_modules', 'sherpa-onnx-darwin-${arch}'), + join('node_modules', 'sherpa-onnx-linux-${arch}'), + join('node_modules', 'sherpa-onnx-win-x64') + ]) + ) + }) + + function normalizeResourceTarget(target: string | undefined): string | undefined { + return target?.replace(/[\\/]/g, sep) + } +
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
975ba97f-9a36-4a1d-b6e1-a5aa01b83fd8
📒 Files selected for processing (1)
src/main/windows/windows-msys-job.win32.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
ELI5
Avoid unrelated jobs, repeated imports and fixtures.
What Changed
Exclude standalone Codex unit from real-contract detection; retain production/unknown/workflow and unit/type/static controls. Remove one module reset, preserving fresh SQLite Stores/reloads. Clean three fixture groups. Retire two static packaged-CLI cases and add actual Mac argv/environment receipts. Unmount workspace hook fixtures before Happy DOM disappears.
The Windows MSYS test waits for the observed replacement Bash prompt before its sole write. Prompt/child receipt share the existing 15-second budget; ownership/termination assertions remain.
Original suite unchanged; sibling honors 600 lines.
Why
Combine test/CI fixes without production/library/native patches, retries/skips or timeout increases or worker changes.
Linked Issue
N/A — template policy.
Visual Proof
N/A — CI/tests only.
Testing
Historical fixtures; no paired timing. Codex 237s remains opportunity.
139 distinct local cases: 108 Bun/31 Node across runs; no combined run. Cleanup's original/candidate six passed; hosted exception unreproduced, callback unknown. Portable smoke validates sequence, not Windows ownership. Formatter/lint/typecheck/quality passed; Local readiness checks 5.080762125s. Local attempts 112.665375375s; prior hooks 4.112062958s + latest 1.246258208s separately. Empty lint/cache stops/warnings retained; administrative overhead unknown.
PR heads: 23,127 assigned seconds (5665+6024+5605+5833), including failures. Natural main/closed lifecycle:25+7=32; observed total23,159. All fourth-head jobs/unit shards and real Windows MSYS passed; unhandled0. Merged4dfc74e5 preserves postimages/WSL prefix. Specialist selection intentional; no hosted savings claimed.
AI Disclosure
Codex authored; independent review.
Review
Mac gap fixed. CodeRabbit inventory request declined per junk policy: static mapping alarm lost. Manually staged dependencies and
--pr 0cannot prove builder completeness; no equivalent coverage claim. Docstrings declined under concise-comment policy.Agent skill upstream boundary
Notes
No hosted speed, native-cause or fleet claim.
Checklist