Skip to content

[CI] Reduce repeated test imports and unrelated runner allocations - #27222

Merged
nwparker merged 4 commits into
mainfrom
nwparker/ci-select-contracts-clean-fixtures-20261010
Oct 10, 2026
Merged

nwparker merged 4 commits into
mainfrom
nwparker/ci-select-contracts-clean-fixtures-20261010

Conversation

@nwparker

@nwparker nwparker commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179 $\color{#cf222e}{\Huge{\mathbf{−}}}$​147 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

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

Evidence Before After
Unit-only classifier Codex selected Excluded; other outputs identical
Historical source-matched fixtures 54 roots/92 files Fresh roots empty
Packaged CLI 15 cases 14; retire two static/add Mac receipt
Store Node ABBA median seconds 4.094300250 2.410804625; 41.118% lower, same 16 cases
Windows fixture Write before readiness Observed prompt before sole write

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 0 cannot prove builder completeness; no equivalent coverage claim. Docstrings declined under concise-comment policy.

Agent skill upstream boundary

  • Not applicable.

Notes

No hosted speed, native-cause or fleet claim.

Checklist

  • Local qualification/reviews complete.
  • Current CI/review complete; merged normally, lifecycle closed.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The Codex index-heal contract detector now excludes the Codex client unit-test path, with tests for the resulting job selection. Several test suites now register cleanup for temporary directories or rendered components. The packaged CLI asset tests remove runtime-resource assertions and add Linux and macOS launcher checks for environment variables and argument forwarding. The Windows MSYS test now uses one deadline for Bash readiness and child startup.





Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 2dc35

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 | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description covers the change, rationale, testing, review notes, and non-UI visual proof. However, it does not provide the required linked issue and replaces the template checklist with an incompl… Add a valid linked issue under "Linked Issue" and complete the required checklist items, including self-review, cross-platform impact, and lint, typecheck, test, and build status.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the main CI and test changes, including reduced repeated test setup and unrelated runner allocations.

Full details: Description check

Explanation

The description covers the change, rationale, testing, review notes, and non-UI visual proof. However, it does not provide the required linked issue and replaces the template checklist with an incomplete custom checklist.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR








  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/main/cli/packaged-cli-assets.test.ts (2)

126-136: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Restore focused assertions for packaged runtime roots.

The removed assertion was the only test that checked ordinary runtime roots such as tweetnacl and zod. The packaged-CLI fixture copies those packages directly into resources/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 win

Add a focused macOS packaged-CLI invocation test.

The macOS signal test invokes darwinLauncherAsset with no arguments and checks only process and listener behavior. The remaining tests that check ELECTRON_RUN_AS_NODE, the CLI path, and argv use linuxLauncherAsset only. 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
📥 Commits

Reviewing files that changed from the base of the PR and between 7aa91f7 and 3856907.

📒 Files selected for processing (7)
  • config/scripts/pr-code-change-scope.mjs
  • config/scripts/pr-codex-unit-only-selection.test.mjs
  • src/cli/runtime-client.test.ts
  • src/main/cli/packaged-cli-assets.test.ts
  • src/main/codex-cli/command.test.ts
  • src/main/persistence-protected-secret-fail-closed.test.ts
  • src/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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 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 win

Restore the packaged runtime dependency assertion.

The fixture manually stages zod and tweetnacl, then runs worktree create --pr 0. Argument validation returns before loadRuntimeClientClass(), 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
📥 Commits

Reviewing files that changed from the base of the PR and between 339b20f and 2dc3529.

📒 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.

@nwparker
nwparker merged commit 4dfc74e into main Oct 10, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant