# R2d — native run title rename ## What changed New `lib/features/runs/actions/title*` slice plus its tests and this note. No existing source file was edited. | File | Lines | Responsibility | | --- | --- | --- | | `lib/features/runs/actions/title_wording.dart` | 24 | Web-verbatim words, test keys, refusal wording | | `lib/features/runs/actions/title_dialog.dart` | 183 | Native Material/Cupertino text-field prompt and inline refusal | | `lib/features/runs/actions/title_action.dart` | 109 | `RunTitleAction`, stored-title seeding, send/deliver orchestration | | `test/features/runs/actions/title_test_support.dart` | 110 | Fake gateway, run fixtures, stateful host, app wrappers | | `test/features/runs/actions/title_action_test.dart` | 244 | Both-platform open/cancel/exact-save and stored-title seeding | | `test/features/runs/actions/title_resilience_test.dart` | 243 | Refusal retention, double save, disposal, stale owner, 2x/narrow | `RunTitleAction(run: …, gateway: …, onRunChanged: …)` renders one native `OutlinedButton` (`Rename`) on Material and one plain `CupertinoButton` on Cupertino, and nothing for a run without a numeric id. Platform style follows the enclosing app (`MaterialLocalizations` presence). No style overrides, fixed component sizes or new dependencies. ## Behaviour and web parity The prompt is seeded with the run's actual stored title exactly as the browser reads it, `String(d.title ?? "")` in `web/src/views/runDetail.js`. It is never derived from `input.prompt`, stage output or a placeholder. A missing title seeds an empty field. Typing, opening and the dismiss action send nothing. Only `Save` calls the existing `RunsRepository.setRunTitle(id, title)`, which sends the exact envelope: ``` set_run_title {"run_id": , "title": } ``` The field text is passed through untrimmed, matching `repo.setRunTitle(id, String(state.renameValue ?? ""))` in `web/src/repository.js`. Leading/trailing spaces and Unicode are preserved, and a blank title is sent as `""` so the server, not the client, decides whether it is acceptable. There is no local `canSubmit` gate on blank text. A refusal (including a blank-title refusal) is shown verbatim below the field and the prompt stays open with the typed draft intact. Nothing is updated locally. Only an accepted reply closes the prompt and passes the server's returned `run_detail` once through `onRunChanged`; the action never fabricates a run or a title. A second Save tap while sending is ignored, both dialog actions disable until the reply, and every asynchronous resume checks `mounted`. A reply for a run the widget no longer owns is dropped. ## Checks actually run ``` dart format lib/features/runs/actions/title*.dart \ test/features/runs/actions/title*.dart # clean flutter analyze # No issues found! flutter test test/features/runs/actions/title_action_test.dart \ test/features/runs/actions/title_resilience_test.dart # 11 passed flutter test test/features/runs # 45 passed flutter test # 63 passed flutter build web # Built build/web (16.2s) ``` Focused acceptance coverage: - both platforms: native button and dialog, stored title in the field, typing and Cancel produce zero gateway calls, Save sends exact `set_run_title` fields; - exact field values: Unicode plus leading/trailing whitespace preserved; blank title sent as `""` and the server refusal shown with the blank draft retained; - failed save: server words verbatim, draft retained, dialog open, no callback and no local title change; transport failure likewise; - double Save: one request, action buttons disabled while in flight; - disposal: a late reply after the tree is replaced throws nothing and delivers nothing; a reply after the widget's run id changes is not delivered; - 320x480 at 2x text: both prompts open, show a long title and a refusal, and close with no rendering exception; - malformed run: no rename button, and the stored-title helper ignores prompts. ## Honest limits - **Not wired into a run-detail screen.** This branch has no run-detail screen or controller; the manager owns integration. No real browser interaction or capture was performed, so rendered feature parity is not claimed. `flutter build web` proves compilation of the existing entrypoint, not that this widget is reachable or visible. - **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used. Source uses portable Flutter/Cupertino/Material widgets only. - No real server, operator run or chat was touched. Tests use a local fake gateway with no socket. - No repository/domain/controller/shell/main/pubspec, `web/`, Go server, installer or deployment file was changed. - Nothing was committed, pushed or deployed; the files above are the candidate in the working tree, per the stage instruction not to commit.