oficina / meet Public

release-mac.sh: the works.oficina.calls Mac release, up to publication

Human

Prompt

2. Write a new release script for works.oficina.calls (do not copy release-calls-0.4.16.sh unchanged: it hard-codes net.amadan.oficina.calls, the .ios ID and build/Calls.app) — or document exactly how the existing release tooling (rastrillo tools/release_mac.py + publish_mac_update.py, native/mac-updates.json) produces "Oficina Calls.app" as works.oficina.calls build 31+ (above the last published build), Developer ID signed and notarised. Calls' Mac release needs NO extra entitlements yet — camera/mic only. 3. Dry-run the release locally up to (not including) publishing.

From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.

Summary

native/scripts/release-mac.sh <version> <build> preflights (clean tree, works.oficina.calls, tools from the pinned rastrillo/native checkout, build above the live feed's newest), checks the Developer ID, Sparkle key and notary profile, builds the release configuration, runs release_mac.py (sign inside out, notarise, staple, Gatekeeper, Sparkle-signed zip and release.json), smoke-tests the zip as a quarantined download (names, icon, RastrilloApple resources, Gatekeeper verdict, 20 s translocated launch), and runs publish_mac_update.py's read-only plan. It reads the bundle ID, feed and key from mac-updates.json and publishes nothing; it prints the publish command. native/README.md gains "Releasing the Mac app" with the steps and the remaining publish step.
Agent notes
Unlike release-calls-0.4.16.sh it is in the repository, takes the version and build as arguments, and drops the iPhone device build, PAT minting and publication; those are written down in the README instead of being automated untested.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev da5fc98394b1a0fc79ac850dc0c3bfa362675437 parent 96ef413
2 files changed, +277 −8
  • native/README.md +66 −8
  • native/scripts/release-mac.sh +211 −0

CI passed — run details

CI log
=== vet ===
go vet ./...
=== fmt ===
=== test ===
go test ./...
ok  	amadan.net/oficina/calls/callscore	7.451s
ok  	amadan.net/oficina/calls/cmd/calls	13.278s
?   	amadan.net/oficina/calls/cmd/calls-contract	[no test files]
ok  	amadan.net/oficina/calls/cmd/quality-summary	0.009s
ok  	amadan.net/oficina/calls/internal/calls	12.784s
ok  	amadan.net/oficina/calls/internal/calls/apns	0.007s
ok  	amadan.net/oficina/calls/internal/calls/hub	1.055s
?   	amadan.net/oficina/calls/internal/calls/icons	[no test files]
?   	amadan.net/oficina/calls/internal/calls/keymailtest	[no test files]
ok  	amadan.net/oficina/calls/internal/calls/relay	0.003s
ok  	amadan.net/oficina/calls/internal/calls/seal	0.002s
?   	amadan.net/oficina/calls/internal/calls/teamstate	[no test files]
ok  	amadan.net/oficina/calls/internal/callstest	12.333s
ok  	amadan.net/oficina/calls/protocol	0.002s
?   	amadan.net/oficina/calls/scripts/writeestilo	[no test files]
=== migration-check ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo migration check
rastrillo migration check: models and migrations agree
=== race ===
CGO_ENABLED=1 go test -race ./internal/...
ok  	amadan.net/oficina/calls/internal/calls	87.947s
ok  	amadan.net/oficina/calls/internal/calls/apns	1.024s
ok  	amadan.net/oficina/calls/internal/calls/hub	4.588s
?   	amadan.net/oficina/calls/internal/calls/icons	[no test files]
?   	amadan.net/oficina/calls/internal/calls/keymailtest	[no test files]
ok  	amadan.net/oficina/calls/internal/calls/relay	1.019s
ok  	amadan.net/oficina/calls/internal/calls/seal	1.011s
?   	amadan.net/oficina/calls/internal/calls/teamstate	[no test files]
ok  	amadan.net/oficina/calls/internal/callstest	47.539s
diff --git a/native/README.md b/native/README.md
index 29b7a23..33f9deb 100644
--- a/native/README.md
+++ b/native/README.md
@@ -706,7 +706,9 @@ The production handoff endpoints were deployed in `86ed9f3`. In-progress handoff
server restart. There are at most 256 pending handoffs per server process.
`make native-mac` builds for the host Mac and signs the local `.app` ad hoc.
-Developer ID signing, notarization and App Store packaging remain follow-up work.
+Developer ID signing and notarization are `scripts/release-mac.sh` (see
+[Releasing the Mac app](#releasing-the-mac-app)); App Store packaging remains
+follow-up work.
The iPhone target, device builds and Safari tests are described in
[ios/README.md](ios/README.md).
@@ -740,13 +742,69 @@ be reinstalled by hand, once:
- the old "Calls" rows in System Settings ▸ Privacy & Security (Camera,
Microphone, Screen Recording).
-**For the next release.** The release archive is now named
-`works.oficina.calls-<build>.zip` (release_mac.py names it after the bundle
-ID). The app to package is `native/build/Oficina Calls.app`. The last release
-script, `/Users/paulcampbell/amadan.net/oficina/release-calls-0.4.16.sh`
-(outside this repository), hard-codes the old IDs (`BUNDLE_ID`,
-`IOS_BUNDLE_ID`, lines 36-37) and `build/Calls.app` (lines 211-257). Don't
-copy it unchanged for the next release.
+**For the next release.** Use `scripts/release-mac.sh` (below). The archive
+is now `works.oficina.calls-<build>.zip` (release_mac.py names it after the
+bundle ID), holding `Oficina Calls.app`. The old release scripts outside this
+repository (`/Users/paulcampbell/amadan.net/oficina/release-calls-0.4.16.sh`
+and its predecessors) hard-code `net.amadan.oficina.calls`, the `.ios` ID and
+`build/Calls.app`; don't use them again.
+
+## Releasing the Mac app
+
+`native/scripts/release-mac.sh <version> <build>` does everything up to
+publication and publishes nothing:
+
+1. **Preflight**: a clean tree; `mac-updates.json` is `works.oficina.calls`;
+ rastrillo/native's tools are the checkout Package.resolved pins
+ (`apple/.build/checkouts/native/tools`), not a separate copy; the build is
+ above every build in the live feed (the publisher refuses anything else).
+2. **Keychain**: the Developer ID identity (default `Developer ID
+ Application: Team Tito Limited (9U4A84C4WK)`), the Sparkle EdDSA key
+ (account from `mac-updates.json`) matching `public_ed_key`, and the
+ notarytool profile (default `slopbox-notary`).
+3. **Build**: `build-mac.sh` in the release configuration with the update
+ configuration, version and build (`OFICINA_SKIP_PREPARE=1` reuses
+ `native/build`'s CallsBridge, RNNoise and DeepFilter).
+4. **`release_mac.py`**: signs inside out with the hardened runtime, submits
+ to the notary service and waits, staples, asks Gatekeeper, zips and signs
+ the archive for Sparkle, and writes `release.json` beside it in the record
+ directory (default
+ `~/amadan.net/oficina/sparkle-worktrees/releases/calls-<version>-<build>`).
+ The only entitlements are the camera and audio input the usage strings ask
+ for; Calls declares no `entitlements` or `provisioning_profile` in
+ `mac-updates.json` yet (Oficina ID's shared keychain is a later slice).
+5. **Smoke test**: the zip unpacked as a quarantined download is "Oficina
+ Calls.app" with the ID, display name "Oficina Calls", CFBundleName and
+ SUBundleName "Calls", the asset-catalog icon and RastrilloApple's resources;
+ it has a stapled ticket, Gatekeeper accepts it as Notarized Developer ID,
+ and it stays up 20 s launched translocated.
+6. **The publisher's plan**: `publish_mac_update.py` without `--publish`,
+ against the `oficina/native-releases` clone (default
+ `~/amadan.net/oficina/sparkle-worktrees/native-releases`, clean, on main).
+ It checks the archive's metadata and signature and the build number, and
+ prints the tag, download URL and feed, changing nothing.
+
+A record directory holding this build's finished release is reused, so a rerun
+after a failure in step 5 or 6 does not notarise again.
+
+**Publishing** is the one remaining command, which the script prints:
+
+```sh
+python3 native/apple/.build/checkouts/native/tools/publish_mac_update.py \
+ <record> --config native/mac-updates.json \
+ --repo ~/amadan.net/oficina/sparkle-worktrees/native-releases \
+ --sparkle-tools native/apple/.build/artifacts/sparkle/Sparkle/bin --publish
+```
+
+It pushes the tag `calls-<build>` to `oficina/native-releases`, uploads the zip
+with `amadan release create`, checks the anonymous download against
+`release.json`, and only then commits and pushes `calls/appcast.xml`. Run it
+as the agent: `AMADAN_HOME=~/.amadan-claude-agent` for `amadan`, and git
+pushing with a temporary PAT from `amadan tokens create` (through
+`GIT_ASKPASS`, with `credential.helper` reset), revoked afterwards, as the
+0.4.x release scripts did. Rerunning it is the recovery. Then check the live
+feed's newest item, and reinstall by hand once (above): no installed Calls
+before this release can take it as an update.
## Quality reports and Report a problem
diff --git a/native/scripts/release-mac.sh b/native/scripts/release-mac.sh
new file mode 100755
index 0000000..ecf2fbc
--- /dev/null
+++ b/native/scripts/release-mac.sh
@@ -0,0 +1,211 @@
+#!/bin/zsh
+# A Calls Mac release, up to but not including publication: "Oficina Calls.app"
+# as works.oficina.calls, Developer ID signed inside out, notarised, stapled,
+# checked by Gatekeeper as a quarantined download, launched, and validated
+# against the feed by the publisher's own read-only plan.
+#
+# native/scripts/release-mac.sh <version> <build>
+# native/scripts/release-mac.sh 0.5.0 31
+#
+# It publishes nothing: no tag, no release asset, no appcast commit. The last
+# thing it prints is the publish command, for whoever publishes (see "Releasing
+# the Mac app" in native/README.md).
+#
+# Everything Calls-specific is read from the repository, not written here: the
+# bundle ID, feed and Sparkle key from native/mac-updates.json, the app's file
+# name from what scripts/bundle-mac.py built, and rastrillo/native's release
+# tools from the revision Package.resolved pins (apple/.build/checkouts/native).
+# So it cannot drift from the app the way release-calls-0.4.16.sh (outside the
+# repository, net.amadan.oficina.calls and build/Calls.app hard-coded) did.
+#
+# Environment:
+# IDENTITY Developer ID identity (default Team Tito Limited's)
+# TEAM its Team ID (default 9U4A84C4WK)
+# NOTARY_PROFILE notarytool keychain profile (default slopbox-notary)
+# RECORD release directory (default
+# ~/amadan.net/oficina/sparkle-worktrees/releases/calls-<version>-<build>);
+# it must not exist, unless it holds this build's finished
+# release, which is then checked and reused
+# ARTIFACTS the oficina/native-releases clone the plan is checked
+# against (default ~/amadan.net/oficina/sparkle-worktrees/native-releases);
+# unset or missing skips the plan with a warning
+# OFICINA_SKIP_PREPARE=1 reuse native/build's CallsBridge, RNNoise and
+# DeepFilter instead of rebuilding them (build-mac.sh)
+# ALLOW_DIRTY=1 build from a tree with local changes (a rehearsal only:
+# the release records the commit, which then does not name it)
+
+set -e -u -o pipefail
+setopt no_nomatch
+
+VERSION=${1:?usage: release-mac.sh <version> <build>}
+BUILD=${2:?usage: release-mac.sh <version> <build>}
+[[ $VERSION =~ '^[0-9]+(\.[0-9]+){0,2}$' ]] || { print -u2 "version must be numeric, like 0.5.0"; exit 2 }
+[[ $BUILD =~ '^[1-9][0-9]*$' ]] || { print -u2 "build must be a positive integer"; exit 2 }
+
+IDENTITY=${IDENTITY:-'Developer ID Application: Team Tito Limited (9U4A84C4WK)'}
+TEAM=${TEAM:-9U4A84C4WK}
+NOTARY_PROFILE=${NOTARY_PROFILE:-slopbox-notary}
+
+NATIVE=${0:A:h:h}
+REPO=${NATIVE:h}
+CONFIG=$NATIVE/mac-updates.json
+TOOLS=$NATIVE/apple/.build/checkouts/native/tools
+SPARKLE_BIN=$NATIVE/apple/.build/artifacts/sparkle/Sparkle/bin
+RECORD=${RECORD:-$HOME/amadan.net/oficina/sparkle-worktrees/releases/calls-$VERSION-$BUILD}
+ARTIFACTS=${ARTIFACTS-$HOME/amadan.net/oficina/sparkle-worktrees/native-releases}
+
+json() { python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[sys.argv[2]])' "$@" }
+BUNDLE_ID=$(json "$CONFIG" bundle_id)
+FEED_URL=$(json "$CONFIG" feed_url)
+ZIP=$BUNDLE_ID-$BUILD.zip
+
+typeset -a NOTES
+STEP=0
+SMOKE_PID=""
+TMP=$(mktemp -d "${TMPDIR:-/tmp}/calls-release.XXXXXX")
+step() { STEP=$((STEP + 1)); print -P "\n%B%F{cyan}==> [$STEP/6] $*%f%b" }
+say() { print -r -- " $*" }
+ok() { print -n -P " %F{green}ok%f "; print -r -- "$*" }
+warn() { print -n -P " %F{yellow}warning:%f "; print -r -- "$*"; NOTES+=("$*") }
+die() { print -n -P "%F{red}error:%f " >&2; print -r -- "$*" >&2; exit 1 }
+need() { [[ -e $1 ]] || die "missing: $1" }
+plist() { plutil -extract "$2" raw -o - "$1/Contents/Info.plist" }
+on_exit() {
+ local rc=$?
+ [[ -n $SMOKE_PID ]] && kill "$SMOKE_PID" 2>/dev/null || true
+ rm -rf "$TMP"
+ (( rc == 0 )) || print -P "\n%F{red}%BFAILED%b at step $STEP, exit $rc. Nothing was published.%f" >&2
+}
+trap on_exit EXIT
+trap 'exit 130' INT TERM
+
+COMMIT=$(git -C "$REPO" rev-parse HEAD)
+print -P "%BOficina Calls $VERSION ($BUILD), $BUNDLE_ID%b, commit ${COMMIT[1,12]}"
+
+# ---- 1. Preflight (read-only) ---------------------------------------------
+step "Preflight: tree, tools, feed"
+if [[ -n $(git -C "$REPO" status --porcelain --untracked-files=no) ]]; then
+ [[ ${ALLOW_DIRTY:-0} == 1 ]] || die "the tree has local changes; commit them (or ALLOW_DIRTY=1 for a rehearsal)"
+ warn "built from a tree with local changes: $COMMIT does not name this build"
+fi
+[[ $BUNDLE_ID == works.oficina.calls ]] || die "mac-updates.json says $BUNDLE_ID, not works.oficina.calls"
+for tool in python3 curl shasum ditto xcrun spctl codesign; do command -v $tool >/dev/null || die "$tool not on PATH"; done
+# The pinned tools exist only after SwiftPM has resolved the package once.
+[[ -d $TOOLS ]] || swift package --package-path "$NATIVE/apple" resolve
+for file in "$TOOLS/release_mac.py" "$TOOLS/publish_mac_update.py" "$SPARKLE_BIN/sign_update" "$SPARKLE_BIN/generate_keys" "$SPARKLE_BIN/generate_appcast"; do need "$file"; done
+pinned=$(python3 -c 'import json,sys; print(next(p["state"]["revision"] for p in json.load(open(sys.argv[1]))["pins"] if p["identity"] == "native"))' "$NATIVE/apple/Package.resolved")
+checkout=$(git -C "$TOOLS/.." rev-parse HEAD)
+[[ $checkout == $pinned ]] || die "rastrillo/native checkout is ${checkout[1,7]}, Package.resolved pins ${pinned[1,7]}; run swift package resolve"
+ok "rastrillo/native tools at the pin, ${pinned[1,7]}"
+# The publisher refuses a build at or below any published one; say so now,
+# before twenty minutes of building and notarising.
+curl -fsS "$FEED_URL" -o "$TMP/feed.xml" || die "could not fetch $FEED_URL"
+newest=$(python3 - "$TMP/feed.xml" <<'PY'
+import sys, xml.etree.ElementTree as ET
+S = '{http://www.andymatuschak.org/xml-namespaces/sparkle}'
+print(max([int(v.text) for v in ET.parse(sys.argv[1]).iter(S + 'version')] or [0]))
+PY
+)
+(( BUILD > newest )) || die "the feed already has build $newest; this build must be above it"
+ok "feed's newest build is $newest; $BUILD is above it"
+
+# ---- 2. Keychain (read-only) ------------------------------------------------
+step "Keychain: Developer ID, Sparkle key, notary profile"
+[[ $(security find-identity -v -p codesigning) == *"\"$IDENTITY\""* ]] || die "no valid '$IDENTITY' identity"
+ok "$IDENTITY"
+key=$("$SPARKLE_BIN/generate_keys" --account "$(json "$CONFIG" keychain_account)" -p)
+[[ $key == $(json "$CONFIG" public_ed_key) ]] || die "the Sparkle key in the keychain is not mac-updates.json's public_ed_key"
+ok "Sparkle EdDSA key matches mac-updates.json"
+xcrun notarytool history --keychain-profile "$NOTARY_PROFILE" >/dev/null || die "notary profile $NOTARY_PROFILE did not authenticate"
+ok "notary profile $NOTARY_PROFILE authenticates"
+
+# ---- 3. Build ---------------------------------------------------------------
+REUSE=0
+if [[ -e $RECORD ]]; then
+ [[ -f $RECORD/release.json && -f $RECORD/$ZIP ]] || die "$RECORD exists without release.json and $ZIP; inspect and remove it"
+ [[ $(json "$RECORD/release.json" version) == $VERSION && $(json "$RECORD/release.json" build) == $BUILD ]] || die "$RECORD is another release"
+ REUSE=1
+fi
+step "Build Oficina Calls.app $VERSION ($BUILD), release configuration"
+APP=$NATIVE/build/Oficina\ Calls.app
+if (( REUSE )); then
+ say "skipped: reusing the notarised release in ${RECORD/#$HOME/~}"
+else
+ (cd "$NATIVE" && OFICINA_BUILD_CONFIGURATION=release scripts/build-mac.sh \
+ --updates-config mac-updates.json --version "$VERSION" --build "$BUILD" --sign-identity "$IDENTITY")
+ [[ $(plist "$APP" CFBundleIdentifier) == $BUNDLE_ID ]] || die "built app is not $BUNDLE_ID"
+ [[ $(plist "$APP" CFBundleShortVersionString) == $VERSION && $(plist "$APP" CFBundleVersion) == $BUILD ]] || die "built app is not $VERSION ($BUILD)"
+ ok "${APP/#$HOME/~} is $BUNDLE_ID $VERSION ($BUILD)"
+fi
+
+# ---- 4. Sign, notarise, staple, EdDSA (release_mac.py) -------------------------
+step "release_mac.py: sign inside out, notarise, staple, Gatekeeper, Sparkle archive"
+if (( ! REUSE )); then
+ say "notarisation usually takes a few minutes"
+ python3 "$TOOLS/release_mac.py" "$APP" --config "$CONFIG" --sparkle-tools "$SPARKLE_BIN" \
+ --identity "$IDENTITY" --team "$TEAM" --notary-profile "$NOTARY_PROFILE" --output "$RECORD"
+fi
+SHA=$(json "$RECORD/release.json" sha256); LEN=$(json "$RECORD/release.json" length)
+[[ $(shasum -a 256 "$RECORD/$ZIP" | cut -d' ' -f1) == $SHA ]] || die "$ZIP's digest differs from release.json"
+ok "$ZIP: $LEN bytes, sha256 $SHA, notarisation $(json "$RECORD/release.json" notarization_id)"
+say "entitlements: $(python3 -c 'import json,sys; print(", ".join(sorted(json.load(open(sys.argv[1]))["entitlements"])))' "$RECORD/release.json")"
+
+# ---- 5. The download, as a person gets it ----------------------------------------
+step "Smoke test: quarantined copy, names, Gatekeeper, translocated launch for 20 s"
+SMOKE=$TMP/smoke
+mkdir -p "$SMOKE"
+ditto -x -k "$RECORD/$ZIP" "$SMOKE"
+apps=("$SMOKE"/*.app(N))
+(( ${#apps} == 1 )) || die "the archive holds ${#apps} apps, not one"
+GOT=${apps[1]}
+[[ ${GOT:t} == "Oficina Calls.app" ]] || die "the archive holds ${GOT:t}, not Oficina Calls.app"
+for pair in CFBundleIdentifier=$BUNDLE_ID CFBundleDisplayName="Oficina Calls" CFBundleName=Calls SUBundleName=Calls CFBundleIconName=AppIcon; do
+ [[ $(plist "$GOT" ${pair%%=*}) == ${pair#*=} ]] || die "${pair%%=*} is '$(plist "$GOT" ${pair%%=*})', not '${pair#*=}'"
+done
+ok "Oficina Calls.app: $BUNDLE_ID, display name Oficina Calls, CFBundleName and SUBundleName Calls"
+[[ -f $GOT/Contents/Resources/Assets.car ]] || die "no Assets.car"
+[[ -d $GOT/Contents/Resources/RastrilloNative_RastrilloApple.bundle ]] || die "no RastrilloApple resources (the app menu's strings)"
+xattr -w com.apple.quarantine "0081;$(printf %x $(date +%s));Safari;" "$GOT"
+xcrun stapler validate "$GOT" >/dev/null || die "no stapled ticket"
+gk=$(spctl --assess --type execute -vv "$GOT" 2>&1) || die "Gatekeeper rejected the app: $gk"
+[[ $gk == *"source=Notarized Developer ID"* && $gk == *"origin=$IDENTITY"* ]] || die "unexpected Gatekeeper verdict: $gk"
+ok "Gatekeeper: accepted, Notarized Developer ID, $TEAM"
+say "launching; if macOS asks whether to open an app downloaded from the Internet, click Open"
+open -n "$GOT"
+for _ in {1..60}; do
+ SMOKE_PID=$(pgrep -f 'AppTranslocation/.*/Oficina Calls\.app/Contents/MacOS/CallsMac' | head -1 || true)
+ [[ -n $SMOKE_PID ]] && break
+ sleep 1
+done
+[[ -n $SMOKE_PID ]] || die "the translocated app did not start within 60 s"
+sleep 20
+kill -0 "$SMOKE_PID" 2>/dev/null || die "the app quit within 20 s of launch"
+ok "ran translocated for 20 s (pid $SMOKE_PID)"
+kill "$SMOKE_PID" 2>/dev/null || true
+SMOKE_PID=""
+
+# ---- 6. The publisher's plan (read-only) ------------------------------------------
+step "publish_mac_update.py plan (validates; changes nothing)"
+if [[ -n $ARTIFACTS && -d $ARTIFACTS/.git ]]; then
+ python3 "$TOOLS/publish_mac_update.py" "$RECORD" --config "$CONFIG" --repo "$ARTIFACTS" --sparkle-tools "$SPARKLE_BIN"
+else
+ warn "no native-releases clone at '${ARTIFACTS:-unset}'; the publisher's plan was not checked"
+fi
+
+cat <<EOF
+
+----- Oficina Calls $VERSION ($BUILD): ready to publish, NOT published -----
+commit: $COMMIT
+release: $RECORD
+archive: $ZIP $LEN bytes sha256 $SHA
+feed: $FEED_URL (newest now $newest)
+notes: ${(j:; :)NOTES:-none}
+
+Publish (pushes tag calls-$BUILD, uploads the zip, commits the appcast), with
+git and amadan as the agent (native/README.md, "Releasing the Mac app"):
+ python3 $TOOLS/publish_mac_update.py \\
+ $RECORD \\
+ --config $CONFIG --repo ${ARTIFACTS:-<native-releases clone>} \\
+ --sparkle-tools $SPARKLE_BIN --publish
+------------------------------------------------------------------------
+EOF