# Native task view controller report

Branch: native/task-view, started from origin/main 4024216e in its own physical
TMPDIR worktree. Main advanced to eb367315 with the landed attachment slice;
`git merge origin/main` brought that work in (fast-forward) before final
verification. This branch has not been rebased. No merge to main, release or
deployment is authorized.

## Scope and rulings

Overview, Changed files, Checks and Preview share a pinned decision. Changed
files and Preview remain web links in this slice. The thin engine has no plan
state; offer approval only when the web has an actionable card (controller
confirmed 2026-11-26).

Own-task Move uses GET /projects.allowed. Another creator's task opens the
existing /tasks/{id}/move page in the default Mac browser or the iPhone Safari
sheet. The controller approved this limited fallback on 2026-11-26 because
MoveChoices uses the creator's allowed repositories, which the device API
cannot read for another creator. Follow-up: GET /tasks/{id}/move-choices for
devices, using the same authorization and choices as the web.

Luna approved these exact native-only strings on 2026-11-26:

| Key | Value |
| --- | --- |
| native.task.overview | Overview |
| native.task.changes | Changed files |
| native.task.undo_merge | Undo merge |
| native.task.undo_confirm | Undo this merge? |
| native.task.undo_detail | Equipo will start a task to revert this merge. From now on, it will ask before every merge in this project. |

Other imported words are copied from copy.go under check-parity.py. Native
catalog entries use the existing translated/manual convention. Native-only
approval attribution is retained here and beside their Swift call sites.

## Tests first

`swift test --package-path native/apple --filter TaskDetailTests` first failed
fullWireTaskKeepsEveryNestedField on the original partial decoder. The coverage
fixture populates every field of wire.Task, wire.Step and their nested wire
subresources, including copydesk.Signature. It is a serialization shape, not
an actionable task. Typed optional fields preserve older payloads. The
round-trip test now passes without dropping any populated field.

The action-rule tests first failed 15 assertions with the empty rule model.
The implementation follows work_pages.go taskLineOf/priorityOf,
work_views.go decorate/decisionOf/liveStep, and mergeauth.go undoReceipt.
`swift test --package-path native/apple --filter TaskDetailTests` then passed
7 tests, including parameterized lifecycle and needs-you cases.

`swift test --package-path native/apple --filter
'TaskActionAPITests|CheckSectionTests'` first failed 36 issues with the stub
commands, fallback-only errors and empty parser. With implementation, all 6
tests pass. Requests cover merge, cancel, round, undo (receipt revision), move,
kind and priority, bearer use, 409/500 propagation and reviewed failure words.
Priority preserves the deadline as RFC3339 or explicit null. The parser uses
the runner's `=== script` markers only for .amadan/ci.d, preserves Go test
markers, applies the existing 200-line/32-KiB bounds and moves the last section
to the front only on failure. ciDScript exits at the first failed script.

Compiler scaffolding corrections (a generated inline declaration and duplicate
TaskActions.swift basenames) were resolved before counting failing assertions.

TaskDetailModelTests first failed 8 assertions with stub reads/actions; the
implementation passes the double-tap, creator, stale-confirmation and conflict
refresh tests. TaskDecisionTests first failed 4 assertions with the stub card
selector/choice validator, then passed with creator/owner, lifecycle, current
card, exploration, known-choice and direction-note guards. The task-card
answer test first failed 3 assertions with a stub answer, then passed. Its fake
server also verifies that a malformed successful response is shown as failure.

The fixed move URL test failed 2 assertions against the settings-only allowlist,
then passed with the exact `/tasks/[A-Za-z0-9_-]+/move` pattern. The separate
other-creator branch test failed with the unconnected opener and then passed:
it hands the fixed-origin task URL to the opener and never reads the viewer's
project choices. The production opener is the existing settings presentation.

The model tests use a usable fake bearer and implement `/snapshot`, `/tasks`,
`/needs-you`, `/time-zone` and `/projects`, so refresh assertions exercise the
signed-in refresh path as well as the full task read. Own Move filters out the
current repository, sorts the allowed list, refuses destinations outside it,
and does not send another creator's task through the native route.

## Native screen and layout

The iPhone keeps its decision below the scrolling evidence on every tab. The
Mac presents the same decision as a toolbar above the tabs in task detail.
Overview includes the brief, track, facts, Review summary, steps, branch/commit
and task thread. Checks uses the existing bounded selectable log component,
with the failed runner section open first and Review's summary below. It
reloads when the task revision changes. Unknown card kinds remain on the web;
the thin task has no plan state to fabricate into an approval.

The simulator UI tests drive the production screen through an offline transport:
Overview, the actual More menu, the actual Merge confirmation, Checks, and
Accessibility Extra Large. All four approved tab labels remain visible without
truncation at default and Accessibility Extra Large. The native segmented
control and wording are unchanged; the controller was notified of this result.

A second web comparison added failing tests for two existing page rules:
`OpenMergeCards` selects the newest open card by created time/id, and
`pageTask` removes earlier merge steps from an exploration. Both tests failed
before implementation and pass now. Held cards retain their reviewed Run it
now / Wait choices. No response text is invented for an unknown card option.

Device-route boundary: Continue without Copy has only
`/conversation/tasks/{id}/continue-without-copy`, not a bearer device route.
That decision, unknown card kinds and the outside-sandbox warning keep the
existing Open in Equipo on the web fallback. The controller was notified.

## Mutations

Command: `python3 "$TMPDIR/task-view-mutate.py"`. For each mutation the
harness saves the source, makes one change, runs
`swift test --package-path native/apple --filter 'TaskDetail|TaskDecision|TaskAction|CheckSection'`,
requires a failing assertion (not just a compiler error), then restores the
source. The last focused baseline passed 30 tests in 5 suites. All 88 distinct
mutations below were killed. The Move availability mutation initially survived;
an ended-task read test was added and the mutation then failed as intended.
One closure mutation initially did not compile; it was corrected to a compiling
mutation and killed by assertions. A literal mismatch stopped one batch before
mutation; it was corrected and the batch resumed. Neither was counted as a kill.

The runner, final verdict JSON and command transcript are retained in
`polish-audit/equipo-daily-driver/site/build/slice3/`. The verification archive
contains the individual failing test logs and the red/green baseline logs.

| Mutation | Result |
| --- | --- |
| `owner` | Assertion failed; restored |
| `creator` | Assertion failed; restored |
| `done` | Assertion failed; restored |
| `cancelled` | Assertion failed; restored |
| `moving` | Assertion failed; restored |
| `stopping` | Assertion failed; restored |
| `merging` | Assertion failed; restored |
| `merge_offer` | Assertion failed; restored |
| `live_driver` | Assertion failed; restored |
| `kind_toggle` | Assertion failed; restored |
| `priority_toggle` | Assertion failed; restored |
| `retry_failed` | Assertion failed; restored |
| `retry_terminated` | Assertion failed; restored |
| `recover_reason` | Assertion failed; restored |
| `recover_unterminated` | Assertion failed; restored |
| `round_copyhold` | Assertion failed; restored |
| `round_copy_skip` | Assertion failed; restored |
| `round_need` | Assertion failed; restored |
| `undo_offer` | Assertion failed; restored |
| `undo_sha` | Assertion failed; restored |
| `undo_checks` | Assertion failed; restored |
| `undo_window` | Assertion failed; restored |
| `undo_task` | Assertion failed; restored |
| `undo_kind` | Assertion failed; restored |
| `undo_open` | Assertion failed; restored |
| `undo_options` | Assertion failed; restored |
| `driver_preview` | Assertion failed; restored |
| `driver_research` | Assertion failed; restored |
| `driver_publish` | Assertion failed; restored |
| `decision_creator` | Assertion failed; restored |
| `decision_owner` | Assertion failed; restored |
| `decision_final` | Assertion failed; restored |
| `decision_moving` | Assertion failed; restored |
| `decision_stopping` | Assertion failed; restored |
| `decision_copyhold` | Assertion failed; restored |
| `decision_copy_skip` | Assertion failed; restored |
| `decision_task` | Assertion failed; restored |
| `decision_open` | Assertion failed; restored |
| `decision_kind` | Assertion failed; restored |
| `decision_explore` | Assertion failed; restored |
| `decision_allowlist` | Assertion failed; restored |
| `answer_choice` | Assertion failed; restored |
| `answer_note_limit` | Assertion failed; restored |
| `answer_note_required` | Assertion failed; restored |
| `rules_fresh` | Assertion failed; restored |
| `move_busy` | Assertion failed; restored |
| `move_web` | Assertion failed; restored |
| `move_current_filter` | Assertion failed; restored |
| `write_busy` | Assertion failed; restored |
| `write_allowed` | Assertion failed; restored |
| `confirmation_revision` | Assertion failed; restored |
| `receipt_revision` | Assertion failed; restored |
| `move_creator` | Assertion failed; restored |
| `move_destination` | Assertion failed; restored |
| `move_same_repo` | Assertion failed; restored |
| `card_revision` | Assertion failed; restored |
| `settings_allowlist` | Assertion failed; restored |
| `move_origin_path` | Assertion failed; restored |
| `action_bearer` | Assertion failed; restored |
| `action_failure` | Assertion failed; restored |
| `action_conflict_words` | Assertion failed; restored |
| `undo_revision_body` | Assertion failed; restored |
| `log_bound` | Assertion failed; restored |
| `log_gate` | Assertion failed; restored |
| `log_testing_marker` | Assertion failed; restored |
| `log_failure_first` | Assertion failed; restored |
| `explore_page_kind` | Assertion failed; restored |
| `latest_card` | Assertion failed; restored |
| `card_sort` | Assertion failed; restored |
| `card_id` | Assertion failed; restored |
| `card_busy` | Assertion failed; restored |
| `checks_status` | Assertion failed; restored |
| `checks_exit` | Assertion failed; restored |
| `move_allowed` | Assertion failed; restored |
| `explore_merge_filter` | Assertion failed; restored |
| `priority_creator` | Assertion failed; restored |
| `menu_creator` | Assertion failed; restored |
| `round_creator` | Assertion failed; restored |
| `round_placement` | Assertion failed; restored |
| `undo_creator` | Assertion failed; restored |
| `rules_revision_only` | Assertion failed; restored |
| `rules_read_only` | Assertion failed; restored |
| `decision_revision_only` | Assertion failed; restored |
| `decision_read_only` | Assertion failed; restored |
| `placement_guard` | Assertion failed; restored |
| `placement_stop` | Assertion failed; restored |
| `placement_hold` | Assertion failed; restored |
| `placement_preparing` | Assertion failed; restored |

## Gates and captures

No server code or route changed, so the controller's native-only gate applies;
no new GET route needs a performance budget. `native/scripts/check-native.sh`
checks wire fixtures, catalog/parity, sign-in lifetime, reference hygiene, the
whole Swift suite, and both native builds. The post-commit reference scan is
run separately as required. Gate logs, simulator captures, Mac capture and
exact-head Linux CI verdict are retained in `site/build/slice3/`.

Final local results:

- `native/scripts/check-native.sh`: passed. 482 catalog entries; 326 web
  strings byte-identical under parity; 298 Swift tests in 38 suites passed
  (one pre-existing known issue); Mac and iPhone Simulator builds passed.
- `native/scripts/build-mac.sh --configuration debug`: passed, ad hoc local
  bundle only. The capture runs that bundle through Launch Services with
  `EQUIPO_TASK_FIXTURE=overview` and `EQUIPO_FIXTURE_CAPTURE` pointing into the
  audit directory. It records only its own NSWindow through AppKit.
- `xcodebuild -project native/ios/EquipoPhone.xcodeproj -scheme TaskViewUI
  -destination 'platform=iOS Simulator,id=<isolated EquipoTaskView simulator>'
  -derivedDataPath native/build/Phone
  -resultBundlePath "$TMPDIR/task-view-final-ui.xcresult"
  CODE_SIGNING_ALLOWED=NO test`: passed all 3 UI tests. The Checks test also
  requires an expanded text view and verifies the failing section precedes
  the earlier successful section.
- The first native gate flagged the debug capture's `Data.write` call under
  the blanket raw-secret-store-write rule. The fixture now uses the existing
  fixture convention, FileManager.createFile; the gate was not weakened.

Inspected actual captures, all in `site/build/slice3/`:
`iphone-overview.png`, `iphone-checks.png`, `iphone-menu.png`,
`iphone-merge-confirmation.png`, `iphone-tabs-large.png`, and `mac-task.png`.
The duplicate branch row was removed from the confirmation before this final
capture. The iPhone fixture uses the normal inline task navigation title.
The extra large-text image records the unchanged, untruncated approved tabs.
There are no outstanding copy questions.

After commit, the required command is
`python3 scripts/runner-dead-references.py`; its final output is retained as
`post-commit-references.log`. Push uses the normal helper with `native task view`
and `origin native/task-view`. Linux hub status is read with
`AMADAN_HOME="$HOME/.amadan-claude-agent" amadan ci status oficina/equipo -branch
native/task-view -json` into a scratch file; the exact commit verdict is saved
as `site/build/slice3/ci-verdict.json` before handoff. No merge to main or release.

The first post-commit reference scan included the newly tracked files and
flagged five uses of a reserved project name in fake Move choices. Those
fixture-only choices now use `oficina/notes`. No shipped route or behavior
changed. The reference scan and native gate were repeated after that fix.

## Screenshot review follow-up (2026-11-26)

The Mac tab picker now hides its visual label while retaining its accessibility
label. The more menu uses the borderless Mac menu style with its indicator
hidden. Overview keeps branch and commit in the facts block only, on both
platforms. Every pinned primary action now uses RosterButton, including answer,
round, merge and web fallbacks; secondary card choices retain that component's
secondary style.

The contradictory Checks screenshot was fixture data, not stale summary
selection. Both tabs already selected the last Review in wire step order.
That selection now lives in TaskPage.latestReview and is covered with an older
approval, a newer changes-requested review, and a trailing Preview. Missing
Review and missing steps also return no summary. The failed fixture now contains
an earlier approval followed by changes requested, with matching task verdict,
review headline and summary, and no merge offer. The Checks UI test requires
Changes requested and rejects Approved on that tab.

Test-first command: `swift test --package-path native/apple --filter
latestReviewWins`. With the selector stub returning nil, the test failed at
`#require` (red). With last matching Review, it passed (green). Replacing
`task.steps?.last` with `task.steps?.first` failed the id, headline and summary
assertions (mutation killed), then the source was restored. This adds one
mutation to the original 88 killed mutations. Logs are retained as
`polish-red.log`, `polish-green.log`, and `polish-mutation.log` in the slice3
capture directory. No new runtime copy was introduced.

Follow-up validation: `native/scripts/check-native.sh` passed with 299 Swift
tests in 38 suites (one existing known issue), 326 exact web parity strings,
and both native builds. `build-mac.sh --configuration debug` passed.
The same TaskViewUI command above, with result bundle
`$TMPDIR/task-view-polish-ui.xcresult`, passed all three UI tests. All six
screenshots were recaptured from this branch; Mac and iPhone Overview and
iPhone Checks were inspected for these changes. The existing large-type tab
capture, menu and confirmation were refreshed too. The isolated simulator
and fixture Mac process were stopped after capture.

## Fable delta review (2026-11-26)

This delta supersedes the earlier statement that selecting the last Review was
sufficient. Evidence must also belong to the current candidate SHA. Overview
and Checks now select the last matching Review/Checks step. A missing current
Review shows the exact reviewed web `runner.verdict.skipped` words, “Not run”.
Running or queued Checks show their state without fetching an empty log.

Hosted logs use the optional device-only `Step.hosted.failed` projection approved
by the controller. It exposes failed job names only, from stored HostedCI,
without repo, branch, URL, log, token or runner metadata. It is part of the
existing task-authorized step representation; no new GET route or runner
protocol change is involved. Non-hosted and malformed/missing stored results
omit the field. OpenAPI and native decoding include the additive field; older
payloads still decode. Native uses these names as the marker allowlist. Only
when the field is absent does it fall back to the header's `Failed:` names.
The hosted header appears as a summary and every named failed job is marked.

Local section markers accept only basename-shaped names, excluding whitespace,
paths and Go test markers. Section boundaries retain the original marker line,
the prefix before the first marker, and every other bounded log line. Failed
local sections move first; source-order ids let tests reconstruct the exact
bounded log. A tool can spoof a basename marker such as `=== 20-check`, so the
local failure indication remains a hint. Follow-up: the runner should send
structured section names and byte offsets, or escape marker-like tool output.

Merge, Undo and Cancel now create a confirmation intent in TaskDetailModel;
only confirming that intent can send the write. Cancel appears last after a
divider, uses the destructive role, and remains hidden during merging.
Cancel title and detail are approved **Luna, 2026-11-26**:
`native.task.cancel_confirm` = “Cancel this task?”;
`native.task.cancel_detail` = “Equipo will stop this task. You cannot resume it,
and nothing will be merged.” Buttons reuse reviewed web strings.

Decision cards are restricted to merge, direction and held. Unknown options
hide only themselves, preserving recognized choices. Successful direction
answers clear the draft note, and other answer types never carry it. All task,
Preview, Move and Changed files links go through the shared checked opener:
fixed origin-relative task paths, or a Changed files URL on the exact session
origin or HTTPS amadan.net. Credentials, unexpected ports, lookalike hosts and
other forges are refused. Mac opens the default browser; iPhone uses the
parent-owned Safari sheet.

Test-first commands and observations:

- `swift test --package-path native/apple --filter TaskCandidateTests`: red,
  10 assertions failed before current-candidate selection; green after it.
- `swift test --package-path native/apple --filter TaskDetailModelTests`: model
  confirmation tests red with 6 assertions before intent enforcement; green
  after implementation. Wire assertions distinguish receipt revision 72 from
  task revision 9 and preserve the urgent deadline.
- `swift test --package-path native/apple --filter TaskDecisionTests`: red,
  5 assertions for newer unknown/question cards and unknown options; green.
- `swift test --package-path native/apple --filter HostedSectionTests`: red for
  hosted grouping, summary, all-failed labeling and lossless local splitting;
  green after implementation. A test encoding setup used numeric dates first;
  corrected to use raw server JSON before the final decoding assertion.
- `swift test --package-path native/apple --filter TaskWebNavigationTests`:
  red for fixed task pages and unchecked Changed files URLs; green after the
  allowlist implementation.
- `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test ./internal/equipo/chat -run
  '^TestStepHostedDeviceView' -count=1`: red (field missing), then green.
- Wire schema regenerated through `EQUIPO_DEVICE_SCHEMAS=<scratch>
  GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test ./internal/wire/wireschema -run
  '^TestDump$' -count=1`. The device contract test passed.

The source budget increases are precisely the approved minimal projection:
wire 7067 lines, chat 34835 source / 9583 test lines. Existing exemptions now
record those measured counts and the reason; no route/performance exemption
was added.

Initial delta validation checkpoint: all 314 Swift tests passed (one existing
known issue). Go build and vet passed with `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0
GOOS=linux GOARCH=amd64 make build vet`; the Make target also compiles/vets the
Darwin runner. Native staticcheck v0.7.0 and govulncheck v1.8.0, analyzing with
`GOOS=linux GOARCH=amd64`, passed. Govulncheck reported no reachable vulnerable
code. `make fmt-check spacing copy-release-check lanes-check budget` and
`make migration-check` passed. The formatting tool came from the Go 1.26.11
GOROOT prepended to PATH.

Local runner-host cannot pass on this Mac: runner prerequisites fail, and the
quarantine checks require Codex 0.165.0 while the local binary reports 0.154.0.
`make test-quarantine` records 11 prerequisite/provider failures; no test or
provider contract was weakened. The Linux hub run is the required final gate.

Mutation command: for each listed edit, `swift test --package-path native/apple
--filter <suite>`; each source restored in a `finally` block before the next
mutation. All 31 compiled and failed assertions (no compile failures counted).

| Mutation | Suite | Result |
| --- | --- | --- |
| undo-task-revision | TaskDetailModelTests | killed |
| perform-busy | TaskDetailModelTests | killed |
| merge-confirmation | TaskDetailModelTests | killed |
| undoMerge-confirmation | TaskDetailModelTests | killed |
| cancel-confirmation | TaskDetailModelTests | killed |
| merge-card-confirmation | TaskDetailModelTests | killed |
| explore-revision | TaskDetailModelTests | killed |
| urgent-deadline | TaskDetailModelTests | killed |
| direction-clear | TaskDetailModelTests | killed |
| direction-note-only | TaskDetailModelTests | killed |
| review-last | TaskCandidateTests | killed |
| review-candidate | TaskCandidateTests | killed |
| checks-last | TaskCandidateTests | killed |
| checks-candidate | TaskCandidateTests | killed |
| running-checks-empty-log | TaskCandidateTests | killed |
| decision-kind | TaskDecisionTests | killed |
| merge-unknown-option | TaskDecisionTests | killed |
| direction-unknown-option | TaskDecisionTests | killed |
| hosted-only-last-failed | HostedSectionTests | killed |
| hosted-not-split | HostedSectionTests | killed |
| hosted-header-not-summary | HostedSectionTests | killed |
| hosted-empty-field-fallback | HostedSectionTests | killed |
| hosted-allowlist | HostedSectionTests | killed |
| local-prose-marker | HostedSectionTests | killed |
| marker-lines-dropped | HostedSectionTests | killed |
| prefix-dropped | HostedSectionTests | killed |
| web-allowlist | TaskWebNavigationTests | killed |
| forge-allowlist | TaskWebNavigationTests | killed |
| forge-credentials | TaskWebNavigationTests | killed |
| forge-port | TaskWebNavigationTests | killed |
| cancel-merging | TaskDetailModelTests | killed |

Three final edge regressions were added test-first: the facts block borrowing
an older candidate's gate, a truncated hosted log being styled as a header,
and a merge-card confirmation surviving a task revision change. The focused
run failed four assertions before the fixes, then passed 23 tests. Removing
each fix separately also failed its assertions: `facts-current-candidate`,
`truncated-hosted-is-log`, and `merge-card-task-revision` (three more mutations).
A truncated prefix remains in the bounded monospaced log view; only an actual
Hosted CI header is rendered as the summary. Merge card confirmations now bind
both the task revision and the existing card revision.

The four Go mutations also failed the intended mapping assertions:
`hosted-mapping-absent`, `hosted-drop-name`, `hosted-local-exposed`, and
`hosted-omit-guard`. They ran with `go test -overlay=<mutation.json>
./internal/equipo/chat -run '^TestStepHostedDeviceView' -count=1`, under
`GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0`; overlays isolate them from other reads
without changing the checked-out source. The unmutilated mapping and device
contract tests were run again afterwards. **38 delta mutations killed: 34
native and 4 Go.** The ten review survivors are all represented, including both
last/current-candidate selectors and both model-level confirmations.

Final native gate: `native/scripts/check-native.sh` passed, 316 tests in 41
suites (one existing known issue), 485 catalog strings, 327 exact web parity
strings, and both native builds. The rebuilt Mac bundle passed and was captured
through its own NSWindow. TaskViewUI ran all five scenarios: Overview/menu/Merge,
local failing Checks, hosted Checks, Cancel confirmation, and large-type tabs.
The first hosted UI assertion counted accessibility text-view objects (8 rather
than 2), although both log boxes were visibly correct. It now checks the actual
visible text of both jobs; rerunning that test passed. The other four scenarios
passed on the first run. All captures were inspected and replaced in
`site/build/slice3/`; the new additional captures are `iphone-checks-hosted.png`
and `iphone-cancel-confirmation.png`. The fixture process and isolated simulator
were stopped after capture.

`make test` was attempted locally. The repository-wide command cannot pass on
Darwin: a direct `go test ./internal/toolproxy` reproduces the existing
`undefined: unix.O_PATH` compilation error at stdio.go:112 and :118. After
11 minutes the broad command was still running thin tests; its own process
group was stopped once that platform blocker was confirmed. No Linux test
result is inferred from the interrupted local run. Linux hub CI remains the
required verdict. The focused changed-package tests pass on this Mac.

Final changed-package validation: `go test ./internal/equipo/chat
./internal/wire/...` passed with Go 1.26.11 and CGO disabled. `make perf` ran
TestPerfScreens and TestPerfBoot but the repository-wide command failed on the
same Darwin toolproxy compilation issue; no route or performance budget was
changed. Final `make fmt-check budget` passed. Gate logs and the individual
mutation transcripts are retained in `site/build/slice3/delta-validation/`.
There are no outstanding copy questions. No merge or release was performed.
