# Mac power use

Branch `native/mac-power`, based on `602b91fe`. No server change, merge or
release. Slice 7's priority review fixes were completed first at `f9e00ea6`
with passing Linux CI.

## Behaviour

Command-K searches the current task window, Needs you tasks, active projects
and the four sidebar destinations. Matching folds case and diacritics and
supports subsequences; duplicate task entries use the latest revision. Search
is local and bounded by the existing task-list window, not a remote full-history
search. The selected task's actions reuse `TaskDetailModel`, the task page's
rules, confirmations, revision bindings, errors and allowlisted web opener.
Merge and Cancel only open confirmations. Retry has no shortcut.

Go provides Command-1 through Command-4, Command-R and Command-[ / Command-].
File provides Command-N, which opens and focuses Conversation, including when
only a task window is open or all app windows have been closed. Command-Return
sends in the composer; Shift-Return and marked text do not send. In the palette,
Return opens the selection and Command-Return opens a selected task window.
Command-Shift-M opens the existing merge confirmation.

Each window publishes its own workspace with `focusedSceneValue`. The task
WindowGroup identity contains a local session UUID and origin, never a token.
It cannot follow an account switch or restore an old session. Task windows
observe the event cursor and re-read detail; cancellation, moving, a changed
repository, or verified 401/403/404 closes the window. Network errors preserve
it with the existing read error. Selecting another task's action in a standalone
window routes to the main window and retains the original window's identity.
The queued action carries its context, and a fresh read precedes presentation;
a navigation change discards that intent.

## Copy and accessibility

The ten `native.mac.*` keys use Luna's approved values and `Luna, 2026-11-27`
comments. All 334 reused web strings remain byte-identical. Existing task action
labels keep reviewed sentence case in menus, as ruled; menu-specific title case
is a follow-up for Luna. No copy question remains.

The palette uses native text fields and buttons, exposes selection traits and
labels, and announces the selected result/action when VoiceOver is enabled.
Arrow keys, Return, Command-Return and Escape are handled. Actual keyboard
fixture checks covered Command-K and Down/Return reaching Merge confirmation;
model tests pin the no-write-before-confirmation rule. Spoken VoiceOver output
was not verified by a human in this run.

## Validation and mutations

Machine load, swap and other heavy jobs were checked before every build,
filtered test invocation and fixture launch. One own heavy job at a time,
`--jobs 4`, with timeouts. No simulator was booted. The full native/CI gate script
was deliberately not run locally under the controller's latest machine rules.

- Test-first: `swift test --package-path native/apple --jobs 4 --filter MacPowerTests`
  failed on missing model types. Later search and routing regressions were
  added before their implementation.
- `swift test --package-path native/apple --jobs 4 --filter
  'MacPowerTests|MacWorkspaceTests|TaskDetailModelTests'`: 34 tests passed.
- `swift build --package-path native/apple --jobs 4 --product EquipoMac`: passed.
- `python3 native/scripts/check-strings.py`, `check-parity.py`,
  `check-oficina-id.py` and `check-sign-in-lifetime.py`: passed.
- Post-commit `python3 scripts/runner-dead-references.py`: recorded with the
  pushed head's CI evidence.

Each mutation below was applied alone, its named filtered suite was run with
`swift test --package-path native/apple --jobs 4 --filter <suite>`, and the
source was restored. Every final run failed on test expectations, not a compiler
error. The Merge confirmation mutant initially survived because the snapshot
merge preserved an existing merge card. The test now closes that card at a
new revision and asserts the task-action path as well as the separate card path.

| Mutation | Suite | Result |
| --- | --- | --- |
| `search-revision` | `MacPowerTests` | killed |
| `known-original-repo` | `MacPowerTests` | killed |
| `palette-action-guard` | `MacWorkspaceTests` | killed |
| `palette-other-window` | `MacWorkspaceTests` | killed |
| `routed-action-selection` | `MacWorkspaceTests` | killed |
| `fresh-search` | `MacPowerTests` | killed |
| `archived-project` | `MacPowerTests` | killed |
| `window-origin` | `MacWorkspaceTests` | killed |
| `busy` | `MacPowerTests` | killed |
| `refused` | `MacPowerTests` | killed |
| `active-session` | `MacPowerTests` | killed |
| `fresh-revision` | `MacPowerTests` | killed |
| `read-failure` | `MacPowerTests` | killed |
| `merge-offer` | `MacPowerTests` | killed |
| `retry-guard` | `MacPowerTests` | killed |
| `move-guard` | `MacPowerTests` | killed |
| `cancel-guard` | `MacPowerTests` | killed |
| `perform-guard` | `MacPowerTests` | killed |
| `merge-confirmation` | `MacPowerTests` | killed |
| `cancel-confirmation` | `MacPowerTests` | killed |
| `merge-card` | `MacPowerTests` | killed |
| `refusal-classification` | `MacPowerTests` | killed |
| `cancelled-window` | `MacPowerTests` | killed |
| `moving-window` | `MacPowerTests` | killed |
| `moved-window` | `MacPowerTests` | killed |
| `invisible-window` | `MacPowerTests` | killed |
| `window-account` | `MacWorkspaceTests` | killed |
| `window-lifetime` | `MacWorkspaceTests` | killed |
| `history-forward` | `MacPowerTests` | killed |
| `deduplicate` | `MacPowerTests` | killed |
| `brief-search` | `MacPowerTests` | killed |
| `branch-search` | `MacPowerTests` | killed |

The mutation driver, individual logs and results JSON are retained beside the
screenshots in `site/build/slice9/validation/`.

## Mac evidence

`site/build/slice9/mac-palette.png` and `mac-task-window.png` are in-app NSView
snapshots from the actual offline Mac build and WindowGroup. Screen capture
permission was unavailable, so these capture content, not WindowServer chrome.
The fixture's current-candidate Review step now agrees with its Approved facts.
The standalone-window shortcut check selected a retry task in main and a merge
task in its own window; Command-Shift-M opened the latter's confirmation.

The initial synthetic shortcut harness skipped NSMenu's normal opening
lifecycle, leaving SwiftUI's cached menu validation and focused values stale.
Running the menu delegate's opening callbacks before the key equivalent fixed
it; a constant focus probe confirmed the diagnosis. The temporary explicit
window registry was removed. Native SwiftUI focus remains the sole command
source. The two read-only reviewers' normal-menu discriminator identified the issue.

Confirmation sheets were reached through real keyboard/menu events. Their
NSView bitmap omits AppKit vibrancy-rendered labels, so those incomplete images
are not presented as screenshots; the fixture logs and model assertions are
retained. No actual merge was sent by a capture.

## Handoff

Normal push with `agent-tools/push.sh`; exact head and Linux CI verdict are
reported in the handoff and saved CI JSON. No merge, deployment or release.
Own fixture processes and scratch are removed after validation.

## Fable delta: same-task context, accessibility and navigation

The task screen now resolves the Mac model directly from its current context.
Its state owns a model only on the session/task initializer used outside that
context. Replacing the context for the same task ID therefore replaces the
screen's model as well as the command target. Notification, palette and
other-window routes are covered; a mounted NSHostingView regression replaces
the same-ID context and asserts that its Merge sheet attaches to the window.
The palette's labelled accessibility element contains its children. Source
contracts pin containment and the separate Not now, Open in New Window and
result labels, following this repository's view-contract tests. An attempted
in-process accessibility-tree walk returned no usable SwiftUI children in the
Swift test host, so it is not used as evidence of spoken VoiceOver output.

Pane changes retain the inspector's task and visibility. The workspace owns
an unsent composer draft; recreated AppKit transcripts bind to it, including
edits, paste and clearing after send. A Task-menu action reveals a hidden
inspector before invoking its model. Palette Return ignores marked text.
Task WindowGroup restoration is disabled, so old restored windows do not flash
before account validation. Title-word-prefix matches rank first, other title
matches next, metadata then whole-word brief matches (query length at least
two). The index is cached until its source task/project data changes.

Explicit deferrals: Command-Return from a list, double-click to open a task
window, and a keyboard shortcut for Open in New Window. Existing sentence-case
task labels in Mac menus remain the copy follow-up for Luna. No new copy.

The notification-actions branch is checkpointed locally at 4dac0111 while this
priority fix is handled. Its first focused Go tests passed; the unfinished
implementation was not pushed. The approved share follow-ups come after this
Mac delta and before notification work resumes.

Delta validation: the initial review tests failed on the missing draft, routing
and input-method helpers. Focused tests then passed, including the mounted
same-task sheet test. All 15 deliberate mutations below failed the filtered
`MacPowerReviewTests` suite; sources were restored after each run. Accessibility,
restoration and keyboard wiring are source contracts; the other failures are
behavioral assertions. The mounted screen also catches restoring the old
state-owned Mac model. The first queued-clear log was too verbose for the
runner's issue-line detector; its test did fail. A boolean assertion now keeps
that output bounded, and the repeated mutation was observed failing cleanly.

| Delta mutation | Result |
| --- | --- |
| Restore state-owned Mac screen model | killed |
| Ignore palette accessibility children | killed |
| Clear inspector/task on pane navigation | killed |
| Stop storing edited composer text | killed |
| Do not reveal inspector before menu action | killed |
| Ignore marked text | killed |
| Remove the Return marked-text wiring | killed |
| Restore task windows automatically | killed |
| Remove title-word-prefix ranking | killed |
| Match brief substrings | killed |
| Remove brief minimum query length | killed |
| Rebuild the index on every query | killed |
| Keep the queued action after navigation | killed |
| Route own-task actions out of a task window | killed |
| Allow a queued action across navigation with the same inspector | killed |

Queued actions now also carry a navigation generation. Keeping the inspector
across a pane change cannot revive an old action after its asynchronous read.
Mutation logs, the driver and focused-test results are retained with the
slice 9 review evidence. No simulator was started.

Main c01b4efa was merged normally. The Mac app retains Services registration
and the fixture/menu setup; both approved string sets and their review dates
are retained, including the share UI catalog. On the combined head:
`swift test --package-path native/apple --jobs 4 --filter
'MacPowerReviewTests|MacWorkspaceTests|MacPowerTests|TaskDetailModelTests|ComposerPolishTests'`
passed all 46 tests. String validation, 336-string parity, Oficina ID and
sign-in-lifetime source checks passed. Full suites remain on Linux hub CI.
