213 lines
12 KiB
Markdown
213 lines
12 KiB
Markdown
# T1 — native create-from-template prompt
|
||
|
||
Manager integration: retained both sides' compatible run-test gateway/scroll
|
||
repairs when merging. Split native field/action controls from dialog state so
|
||
production files remain under250lines. Added a fail-closed repository guard:
|
||
an empty/malformed created detail without a positive integral pipeline identity
|
||
cannot be reported as successful creation. The new regression failed before the
|
||
guard; all24 template tests pass after.
|
||
|
||
Browser acceptance now also covers Cupertino at 2x on a phone. The probe found
|
||
the prompt open and usable; its old "is the prompt open?" test required a
|
||
`role=button` Create node, which the Cupertino action row does not expose at that
|
||
scale even though the action is present and tappable. The probe now tests the
|
||
native alert-dialog surface directly and keeps the Material-only aria-disabled
|
||
check, with disabled-state coverage for Cupertino in widget tests. The probe's
|
||
own opener is now a bounded scrollable column so a long button label cannot run
|
||
past a phone viewport. No product layout change was needed: the Cupertino dialog
|
||
fits at 2x and its success capture was inspected.
|
||
|
||
## Result
|
||
|
||
A native Material/Cupertino prompt implements the browser's P5 create flow
|
||
without a gallery, route, shell wiring, publish/run control or dependency change.
|
||
Create validates the template's source first and only a passing validate submits
|
||
it create-only. The accepted detail is reported once through the dialog callback;
|
||
nothing is sent while typing, on Cancel, or after a validation refusal.
|
||
|
||
This visit addresses the UI review's blocking findings and the earlier
|
||
non-blocking notes:
|
||
|
||
- **B1 (2x, short phone hid the feedback):** the refusal/success line now sits
|
||
directly under the field, before the note, inside the dialog's scroll area, and
|
||
the prompt scrolls it into view when it is outside the visible content. At
|
||
2x/360×640 both lines are visible at rest without any scroll.
|
||
- **B2 (Cupertino field had no accessible name):** the field now has a visible
|
||
`New pipeline name (required)` label merged into the text field's semantics
|
||
node (label + value on one node). The Cupertino placeholder was removed
|
||
because it duplicated the accessible name; the visible wording is unchanged.
|
||
- **S1 (Material label truncated to `New pipeline name (requ…`):** the floating
|
||
label was replaced by the same wrapping label above the field that the browser
|
||
renders, so the full wording stays visible at 2x.
|
||
- **Advisory in-flight lock:** the flow test now asserts the field and Cancel are
|
||
disabled and that a system back does not dismiss while a validate is pending.
|
||
- The earlier note's file count is corrected below.
|
||
|
||
## Files (all new; nothing modified or preserved-changed)
|
||
|
||
| File | Lines | Responsibility |
|
||
| --- | ---: | --- |
|
||
| `lib/features/templates/ui/template_create_dialog.dart` | 287 | Native prompt, labelled field, validate-then-submit state machine, feedback reveal |
|
||
| `lib/features/templates/ui/template_create_wording.dart` | 42 | Browser wording verbatim, title/created-name/error helpers, stable keys |
|
||
| `test/features/templates/ui/template_create_dialog_test.dart` | 138 | Material blank/Cancel/happy path and validation-refusal coverage |
|
||
| `test/features/templates/ui/template_create_flow_test.dart` | 171 | Submit refusal, in-flight lock/double submit, Cupertino branch |
|
||
| `test/features/templates/ui/template_create_accessibility_test.dart` | 225 | 2x/3x layout, feedback visibility, both hosts' field semantics |
|
||
| `test/features/templates/ui/template_create_test_support.dart` | 127 | Recording gateway, fixture template, Material/Cupertino host |
|
||
| `test/features/templates/ui/template_create_wording_test.dart` | 43 | Exact wording and name fallbacks |
|
||
| `tool/template_create_probe.dart` | 167 | Isolated in-process fixture entry; Material or Cupertino, optional text scale |
|
||
| `tool/template_create_probe.mjs` | 316 | Loopback static server + real headless Chrome driver |
|
||
| `notes/T1-create.md` | — | This evidence |
|
||
|
||
`TemplateEntry`, `TemplateRepository`, `ApiGateway` and `TemplateRepositoryException`
|
||
are reused unchanged. `pubspec.*`, `lib/main.dart`, the shell, another feature,
|
||
`web/`, the Go server and `android/` were not touched.
|
||
|
||
## Behaviour and wire requests
|
||
|
||
- Exact browser wording: title `Create from {name}` (blank name falls back to the
|
||
template key), field `New pipeline name (required)`, note
|
||
`Creates a new draft pipeline on the server from this template's source; it is not run.`,
|
||
buttons `Cancel`/`Create`, in-flight `Creating…`, post-success `Close`, and
|
||
`Created "{name}". It is in the Pipelines list.`.
|
||
- Opening the prompt, typing and Cancel send nothing. Only Create runs
|
||
`TemplateRepository.validate(template.source)` and then, only after it passes,
|
||
`TemplateRepository.submit(typedName, template.source)`. The repository sends
|
||
`{type: 'submit', name: <trimmed>, source: <verbatim>, create_only: true}`; the
|
||
source is never trimmed or re-encoded.
|
||
- Blank/whitespace-only name keeps Create disabled. Sending disables the field,
|
||
both buttons and the confirm action, and blocks back/barrier dismissal. After a
|
||
success the field and Create stay disabled and the dismiss button reads Close.
|
||
- `_sending` plus `_canSubmit` guard a second tap/Enter, so a pending validate
|
||
cannot produce a second validate or submit.
|
||
- A validation refusal shows the server's own text in the still-open prompt and
|
||
sends no `submit`. A submit refusal also keeps the prompt and the typed name.
|
||
Neither refusal calls the callback and neither shows a success line.
|
||
- Success uses the server's own `detail.name` when non-blank, else the trimmed
|
||
submitted name, exactly like the web's `createdPipelineName`. The accepted
|
||
`detail` is delivered through `onCreated` once, before the user presses Close.
|
||
- The field keeps one layout on both hosts: a wrapping visible label, then the
|
||
native `TextField`/`CupertinoTextField`, wrapped in `MergeSemantics`. A reader
|
||
gets one text-field node whose label is the full wording and whose value is the
|
||
typed name. Refusal/success is placed after the field and before the note.
|
||
- Controls are standard `AlertDialog`/`AlertDialog.scrollable`/`TextField`/
|
||
`FilledButton`/`TextButton` and `CupertinoAlertDialog`/`CupertinoTextField`/
|
||
`CupertinoDialogAction`. Only the semantic error colours are used
|
||
(`colorScheme.error`, `CupertinoColors.systemRed`); there are no font/size/
|
||
colour overrides, fixed component sizes or bespoke palette.
|
||
|
||
## Checks actually run
|
||
|
||
```
|
||
cd app
|
||
flutter analyze # No issues found! (1.2s)
|
||
dart format --output=none --set-exit-if-changed \
|
||
lib/features/templates test/features/templates \
|
||
tool/template_create_probe.dart # 0 changed
|
||
flutter test test/features/templates # 23 passed
|
||
flutter test # whole app, passed
|
||
flutter build web -o build/web-normal # normal entry, ✓ Built
|
||
flutter build web --target=tool/template_create_probe.dart \
|
||
-o build/template_create_probe_web # ✓ Built
|
||
PROBE_WEB_ROOT="$PWD/build/template_create_probe_web" \
|
||
OPENCODE_ARTIFACT_DIR=…/public/t1-create \
|
||
node tool/template_create_probe.mjs # ok: true
|
||
PROBE_WIDTH=360 PROBE_HEIGHT=640 PROBE_SCALE=2 \
|
||
PROBE_CAPTURE_PREFIX=t1-create-2x-360x640 … # ok: true
|
||
PROBE_SCALE=2 PROBE_CAPTURE_PREFIX=t1-create-2x-390x844 … # ok: true
|
||
PROBE_HOST=cupertino PROBE_CAPTURE_PREFIX=t1-create-cupertino … # ok: true
|
||
git status --porcelain=v1 -uall # only the ten new files below
|
||
```
|
||
|
||
The focused suite is the prior T1a data tests (13) plus ten UI/wording tests,
|
||
including: blank/Cancel/happy path; validate and submit refusals; the in-flight
|
||
lock (disabled field/Cancel, back does not dismiss) and double-submit guard;
|
||
Cupertino native controls with the visible label; 2x/360×640 feedback visible at
|
||
rest for both refusal and success; the full label wrapping without ellipsis; the
|
||
reveal after the content was scrolled; and the field's semantics label + value on
|
||
both hosts.
|
||
|
||
## Browser evidence (real headless Chrome, loopback only)
|
||
|
||
The fixture gateway is in-process; the probe never opens a socket and never
|
||
submits to a real server. The driver reads `globalThis.templateCreateProbe` to
|
||
verify request counts and payloads, and asserts the field's DOM `aria-label` is
|
||
`New pipeline name (required)`.
|
||
|
||
1x, 390×844 (`public/t1-create/`):
|
||
|
||
- Blank name: `Create` had `aria-disabled="true"`, field empty, editable and
|
||
labelled.
|
||
- `Probe release` + Create: exactly one `validate`, zero `submit`, callback
|
||
count 0; the server's `invalid definition: fixture stage "añadir" has no type`
|
||
was shown and the field still held `Probe release`.
|
||
- Retrying Create: second `validate`, exactly one `submit` with
|
||
`{name: "Probe release", source: <verbatim fixture>, create_only: true}`, one
|
||
created callback, the exact success line, field locked, `Close` shown.
|
||
- Close sent no further request and dismissed the prompt.
|
||
|
||
2x captures (`public/t1-create-2x-360x640/`, `public/t1-create-2x-390x844/`):
|
||
|
||
- The full `New pipeline name (required)` label wraps and is visible at rest on
|
||
both viewports; the refusal and success lines are visible at rest on 360×640
|
||
without scrolling or any other interaction.
|
||
- The title remains visible above them; only the note is clipped by the short
|
||
viewport, and it stays scrollable.
|
||
|
||
Cupertino captures (`public/t1-create-cupertino/`, 390×844, Chrome): blank,
|
||
refusal and success with the same label, wording, request counts and locked
|
||
field. The DOM input exposes `aria-label` `New pipeline name (required)`.
|
||
|
||
Captures (public, shared with later stages):
|
||
|
||
- `public/t1-create/t1-create-blank-name-disabled.png`
|
||
- `public/t1-create/t1-create-validation-refusal.png`
|
||
- `public/t1-create/t1-create-accepted-success.png`
|
||
- `public/t1-create-2x-360x640/t1-create-2x-360x640-blank-name-disabled.png`
|
||
- `public/t1-create-2x-360x640/t1-create-2x-360x640-validation-refusal.png`
|
||
- `public/t1-create-2x-360x640/t1-create-2x-360x640-accepted-success.png`
|
||
- `public/t1-create-2x-390x844/t1-create-2x-390x844-blank-name-disabled.png`
|
||
- `public/t1-create-2x-390x844/t1-create-2x-390x844-validation-refusal.png`
|
||
- `public/t1-create-2x-390x844/t1-create-2x-390x844-accepted-success.png`
|
||
- `public/t1-create-cupertino/t1-create-cupertino-blank-name-disabled.png`
|
||
- `public/t1-create-cupertino/t1-create-cupertino-validation-refusal.png`
|
||
- `public/t1-create-cupertino/t1-create-cupertino-accepted-success.png`
|
||
|
||
The probe defaults to the Material host; `PROBE_HOST=cupertino`,
|
||
`PROBE_WIDTH`/`PROBE_HEIGHT`, `PROBE_SCALE` and `PROBE_CAPTURE_PREFIX` select the
|
||
other evidence above. The driver types the name once and retries Create after the
|
||
server refusal, so the same typed name is retained and then accepted.
|
||
|
||
## Task diff
|
||
|
||
```
|
||
?? app/lib/features/templates/ui/template_create_dialog.dart
|
||
?? app/lib/features/templates/ui/template_create_wording.dart
|
||
?? app/notes/T1-create.md
|
||
?? app/test/features/templates/ui/template_create_accessibility_test.dart
|
||
?? app/test/features/templates/ui/template_create_dialog_test.dart
|
||
?? app/test/features/templates/ui/template_create_flow_test.dart
|
||
?? app/test/features/templates/ui/template_create_test_support.dart
|
||
?? app/test/features/templates/ui/template_create_wording_test.dart
|
||
?? app/tool/template_create_probe.dart
|
||
?? app/tool/template_create_probe.mjs
|
||
```
|
||
|
||
All changes are additions in the working tree; no tracked file was modified and
|
||
no other lane's work was changed. Nothing was staged, committed, pushed or
|
||
deployed.
|
||
|
||
## Honest limits
|
||
|
||
- Not wired into a gallery or shell: this slice exposes
|
||
`showTemplateCreateDialog(...)`, as instructed. The manager owns registration
|
||
and the real detail action.
|
||
- Mobile (Android/iOS) is unverified: no Android/iOS build, emulator, device or
|
||
ADB was used. The Cupertino captures are Chrome's rendering of the Cupertino
|
||
widgets, not iOS; VoiceOver/TalkBack behaviour was not run.
|
||
- No real Pipelines server, credentials or operator pipeline was touched. Browser
|
||
evidence uses the in-process fixture gateway and no `submit` reached a server.
|
||
- The app's real dark shell theme was not exercised; both native hosts use
|
||
semantic theme colours (the Cupertino capture happened to run in dark mode).
|
||
- Not committed/pushed/deployed; the candidate is the uncommitted working tree
|
||
above.
|