Skip to content

build(packaging): fail when orca serve's serve-selection entry or its chunks stay packed (#27404 guard) - #30228

Merged
nwparker merged 1 commit into
mainfrom
nwparker/r2-packaged-serve-payload
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/r2-packaged-serve-payload

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you run orca serve, the CLI first runs a small file from the installed app to decide which server to start. Plain Node runs that file, and plain Node can't read inside the app's packed archive (app.asar). When the file was left packed (#27404), every orca serve quietly fell back. Packaging now fails if that file, or any file it loads, isn't unpacked.

What Changed

  • config/scripts/verify-packaged-web-client.cjs becomes verify-packaged-serve-payload.cjs. The name now covers what it checks: everything orca serve opens by path from the unpacked app.
  • New assertPackagedServeSelectionEntry(resourcesDir), run in afterPack beside the web-client check:
    • app.asar.unpacked/out/main/orcad/orcad-local-serve-selection-entry.js must exist;
    • it then walks every relative require("./…") / require("../…") reachable from the entry. Each one must exist unpacked, so a packed chunk fails at packaging and not on a user's orca serve.
  • A test pins the entry path to ORCAD_LOCAL_SERVE_SELECTION_ENTRY (the constant the CLI uses).
  • The afterPack fixture in electron-builder-runtime-resources.test.mjs seeds the entry.

Why

Round 2, C2 / S3.3, packaged payloads. I audited the five assets the proposal named:

  • web client: already checked by assertPackagedWebClient;
  • mobile page and port-scan worker: already checked through the orcad template inventory (ORCAD_ARTIFACTS, verify-packaged-orcad-template.cjs);
  • build commit: already checked by the node-server artifact preflight (fix(orcad): stamp the build commit so orca skills install works on SSH and headless hosts #28558);
  • serve-selection entry: only checked as a string in the asarUnpack list (electron-builder-config.test.mjs). Nothing checked the real packaged output, or the chunks the entry loads.

So this adds only the missing check. Walking requires catches a chunk that moves out of the unpacked globs, which a list test can't see.

Linked Issue

Refs round-2 SSH/remote hardening S3 (C2). Guards #27404.

Visual Proof

N/A: packaging guard only.

Testing

  • pnpm test config/scripts/verify-packaged-serve-payload.test.mjs config/scripts/electron-builder-runtime-resources.test.mjs passes. The new cases fail without the check.

  • The full static-analysis job, run locally.

  • Ran the guard against a real built out/main staged as app.asar.unpacked/out: it passes. That run caught and fixed extension-less requires. A full package wasn't built locally because of machine load; packaging CI runs afterPack for real.

  • Automated tests added/updated, or explained why not below

Review

Codex review (gpt-6.1-sol, high): no findings. It also staged the real main build with the configured unpack rules, and the guard accepted it.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Build-time only. Paths use path.join, so it works the same on every platform.

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 Oct 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23c0c0dc-5662-4bba-b43f-30896e73ef07
📥 Commits

Reviewing files that changed from the base of the PR and between 6afbe49 and 64ce337.

📒 Files selected for processing: 5
  • config/electron-builder.config.cjs
  • config/scripts/electron-builder-runtime-resources.test.mjs
  • config/scripts/verify-packaged-serve-payload.cjs
  • config/scripts/verify-packaged-serve-payload.test.mjs
  • config/scripts/verify-packaged-web-client.cjs
  • 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.

@nwparker
nwparker merged commit 9085c5b into main Oct 18, 2026
36 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