114 lines
7.2 KiB
Markdown
114 lines
7.2 KiB
Markdown
# Needs you surface (native bell + sheet)
|
||
|
||
The reusable native surface over the landed pure attention model is in
|
||
`lib/features/attention/ui/`:
|
||
|
||
- `needs_you_bell.dart` — `NeedsYouBell` receives `entries` and the
|
||
`onOpen`/`onDismiss`/`onClearAll` callbacks. It reads no socket, clock or
|
||
storage. The accessible name is `attentionBadgeLabel(entries.length)`
|
||
(`Notifications` when empty, `Notifications, N needing attention` otherwise)
|
||
and the visible count badge is absent when empty. It keeps the caller's list
|
||
live for the open sheet, dismisses a Failed row before handing it to `onOpen`
|
||
(opening it is dealing with it; a Decision row stays until answered), and
|
||
returns focus to the bell when the sheet is closed without choosing a run,
|
||
as the browser does.
|
||
- `needs_you_sheet.dart` — captures the dismissal snapshot with
|
||
`attentionDismissalSnapshot` as the route opens, then uses
|
||
`showModalBottomSheet` on Material and `showCupertinoModalPopup` on Cupertino.
|
||
Back, Escape and barrier dismissal are the native route behaviours.
|
||
- `needs_you_sheet_material.dart` — M3 bottom sheet with a native `ListTile` per
|
||
entry (leading kind icon, label, `{pipeline} · {detail}`), a per-row trailing
|
||
close `IconButton`, and a `Clear all` text action. It deliberately has no
|
||
extra `Close` button: the native drag handle, barrier, system back and Escape
|
||
close it, unlike the browser and the Cupertino popup, which carry an explicit
|
||
`Close`. That is a platform difference, not a missing action.
|
||
- `needs_you_sheet_cupertino.dart` — a `CupertinoPopupSurface` containing
|
||
inset-grouped Cupertino list sections, host text roles, an xmark dismissal
|
||
action per row, a Close action, and a separate Clear-all group. Rows do not
|
||
use `CupertinoListTile` because that control caps title/subtitle at one line
|
||
and would truncate a scaled label.
|
||
- `needs_you_copy.dart` — the browser's wording, including
|
||
`Dismiss {label}` and `Dismiss {label} (run {runId})` when labels repeat.
|
||
|
||
Each destructive control is named after its row, never bare `Dismiss`: the
|
||
Material tooltip and the Cupertino xmark semantic label are
|
||
`Dismiss {label}`, plus `(run {runId})` when two rows share a label, matching
|
||
`web/src/views/attention.js`. The Material drag handle keeps its native
|
||
`Dismiss` label (`modalBarrierDismissLabel`); that is the barrier action, not a
|
||
row action.
|
||
|
||
The Material action reserves its own trailing room for the count badge. A
|
||
native `Badge` paints its label 12 logical px past the icon and makes the
|
||
stadium at least as tall as it is wide, so the label grows with the text scale:
|
||
at 1x it ends inside the 48 px action, at 2x it reaches 8 logical px beyond it.
|
||
A Material app bar puts its last action flush at the trailing edge, which used
|
||
to shear the badge's right end at 2x text (320 and 390 logical px). The bell now
|
||
reserves the scaled label height minus that built-in offset, leaving a 16
|
||
logical px margin at every scale, so a caller can place it directly in
|
||
`AppBar.actions` without extra padding. `test/features/attention/ui/needs_you_badge_test.dart`
|
||
measures the stadium the badge actually paints in that placement at 320×640/2x
|
||
and 390×844/2x and requires a visible margin; it fails if the reserved room is
|
||
removed. The Cupertino action already sits inside the navigation bar's trailing
|
||
room and fits (32 logical px at 320/2x).
|
||
|
||
The bell keeps the list it was given: pass a new list when the rows change.
|
||
An open sheet redraws when the new list draws different rows, and the
|
||
`Dismiss {label}` names refresh with it. Callers must not mutate the list in
|
||
place, and should derive a row's current run data from its `runId` rather than
|
||
from `entry.run` if they replace a summary without changing the drawn text.
|
||
|
||
The sheet draws the caller's live list, so a dismissal redraws it in place, and
|
||
it stays open after `Dismiss` and `Clear all` so several rows can be dealt with
|
||
in one visit. The bell hands the sheet a new list whenever what it draws changes —
|
||
identities, order, label or the `{pipeline} · {detail}` line — so a title edit or
|
||
a new diagnostic on an existing run reaches both an open sheet and one reopened
|
||
later, and its `Dismiss {label}` name refreshes with it. `Clear all` still receives
|
||
only the snapshot captured when the sheet opened: a run that arrives later is
|
||
shown but never silently cleared. Both hosts show `Nothing needs you right now.`
|
||
and no Clear all when the live list is empty. The title is exposed as a
|
||
route-naming header for assistive technology.
|
||
|
||
Focused tests in `test/features/attention/ui/` (28 new widget tests, both hosts
|
||
where meaningful): empty/plain vs counted bell and semantics label, the honest
|
||
empty sheet, back/Escape/barrier dismissal, focus return to the bell, the named
|
||
header, per-row dismiss names including the run-id suffix for repeated labels,
|
||
row Dismiss naming exactly its identity while the sheet stays open and redraws,
|
||
row Open identity, a Failed row dismissed before opening while a Decision is
|
||
not, Clear all applied only to the open snapshot while a later entry stays, a
|
||
same-identity title/diagnostic change refreshing both the open and reopened
|
||
sheet and its dismiss name, the painted badge margin in `AppBar.actions` at
|
||
320×640/2x and 390×844/2x, and 320 logical px / 2x dark wrapping with an
|
||
unscaled width check.
|
||
`flutter test test/features/attention` passes all 72 tests.
|
||
|
||
Real-browser fixture: `tool/attention_probe.dart` + `tool/attention_probe.mjs`
|
||
(no socket, storage or notification permission; `CHROME_PATH` overrides the
|
||
Chrome binary). The drive passes and wrote twenty captures to the run artifact
|
||
folder under `attention-ui/`: bell, open sheet, the sheet redrawn after
|
||
dismissing `7:Decision`, the cleared sheet, the Decision and Failed row-open
|
||
states, and the empty sheet, for Material and Cupertino in dark at 320 logical
|
||
px / 2x; bell + sheet for both hosts in light at 390 logical px and the default
|
||
text scale; and the Material bell and after-dismiss state at 390 logical px / 2x
|
||
where the badge must keep its trailing margin. The drive asserts two distinct
|
||
`Dismiss ...` row names, the row disappearing from the still-open sheet, Escape
|
||
returning to the page with `Dismissed 7:Decision` and one needing attention,
|
||
Clear all leaving an empty sheet with no Clear all or row dismiss, a Decision
|
||
row opening without a dismissal while a Failed row drops the count, and the
|
||
empty state offering neither Clear all nor a row dismiss. Measured from the
|
||
fresh PNGs, the Material badge's right edge is 16 logical px inside the
|
||
viewport at 320/2x, 390/2x and 390/1x.
|
||
|
||
`flutter analyze` is clean; `flutter build web` (normal `lib/main.dart`) succeeds
|
||
and the full suite passes. The component is not registered in the shell,
|
||
runs-list heading or a route; frames wiring, persisted dismissals, notification
|
||
permission and routing remain for later slices. No run, chat, `run_detail_*`,
|
||
server, web or deployment files were changed. Mobile and real device behaviour
|
||
are unverified.
|
||
|
||
## Manager completion after the Review visit limit
|
||
|
||
The pipeline exhausted its Review visits after the Code fixes. The retained tree is
|
||
complete: 72 attention/UI tests pass. Manager merged it directly; no rerun was
|
||
started. This is the reusable bell + sheet surface — runs-list registration and
|
||
persistence wiring remain separate work.
|