Repository navigation
fix(release): fail the build when Apple rejects a notarization - #385
Merged
Merged
Conversation
`xcrun notarytool submit --wait` exits 0 as long as the submission itself completed, including when Apple returns `Invalid`. The sign-and-notarize hook trusted that exit code, so a rejected binary would have been archived and uploaded as if it had passed — the gate could not actually fail. Read the submission JSON with plutil (always present on macOS, so no new dependency) and require status `Accepted`. On failure, print the raw response and fetch the notary log so the rejection reason lands in the workflow output instead of requiring a separate round trip. Add scripts/smoke-sign-notarize-hook.sh covering the Accepted, Invalid, Rejected, missing-credential, missing-key-file, and non-darwin paths with codesign/ditto/xcrun stubbed on PATH, so it needs no signing identity, credentials, or network. Verified it fails against the previous exit-code-only logic and passes against the fix. Wired it into examples-smoke.yml as a macOS job. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The release guard is correct and tested; the remaining environment-isolation issue is non-blocking.
Review effort: Balanced
Findings: 1
What changed in this PR
Ensures Apple notarization rejection aborts releases before artifacts are uploaded.
Changes:
- Validates notarization JSON status and reports rejection logs.
- Adds macOS smoke coverage for success and failure paths.
- Runs the smoke test in CI.
| File | Description |
|---|---|
scripts/sign-and-notarize-darwin.sh |
Enforces Accepted notarization status. |
scripts/smoke-sign-notarize-hook.sh |
Adds stubbed hook smoke tests. |
.github/workflows/examples-smoke.yml |
Adds the macOS smoke job. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…s env `env` without `-u` keeps inherited variables, so a developer or runner with APPLE_API_KEY_ISSUER_ID already exported would have sent that case down the normal notarization path and failed the smoke test for the wrong reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follow-up to #384.
Problem
xcrun notarytool submit --waitexits 0 as long as the submission completed — including when Apple comes backInvalid. The hook added in #384 checked only the exit code, so a rejected binary would have been archived and uploaded as though it had passed. Moving notarization ahead of the first upload only helps if notarization can actually fail the build.Change
scripts/sign-and-notarize-darwin.sh— submit with--output-format json, readstatusandidwithplutil(always present on macOS, so no new dependency), and requireAccepted. On failure, print the raw response and fetchnotarytool logfor the submission so the rejection reason lands in the workflow output.scripts/smoke-sign-notarize-hook.sh(new) — covers the hook's failure paths withcodesign,ditto, andxcrunstubbed onPATH, so it runs with no signing identity, no credentials, and no network:AcceptedInvalid, notarytool exits 0Rejected, notarytool exits 1APPLE_API_KEY_ISSUER_ID.github/workflows/examples-smoke.yml— runs it as amacos-latestjob.Validation
Invalidcase (expected exit 1, got 0). Restored the fix: all six cases pass.shellcheckclean on both scripts;yamllintclean on the workflow.pnpm test— 385 passed.Note
I drafted a matching line for the shared publishing rule and backed it out: it pushed the emitted
publishing.mdto 5118 bytes against the 5120-byte budget, and a 2-byte margin isn't worth it for a tool-specific caveat. The rule already carries the ordering requirement; the status-assertion detail lives in the script comment and is now pinned by the smoke test. Worth knowing that rule is at 5076/5120 — the next edit to it will likely need a trim elsewhere.🤖 Generated with Claude Code