# Chat UI controller report

Branch: `chat-ui`, starting at `df2b9e3` (the brief, on deployed `0cb576b`).
No deployment or default-branch changes.

## Gaps captured before implementation

- Messages read like paragraphs in a document. Senders had the same layout,
  with no timestamps or specialist icons.
- The composer followed the whole document and disappeared below the fold.
- Task cards followed all messages, separate from the messages that introduced them.
- Task threads lacked their task's steps and pending questions.
- Sending used a page navigation. There was no Enter/Shift+Enter chat behavior.
- The navigation counts wrapped onto several lines.

## Changes

Both conversation views now use one scrolling column and a docked composer.
Your messages have a tinted bubble aligned to the right. Other people,
coordinators and specialists appear on the left, with an icon, name and time.
Task threads use the task description as their heading.

Cards sit in message order. Tasks include their steps, model/account labels,
links to their thread and plan, candidate evidence and existing approval actions.
Pending questions can be answered from their cards. Existing authorization and
form handlers remain responsible for those actions.

The composer uses Rastrillo live forms. Enter sends, Shift+Enter adds a newline,
and composition input is left alone. The send button is disabled while the
request is pending; the textarea becomes read-only so it can retain focus.
Confirmed sends clear the draft and return focus to the composer. Background
updates preserve drafts. The feed follows new messages at the bottom and keeps
the visible message in place while reading older messages, including when the
server's 50-message window moves forward. Message and card scroll identifiers
remain distinct even when their stored IDs match.

The ordered message list, focusable scroll region and persistent live announcement
region support keyboard and assistive-technology use. Phone navigation retains
the existing index and back links. Styling uses theme tokens and complete borders.
Vendored assets are unchanged. No framework or schema changes were needed.

Browser fixture helpers for screenshots and real-session sign-in are shared to
stay within the existing source and test size budgets. The old layout assertion
now checks for one column; the foundation walk checks the conversation's empty
state rather than assuming the first navigation destination is empty.

## Screenshots

The app ran through the repository's Chromium harness, bound to loopback, with
logged-mail mode allowed, a scratch database, and a real verified session. The
fixture contains a team, project, six messages in each conversation, a task with
steps and a pending question. Both sizes are 900 pixels high.

All files are under `docs/mockups/built/2026-11-05/`:

| View | Before | After |
|---|---|---|
| Conversation, desktop | `before/conversation-1280.png` | `after/conversation-1280.png` |
| Conversation, phone | `before/conversation-390.png` | `after/conversation-390.png` |
| Task thread, desktop | `before/thread-1280.png` | `after/thread-1280.png` |
| Task thread, phone | `before/thread-390.png` | `after/thread-390.png` |
| Navigation, desktop | `before/nav-1280.png` | `after/nav-1280.png` |
| Navigation, phone | `before/nav-390.png` | `after/nav-390.png` |

Reference captures are `mockups/{conversation,nav,journey,native}-{1280,390}.png`.
The phone reference captures scroll to the phone drawing. The built chat opens
at its newest messages; the before version opens at the top of the document.
Before and after captures use the same seed without browser-test replies.
Additional `after/{conversation,thread}-history-{1280,390}.png` captures show
the task steps near the start of each feed. These use `EQUIPO_CHAT_HISTORY=1`.

Capture command, with `EQUIPO_BROWSER_ARTIFACTS` pointing to the appropriate
scratch directory: `EQUIPO_ALLOW_LOGGED_MAIL=1 EQUIPO_CHAT_BASELINE=1
GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0 go test -tags browser ./internal/equipotest
-run '^TestChatBrowser$' -count=1`. The baseline flag captures without asserting
the new behavior, so the same fixture runs on the original UI.

## Verification

The first `TestChatBrowser` run failed with `missing accessible chat feed` before
implementation. The long-history acceptance check also failed before its fix.

- `GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0 go test ./internal/equipo/conversation -run '^TestChatFeed$' -count=1`: passed.
- `GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0 go test -tags browser ./internal/equipotest ./internal/plan3test -run '^(TestChatBrowser|TestFoundationBrowserWalk|TestRunnerTaskBrowserWalk|TestConversationLayout|TestTeamsHierarchyBrowser)$' -count=1`: passed. Includes both widths, 200% text, live messages and task progress, draft/focus retention, scrolling, keyboard sends and navigation.
- `EQUIPO_BROWSER_NO_JS=1 GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0 go test -tags browser ./internal/equipotest -run '^(TestChatBrowser|TestFoundationBrowserWalk|TestRunnerTaskBrowserWalk)$' -count=1`: passed.
- `make -k ci`, first run: reference-inventory and project-correction-link failures. Both were fixed. Build, vet, formatting, static analysis, vulnerability and secret scans, size budgets, adapter checks, containment checks, migration and performance checks passed. Some unchanged execution packages exceeded advisory local timing budgets under load.
- `GOFLAGS=-p=2 make -k ci`, final run: **exit 0**. All 31 tested packages passed uncached. Adapter, containment, migration and both required performance checks passed. Two full gate runs were made in total.

The final full test step took 15m53.465s with two Go packages running at once.
Seven package timing limits were exceeded during this shared-machine run. These
are advisory locally and enforced on CI; a successful local exit does not certify
those timing limits. No limits were increased.

| Package | Observed | Limit |
|---|---:|---:|
| `internal/directlive` | 6m21.935s | 6m |
| `internal/equipotest` | 5m8.902s | 5m |
| `internal/runner` | 9m25.809s | 5m30s |
| `internal/runner/containment` | 15.385s | 15s |
| `internal/runner/provider` | 35.284s | 15s |
| `internal/runner/provider/claude` | 1m12.855s | 45s |
| `internal/runner/provider/codex` | 1m0.805s | 35s |

Seventeen mutations were applied separately, tested, then restored. Every
mutation failed its guard. Unit mutations used `go test ./internal/equipo/conversation
-run '^TestChatFeed$' -count=1`; browser mutations used `go test -tags browser
./internal/equipotest -run '^TestChatBrowser$' -count=1`, except the two history
cases, which used `./internal/plan3test -run '^TestConversationLayout$'`.
All commands used `GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0`.

| Deliberate breakage | Observed failure |
|---|---|
| Remove retained older messages | Message being read disappeared |
| Treat message and card IDs as interchangeable | Visible message moved |
| Reverse feed ordering | Cards detached from messages |
| Style every person as the current viewer | Identity assertion failed |
| Substitute a specialist key for its name | Identity assertion failed |
| Select answered questions instead of pending ones | Thread-card assertion failed |
| Ignore task lookup errors | Denied lookup was hidden |
| Remove the ordered list | Accessible-feed assertion failed |
| Remove machine-readable timestamps | Message-times assertion failed |
| Remove viewport height | Composer left the viewport |
| Remove the feed's live subscription | Live-message wait timed out |
| Clear the draft on live updates | Draft/focus assertion failed |
| Stop following the bottom | Bottom-follow assertion failed |
| Always jump to the bottom | Reading-position assertion failed |
| Suppress live announcements | Announcement assertion failed |
| Send on Shift+Enter | Newline assertion failed |
| Remove Enter submission | Sending-state wait timed out |

The reference inventory has exact allowances for the supplied brief's excluded
path, DOM properties and the reused isolation-disclosure partial. No broad
allowances or size-budget increases were added.

## Copy and handoff

New app-owned runtime strings: **none**. Existing strings are reused. Fixture
messages and labels are test data. No copy-review service was started, and no
README prose was changed.

Delivery target: `origin/chat-ui`. The harness stopped its loopback servers and
browsers and removed its temporary databases and profiles. The task scratch
files were removed at handoff; the 24 comparison PNGs remain in the repository.
The release/install areas named in the brief were not changed.

## Round 2

Starting point: `b42b4ed`, the second brief on `acf53a2`. The sidebar now has
one team name and switch control, one Specialists heading, compact status text,
and project and Needs you counts. Playbooks and the template library are under
Team. Failed count reads remain unavailable.

Incoming messages are plain text under their sender label. Your messages use a
right-aligned tinted bubble, with a small keyboard-accessible actions menu.
Dates separate days, including retained history after live updates. The header
and rounded composer stay in place while the feed scrolls. On phones the back
link shares the title row. The composer has a placeholder, an accessible label,
and a small Send button. Its project picker appears only in the main conversation
when projects exist. Choosing a project prefixes the message with its name,
visible in the sent message. This supplies context without changing project
permissions or automatically assigning a task.

Question cards use a hairline border and attention tint. Single-field native
questions with options have one-tap answers. Free text starts at one line and
grows as you type; Send and Deny retain the existing answer handlers. Task cards
link to their thread, include project, kind and age, and use step pills with
category, action, model and account. Arrows connect the steps; active and done
states have markers as well as colour. Edit plan and Why these models are small
controls. Evidence and project correction remain available in the card's details.

Navigation reads now live with the navigation view. Browser wait, click and
capture helpers are shared in `internal/browsertest`. Existing size ceilings are
unchanged. Vendored assets, schema, release code and README prose are unchanged.

### Round 2 verification

The first browser run failed on the sidebar, message presentation, date separator,
header, question, task actions and composer. The first project-context test failed
because the selection was absent from the message. The first option-label test
failed because native option labels were discarded. Adding date separators also
exposed a retained-history offset failure; rebuilding the separators across
retained and newly loaded messages fixed it. Final review also found the missing
recommendation-kind label. `TestChatTaskKinds` failed before that pending copy
entry was added.

All commands use `GOTOOLCHAIN=go1.26.10 CGO_ENABLED=0`:

- Browser checks, passed: `go test -tags browser ./internal/equipotest ./internal/plan3test -run '^(TestChatBrowser|TestFoundationBrowserWalk|TestRunnerTaskBrowserWalk|TestConversationLayout|TestTeamsHierarchyBrowser)$' -count=1`.
- Scriptless checks, passed: `EQUIPO_BROWSER_NO_JS=1 go test -tags browser ./internal/equipotest -run '^(TestChatBrowser|TestFoundationBrowserWalk|TestRunnerTaskBrowserWalk)$' -count=1`.
- Focused checks, passed: `go test ./internal/equipo ./internal/plan3test ./internal/runnerproto -run '^(TestChatNavigationStatus|TestChatTaskKinds|TestConversationMessageReplay|TestPlan3ReleaseBoundaries|TestQuestionOptionLabels)$' -count=1`.
- Full gate: `GOFLAGS=-p=2 make -k ci`, one run, exit 2. The failures were two old assertions: `TestRailRoutes` required a separate Teams row with an icon, and `TestConversationNoProjectPicker` rejected a selector even when projects existed. They now check the team switch and the conditional picker. Their focused rerun passed. The full affected-package rerun, `GOFLAGS=-p=2 go test ./internal/equipotest ./internal/plan3test -count=1`, passed: 334.069s and 197.220s respectively. The application package still exceeded its advisory 300s local limit. Final browser reruns passed in 37.214s and 5.582s.

Build, vet, formatting, static analysis, vulnerability and secret scans, size
budgets, adapter, containment, migration and performance checks passed in that
full run. The test step took 17m33.138s: 27 packages passed and two failed on the
assertions above. No second full gate run was made. The final recommendation
label was added during the gate and passed the task-kind, template-copy and
copy-inventory checks separately.

Conversation first-byte time was 25.721 ms median, 33.421 ms worst; task threads
were 22.319 ms median, 28.049 ms worst. Both are within the 150 ms budget.
Cold boot was 119 ms median against 500 ms.

The full run emitted these local advisory timing notices. CI enforces them;
passing the functional checks does not certify these timing limits.

| Package | Observed | Limit |
|---|---:|---:|
| `internal/directlive` | 9m20.368s | 6m |
| `internal/runner` | 8m10.746s | 5m30s |
| `internal/runner/provider` | 32.779s | 15s |
| `internal/runner/provider/claude` | 1m6.783s | 45s |
| `internal/runner/provider/codex` | 57.863s | 35s |

Twenty-one mutations were applied separately and restored. Each failed its guard:

| Guard command | Deliberate breakages caught |
|---|---|
| `go test -tags browser ./internal/equipotest -run '^TestChatBrowser$' -count=1` | Separate brand restored; team switch removed from header; duplicate specialist heading; wrapping counts; missing project count; boxed incoming text; visible own email; missing message menu; missing date separator; expanded header; multiline initial question field; missing options; missing age; missing plan controls; missing placeholder; page overflow; wrong option answer field. |
| `go test -tags browser ./internal/plan3test -run '^TestConversationLayout$' -count=1` | Removed date rebuilding from retained history. |
| `go test ./internal/plan3test -run '^TestConversationMessageReplay$' -count=1` | Selected project omitted from the message. |
| `go test ./internal/runnerproto -run '^TestQuestionOptionLabels$' -count=1` | Native option labels discarded. |
| `go test ./internal/equipo -run '^TestChatNavigationStatus$' -count=1` | Working count replaced with zero. |

### Round 2 captures and copy

The ten `after/*.png` files under `docs/mockups/built/2026-11-05/` are replaced
at the original 1280×900 and 390×900 sizes. Before and reference images remain
unchanged. The fixture question now includes Net and Subtotal options so the
one-tap controls can be compared with the reference. Capture uses the original
command above, with `EQUIPO_CHAT_BASELINE=1`; the four history captures also use
`EQUIPO_CHAT_HISTORY=1`. Captures exclude replies inserted by browser assertions.

Each new entry below has `// COPY REVIEW PENDING` in `copy.go`. The consolidated
Plan 3 inventory contains the same pending entries. Its test now expects the
release-copy check to reject this branch while that copy is pending.

| Key | Draft text |
|---|---|
| `task.kind.recommendation` | Recommendation |
| `nav.switch` | switch |
| `nav.idle` | idle |
| `nav.waiting` | waiting |
| `nav.queued` | queued |
| `conversation.placeholder` | Ask for a fix, a feature, or what’s next |
| `conversation.today` | Today |
| `conversation.message_actions` | Message actions |
| `conversation.any_project` | Any project |
| `conversation.why_models` | Why these models? |
| `conversation.send_short` | Send |
| `conversation.age_minutes` | %d min |
| `conversation.age_hours` | %d hr |
| `conversation.age_days` | %d d |

No copy-review server was started. The harness closed its loopback servers and
browsers. Scratch captures, mutation scripts and test logs were removed. Delivery
target is `origin/chat-ui`; no default-branch push or deployment.
