oficina / sheets Public

native: register works.oficina.sheets in the Sparkle Mac bundle

Human

Prompt

Phase 0 of the Oficina native level-up for Sheets. Follow native-levelup/BRIEF.md. Pin Sheets' native dependency to rastrillo/native branch native/levelup-phase0-tools tip 238e4903ffcae42b52eba5c07c6a4af8d4348e08 (repin to rastrillo main once it lands; keep the pin change a single, easy-to-update commit). Do, and only do: 1. Repin rastrillo/native from 14ee567, fix what the bump breaks, fix native/README.md:21's wrong revision. 2. Bundle IDs -> works.oficina.sheets on every build (Mac Sparkle mac-updates.json bundle_id, App Store Mac, iOS); review/dev variant -> works.oficina.sheets.review; keep the custom URL scheme works.oficina.sheets and make sure the Mac Sparkle bundle registers it. 3. Names: Finder/Dock/Spotlight/home-screen "Oficina Sheets"; plain "Sheets" inside the app's own UI; check the iOS home-screen label in the simulator (screenshot) and report whether it truncates. 4. No keychain-access-groups/associated-domains entitlements yet; no sign-in code changes. 5. Run the native gates (Mac build + iOS simulator build + tests) and make ci. Push, describe the branch on the hub, stop.

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

rastrillo's bundle-mac.py writes an Info.plist with no URL types, so the direct-download build never received the sign-in callback (audit 4.7). build-mac.sh now runs scripts/mac-url-types.py after bundling: it copies CFBundleURLTypes from macos/Info.plist (the App Store declaration, so the two cannot drift) and re-signs with the same identity, entitlements and profile through rastrillo's sign_bundle. release_mac.py signs a copy of this built app, so releases carry it. test-mac-bundle.py now also asserts the ID, the names and the scheme.
Agent notes
Cleaner long-term home: a --url-scheme option on rastrillo's bundle-mac.py (Docs, Calendar and Memoria have the same gap); then this helper goes. test-mac-bundle.py's existing 'No SwiftPM fallback paths found' precondition fails on Swift 6.4.2 independent of this branch: the toolchain no longer embeds .build paths in resource accessors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a54595d0b88a068412dd661ca5f65e17df12af07 parent 0d5a1ad
3 files changed, +50 −0
  • native/scripts/build-mac.sh +1 −0
  • native/scripts/mac-url-types.py +41 −0
  • native/scripts/test-mac-bundle.py +8 −0

CI passed — run details

diff --git a/native/scripts/build-mac.sh b/native/scripts/build-mac.sh
index 6c81843..9dcbc96 100755
--- a/native/scripts/build-mac.sh
+++ b/native/scripts/build-mac.sh
@@ -4,3 +4,4 @@ cd "$(dirname "$0")/.."
swift package --package-path apple resolve
shared_native="${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}"
python3 "$shared_native/tools/bundle-mac.py" . Sheets "$@"
+python3 scripts/mac-url-types.py "$shared_native/tools" "$@"
diff --git a/native/scripts/mac-url-types.py b/native/scripts/mac-url-types.py
new file mode 100755
index 0000000..f6b47b9
--- /dev/null
+++ b/native/scripts/mac-url-types.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+"""Register the sign-in URL scheme in the Sparkle Mac bundle, then re-sign it.
+
+rastrillo's bundle-mac.py writes its own Info.plist and declares no URL types,
+so without this the direct-download build never receives
+works.oficina.sheets://signin and only the exchange poll completes sign-in.
+The App Store build gets the same declaration from macos/project.yml, through
+macos/Info.plist; this copies it from there so the two cannot drift.
+
+Takes the arguments build-mac.sh passed to bundle-mac.py, finds the bundle
+the same way it named it, and signs again with the same identity,
+entitlements and profile.
+"""
+import argparse
+from pathlib import Path
+import plistlib
+import sys
+
+parser = argparse.ArgumentParser(description=__doc__)
+parser.add_argument("tools", type=Path, help="rastrillo/native's tools directory")
+parser.add_argument("--display-name", default="Oficina Sheets")
+parser.add_argument("--sign-identity", default="-")
+parser.add_argument("--updates-config", type=Path)
+parser.add_argument("--entitlements", type=Path)
+parser.add_argument("--provisioning-profile", type=Path)
+args, _ = parser.parse_known_args()
+sys.path.insert(0, str(args.tools.resolve()))
+from mac_updates import sign_bundle, signing_declaration # noqa: E402
+
+native = Path(__file__).resolve().parents[1]
+app = native / f"build/{args.display_name}.app"
+store = plistlib.loads((native / "macos/Info.plist").read_bytes())
+url_types = store["CFBundleURLTypes"]
+if not any("works.oficina.sheets" in entry.get("CFBundleURLSchemes", []) for entry in url_types):
+ raise SystemExit("mac-url-types: macos/Info.plist no longer declares works.oficina.sheets")
+info_path = app / "Contents/Info.plist"
+info = plistlib.loads(info_path.read_bytes())
+info["CFBundleURLTypes"] = url_types
+info_path.write_bytes(plistlib.dumps(info))
+sign_bundle(app, args.sign_identity,
+ *signing_declaration(args.updates_config, args.entitlements, args.provisioning_profile))
diff --git a/native/scripts/test-mac-bundle.py b/native/scripts/test-mac-bundle.py
index 3096f67..138c28b 100644
--- a/native/scripts/test-mac-bundle.py
+++ b/native/scripts/test-mac-bundle.py
@@ -22,6 +22,14 @@ with tempfile.TemporaryDirectory(prefix="oficina-sheets-launch-") as directory:
assert len(apps) == 1, "Expected one application in release archive"
app = apps[0]
info = plistlib.loads((app / "Contents/Info.plist").read_bytes())
+ # Paul, 2026-11-14: works.oficina.* on every build, "Oficina Sheets" where
+ # Finder looks, plain "Sheets" in the menu bar, and the sign-in scheme
+ # registered so the browser's callback reaches the app.
+ assert info["CFBundleIdentifier"] == "works.oficina.sheets", info["CFBundleIdentifier"]
+ assert app.name == "Oficina Sheets.app" and info["CFBundleDisplayName"] == "Oficina Sheets", app.name
+ assert info["CFBundleName"] == "Sheets", info["CFBundleName"]
+ assert any("works.oficina.sheets" in entry.get("CFBundleURLSchemes", [])
+ for entry in info.get("CFBundleURLTypes", [])), "works.oficina.sheets URL scheme not registered"
executable = app / "Contents/MacOS" / info["CFBundleExecutable"]
strings = subprocess.check_output(["strings", str(executable)], text=True).splitlines()
fallbacks = {line.split("/.build/", 1)[0] + "/.build" for line in strings