Sovereign Blueprint: Universal macOS Build (Apple Silicon & Intel)
IMPORTANT
AI Context & Knowledge Heritage
- Subsystem: Sovereign Deployment & Desktop Shell / macOS Universal
- Architecture:
@docs ARCHITECTURE:DesktopShell,@docs ARCHITECTURE:Core - Failure Path: Sidecar missing in
.appbundle, permission denial on read-only/Applications, Gatekeeper quarantine failure, architecture slice mismatch in fat binary. - Observability:
sidecar_runtime.login App Support directory, GitHub Actions artifact verification.
1. Executive Summary & Architectural Scope
This blueprint defines the architecture, contracts, and deterministic execution plan for delivering a Universal macOS Application (.dmg and .app) for Tadpole OS from the existing unified repository.
The build will natively support both:
- Apple Silicon (
aarch64-apple-darwin): M1, M2, M3, M4 series. - Intel x86_64 (
x86_64-apple-darwin): Legacy macOS hardware.
Architectural Decisions (Locked via Socratic Gate)
- Repository Topology: Unified Monorepo (No separate repository). Shared React 19 UI, shared Rust Axum engine, shared database models.
- Code Signing & Notarization: Ad-hoc signed; not notarized.
bundle.macOS.signingIdentity: "-"requests ad-hoc signing without Apple Developer credentials. Gatekeeper can still require operator approval. - Data & Persistence Layout: Hybrid macOS Standard. Defaults to
~/Library/Application Support/com.tadpole.os/to avoid/Applicationsread-only failures, with explicitTADPOLE_DATA_DIRenvironment override for portable/testing workflows. - CI/CD Execution: Automated via GitHub Actions triggered on both tagged release commits (
v*) and manual workflow dispatch (workflow_dispatch).
2. The Sovereign 4-Pillar Architectural Breakdown
mermaid
graph TD
subgraph "macOS Universal Architecture"
UI["React 19 Frontend (WKWebView)"]
TS["Tauri v2 Desktop Shell (Universal 2 Fat Binary)"]
SC["Sidecar Engine: server-rs (Universal 2 Fat Binary via lipo)"]
FS["Persistent State (~/Library/Application Support/com.tadpole.os/)"]
end
UI <-->|Tauri IPC Bridge / Neural Token| TS
TS -->|Spawns & Monitors PID| SC
UI <-->|HTTP / WebSocket (127.0.0.1:8000)| SC
SC -->|SQLite WAL + Migrations| FS
TS -->|Logs & PID Lock| FSPillar 1: Gateway (Interface & Shell Presentation)
- Runtime Webview: macOS WKWebView powered by WebKit (standard Tauri v2 runtime on macOS).
- Bundle Packaging:
- Standard macOS
.appbundle structure (AI-Tadpole-OS.app/Contents/MacOS/,Contents/Resources/). - Disk Image (
.dmg) distribution with standard drag-to-Applications layout.
- Standard macOS
- Window Governance:
- Window title:
AI-Tadpole-OS. - Dimensions: Default
1280x720, resizable; no minimum size is currently configured. - Native macOS menu bar support with standard shortcuts (
Cmd+Qquit,Cmd+Wclose,Cmd+Ccopy,Cmd+Vpaste). - High-DPI / Retina asset rendering using
icons/icon.icns.
- Window title:
Pillar 2: Runner (Lifecycle & Sidecar Orchestration)
- Sidecar Binary Name:
server-rs-universal-apple-darwininsidesrc-tauri/bin/. - Dual-Architecture Compilation & Lipo Splicing:
- Compile
server-rswith targetaarch64-apple-darwin. - Compile
server-rswith targetx86_64-apple-darwin. - Splice both slices into a fat Mach-O binary using
lipo -create -output src-tauri/bin/server-rs-universal-apple-darwin.
- Compile
- Process Management in
src-tauri/src/main.rs:- Single-instance detection using
.app.pidinApplication Support. - Stale sidecar cleanup on startup: graceful POSIX
SIGTERM(kill -15) followed by polling and fallbackSIGKILL(kill -9). - Clean shutdown handler on
RunEvent::ExitRequestedorRunEvent::Exit. - Sidecar health verification: loopback TCP polling against
http://127.0.0.1:8000/v1/engine/healthwith bounded retry window.
- Single-instance detection using
Pillar 3: Registry (Persistence & Data Directory Governance)
- Read-Only App Bundle Protection: On macOS,
/Applications/AI-Tadpole-OS.appis read-only for standard users. The application MUST NOT attempt to write.db,.log, or.neural_tokeninto the executable directory. - Path Resolution Matrix:
Platform / Context Resolved Data Directory SQLite Location Log Location macOS (Default) ~/Library/Application Support/com.tadpole.os/~/Library/Application Support/com.tadpole.os/tadpole.db~/Library/Application Support/com.tadpole.os/sidecar_runtime.logmacOS (Custom) $TADPOLE_DATA_DIR(if set)$TADPOLE_DATA_DIR/tadpole.db$TADPOLE_DATA_DIR/sidecar_runtime.logWindows / Linux <exe_parent>(Existing Portable Mode)<exe_parent>/tadpole.db<exe_parent>/sidecar_runtime.log - Security Permissions:
- Data directory created with mode
0o700. .neural_tokenfile written with POSIX mode0o600(Owner read/write only).
- Data directory created with mode
Pillar 4: Security (Auth, Isolation & Gatekeeper Compliance)
- Local Loopback Isolation: Sidecar strictly binds to
127.0.0.1(configurable viaBIND_ADDRESS). - Neural Token Authentication: Cryptographically generated 256-bit token passed from Tauri shell to webview via loopback IPC only.
- Gatekeeper & Quarantine Handling:
- Tauri performs ad-hoc signing through
bundle.macOS.signingIdentity: "-". Packaging verifies the shell, engine and app signatures withcodesign --verify. - Clear user guide in documentation for clearing quarantine:bash
xattr -cr /Applications/AI-Tadpole-OS.app
- Tauri performs ad-hoc signing through
- Supply-Chain Dependency Audit:
server-rs/deny.tomlincludes bothaarch64-apple-darwinandx86_64-apple-darwin. Target inclusion is configuration evidence; a successful dependency audit must still be recorded.
3. Deterministic Task Sequence & Implementation Plan
mermaid
gantt
title macOS Universal Build Execution Sequence
dateFormat X
axisFormat %s
section Stage 1: Core Shell
Data Path Governance in main.rs :active, s1, 0, 10
POSIX Process Signals & Cleanup Guard :active, s2, 10, 20
section Stage 2: Tauri Config
tauri.conf.json macOS & DMG Config :s3, 20, 30
Cargo Deny Target Alignment :s4, 30, 35
section Stage 3: CI/CD Pipeline
GitHub Actions macOS Runner Job :s5, 35, 50
Lipo Sidecar Splicing Script :s6, 50, 65
section Stage 4: Verification
Invariant Test for Path Resolution :s7, 65, 80
Documentation & User Guidance Docs :s8, 80, 95Stage 1: Data Directory & Lifecycle Governance (src-tauri/src/main.rs)
- Implement platform-conditional base directory resolution:
- On
target_os = "macos": check an absoluteTADPOLE_DATA_DIRenvironment override, otherwise use$HOME/Library/Application Support/com.tadpole.os/.data_dir.rsreturns an error for missing HOME or relative paths instead of falling back into the bundle. - On Windows/Linux: maintain current portable
exe_path.parent()behavior.
- On
prepare_data_dircreates the directory before initializing SQLite paths, PID locks or log streams. Creation and permission failures stop startup..envis loaded after path selection.- Verify POSIX permissions (
0o600on.neural_token,0o700on data dir) under Unix.
Stage 2: Tauri Configuration & Audit Alignment
- Update
src-tauri/tauri.conf.json:- Add
bundle.macOSconfiguration specifyingminimumSystemVersion: "11.0". - Use Tauri's default DMG geometry; no custom installer background is configured.
- Add
- Update
server-rs/deny.toml:- Add
{ triple = "x86_64-apple-darwin" }to[graph.targets]alongside existingaarch64-apple-darwin.
- Add
Stage 3: Automated CI/CD Workflow (.github/workflows/build.yml)
- Extend build matrix to include:yaml
- platform: "macos-universal" os: macos-14 # GitHub-hosted M1 runner target: universal-apple-darwin suffix: "" - Add runner preparation steps:
- Install Rust targets:
rustup target add aarch64-apple-darwin x86_64-apple-darwin. - Build
server-rsforaarch64-apple-darwinandx86_64-apple-darwin. - Execute
lipo -createto generatesrc-tauri/bin/server-rs-universal-apple-darwin. - The workflow invokes
scripts/build-macos-universal.sh, which runsnpx --no-install tauri build --target universal-apple-darwin -- --locked, thenscripts/verify-macos-bundle.sh.
- Install Rust targets:
- Configure artifact upload paths:
src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg- The
.appis verified before upload and distributed inside the.dmg; no.app.tar.gzupload is configured.
Stage 4: Local Build Helper Script (scripts/build-macos-universal.sh)
- Create a deterministic shell script for macOS developers to build locally in one command:
- Pre-flight checks (
rustup,lipo, Node.js). - Sidecar compilation and lipo stitching.
- Tauri bundling.
- Pre-flight checks (
Stage 5: Invariant Testing & Parity Verification
- Configuration checks live in
tests/invariants/inv_011_macos_bundle_invariants.test.ts. Executable directory tests live insrc-tauri/src/data_dir.rs, and mocked artifact failure tests inscripts/tests/test_macos_bundle.py:- Required targets exist in
tauri.conf.json. - Correct binary naming convention for universal target.
- Permissions and path fallback invariants.
- Required targets exist in
- Run
python execution/parity_guard.py,npm run adg:verifyandnpm run test:witness. The release quality gate includes these checks and the packaging failure tests.
4. Agent Execution Map
| Task | Specialist Agent | Skill Sets Involved |
|---|---|---|
| Path resolution & POSIX signal handlers | tauri-pro & rust-pro | tauri-pro, rust-pro, clean-code |
| Tauri DMG & macOS bundle config | tauri-pro | tauri-pro, lint-and-validate |
| GitHub Actions CI multi-target lipo pipeline | server-management | deployment-procedures, bash-linux |
| Invariant test suite & supply-chain audit | testing-rigor | testing-patterns, tdd-workflow |
| Documentation & Gatekeeper bypass notes | documentation-templates | documentation-templates |
5. Verification Gate & Definition of Done
Verification status, 2026-10-22: Local configuration, directory-policy and mocked artifact-gate tests run on Windows. They do not establish a successful native macOS build. The inspected CI run predates this implementation and contains no macOS job. A native build and installed runtime verification remain required.
The Universal macOS implementation is ready for release only after:
- [ ] Dual-Slice Verification:
scripts/verify-macos-bundle.shpasses on a fresh native build, requiringx86_64andarm64in both the shell named byInfo.plistand the bundledserver-rs, valid signatures, and a nonempty disk image. - [ ] Read-Only Installation Test: App launches and operates normally when installed into a read-only simulated
/Applicationsfolder, writing all dynamic state into~/Library/Application Support/com.tadpole.os/. - [ ] Health Probe Convergence: Installed application reaches engine readiness on loopback, successfully authenticates the UI, and stops its sidecar on quit. Record observed startup time; the current retry loop is not a five-second service guarantee.
- [ ] Supply Chain Audit:
cargo deny checkpasses cleanly for bothaarch64-apple-darwinandx86_64-apple-darwin. - [ ] CI Automation: GitHub Actions workflow generates downloadable
.dmgartifact on tagged releases and manual dispatch. - [x] ADG v2 Parity (local): ADG/witness verification and documentation parity pass in the local audit. This does not establish native build/runtime success.
