Skip to content

ci(release): publish main-process source maps with each release - #17630

Merged
nwparker merged 4 commits into
stablyai:mainfrom
nwparker:nwparker/release-publish-sourcemaps
Aug 31, 2026
Merged

nwparker merged 4 commits into
stablyai:mainfrom
nwparker:nwparker/release-publish-sourcemaps

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Problem

Desktop bundles ship minified, and packaging drops out/**/*.map from app.asar — so a stack trace from a released build cannot be mapped back to source.

There is no third-party crash service to symbolicate for us: crashReporter runs with uploadToServer: false, and stacks reach us as text via crash-reports.json, the crash dialog's "Copy Details", or the opt-in feedback POST. A human reads them, so the maps have to be fetchable by a human.

main builds with sourcemap: 'hidden' (#17527) — the maps are produced in CI but were never published anywhere.

Change

Zip the maps on the linux-x64 leg and upload to the draft release as orca-sourcemaps-<tag>.zip.

  • 33.7 MB raw → 8.0 MB zipped, 69 files (measured on a real out/main build)
  • The main bundle is platform-independent, so one leg covers the whole release rather than uploading four near-identical copies
  • Runs after Build app and before Publish release artifacts (Linux), so it reads out/ before packaging filters it
  • Fails the release if no maps are found, so a regression of build.sourcemap breaks the release loudly instead of silently shipping undecodable builds

No change to installed app size — !out/**/*.map (added in #17527) keeps them out of app.asar, and hidden means no sourceMappingURL is emitted, so the app never looks for them.

Verification

  • The zip snippet was run verbatim against a real out/main build: 69 files, 35,385,172 B → 8,407,468 B.
  • New contract test config/scripts/release-cut-sourcemap-publish.test.mjs (3 tests) covers single-leg gating, the fail-loud guard, and step ordering relative to Build app / Publish release artifacts (Linux).
  • Existing release-workflow contract tests pass (release-cut-token-permissions, publish-complete-draft-releases, windows-signing-workflow-contract, release-cut-signpath-slack — 16 tests).

Merge order

Depends on #17527 for sourcemap: 'hidden' and the !out/**/*.map packaging exclusion. Merge #17527 first, or this leg's guard will fail the next release.

Desktop bundles ship minified, and packaging drops out/**/*.map from
app.asar, so a stack trace from a released build cannot be mapped back to
source. main builds with sourcemap:'hidden' — the maps exist in CI but were
never published anywhere.

Zip them on the linux-x64 leg and upload to the draft release as
orca-sourcemaps-<tag>.zip (33.7MB raw, ~8MB zipped, 69 files). The main
bundle is platform-independent, so one leg covers the whole release. The
step fails loudly if no maps are found, so a regression of build.sourcemap
breaks the release instead of silently shipping undecodable builds.
@greptile-apps

greptile-apps Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR publishes main-process source maps alongside each release so maintainers can decode stack traces from minified desktop builds.

  • Bundles JavaScript source maps on the linux-x64 build leg before packaging removes them.
  • Uploads the archive to the draft GitHub release with retry behavior.
  • Adds workflow contract tests for platform gating, temporary staging, missing-map failure, and step ordering.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.github/workflows/release-cut.yml Adds single-leg source-map validation, archiving outside the checkout, and draft-release upload before Linux artifact publication.
config/scripts/release-cut-sourcemap-publish.test.mjs Adds contract coverage for source-map publication gating, staging location, fail-loud behavior, and workflow ordering.

Sequence Diagram

sequenceDiagram
  participant B as Linux x64 build
  participant T as Runner temporary directory
  participant R as Draft GitHub release
  B->>B: Build app and emit hidden source maps
  B->>B: Verify out/main contains .js.map files
  B->>T: Create orca-sourcemaps-tag.zip
  T->>R: Upload source-map archive
  B->>B: Package and publish Linux artifacts
Loading

Reviews (4): Last reviewed commit: "Merge branch 'main' into nwparker/releas..." | Re-trigger Greptile

Every entry in electron-builder's `files` is a negation, so app-builder hits
containsOnlyIgnore() and prepends `**/*` (fileMatcher.js:285). A zip left in
the workspace root would have been packed into the linux-x64 app.asar,
growing that platform's installers by ~8MB and diverging them from arm64 —
the same hazard the '!pr-evidence' exclusion already guards against.

Stage it in $RUNNER_TEMP, matching the release-state file at :444.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The release workflow adds Linux x64 steps that fail when main-process source maps are absent, archive emitted *.js.map files in $RUNNER_TEMP, and upload the archive to the release with retries. Vitest tests verify the workflow conditions, source map handling, failure behavior, upload configuration, and step ordering.

Merge Risk: 🔵 Low · up to aa756

This adds a release-only source-map archive and fails releases when maps are missing without changing the installed app. The PR is mergeable with explicit owner awareness that #17527 must land first; otherwise a release could fail or the packaging boundary could change, and the artifact contract would benefit from stronger test assertions.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, implementation, rationale, verification, scope, and merge dependency. It does not follow the repository template and omits the required linked issue, explicit Vis… Reformat the description using all required template headings. Add a valid linked issue reference, write N/A with a reason under Visual Proof, complete the Testing and applicable checklist items, provide the required AI Disclosure or foll…
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 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: publishing main-process source maps with each release.
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: Description check

Explanation

The description explains the problem, implementation, rationale, verification, scope, and merge dependency. It does not follow the repository template and omits the required linked issue, explicit Visual Proof entry, testing checklist, AI Disclosure, Review, boundary, Notes, and final Checklist sections.

Resolution

Reformat the description using all required template headings. Add a valid linked issue reference, write N/A with a reason under Visual Proof, complete the Testing and applicable checklist items, provide the required AI Disclosure or follow the internal-contributor exception, and complete Review, Agent skill upstream boundary, Notes, and Checklist sections.

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 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 88abb393-7187-47da-ac16-91ad0f96d552

📥 Commits

Reviewing files that changed from the base of the PR and between 5897b7b and 52c3f04.

📒 Files selected for processing (2)
  • .github/workflows/release-cut.yml
  • config/scripts/release-cut-sourcemap-publish.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment on lines +26 to +28
expect(bundle.run).toContain("find out/main -name '*.js.map'")
expect(publish.with.command).toContain('gh release upload')
expect(publish.with.command).toContain('orca-sourcemaps-')

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Strengthen the source-map publication contract assertions.

Assert that each source-map step appears exactly once, that archive creation uses orca-sourcemaps-$TAG.zip, and that the upload references the same tag-specific archive. This prevents duplicate workflow steps or mismatched archive paths from passing the contract test.

📍 Affects 1 file
  • config/scripts/release-cut-sourcemap-publish.test.mjs#L26-L28 (this comment)
  • config/scripts/release-cut-sourcemap-publish.test.mjs#L16-L17

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 591b4366-7aaf-436d-8af4-88c16bb9568a

📥 Commits

Reviewing files that changed from the base of the PR and between 52c3f04 and aa75663.

📒 Files selected for processing (2)
  • .github/workflows/release-cut.yml
  • config/scripts/release-cut-sourcemap-publish.test.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

// Why: the main bundle is platform-independent, so duplicating the ~8MB
// artifact across legs would only race the uploads against each other.
for (const step of [bundle, publish]) {
expect(step.if).toContain('linux-x64')

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Require an exact linux-x64 gate.

toContain('linux-x64') also accepts a condition that includes linux-arm64. The test would then pass after source maps are uploaded by multiple platform legs. Compare the complete if expression.

Proposed test fix
 for (const step of [bundle, publish]) {
-  expect(step.if).toContain('linux-x64')
+  expect(step.if).toBe("matrix.platform == 'linux-x64'")
 }

Comment on lines +55 to +56
expect(stepIndex('Publish main-process source maps')).toBeGreaterThan(bundle)
expect(bundle).toBeLessThan(stepIndex('Publish release artifacts (Linux)'))

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert publication before Linux artifact upload.

The current test does not prove that Publish main-process source maps runs before Publish release artifacts (Linux). A future move of the upload step after artifact publication would pass this test.

Add an assertion that the source-map publication index is less than the Linux artifact publication index.

Proposed test fix
 const bundle = stepIndex('Bundle main-process source maps')
+const publish = stepIndex('Publish main-process source maps')
 expect(bundle).toBeGreaterThan(stepIndex('Build app'))
-expect(stepIndex('Publish main-process source maps')).toBeGreaterThan(bundle)
+expect(publish).toBeGreaterThan(bundle)
+expect(publish).toBeLessThan(stepIndex('Publish release artifacts (Linux)'))
 expect(bundle).toBeLessThan(stepIndex('Publish release artifacts (Linux)'))

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

✅ No new issues found.

Reviewed changes

  • Bundle step — on the linux-x64 leg, fail-loud if out/main has no .js.map files, then zip them into orca-sourcemaps-<tag>.zip.
  • Publish step — retry-wrapped gh release upload of the zip to the draft release, reusing the job's contents: write permission.
  • Contract test — pins single-leg gating, the fail-loud guard, and ordering relative to Build app / Publish release artifacts (Linux).

ℹ️ Merge-order dependency on #17527

This PR is correct on its own but does not stand alone: the find out/main -name '*.js.map' guard only passes once #17527 lands (it adds sourcemap: 'hidden' to the main build and the !out/**/*.map packaging exclusion). #17527 is still open, so this must merge after it or the next release cut fails loudly at the bundle step. The author documented this in the PR body; flagging only so the merge ordering is enforced. The fail-loud behavior itself is the right design — a regression of sourcemap should break the release rather than ship undecodable builds.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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

✅ No new issues found.

Reviewed changes (delta since prior pullfrog review)

  • Bundle step stages outside the checkout — the zip now lands in $RUNNER_TEMP instead of the workspace root, so electron-builder's **/* default (all files entries are negations) cannot pack the 8 MB zip into app.asar.
  • Publish step tracks the new location — uploads from ${{ runner.temp }}, which matches $RUNNER_TEMP on GitHub-hosted runners.
  • Contract test — adds an out-of-checkout staging assertion and reworks step lookup into a stepIndex helper.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit fc73903 into stablyai:main Aug 31, 2026
52 of 54 checks passed
nwparker added a commit that referenced this pull request Aug 31, 2026
…17641)

`serializes FETCH_HEAD callers before they enter admission` assumed that two
same-repo fetches join the FETCH_HEAD lock lane in call order. They do not.

`runWithGitFetchHeadLock` first `await`s `fetchLockPath`, which walks the
filesystem (`realpath`, `stat` per parent directory, `readFile` of `commondir`,
`realpath` again) before it calls `runWithGitOperationLock`, and the lane is
registered only after that walk resolves. For a non-existent `/repo` that is
five libuv threadpool round-trips per caller. Two callers issued back to back
run their chains concurrently, so lane order is threadpool completion order,
not call order.

When the `interactive` fetch won that race it entered the lane ahead of the
`background` fetch. On the first caller's release it reached admission
immediately and, being interactive, took the free network headroom slot instead
of queueing, while the background fetch stayed parked on the lock. `queued`
therefore settled at 0 and never reached the asserted 1. Measured inversion
rate for the bare lock-path walk was 54/500 on an idle machine; the test itself
failed 5/20 locally, always at the same assertion, matching the two CI failures
on unrelated PRs (#17530, #17630) at the same line.

Fix the premise rather than the symptom: stub only the key derivation, keeping
the real FIFO `runWithGitOperationLock` that the test actually exercises, so the
lane is registered synchronously with the call. Key derivation keeps its own
coverage in `src/shared/git-fetch-head-lock.test.ts`. This also stops the fetch
tests in this file from sharing one global `/.git/FETCH_HEAD` lane with each
other and from touching the real filesystem.

Verified deterministic: 40/40, then 30/30 clean runs, plus 25/25 with twelve CPU
hogs and a concurrent `src/main/git/command-runner/` run saturating the box.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…lyai#17630)

* ci(release): publish main-process source maps with each release

Desktop bundles ship minified, and packaging drops out/**/*.map from
app.asar, so a stack trace from a released build cannot be mapped back to
source. main builds with sourcemap:'hidden' — the maps exist in CI but were
never published anywhere.

Zip them on the linux-x64 leg and upload to the draft release as
orca-sourcemaps-<tag>.zip (33.7MB raw, ~8MB zipped, 69 files). The main
bundle is platform-independent, so one leg covers the whole release. The
step fails loudly if no maps are found, so a regression of build.sourcemap
breaks the release instead of silently shipping undecodable builds.

* fix(release): stage source map bundle outside the checkout

Every entry in electron-builder's `files` is a negation, so app-builder hits
containsOnlyIgnore() and prepends `**/*` (fileMatcher.js:285). A zip left in
the workspace root would have been packed into the linux-x64 app.asar,
growing that platform's installers by ~8MB and diverging them from arm64 —
the same hazard the '!pr-evidence' exclusion already guards against.

Stage it in $RUNNER_TEMP, matching the release-state file at :444.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#17641)

`serializes FETCH_HEAD callers before they enter admission` assumed that two
same-repo fetches join the FETCH_HEAD lock lane in call order. They do not.

`runWithGitFetchHeadLock` first `await`s `fetchLockPath`, which walks the
filesystem (`realpath`, `stat` per parent directory, `readFile` of `commondir`,
`realpath` again) before it calls `runWithGitOperationLock`, and the lane is
registered only after that walk resolves. For a non-existent `/repo` that is
five libuv threadpool round-trips per caller. Two callers issued back to back
run their chains concurrently, so lane order is threadpool completion order,
not call order.

When the `interactive` fetch won that race it entered the lane ahead of the
`background` fetch. On the first caller's release it reached admission
immediately and, being interactive, took the free network headroom slot instead
of queueing, while the background fetch stayed parked on the lock. `queued`
therefore settled at 0 and never reached the asserted 1. Measured inversion
rate for the bare lock-path walk was 54/500 on an idle machine; the test itself
failed 5/20 locally, always at the same assertion, matching the two CI failures
on unrelated PRs (stablyai#17530, stablyai#17630) at the same line.

Fix the premise rather than the symptom: stub only the key derivation, keeping
the real FIFO `runWithGitOperationLock` that the test actually exercises, so the
lane is registered synchronously with the call. Key derivation keeps its own
coverage in `src/shared/git-fetch-head-lock.test.ts`. This also stops the fetch
tests in this file from sharing one global `/.git/FETCH_HEAD` lane with each
other and from touching the real filesystem.

Verified deterministic: 40/40, then 30/30 clean runs, plus 25/25 with twelve CPU
hogs and a concurrent `src/main/git/command-runner/` run saturating the box.
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