diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6c88038f..4c37f7a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,19 +91,20 @@ Quit your running Parcel first: the harness refuses to control or quit it, and manages fixture windows rather than your own. Screen recording is a separate opt-in: see [media capture](docs/media/README.md). -`mise run reality` checks real apps using a separate signed helper. Add this -worktree's `build/ParcelRealityDriver.app` to **Privacy & Security → Accessibility** -once, alongside `build/Parcel.app`, then run -`mise run reality -- --preflight-only`. Both use the local **Parcel Development** -identity; the helper refuses ad-hoc signing and checks its designated requirement -on rebuild. A missing helper grant fails preflight with the exact app to add. +`mise run reality` checks real apps using a helper embedded only in its debug +Parcel bundle. Only `build/Parcel.app` needs Accessibility: its directly spawned +helper inherits that existing permission. No separate helper grant is needed. +Run `mise run reality -- --preflight-only` to verify inherited access without +opening scenario windows or requesting consent. Reality builds require the local +**Parcel Development** identity and preserve Parcel's designated requirement. +Ordinary debug and release bundles contain neither helper nor launcher. Every live lane shares `Scripts/screen-lock.sh`; do not run reality, fixture, -first-light, or tour checks outside that lock. Parcel and the harness need no -Screen Recording grant. Optional visual checks use ScreenCaptureKit only in the -driver: explicitly grant **Screen & System Audio Recording** to -`build/ParcelRealityDriver.app`, then set `PARCEL_REALITY_SCREEN_CAPTURE=1`. -See [reality checks](Tests/Reality/README.md) for scenarios, grants, and artifact safety. +first-light, or tour checks outside that lock. Frame checks need no Screen Recording. +Optional visual checks use ScreenCaptureKit only in the helper, with +`PARCEL_REALITY_SCREEN_CAPTURE=1` and an existing Screen Recording grant for its +responsible Parcel bundle. The lane never requests a new privacy grant. +See [reality checks](Tests/Reality/README.md) for scenarios and artifact safety. ## Translations diff --git a/Tests/Reality/README.md b/Tests/Reality/README.md index ab8f7c5e..4d059e88 100644 --- a/Tests/Reality/README.md +++ b/Tests/Reality/README.md @@ -1,35 +1,36 @@ # Reality -`mise run reality` builds `build/Parcel.app` and the signed -`build/ParcelRealityDriver.app`, takes the shared screen lock, and runs -`ParcelRealityTests` under `caffeinate -dimsu`. Direct use requires -`PARCEL_REALITY=1` and the lock wrapper. Without opt-in, no apps launch. -This lane uses real apps. A separate opt-in FixtureApp test covers the driver. -Unit lanes run only pure harness and protocol tests. - -## One-time grants - -Run `Scripts/make-dev-cert.sh` in a terminal if the local **Parcel Development** -identity is missing. The driver refuses ad-hoc signing and checks that its -certificate-bound designated requirement stays the same across rebuilds. - -Add both apps to **System Settings → Privacy & Security → Accessibility**: - -- `build/Parcel.app` -- `build/ParcelRealityDriver.app` in this worktree - -Then run `mise run reality -- --preflight-only`. A missing driver grant fails -preflight with the exact app path; it never silently skips or opens a consent prompt. -The harness itself needs neither Accessibility nor Screen Recording. - -Parcel never needs Screen Recording for this lane. Visual pixel checks are a -separate driver-only opt-in: add `build/ParcelRealityDriver.app` under -**Screen & System Audio Recording**, then run -`PARCEL_REALITY_SCREEN_CAPTURE=1 mise run reality`. Only the driver uses -ScreenCaptureKit. Captures stay in the private run artifact directory; they can -include other visible apps, so do not share them without checking their contents. -Without this flag, visual rows are labelled **needs Screen Recording for the driver -(opt-in)**. CG overlay presence/level/bounds alone cannot prove shared-panel pixels. +`mise run reality` builds a reality-only debug `build/Parcel.app`, takes the +shared screen lock, and runs `ParcelRealityTests` under `caffeinate -dimsu`. +Direct use requires `PARCEL_REALITY=1` and the lock wrapper. Without opt-in, +no apps launch. This lane uses real apps; a separate FixtureApp check covers +the driver. Unit lanes run only pure harness and protocol tests. + +## Existing permission + +Only `build/Parcel.app` needs **Privacy & Security → Accessibility**. No separate +helper or harness grant is needed. The local **Parcel Development** identity and +Parcel's designated requirement must stay stable; ad-hoc reality builds are rejected. +Run `Scripts/make-dev-cert.sh` in a terminal only if that identity is missing. + +`mise run reality -- --preflight-only` launches a host-only Parcel instance through +Launch Services. It directly spawns `Contents/Helpers/ParcelRealityDriver`, which +inherits Parcel's TCC responsibility. The host never starts the product runtime or +changes preferences; it forwards only the private socket path. The harness checks +peer PID, direct-child ancestry, Accessibility, and HID posting without a consent +prompt. Missing inherited access fails clearly before scenario windows open. + +The launcher exists only under `DEBUG && PARCEL_REALITY`, enabled by +`Scripts/bundle.sh debug --reality`. Ordinary debug and release bundles contain +neither the helper nor its launcher; bundling checks binary strings and symbols. + +Frame checks need no Screen Recording. Optional pixel checks require both +`PARCEL_REALITY_SCREEN_CAPTURE=1` and an existing Screen Recording grant for the +responsible Parcel bundle. Only the helper calls ScreenCaptureKit; the capture +request carries explicit opt-in rather than forwarding the harness environment. +This lane never requests a new grant. Captures remain private and may include +other visible apps; inspect them before sharing. Without opt-in, visual rows +explicitly need Screen Recording. CG overlay metadata cannot prove panel pixels. For one scenario: `mise run reality -- --scenario launch`. `--list` lists scenarios without opening apps when used directly on the executable. `--report PATH` writes @@ -86,7 +87,7 @@ window restoration disabled. Finder folders open with `open `; cleanup closes only the new CG ID through AX and never quits Finder. Singleton apps skip if already running. No user documents are edited or saved. -The pipe-driven helper registers only ledger-owned PID/CG ID pairs, identifies the +The socket-driven helper registers only ledger-owned PID/CG ID pairs, identifies the corresponding AX element at runtime, and rechecks ownership before every operation. AX calls stay on one owning thread per app with a 350 ms messaging timeout. Starting frames and pause/retile disturbances use AX, with CG readback as the only truth. @@ -116,12 +117,13 @@ history survives cleanup in `created-windows.json`. ## Driver regression -After building and granting the helper, run its real FixtureApp check while holding -the same screen lock: +After `mise run reality -- --preflight-only` builds the reality bundle, run the +real FixtureApp check while holding the same screen lock: ```sh Scripts/screen-lock.sh env PARCEL_E2E=1 PARCEL_REALITY_DRIVER_E2E=1 \ - swift test --filter realityDriverOnlyControlsRegisteredFixtureWindows + caffeinate -dimsu swift test --no-parallel \ + --filter realityDriverOnlyControlsRegisteredFixtureWindows ``` Quit your running Parcel first, as for every fixture e2e run. Without the extra