# RB-08 MAJOR: PowerAssertion is a non-functional stub on macOS

**Severity:** MAJOR (macOS only)
**Path:** `src-tauri/src/commands/power.rs:41-121`
**Source:** [2026-04-22 code review](../code-review-2026-04-22.md), originally deferred during A.1 #9
**Labels:** release-blocker, major, macos, platform

**Current state (2026-04-23):** `objc2`/`objc2-foundation` have been
added behind `cfg(target_os = "macos")`, and the `NSProcessInfo`
bridge now calls `beginActivityWithOptions:reason:` / `endActivity:`
with the retained activity handle. Isolated `cargo check` validation
passes for both `x86_64-apple-darwin` and `aarch64-apple-darwin`.
Remaining acceptance gap: manual runtime verification on a real macOS
machine (`pmset -g assertions`, background live session). Diagnostic
reports now also include a `## Power assertions` section that lists any
currently active Kon assertion guards (`reason`, `backend`, `acquired`)
at report time, which gives the tester an in-app breadcrumb alongside
`pmset`.

## Problem

`begin_activity` always returns `Err` on macOS, so `PowerAssertion::begin` converts to `None` and the guard never acquires an `NSProcessInfo beginActivityWithOptions:reason:` assertion. Live recording and LLM cleanup therefore run without App Nap protection on the one platform where it matters.

The stub was deliberate (A.1 #9 acceptance concession — untestable on Linux without a macOS build host). Re-flagged here so it is not forgotten before the first macOS ship.

## Acceptance

- `objc2` + `objc2-foundation` deps added to the kon crate, gated `cfg(target_os = "macos")`.
- `begin_activity` calls `[NSProcessInfo processInfo] beginActivityWithOptions:(NSActivityUserInitiated | NSActivityLatencyCritical) reason:reason]` and retains the returned activity handle.
- `end_activity` calls `endActivity:` on the retained handle.
- Manual-test on a real macOS box: 10-minute background live session completes without throttling; `pmset -g assertions` shows Kon's activity during capture.

## Manual verification checklist

1. Launch Kon on a real macOS machine and start a live transcription session.
2. While capture is running, background the app for at least several minutes.
3. In Terminal, run `pmset -g assertions` and confirm Kon appears with a
   user-initiated / no-idle-style assertion while the session is active.
4. While the session is still running, generate a Kon diagnostic report
   and confirm the `## Power assertions` section lists an active entry
   such as `reason=kon live dictation session`, `backend=macos`,
   `acquired=true`.
5. Stop the session and rerun `pmset -g assertions` or regenerate the
   diagnostic report to confirm the assertion disappears.
6. Repeat once for the LLM cleanup path if desired
   (`reason=kon LLM cleanup`).

## Fix scope

Medium. Dep addition + FFI glue + manual verification. Can be done from Linux with `cargo check --target=aarch64-apple-darwin` for compile validation, but runtime behaviour needs a macOS machine.

## Dependencies

- **Hard blocker:** before first macOS build/ship.
