Skip to content

test: reduce npm startup cost in Codex apply fixtures - #8982

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:codex/batch-cli-fixture-pack
Nov 21, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
luvs01:codex/batch-cli-fixture-pack

Conversation

@luvs01

@luvs01 luvs01 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pack the main and platform packages together for each test version. Setting up a Codex CLI apply fixture now starts npm three times, down from five.
  • Each command retains its own npm configuration and package cache. The commands share a Node compile cache inside that fixture's temporary directory.

Verification

  • A controlled offline comparison on Node 24.22.3 used three independent fixtures per variant. Median setup time fell from 3,699 ms to 1,830 ms.
  • With real npm on Windows, fixture setup created three command workspaces with separate caches and empty user and global config files. All four tarballs matched their SHA-512 integrity values and contained the expected package versions. A private-prefix install and update read back both the main and backing packages at 1.0.0 and 1.1.0 respectively.
  • The three consumer files, codex-cli-update-apply.test.ts, codex-cli-update-artifacts.test.ts, and codex-cli-update-process-fixture.test.ts, completed on Windows with 28 passed, 50 skipped, and 0 failed.
  • bun run typecheck passed for 2,681 files, and git diff --check passed. The full repository suite was not run locally while other Windows tests shared the machine.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Tests
    • Updated automated test fixtures to generate package archives together and verify that the expected archives are returned.
    • Improved isolation of per-command npm settings and caches.
  • User impact
    • No changes to app behavior or end-user features.

Pack each version's two local packages in one real npm invocation and reuse only Node's compiled code within the fixture-owned root. Keep fresh per-command npm config and package caches, the separate real installation, existing readback assertions, and CI budgets unchanged.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The fixture helper sets a root-owned NODE_COMPILE_CACHE path for npm commands. It also packs both local package sources in one invocation, checks that npm returns two archive records, and reads the archives from the shared destination.

Changes: Fixture package creation

Layer / File(s) Summary
npm environment and package packing
tests/helpers/codex-cli-apply-fixture.ts
privateNpm sets NODE_COMPILE_CACHE while retaining its existing npm isolation and timeout. The fixture packs both package sources in one invocation, checks for two returned archives, and reads them by returned filename.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: Minimal · up to fb913

This change only speeds up test fixture setup and does not affect production behavior. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "test: reduce npm startup cost in Codex apply fixtures" matches the main objective. The PR packs the main and platform packages in one privateNpm invocation, which cuts npm invocations from …
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.
Full details: Title check

Explanation

The title "test: reduce npm startup cost in Codex apply fixtures" matches the main objective. The PR packs the main and platform packages in one privateNpm invocation, which cuts npm invocations from five to three, and it sets a shared NODE_COMPILE_CACHE. The title is specific, concise, and follows a conventional commit prefix. It does not cover the compile cache detail, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d61cca1 and fb913fa.

Files selected for processing: 1

  • tests/helpers/codex-cli-apply-fixture.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 20, 2026
@luvs01
luvs01 marked this pull request as ready for review November 20, 2026 04:55
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (MAINTAINERS.md maintainer-integration exception; lane fb2101-queue-b).

  • Exact head: fb913faacc2036cf74d303bf0a3f3a8040e79879
  • Checks on this head: all completed checks pass (ci aggregate, gates/test changed where selected, CodeRabbit, enforce-target, hygiene); none pending or failing.
  • Review: terra review APPROVE, no findings; codex-cli-update apply/artifacts/process-fixture tests 78 pass on the head.
  • Review threads: 0 unresolved.
  • Scope: test-fixture-only; no auth, workflow, release, dependency or provider-preset surface.

This is maintainer integration, not an independent approval.

@lidge-jun
lidge-jun merged commit 6711624 into lidge-jun:dev Nov 21, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants