oficina / memoria Public

Sparkle Mac build registers the works.oficina.memoria URL scheme

Human

Prompt

Keep the custom URL scheme works.oficina.memoria and make sure the Mac Sparkle bundle registers it (the audit found it doesn't, so "Return to Memoria" on the approval page does nothing there).

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 Info.plist from scratch with no URL types. build-mac.sh now runs scripts/register-url-scheme.py after it: CFBundleURLTypes copied from macos/Info.plist (the App Store plist, so the two Mac builds cannot disagree), then the bundle re-signed through rastrillo's own sign_bundle with the same identity, entitlements and profile. release_mac.py copies and re-signs the built app, so a release keeps the scheme. README notes bundle IDs, names and the scheme.
Agent notes
Verified: built with --updates-config mac-updates.json, plutil shows CFBundleURLTypes, codesign --verify --deep --strict passes, and lsregister -f then -dump showed 'claimed schemes: works.oficina.memoria:' for the bundle (unregistered again with lsregister -u). Delete the helper once rastrillo's bundler takes URL types itself (Docs has the same gap).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3416b4e42c78a081f8cd63ba0e1ed73f804931a8 parent 2729042
3 files changed, +54 −0
  • native/README.md +8 −0
  • native/scripts/build-mac.sh +2 −0
  • native/scripts/register-url-scheme.py +44 −0

CI passed — run details

CI log
=== vet ===
go vet ./...
go vet -tags browser ./internal/memoriatest/
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/memoria/cmd/memoria	[no test files]
?   	amadan.net/oficina/memoria/cmd/memoria-contract	[no test files]
ok  	amadan.net/oficina/memoria/internal/memoria	11.320s
ok  	amadan.net/oficina/memoria/internal/memoria/chunk	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/fact	(cached)
?   	amadan.net/oficina/memoria/internal/memoria/icons	[no test files]
ok  	amadan.net/oficina/memoria/internal/memoria/index	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/notion	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/provider	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/query	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/seal	(cached)
ok  	amadan.net/oficina/memoria/internal/memoria/sibling	(cached)
?   	amadan.net/oficina/memoria/internal/memoria/teamstate	[no test files]
ok  	amadan.net/oficina/memoria/internal/memoriatest	5.045s
?   	amadan.net/oficina/memoria/scripts/writeestilo	[no test files]
?   	amadan.net/oficina/memoria/tools/bench	[no test files]
?   	amadan.net/oficina/memoria/tools/drive	[no test files]
?   	amadan.net/oficina/memoria/tools/seed	[no test files]
?   	amadan.net/oficina/memoria/tools/vendorassets	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
diff --git a/native/README.md b/native/README.md
index 13bccf2..0f6cbdc 100644
--- a/native/README.md
+++ b/native/README.md
@@ -8,6 +8,14 @@ native columns and sheets. iPad uses the wider split layout. Both appearances
use system typography and controls. Credentials stay in the per-app Keychain;
responses and generated answers are held in memory.
+Every build is `works.oficina.memoria` (Sparkle Mac, App Store Mac and iOS);
+the iOS review fixture is `works.oficina.memoria.review`. Finder, the Dock,
+Spotlight and the home screen say "Oficina Memoria"; the app's own windows and
+the Mac menu bar say "Memoria". `native/scripts/build-mac.sh` also gives the
+Sparkle bundle the `works.oficina.memoria` URL scheme, copied from
+`native/macos/Info.plist`, because rastrillo's bundler writes none
+(`native/scripts/register-url-scheme.py`).
+
Build Mac with `native/scripts/build-mac.sh`; build the simulator app with
`native/scripts/build-iphone.sh`. For a physical device use
`OFICINA_DEVELOPMENT_TEAM=<team> native/scripts/build-iphone.sh device`. Generate
diff --git a/native/scripts/build-mac.sh b/native/scripts/build-mac.sh
index 8cc6b26..856b6b0 100755
--- a/native/scripts/build-mac.sh
+++ b/native/scripts/build-mac.sh
@@ -4,3 +4,5 @@ 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" . Memoria "$@"
+# The shared bundler registers no URL scheme; see register-url-scheme.py.
+python3 scripts/register-url-scheme.py "$shared_native/tools" "$@"
diff --git a/native/scripts/register-url-scheme.py b/native/scripts/register-url-scheme.py
new file mode 100644
index 0000000..325e004
--- /dev/null
+++ b/native/scripts/register-url-scheme.py
@@ -0,0 +1,44 @@
+"""Give the Sparkle Mac bundle Memoria's URL scheme, then sign it again.
+
+rastrillo/native's tools/bundle-mac.py writes the bundle's Info.plist from
+scratch and has no way to take URL types, so the direct-download Mac app
+registered no works.oficina.memoria:// scheme while the App Store and iOS
+builds did. The browser approval page then sends "Return to Memoria" to
+nothing (native-levelup reports/memoria.md 4.3). This copies CFBundleURLTypes
+from macos/Info.plist, the App Store target's plist, so the two Mac builds
+cannot disagree, and re-signs the host the way bundle-mac.py did: same
+identity, same declared entitlements and profile. Delete it once the shared
+bundler takes URL types itself.
+
+Usage, from native/: register-url-scheme.py <rastrillo tools dir> <bundle-mac.py args...>
+"""
+import argparse
+from pathlib import Path
+import plistlib
+import sys
+
+tools = Path(sys.argv[1]).resolve()
+sys.path.insert(0, str(tools))
+from mac_updates import sign_bundle, signing_declaration # noqa: E402
+
+# The subset of bundle-mac.py's options that decide where the bundle is and how
+# it was signed. Everything else it takes is ignored here.
+parser = argparse.ArgumentParser(allow_abbrev=False)
+parser.add_argument("--display-name", default="Oficina Memoria")
+parser.add_argument("--updates-config", type=Path)
+parser.add_argument("--entitlements", type=Path)
+parser.add_argument("--provisioning-profile", type=Path)
+parser.add_argument("--sign-identity", default="-")
+args, _ = parser.parse_known_args(sys.argv[2:])
+
+app = Path("build") / f"{args.display_name}.app"
+info_path = app / "Contents/Info.plist"
+info = plistlib.loads(info_path.read_bytes())
+url_types = plistlib.loads(Path("macos/Info.plist").read_bytes())["CFBundleURLTypes"]
+schemes = [scheme for entry in url_types for scheme in entry["CFBundleURLSchemes"]]
+if "works.oficina.memoria" not in schemes:
+ raise SystemExit("register-url-scheme: macos/Info.plist no longer registers works.oficina.memoria")
+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))
+print(f"{app}: registers {', '.join(schemes)}")