# A1-wire — native Artifacts action and recorded-group gallery ## What changed The run detail now offers a standard native **Artifacts** action whenever the loaded detail carries steps. It pushes a native page that lists the recorded stage/visit groups from the landed `artifactGroups`/`ArtifactVisitList`. Selecting a row opens the host's native dialog with the recorded name, MIME and size, the visit's own capture facts, and — only when the recorded url resolves through the existing `resolveArtifactUrl` rules — native **Open** and a separate **Copy link**. | File | Lines | Responsibility | | --- | --- | --- | | `lib/features/artifacts/ui/artifact_gallery_action.dart` | 104 | Action gate, steps snapshot, native button, page push | | `lib/features/artifacts/ui/artifact_gallery_page.dart` | 194 | The page: summary/empty state, list, selection, Open/Copy link | | `lib/features/artifacts/ui/artifact_selection_facts.dart` | 71 | Group→step map and the recorded-facts widget | | `lib/features/artifacts/ui/artifact_external_open.dart` | 14 | `ArtifactExternalOpen` capability + default | | `lib/features/artifacts/ui/artifact_external_open_web.dart` | 20 | `window.open` through `js_interop` (JS and wasm) | | `lib/features/artifacts/ui/artifact_external_open_stub.dart` | 6 | Non-web refusal (no launcher dependency in this slice) | | `lib/features/artifacts/ui/artifact_visit_list.dart` | +28/-25 | Exposes the landed label helpers the page reuses | | `lib/features/runs/ui/run_detail_actions.dart` | +3 | Composes the action beside Rename/Cancel | | `test/features/artifacts/ui/artifact_gallery_page_test.dart` | 321 | Page, identity, capture facts, url rules, copy | | `test/features/runs/ui/run_artifacts_action_test.dart` | 161 | Action gate and wiring on both hosts | | `tool/artifact_gallery_probe.dart` | 232 | Isolated fixture entry (real `RunDetailView`) | | `tool/artifact_gallery_probe.mjs` | 421 | Loopback server + headless Chrome driver | No shell/main, pubspec, `web/`, Go server, `android/` or other feature was edited. No dependency was added. ## Behaviour - **Gate.** `showRunArtifactsAction` is true exactly when the loaded detail has at least one step. A detail with no steps shows no action; the page also has an explicit `No steps recorded for this run.` state if ever reached. - **Truthful empty/unavailable.** The page header is the landed `artifactsHeader`: `Artifacts · N recorded` (`· partial capture` when a visit excluded/omitted files), `Artifacts · capture pending` while executing, `No artifacts recorded for this run.` only for a recorded empty capture, and `Artifacts · capture unavailable` when the field was absent. An unavailable capture never says nothing was recorded. - **Selection identity.** `ArtifactVisitList` selection uses `artifactVisitIdentity`; two visits that both recorded `result.csv` stay two distinct rows and selections (unit + browser evidence). - **Facts.** The dialog shows the recorded filename (or `(unnamed artifact)`), the recorded MIME/size (`type not recorded` when empty), the group's `stage · visit N`, the visit's `artifactsSummary` and its `artifactCaptureNotes`. Nothing is inferred from a name. - **Url rules.** Open/Copy link appear only when `resolveArtifactUrl` returns a value: absolute http(s) or a server-relative path resolved against the configured endpoint. Protocol-relative, credentialed, malformed and non-http(s) urls are rejected and the dialog says `The recorded artifact URL cannot be opened safely.` A record with no url says `No artifact URL recorded.` and offers no action. The endpoint comes from the app's shared `PipelinesClient` when the gateway exposes it; a fixture gateway leaves it blank, which only disables relative resolution. - **Open vs copy.** Open calls the injected `ArtifactExternalOpen` with the resolved `Uri` (web: a new tab via `window.open` reached through `js_interop`, so it compiles for JS and wasm). Copy link is a separate action that writes the resolved url to the clipboard. Each reports `Link opened externally.` / `Could not open the link.` and `Link copied.` / `Could not copy link.` as an inline live region. - **Controls.** Material uses `FilledButton.tonalIcon` + `AlertDialog`; Cupertino uses `CupertinoButton.tinted` + `CupertinoAlertDialog` and the grouped page background. No fixed row/button sizes, custom font or palette. The Cupertino action is text-only: the icon variant overflowed by 11 px at 2x text on 390 px (caught by the existing `run_detail_widget_test`), and dropping the icon keeps the label whole without clipping. - **Out of scope, labelled next:** in-app preview/viewer, download, share files, gallery filters and any network artifact fetch were not written. ## Checks actually run ``` flutter analyze # No issues found dart format --output=none --set-exit-if-changed ... # 0 changed flutter test test/features/artifacts test/features/runs # 203 passed flutter test # 712 passed (whole app) flutter build web # ✓ Built build/web flutter build web -t tool/artifact_gallery_probe.dart # ✓ Built build/probe-gallery node --check tool/artifact_gallery_probe.mjs # ok node tool/artifact_gallery_probe.mjs ... # 13/13 checks, 16 captures ``` `git status --short --untracked-files=all` lists only the files above; `pubspec.yaml`/`pubspec.lock` are unchanged. No commit, push or deploy. ## Real browser evidence `tool/artifact_gallery_probe.dart` renders the real `RunDetailView` over a fake `get_run` gateway; `tool/artifact_gallery_probe.mjs` serves the build on an OS-assigned loopback port and drives headless Chrome. Recorded urls point at the probe's own loopback origin (plus unsafe/no-url/empty/unavailable states). No server or operator run was touched. 13/13 checks passed; 16 captures in `/Users/alan/.local/share/pipelines/data/artifacts/81/public/a1-wire/` (`evidence.json` holds the machine-readable result): - The run detail offers the native Artifacts action; the page lists the actual recorded rows (`build.log`, `shot.png`, two `result.csv` visits, group headings, MIME/size), not nav labels. - Selecting the lower duplicate `result.csv` selected `reviewer · visit 2` with its own `Artifacts · 1 recorded · partial capture` and `2 files excluded from artifact capture.` - The safe selection offers native **Open** and a separate **Copy link**; a protocol-relative url offers neither and shows the unsafe wording; a url-less record shows `No artifact URL recorded.` and no action. - A recorded empty capture says `No artifacts recorded for this run.`; an unavailable capture says `Artifacts · capture unavailable` and never the empty wording. - Cupertino lists the same rows with its native dialog and actions; dark Cupertino dialog text samples light (max luminance 1.0). - Both hosts at 320 px / 2x text keep the recorded rows, facts and actions whole. Captures: `a1w-material-{detail,gallery,selected,open,unsafe,nourl,empty, unavailable}.png`, `a1w-cupertino-{gallery,selected,dark-gallery, dark-selected}.png`, `a1w-{material,cupertino}-2x-320-{gallery,selected}.png`. ## Not verified / limits - The actual new-tab open could not be driven in headless Chrome: a synthetic semantics activation carries no user gesture, so the app reports its honest `Could not open the link.` refusal path. The browser proves the action is offered only for a safe resolved url; the widget test proves the exact `http://127.0.0.1:8081/artifacts/1/1/result.csv` uri handed to the opener and the clipboard write. A genuine user tap was not captured. - Non-web external open returns false (no launcher dependency is in scope); the page reports that refusal. Mobile targets were not built or run, so **mobile remains unverified**. - All data is fixture data; no live server or operator run was used. - Page/viewer/share/download/filters are not part of this slice and are labelled as next work. ## Manager completion after the Code deadline The Code visit hit its 30-minute deadline while still active; its session settled and all edits were retained. No retry was started. The manager confirmed the dirty paths were exactly this slice, then ran the focused artifacts/UI tests (29 pass), analysis, and the fixture probe. The probe covers both hosts plus 320px/2x and produced 16 captures (detail, gallery, selected facts, Open, unsafe url, no url, empty, unavailable capture). The Cupertino dark selected dialog and the Material 320px/2x selected dialog were inspected: recorded name/MIME/size, the visit's own capture facts, excluded-file note, and distinct Open / Copy link / Close where a safe url exists. Deliberate scope: this slice links to a validated url externally and copies that link. It performs no in-app preview, download or file sharing, so the artifact viewer/Share rows in app/PARITY.md remain open.