Files

11 KiB

D1-wire — native Changes action in the run detail

Manager completion after retained stage limit

The final Code visit completed its fixes, but the runner could not revisit Review again (visit limit3). No implementation was rerun or discarded. Manager checked the retained source, focused changes/wiring tests and analyzer, then rebuilt and drove the real RunDetailView fixture:15 checks/20 captures pass, including both 320px/2x native menus and selected Raw patch. Narrow hosts use a standard native sheet, never a custom segmented clone. Manager separated the cohesive form controls into diff_form_control.dart and used the actual host/native label style instead of a hard-coded font measurement. No font/size/palette override remains. Evidence: approved temp/changes-wiring-manager-browser. Actual shell merges and publication are tracked separately in WORK.md; earlier notes below are historical.

Adds one standard native action to the existing run-detail bodies and reuses the landed ChangesViewer. No API call, shell/main or pubspec edit; no commit, push or deploy.

Behaviour

  • Material: FilledButton.tonalIcon labelled Changes beside Back to list. It pushes a MaterialPageRoute whose only bar is an AppBar(title: Text('Changes')) above the viewer.
  • Cupertino: CupertinoButton.tinted labelled Changes in the detail's header row. It pushes a CupertinoPageRoute whose only bar is a CupertinoNavigationBar; native back is automatic.
  • The action is offered once the run has stopped executing: the server's executing flag must be false and the status must not be queued/running/waiting. The opened page snapshots the recorded steps, so an executing run is not given a page that could go stale or miss a later settlement; its evidence belongs to the live visit pane when that slice lands. showRunChangesAction holds that check.
  • The run-wide aggregate is shown only for succeeded, matching web/src/changes.js showRunChangesSummary and PARITY R4. A failed run keeps each visit's own recorded capture (stage, visit number, status, capture counters/scope/diagnostic and file rows) without claiming a settled final state; ChangesViewer gained a showSummary input for that.
  • runDetailChangeSteps passes the server's steps unchanged; the page snapshots the list once.
  • No capture, visit, partial/missing/unavailable wording or diff rendering is reinterpreted by the wiring; the changes domain still owns all of it.

Review findings addressed

  1. Failed/running runs no longer receive a settled Changes page. The aggregate and filter are hidden unless the status is succeeded; failed runs still open the per-visit evidence. Executing runs get no action at all, which also removes the stale-snapshot case. Covered by failed and running regressions plus browser checks.
  2. Cupertino Raw patch no longer asserts. The raw body moved to RawPatchView: Material keeps SelectionArea; Cupertino renders the exact recorded bytes in a read-only CupertinoTextField (the pattern the run detail already uses), with its intrinsic line width and horizontal scrolling, so no MaterialLocalizations are required. A Cupertino Raw regression taps the control and checks the native field, and the browser probe opens it.
  3. Dark Cupertino Changes now follows the host. Both the Cupertino page and the file-diff popup it opens wrap the viewer in hostTextTheme(context) (change_style.dart): a Theme with CupertinoTheme.brightnessOf(context) and the host platform. The popup matters because dialogs open on the app Navigator, above the page's own theme, so the first fix alone left the diff header light-theme near-black on the dark popup. Widget regression opens the file from the dark page and asserts the Modified header is light; the probe measures the rendered header pixels (luminance 0.87; 0.15 without the fix), and captures cover dark Changes and dark diff.
  4. The diff form labels stay whole at 320 px and 2x text. A two-segment control cannot keep Rendered and Raw patch on one line there: Material broke Rendered mid-word and Cupertino clipped Raw patch to Raw, with no way to see the rest. diffFormSegmentsFit measures the two fixed words at the host's text scale and, when the native segmented control cannot fit both, the viewer uses the host's standard menu instead (a Material bottom sheet or a Cupertino action sheet) with the same two words, one per row. The current mode is highlighted and the menu is titled Diff form. The Copy patch action keeps its intrinsic width in a horizontal strip rather than breaking its words. Widget regressions on both hosts assert that no label breaks inside a word, is clipped vertically or is clipped horizontally, and that choosing Raw patch from the menu shows the recorded raw body. Browser captures cover the 320x2 menu and raw state on both hosts.

The action gate now also honours the server's executing flag (web's isExecuting), so a failed run whose step is still active is not offered the snapshot page; the status list remains as the fallback for replies without the flag.

The earlier comment claiming runDetailChangeSteps returns the same list instance was corrected. The browser/system Back advisory is unchanged and unresolved: it needs AppRouterDelegate.popRoute/Router work in lib/shell/, which this lane must not edit. The probe's Back checks exercise the page's own back control only.

Files

lib/features/runs/ui/run_changes_action.dart          new, 126 lines
lib/features/runs/ui/run_detail_material.dart         +13/-7
lib/features/runs/ui/run_detail_cupertino.dart        +8/-2
lib/features/changes/changes.dart                     export hostTextTheme
lib/features/changes/domain/run_changes.dart          +7
lib/features/changes/widgets/change_style.dart        +hostTextTheme, fit check, native menu
lib/features/changes/widgets/changes_viewer.dart      showSummary gate
lib/features/changes/widgets/file_diff_viewer.dart    raw body, themed dialog, form menu
lib/features/changes/widgets/raw_patch_view.dart      new, 75 lines
test/features/runs/ui/run_changes_action_test.dart    new, 177 lines
test/features/runs/ui/run_changes_status_test.dart    new, 204 lines
test/features/changes/diff_presentation_test.dart     +2x label regressions
test/features/changes/changes_viewer_test.dart        2x control expectation
test/features/changes/run_changes_test.dart           +9 (status gate)
tool/diff_wiring_probe.dart                           fixture entry, scale=2
tool/diff_wiring_probe.mjs                            browser driver, pixel probe, 2x/320

Checks (actual results)

  • flutter test test/features/changes test/features/runs — 159 tests passed.
  • flutter test test/features/runs/ui/run_changes_action_test.dart test/features/runs/ui/run_changes_status_test.dart test/features/runs/ui/run_detail_widget_test.dart test/features/changes — 67 tests passed.
  • flutter analyze — No issues found.
  • dart format --output=none --set-exit-if-changed on every touched Dart file — clean (0 changed).
  • node --check tool/diff_wiring_probe.mjs — passed.
  • flutter build web --target tool/diff_wiring_probe.dart --output build/probe-wire — built.
  • flutter build web --output build/web-wire-check — built.

Widget regressions cover both hosts: the happy path (recorded filename, stat, per-stage Visit 1, rendered diff, Close diff, Back), unavailable capture wording, a failed run without the aggregate but with its visit capture, an executing run with no action, the dark host text colour on both the Changes page and the opened diff header, the Cupertino Raw native field, and the 320x720 2x labels: no mid-word break, no vertical or horizontal clipping, the native menu labels and choosing Raw patch in it, and the unchanged segmented control on a wide host.

Real browser evidence

tool/diff_wiring_probe.dart renders the real RunDetailView over a fake get_run gateway; tool/diff_wiring_probe.mjs serves it on an OS-assigned loopback port and drives headless Chrome. Query parameters select the fixture: ?run=failed, ?run=running, ?capture=unavailable, ?platform=cupertino&theme=light|dark and ?scale=2 for the 2x text states. No server or operator run was touched.

All 15/15 checks passed (d1-wire/d1-wire-probe.json), 20 captures:

  • Material run detail shows the native Changes action; it opens the recorded lib/features/runs/ui/run_changes_action.dart with 1 file changed · +2 -1 and its implementer visit section.
  • The recorded file opens its actual diff (- const label = "Old";, + const recorded = true;) with Rendered/Raw patch/Copy patch/Close diff; Close diff and Back return.
  • ?capture=unavailable shows Changes · capture unavailable and the server diagnostic, never "No changes observed".
  • ?run=failed keeps the visit capture and shows no run-wide file changed summary.
  • ?run=running offers no Changes action.
  • Cupertino shows the tinted Changes button, one bar, the recorded file and diff; Raw patch renders in the native field with the other actions intact; Close diff and Back return.
  • Cupertino dark renders the summary and the recorded diff with light text; the diff header is sampled from the rendered capture (max luminance 0.87, above the 0.5 readable-text gate) instead of only checking that the words exist.
  • ?scale=2 at 320x720 opens the same diff on both hosts, shows the Diff form menu with Rendered and Raw patch whole, and renders the recorded raw body after choosing Raw patch.

Captures in the shared d1-wire/ folder (390x844, plus the 320x720 2x states):

d1-wire-material-detail.png       d1-wire-material-changes.png
d1-wire-material-diff.png         d1-wire-material-back.png
d1-wire-material-unavailable.png  d1-wire-material-failed.png
d1-wire-material-running.png      d1-wire-cupertino-detail.png
d1-wire-cupertino-changes.png     d1-wire-cupertino-diff.png
d1-wire-cupertino-raw.png         d1-wire-cupertino-back.png
d1-wire-cupertino-dark-changes.png d1-wire-cupertino-dark-diff.png
d1-wire-material-2x-320-diff.png  d1-wire-material-2x-320-menu.png
d1-wire-material-2x-320-raw.png   d1-wire-cupertino-2x-320-diff.png
d1-wire-cupertino-2x-320-menu.png d1-wire-cupertino-2x-320-raw.png

Not verified / remaining

  • Browser and Android system Back on the pushed page are unverified; the advisory Router integration was not changed.
  • Active-run per-visit changes are not shown anywhere yet; that belongs to the live run visit pane, not this snapshot page.
  • Mobile targets were not built, installed or run; Cupertino is verified through widget tests and browser rendering only, so mobile remains unverified.
  • All data is fixture data; no live server or operator run was used.