# Performance review fixes | Finding | Fix | |---|---| | H1 | Removed the invalid v1 report. Recording writes a hardware-keyed v4 baseline; comparison fails clearly when none exists. Plain tests validate every checked-in report and workload. | | H2 | Shared distributed trust notifications promptly revoke input taps, with activation, wake, and disabled-tap backstops. | | H3 | The same notification source refreshes permission streams after a grant without app switching. | | M1 | In-process measurements use per-thread CPU time and minimum batch costs. Calibration scaling is explicit and optional; IPC keeps wall time. | | M2 | Default baselines live at `Benchmarks/baselines/-.json`. Another machine's report is never selected implicitly. | | M3 | Plain tests enforce the fixed 50-window CPU budgets using nine warmed trials and 8× headroom. Live p99 still needs a quiet host. | | M4 | Reducer `detect` became `apply`. Real detection intervals start at AX notification arrival, survive observation/coalescing/queueing, and close at flush or when dropped. | | M5 | Permission requests arriving during a read require a serialized fresh follow-up. Stop/restart also waits for a noninterruptible older read. | | L1 | Added 200-window oversized-gap benchmarks for every layout. The exact compressed-gap recurrence remains deliberately unchanged. | | L2 | Active-stop, pending-final-frame, restart, and stale native-sender tests cover display-link shutdown. Generation and sender-identity guards reject obsolete ticks. | | L3 | Missing layout-stage timing throws with the benchmark name instead of recording zero. | | L4 | Baseline documentation explains that new layouts or workloads require fresh reports. | | L5 | Platform tests cover watchdog, display debounce, and workspace observer idle lifetimes. Native watchdog deadlines now cancel on completion and shutdown. | | L6 | Each tap reads cached trust on ordinary input events instead of querying the system every time. | ## Public surface - `AccessibilityTrustObserver`, its injectable notification-source protocol, and a cancellable `AccessibilityTrustObservation` token. - `WorkspaceObserver` with `start(receive:)` and `stop()`. - `DetectionTrace`, its source/outcome types and signpost source; optional source configuration on `AppThread`, `EngineTraceSink`, and `EngineWindowWorld`. - Detected-event envelopes on `AppThreadEvent` and `EnginePlatformEvent`, with unwrapping/drop helpers on the latter. Delivery and queued holds preserve shared intervals across fan-out; flushing or forced stop completes them exactly once. `ReductionStage.apply` and `EngineTraceStage.apply` replace the old reducer label. The benchmark harness and new timer/callback test seams remain internal. No new package dependency was added; `Package.swift` only drops the obsolete resource. ## Merge reconciliation The main merge retained three implemented focus-mode commands in the unavailable keybinding list. The minimal fix removes those exclusions, updates the existing regression inventory, and regenerates the published schema. Configuration tests cover defaults, named modes, schema inventory, and documentation examples. ## Adaptive layout integration Traversal tests and benchmark fixtures adapt before placement, using usable and full display geometry. The uncached oracle traverses that same materialized tree; it no longer adapts a private copy or calls the production minimum-size helper. Coverage includes capability-limited stacks and uncapped trees in compact, portrait, and ultrawide shapes, plus mixed partitions and hidden minimums. Full-suite validation also required a minimal menu integration repair: previews adapt before placement, and the scoped ratio test prepares Side before changing its main ratio. A portrait Columns preview test covers the adapted placement. These changes have no new public API or package configuration. Fixture regression checks run on the main actor, matching the benchmark suite. The engine follow-up reproduced SIGBUS during Columns arrangement at both 200 and 1,000 tiles in revision `1cf7890`. The worker requested 512 KiB; its measured native stack was 536,576 bytes. The same probe now passes at both sizes, as do worker tests covering Rows, Accordion, mutations, transforms, and adaptation. Traversal uses explicit stacks without changing topology, divider paths, or rounding. Instruction and allocation comparisons are in `ENGINE-CORE.md`. The polish review confirmed that this is a historical stack-exhaustion finding, not an outstanding recursive placement path: revision `1cf7890` recursively summarized and placed a linear-depth Columns tree, and undo positions also recursed down it. Current placement, divider counting, minimum replay, tree folds, and undo tree comparison use explicit stacks. No additional production rewrite was needed. Added 500-window regressions request the same 512-KiB secondary-thread stack: frame solves cover Columns, Rows, Accordion, ordinary and compressed gaps, minimum conflicts, and targeted fit queries. Undo coverage exercises deep-edge gesture coalescing and cancellation, workspace snapshot/restore, every-owner consumption, the 32-entry bound, and closed-window invalidation. These screen-free checks do not certify native window timing or unbounded tree serialization and destruction. ## Deliberately deferred No final baseline was recorded on this loaded host. Record one on a quiet machine and review it before committing. Actual permission grants/revocations, visible window timing, and system idle profiling were not exercised by these headless checks. Detect begins at observable AX arrival, not the underlying server mutation; display, workspace, and input-origin timestamps remain outside this change. An AX call already executing cannot be interrupted, but its pending watchdog deadline can now be cancelled; no uncancellable-deadline follow-up remains.