Files
pipelines/app/notes/R2-title-wire.md
T
alan 3d3ee3a3ab feat(app): wire run rename from the native run detail
Expose the existing RunTitleAction from the real run detail under both native hosts and fold the server's accepted run_detail into the open detail and the matching list row through RunsController, mirroring the web applyRunTitle path. Adds focused wiring/controller tests, a real-composition browser probe and an evidence note. Mobile remains unverified.
2026-10-21 19:16:49 +01:00

95 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# R2 — title wiring into the real run detail
## Result
The already-landed `RunTitleAction` is now rendered by the real run detail under
both native hosts, and its accepted server `run_detail` is folded into the open
detail and the matching list row through `RunsController`. Nothing is sent while
typing or on Cancel, nothing is applied before the server replies, and a stale
reply cannot replace another selected run.
No server, shell, pubspec, main, dialog, repository or protocol file changed.
The action, wording and gateway are reused exactly as landed in R2d.
## Files
| File | Change |
| --- | --- |
| `lib/features/runs/screen.dart` | Passes the app's shared `ApiGateway` into `RunDetailView` |
| `lib/features/runs/ui/run_detail_view.dart` | Builds `RunTitleAction` from the current server detail; folds accepted replies through `controller.acceptRunDetail` |
| `lib/features/runs/ui/run_detail_material.dart` | Adds the action to the existing title/identity `Wrap` |
| `lib/features/runs/ui/run_detail_cupertino.dart` | Adds the action as its own native row below the title block |
| `lib/features/runs/ui/runs_controller.dart` | `acceptRunDetail`: replaces the open detail only for the selected id, updates only the matching list row's server title |
| `test/features/runs/ui/run_title_wiring_test.dart` | New: both hosts, exact Save payload, Cancel, refusal, no optimistic title |
| `test/features/runs/ui/runs_controller_test.dart` | Stale accepted reply cannot replace another run; list fold preserves other fields |
| `test/features/runs/ui/run_detail_widget_test.dart` | Existing detail tests supply the gateway |
| `tool/title_wiring_probe.dart` | Real-composition browser entrypoint |
| `tool/title_wiring_probe.mjs` | Isolated loopback protocol fixture + Chrome driver |
Production diff: 5 files, about 51 added lines and 2 replaced lines.
## Behaviour
- Material detail: `Rename` is an `OutlinedButton` inside the existing identity
`Wrap`. Cupertino detail: a `CupertinoButton` in its own row, so it remains a
separate semantics node instead of merging into the title block.
- Opening the prompt sends nothing. The prompt is seeded from
`storedRunTitle(run)`, never the prompt/output fallback.
- Save sends exactly `set_run_title {"run_id": <id>, "title": <typed text>}`
through `RunsRepository.setRunTitle`, i.e. the one shared gateway.
- Cancel sends nothing. A refusal keeps the prompt open with the typed title and
the server's words verbatim; the stored detail is unchanged.
- Only the returned `run_detail` is delivered. `RunsController.acceptRunDetail`
ignores a map without an id, replaces `detail` only when its id matches, and
updates only that list row's `title` (web `applyRunTitle` behaviour) while
preserving row fields such as `name`/`status`. A late reply for run A while
run B is selected updates A's list row but never B's detail.
## Checks actually run
```
flutter pub get
dart format lib/features/runs test/features/runs/ui/...
flutter test test/features/runs/ui/run_title_wiring_test.dart \
test/features/runs/ui/runs_controller_test.dart \
test/features/runs/ui/run_detail_widget_test.dart # 26 passed
flutter analyze # No issues found!
flutter test # 544 passed
flutter build web # Built build/web
flutter build web --target=tool/title_wiring_probe.dart \
-o build/title_probe_web # Built
OPENCODE_ARTIFACT_DIR=... node tool/title_wiring_probe.mjs \
build/title_probe_web # ok: true
```
Browser probe (real bundle, isolated loopback websocket fixture, 390×844):
- Cupertino detail shows `Rename`; the prompt seeds `Run title` with
`Fixture live run` (DOM field value).
- Cancel after typing `Discarded title` sent no `set_run_title`, left the stored
title visible, and closed the prompt.
- Cupertino Save sent exactly `{run_id: 1, title: "Cupertino renamed run"}`; the
returned server detail replaced the title in the detail and in the list row.
- Material host (Linux UA reload, same deep link `/runs/1`) seeded from the
current server title and Save sent exactly
`{run_id: 1, title: "Material renamed run"}`.
- Seven PNG captures, OCR-checked for the visible title:
`/Users/alan/.local/share/pipelines/data/artifacts/68/public/r2-title-wire/`
(`r2-title-cupertino-detail.png`, `-dialog`, `-cancelled`, `-renamed`,
`-list`, `r2-title-material-dialog.png`, `r2-title-material-renamed.png`).
## Integration note for the parallel Changes lane
Run 67 adds a Changes button to `run_detail_material.dart` and
`run_detail_cupertino.dart`. This change adds a `titleAction` parameter and one
insertion in each file. When merging main, keep both: the title action and the
Changes button are independent additions to the same detail bodies.
## Honest limits
- Mobile (Android/iOS) is unverified: no device, emulator, ADB or mobile build
was used. Source uses portable Material/Cupertino widgets only.
- No real Pipelines server or operator run was touched. The browser probe used
an isolated loopback fixture, not production data or credentials.
- Nothing was committed, pushed, merged to main or deployed.