Skip to content

ci: compile the E2E CLI once for all consumers - #23384

Merged
OrcaWin merged 4 commits into
mainfrom
ci/e2e-setup-efficiency
Sep 27, 2026
Merged

OrcaWin merged 4 commits into
mainfrom
ci/e2e-setup-efficiency

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

E2E jobs were each compiling the same CLI after downloading the app. Compile it once with the app so every consumer can start testing sooner.

What Changed

Build the CLI alongside web projection, after Electron finishes clearing its output directory, and wait for both before uploading. Consumers run the existing permission repair and local launcher installation without recompiling. Older refs keep their existing compilation path through a preparation-script capability check.

Why

Twelve controlled Linux samples measured 4.7–21.2 seconds of repeated compilation per consumer versus under 0.1 second of preparation. Producer overhead varied from 0.2–14 seconds, paid once. This models roughly 1.1–4.7 aggregate runner minutes saved across 14 consumers, before artifact transfer overhead; it is not a measured workflow wall-time saving. Reusing the existing artifact avoids another cache and preserves fresh test repositories and all assertions.

Linked Issue

None.

Visual Proof

N/A — CI setup only.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

23 focused tests and changed-code quality passed on macOS. Contracts cover reused/missing CLI output, preparation failure, old-ref fallback, build failure, and artifact upload ordering.

Eight initial hosted comparisons and four final implementation comparisons passed CLI help and byte parity for all 5,519 output files. Both implementations passed all 12 browser/CLI E2E tests. The final hosted E2E run confirms compilation was skipped and the local launcher installed after download. Subsequent commits only document the benchmark results. Final-head PR CI passed all 36 checks; three existing conditional jobs skipped. No failed tests were rerun or assertions weakened.

The standalone typecheck:e2e still reports pre-existing broad E2E type debt and is not a CI gate; it reported no diagnostics in the modified setup files. PR CI covers the normal supported gates.

Review

Reviewed sequencing, failure propagation, executable permissions, per-runner launcher installation, and older checkout compatibility.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No production UI, SSH protocol, platform support, test coverage, or deadline changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 851b04b2-8ab2-49c5-95a6-da83f86bcef7

📥 Commits

Reviewing files that changed from the base of the PR and between 0697014 and b96dd23.

📒 Files selected for processing (7)
  • .github/workflows/e2e.yml
  • config/scripts/e2e-cli-artifact-capability.test.mjs
  • config/scripts/release-e2e-dispatch-contract.test.mjs
  • docs/reference/ci-runner-efficiency.md
  • package.json
  • tests/e2e/global-setup-cli-artifact.unit.test.ts
  • tests/e2e/global-setup.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.


📝 Walkthrough

Walkthrough

The E2E workflow now conditionally builds shared CLI output after the relay and Electron builds, then waits for that build before artifact upload. The CLI build delegates output preparation to prepare:cli-output. When SKIP_BUILD is set and CLI output exists, global setup prepares it rather than rebuilding it. Tests and documentation cover the workflow sequence, fallback, and setup behavior.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b96dd

No new merge-blocking issue is established for the shared E2E CLI build and reuse change. Normal checks can proceed.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b96dd

The shared CLI build changes how E2E jobs receive executable output, but the observed workflow keeps that output within the same CI run and checks it before local use. No introduced security finding was established. Some artifact-integrity and failure behavior remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new reuse path affects E2E consumer runners receiving the producer's named build artifact. The workflow already distributed other output from that producer, so the inspected change does not establish a new external artifact supplier.

Trust Boundaries and Controls

  • observed — The consumer accepts the workflow artifact for CLI reuse, then runs repository-owned preparation. The installer recognizes an existing launcher only when its symlink points to the repository wrapper; these controls do not authenticate artifact bytes.

Resilience and Maintainability Implications

  • observed — Missing CLI output triggers compilation rather than preparation-only reuse; an existing entrypoint that passes structural checks does not receive an independent freshness check in consumer setup.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 and concisely describes the main change: compiling the E2E CLI once for reuse by all consumers.
Description check ✅ Passed The description covers the required sections, explains the change and rationale, documents testing and compatibility considerations, and completes the checklist. It identifies the linked issue as None…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (3 skipped: 3 unsupported.)

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

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.

@pullfrog pullfrog 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.

ℹ️ Minor suggestions only — the shared-CLI design checks out, one coverage gap inline.

Reviewed changes

  • Shared CLI build in the producer — e2e.yml adds a background e2e-cli step that compiles the CLI after Electron clears out/main, gated by an inline prepare:cli-output capability check so an older checkout ref keeps its per-consumer compile.
  • Consumer reuse — global-setup.ts now runs prepare:cli-output (permission repair + local launcher install) instead of recompiling when SKIP_BUILD is set and the downloaded out/cli exists; a prepare failure aborts setup before the test repo is created.
  • Script extraction — package.json splits build:cli into build:cli + prepare:cli-output with no behavior change for existing callers.
  • Tests and docs — new capability and global-setup unit tests, updated release dispatch contract, and the runner-efficiency benchmark note.

The capability check is genuinely load-bearing: daily-mac-build.yml dispatches e2e.yml --ref main --raw-field ref=$SHA, so the workflow YAML (new) and the checked-out package.json (possibly old) can disagree. Same-ref callers (pr.yml, release-cut.yml --ref "$TAG") stay consistent, and the error paths fail safe (producer skip → consumer rebuilds).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread .github/workflows/e2e.yml
# The CLI emits into out/main too; start only after Electron finishes clearing that tree.
- name: Build shared E2E CLI
id: e2e-cli
background: true

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.

This background step lives in a job the ci-background-step-barriers.test.mjs sweep never reads (it parses pr.yml/mobile.yml/cloud-verify.yml only), so the background-step invariants — wait consumes every id, no continue-on-error or if on the wait, ≤3 pending — go unenforced for this barrier. The repo convention is to add any job with background steps to that sweep; the PR's own dispatch-contract test only pins order and background: true.

Technical details
# Background barrier not swept

## Affected sites
- `.github/workflows/e2e.yml:70-83` — new background `e2e-cli` step + `wait: e2e-cli`.
- `config/scripts/ci-background-step-barriers.test.mjs:21-48` — job list omits `e2e.yml`.

## Required outcome
- The `e2e-cli` barrier is covered by the same invariants as the other background steps.

## Suggested approach
- Parse `e2e.yml` in `ci-background-step-barriers.test.mjs` and add `e2eWorkflow.jobs.build` to the swept list. It has a single background step, so the `pending.size <= 3` bound holds.

@pullfrog pullfrog 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.

Delta since the previous review (d858960 → b96dd2312e) is docs-only: docs/reference/ci-runner-efficiency.md now cites the four-sample final comparison and widens the modeled saving to 1.1–4.7 aggregate minutes, with the "not a measured wall-time reduction" caveat intact. No behavioral surface, no new findings. The single coverage note from the prior review (the e2e-cli background step isn't swept by ci-background-step-barriers.test.mjs) still stands.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 27b823f into main Sep 27, 2026
39 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