Files
pipelines/app/notes/attention-wiring.md
T

4.9 KiB

Runs-list Needs-you bell wiring

The landed attention model and native bell/sheet are now registered in the real Runs destination. The bell sits in the Runs list heading area and reads the same list_runs rows the screen already loaded; it issues no attention request and adds no poll.

Code

  • lib/features/attention/runtime/attention_store.dart — the injectable AttentionStore seam, a SharedPreferences implementation under pipelines.next.attention.v1 (only that key), and an in-memory implementation for tests/fixtures. Reads and writes are total: an unavailable plugin or full store returns null/false instead of throwing.
  • lib/features/attention/runtime/attention_controller.dart — derives today's ordered entries from rows plus the persisted dismissal set, loads asynchronously, and folds pushed run_event frames with the runs feature's existing foldRunEvent. The attention transition detector is seeded by authoritative list reads, reseeded on reconnect, and keeps emitted keys, so a failure/wait that appears while the screen is open reaches the bell once while a reconnect never replays it. Dismissals update memory and notify before the store write, so a slow or failed write cannot block the sheet. Pushed title/name/diagnostic are retained because the lifecycle fold does not carry the row's attention text.
  • lib/features/attention/ui/needs_you_runs_heading.dart — owns the controller and shared-frame subscription for the destination, passes the dismissed list to the landed NeedsYouBell, and opens the existing run through RunsList's onSelected (the existing run route).
  • lib/features/runs/ui/runs_list.dart — small heading insert plus injectable store/clock and reconnect token; no other destination is touched.
  • lib/features/runs/screen.dart — forwards the reconnect token and the test seam to the list.
  • lib/features/runs/ui/runs_filters.dart — the existing filter controls moved out of the list file unchanged for Material, with the Cupertino strip made horizontally scrollable. At 320 logical px / 2x the old wrapping strip alone made the Runs Column overflow before the attention change; one native row is the same narrow-toolbar shape the browser uses and keeps every control reachable. File split keeps runs_list.dart at 159 lines.

The bell keeps the native NeedsYouBell semantics (Notifications / Notifications, N needing attention), shows no badge when empty, and uses the already-landed Material bottom sheet / Cupertino popup. Failed rows dismiss before opening; Decision rows open without dismissing; Clear all uses the snapshot the sheet captured when it opened. Dismissals survive a screen rebuild through the same store.

Verification

  • flutter test — 966 tests passed.
  • Focused flutter test test/features/attention/runtime — 20 tests passed: rows -> entries, export waits and yesterday excluded, dismissal persistence across a rebuilt controller, slow write does not block, failed read/write is harmless, clear-all snapshot leaves a later arrival, live failed frame adds an entry, a frame can create a new run summary, reconnect keeps dismissals and emitted keys, empty state keeps the bell and hides its badge, both hosts at 320 logical px / 2x with no list/sheet overflow, and the SharedPreferences key ownership test.
  • flutter analyze — no issues.
  • flutter build web — normal lib/main.dart built successfully.
  • Real browser (tool/attention_wiring_probe.mjs, isolated startFixture, two fresh app boots, one shared socket each): four captures in public/attention-wiring/ at 320 logical px / 2x: attention-runs-cupertino-bell-320x2.png, attention-runs-cupertino-sheet-320x2.png, attention-runs-material-bell-320x2.png, attention-runs-material-sheet-320x2.png. The drive asserted the accessible count Notifications, 2 needing attention, both void rows absent, the Dismiss ... names and Clear all, and viewed both PNGs. The fixture list held a running row and an export_pending_sequence wait that did not enter the sheet; the fixture served one connection and no get_run/attention request (listRuns: 4 across the two boots, the existing screen loads). Both bell and sheet captures were inspected.

tool/runs_probe_server.mjs now accepts an optional runs list so this fixture can use current-day timestamps without changing the existing runs probe's default data. No legacy driver was edited.

Not done / limits

  • No commit, push, merge, deployment, preview cutover or service restart.
  • Notification permission/tray delivery remains separate work; the transition ledger is exposed for that wiring but no permission is requested here.
  • Android/iOS builds and real devices were not run; web only, as required.
  • The fixture is isolated (loopback, its own browser profile) and does not touch operator runs, chats, storage or production credentials.