Skip to content

Resolve notary profile deterministically from the signing keychain - #90

Merged
alexkroman merged 1 commit into
mainfrom
fix-notary-preflight-order
Jul 27, 2026
Merged

Resolve notary profile deterministically from the signing keychain#90
alexkroman merged 1 commit into
mainfrom
fix-notary-preflight-order

Conversation

@alexkroman

@alexkroman alexkroman commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The release preflight resolved the blurt-notary notary profile via the keychain search list (no --keychain), which is non-deterministic: notarytool picks the profile from whichever keychain on the search list happens to hold one. On this machine the profile exists only in an incidental electron-builder keychain — not in login and not in the dedicated blurt-signing keychain where the design intends it to live. So the lookup succeeded or failed depending purely on search-list order and lock state, surfacing as an intermittent notarytool profile 'blurt-notary' not found.

This makes the lookup deterministic:

  • Populate NOTARY_KEYCHAIN=(--keychain "$SIGNING_KEYCHAIN") once the signing keychain is unlocked, and run the preflight check after the unlock.
  • Pin the preflight history check and the submit/log calls in notarize() to that keychain, so the whole pipeline uses the same, intended profile.
  • On machines with no dedicated signing keychain the array stays empty and we fall back to the search list as before. Expanded with ${arr[@]+"${arr[@]}"} so the empty case is safe under set -u on macOS bash 3.2.
  • The "not found" hint now names the signing keychain and tells you to store the profile there with --keychain; the release skill's preconditions say the same.

Operator action required: store the profile in the signing keychain:
xcrun notarytool store-credentials blurt-notary --keychain ~/Library/Keychains/blurt-signing.keychain-db --apple-id <you> --team-id Y54ZB9JF63 --password <app-specific-pw>

Note: a separate blocker exists — Apple currently returns 403 — a required agreement is missing or has expired; the account's Developer Program License Agreement must be re-signed before notarization will succeed.

Verification

  • shellcheck -x scripts/release-build.sh — clean (exit 0).
  • bash -n scripts/release-build.sh under /bin/bash 3.2.57 — parses.
  • Confirmed empty-array expansion ${arr[@]+"${arr[@]}"} is safe under set -euo pipefail on bash 3.2.

🤖 Generated with Claude Code

The blurt-notary credentials live in the dedicated blurt-signing keychain,
which stays locked at rest by design. The preflight ran the notarytool profile
check before unlock_signing_keychain, and since notarytool reads
non-interactively it couldn't see the profile in a locked keychain — so it
died "profile not found" before ever reaching the unlock step, never prompting
to load the keychain. Move the check after the unlock so a genuine "not found"
really means the profile was never stored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 27, 2026 21:53
@alexkroman
alexkroman enabled auto-merge July 27, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a release-script failure where the blurt-notary keychain profile could not be found because the dedicated blurt-signing keychain was still locked when notarytool was invoked. It reorders the preflight so the signing keychain is unlocked first, making the subsequent notary-profile check meaningful in non-interactive contexts.

Changes:

  • Unlock the dedicated signing keychain before running xcrun notarytool history --keychain-profile ... in the preflight.
  • Add inline commentary documenting why the ordering matters for notarytool profile visibility.
Comments suppressed due to low confidence (1)

scripts/release-build.sh:195

  • notarytool history failures are currently always reported as "profile not found" because all output is discarded and the die message assumes a specific cause. Capture stderr and include it (and optionally hint at --keychain "$SIGNING_KEYCHAIN") so non-profile failures (network/service/auth) are diagnosable and not misclassified.
xcrun notarytool history --keychain-profile "$NOTARY_PROFILE" >/dev/null 2>&1 \
  || die "notarytool profile '$NOTARY_PROFILE' not found. Run: xcrun notarytool store-credentials $NOTARY_PROFILE --apple-id <you@example.com> --team-id $TEAM_ID --password <app-specific-password>"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/release-build.sh
Comment on lines +189 to +193
# Check the notary profile only AFTER unlocking the signing keychain: the
# blurt-notary credentials live in that keychain, and notarytool runs
# non-interactively, so against a still-locked keychain it can't read the
# profile item and reports it as missing. Unlock first, then a genuine
# "not found" here really means the profile was never stored.
@alexkroman
alexkroman added this pull request to the merge queue Jul 27, 2026
Merged via the queue into main with commit fc58c91 Jul 27, 2026
8 checks passed
@alexkroman
alexkroman deleted the fix-notary-preflight-order branch July 27, 2026 22:16
@alexkroman alexkroman changed the title Unlock signing keychain before the notary preflight check Resolve notary profile deterministically from the signing keychain Jul 27, 2026
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.

3 participants