Render every artifact in the shared gallery, with file-type icons
Standardise the artifacts gallery so the run summary and the stage pane render one tile per artifact instead of images as a grid and everything else as a plain list. - Artifacts.kt: ArtifactTile now covers both shapes - an image/video fills the cell with a thumbnail (a video shows its poster frame with a play badge), anything else shows its file-type icon with the name and size beneath it; the grid, share/copy actions and multi-select are unchanged and the capture wording is untouched. - ArtifactType.kt (new): pure ArtifactKind classification from content type plus name extension fallback, and artifactIcon(kind) mapping each kind to a distinct glyph. - ArtifactImage.kt: ArtifactVideoFrame/rememberArtifactVideoFrame extract a poster frame via MediaMetadataRetriever over an in-memory MediaDataSource; the shared memoized-preview scaffold is factored into rememberArtifactPreview. - ArtifactViewer.kt: full-screen viewer takes a video flag and shows the poster frame. - Format.kt: add isVideoContentType; drop the now-unused artifactMetaLine. - Dimens.kt: ARTIFACT_TYPE_ICON_DP, ARTIFACT_PLAY_BADGE_DP, ARTIFACT_TILE_ACTION_DP tokens. - Tests: new ArtifactTypeTest (type-to-icon mapping, extension fallback, distinct glyphs); FormatTest updated for the removed helper. - android/README.md documents the pass. android/ only; no new dependencies beyond material-icons-extended.
This commit is contained in:
@@ -3441,3 +3441,142 @@ native 2208x1840 @420 at the end.
|
||||
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||
`Content-Length: 17928873`.
|
||||
|
||||
|
||||
## One artifacts gallery everywhere, with a type icon for non-media (16 Oct 2026)
|
||||
|
||||
The gallery was already a grid, but only for images: non-image artifacts fell
|
||||
through to a plain one-per-row list beneath it, so the same run rendered two
|
||||
different ways. This pass makes `ArtifactGallery` the single rendering path for
|
||||
every artifact (the run summary and the stage pane's per-visit section already
|
||||
both use it) and gives non-media files a tile too. `android/` only; no
|
||||
dependency was added (the new glyphs are `material-icons-extended`), no run was
|
||||
started from the app, and every `adb` command targeted `emulator-5554` (never
|
||||
`emulator-5556` or the attached Pixel).
|
||||
|
||||
- **One tile, two shapes.** `ui/graph/Artifacts.kt`'s `ArtifactTile` replaces the
|
||||
old `ArtifactTile` + `ArtifactRow` split. An image fills the cell with its
|
||||
thumbnail; a video shows its still/poster frame with a centred play marker on
|
||||
top; anything else shows its file-type icon with the artifact's name and
|
||||
human-readable size beneath it, all in the same width-derived grid. The grid is
|
||||
still built from non-lazy chunked `Row`s, so it never nests a scrollable inside
|
||||
the Summary `LazyColumn` or the pane's scroll.
|
||||
- **Type-to-icon mapping.** The new pure `ui/graph/ArtifactType.kt` classifies an
|
||||
artifact from its content type (parameters tolerated) and, when the server's
|
||||
sniff is generic, its name's extension, into `ArtifactKind`
|
||||
(Image/Video/Audio/Pdf/Json/Archive/Spreadsheet/Log/Code/Document/Other), and
|
||||
`artifactIcon(kind)` gives each kind a distinct shape (PDF, JSON, archive,
|
||||
spreadsheet, log, code, document, audio, generic file). `Format.kt` gained the
|
||||
companion `isVideoContentType` predicate beside `isImageContentType`.
|
||||
- **Video poster frame.** `ui/graph/ArtifactImage.kt` gained
|
||||
`ArtifactVideoFrame`/`rememberArtifactVideoFrame`: the artifact's bytes are
|
||||
fetched through the same bounded cache as an image and the representative sync
|
||||
frame is extracted with the platform `MediaMetadataRetriever` over an in-memory
|
||||
`MediaDataSource` (no temp file, no new dependency, no inline playback). The
|
||||
full-screen viewer takes a `video` flag and shows that frame (its open action
|
||||
plays the clip externally); a fetch/extraction failure falls back to the video
|
||||
glyph rather than a fabricated image.
|
||||
- **Actions kept.** Tap opens the viewer for an image/video and the existing
|
||||
external-open action for anything else; every tile keeps its share control, a
|
||||
non-media tile adds the copy-link control, and long-press / multi-select, the
|
||||
contextual bar, bulk copy/share and the selection semantics are unchanged.
|
||||
The capture summary and partial-capture notes are byte-for-byte unchanged.
|
||||
- **Geometry from tokens, not literals.** `ui/theme/Dimens.kt` gains
|
||||
`ARTIFACT_TYPE_ICON_DP` (28dp), `ARTIFACT_PLAY_BADGE_DP` (32dp) and
|
||||
`ARTIFACT_TILE_ACTION_DP` (32dp); the tile still stretches `ARTIFACT_TILE_DP`
|
||||
cells across the measured width via the unchanged pure `artifactGrid`.
|
||||
|
||||
Review follow-up (same pass, no UI change): the two preview state-holders
|
||||
duplicated the whole memoize-through-caches scaffold, so it is now one private
|
||||
`rememberArtifactPreview(url, maxDim, keyTag, fetchBytes, derive)` that both
|
||||
`rememberArtifactBitmap` and `rememberArtifactVideoFrame` delegate to (the
|
||||
`keyTag` keeps the two cache entries apart); the video fallback draws
|
||||
`artifactIcon(ArtifactKind.Video)` instead of a hardcoded `Icons.Filled.Movie`;
|
||||
and the now-unused `Format.kt` `artifactMetaLine` helper (its last caller was the
|
||||
deleted non-image row) was removed with its `FormatTest` cases.
|
||||
|
||||
Verified on this tree (macOS, Homebrew `openjdk@25`,
|
||||
`JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home`,
|
||||
Gradle 9.7.1, `ANDROID_HOME=/Users/alan/Library/Android/sdk`, `--offline`):
|
||||
|
||||
- `gradle --offline :app:testDebugUnitTest --rerun-tasks` → `BUILD SUCCESSFUL`;
|
||||
the 31 test-result XMLs aggregate to **265 tests, 0 failures, 0 errors, 0
|
||||
skipped** (the new `ui/graph/ArtifactTypeTest` has 6 cases: the media kinds
|
||||
from the content type, the named kinds, the extension fallback for a generic
|
||||
sniff, the never-crash `Other` fallback, the explicit type-to-icon mapping, and
|
||||
that no two kinds share a glyph). `ArtifactGalleryTest` still covers the grid
|
||||
sizing (narrow → fewer, larger cells; wider → more preferred-shaped columns;
|
||||
degenerate inputs). `compileDebugKotlin` emits no warnings.
|
||||
- `gradle --offline :app:assembleDebug --rerun-tasks --no-build-cache` succeeded
|
||||
→ `app-debug.apk` **18,011,393 bytes**, sha256
|
||||
`faa9df077c960b23eef4afbac1b7effa1a50180eabcee2d638cabb232974cfa8`.
|
||||
- On `emulator-5554` (native 2076x2152 @390; `wm size`/`wm density` used for the
|
||||
narrow pass and reset afterwards) against the live server
|
||||
`ws://10.0.2.2:8080/connect`, driven with `adb shell input` and `uiautomator
|
||||
dump`; every capture was written with
|
||||
`android/scripts/capture_png.sh -s emulator-5554` (validated PNG, named display
|
||||
id) into `…/artifacts/140/1/`. Run 136's `implementer` visit 1 is a real mixed
|
||||
set: five `image/png` screenshots plus `chat_stub_approval.py`
|
||||
(`text/plain`, code glyph) and `stub.log` (`text/plain`, log glyph).
|
||||
- **Wide** (2076x2152 ≈ 532dp): `evidence_wide_run136_summary_gallery.png`
|
||||
shows the five thumbnails with their share controls and, in the same grid,
|
||||
the `.py` tile with the `<>` code glyph and the `.log` tile with the log
|
||||
glyph, each with its name and `9.3 KiB` / `220 B` beneath it and the copy +
|
||||
share actions; `evidence_wide_run136_stage_pane.png` shows the same gallery in
|
||||
the stage pane under the unchanged `Artifacts · 7 recorded · partial capture`
|
||||
wording and the `1 files excluded from artifact capture.` note.
|
||||
- **Narrow** (1080x2340 @480 ≈ 360dp):
|
||||
`evidence_narrow_run136_summary_gallery.png` and
|
||||
`evidence_narrow_run136_stage_pane.png` show three cells per row with the
|
||||
thumbnails and the code/log type tiles still legible.
|
||||
- Tapping a thumbnail opened the full-screen viewer
|
||||
(`evidence_wide_run136_image_viewer.png`; `uiautomator dump` reported the
|
||||
`01_approval_pending.png` image plus `Open … externally`, `Copy link …` and
|
||||
`Close viewer`), and the non-media tiles' `Copy link to …` / `Share …`
|
||||
controls are present in the accessibility tree.
|
||||
- `adb -s emulator-5554 logcat -d | grep -cE 'FATAL EXCEPTION|E
|
||||
AndroidRuntime'` returned 0; the emulator display was reset to native
|
||||
2076x2152 @390 afterwards.
|
||||
- **APK publish.** `app-debug.apk` copied to
|
||||
`…/artifacts/140/1/pipelines-debug-wip-c700b28.apk` (`c700b28` = short
|
||||
`HEAD`); `shasum -a 256` matched. `curl -I
|
||||
http://10.0.0.249:8080/artifacts/140/1/pipelines-debug-wip-c700b28.apk`
|
||||
returned `HTTP/1.1 200 OK`, `Content-Type:
|
||||
application/vnd.android.package-archive`, `Content-Length: 18011393`, and a
|
||||
streamed `GET | shasum -a 256` returned the same `faa9df07…` as the local file.
|
||||
At ~17.2 MiB it exceeds the server's 8 MiB per-file inventory cap, so it is
|
||||
served by direct URL only.
|
||||
|
||||
Not verified in this pass: a **video** artifact does not exist on the live server
|
||||
and starting a run is forbidden, so the play-marker/poster-frame render is
|
||||
covered only by the `artifactKind` unit test (`video/mp4 → Video`) and the code
|
||||
path, not by a device capture; the non-media external-open tap was not driven
|
||||
(no handler is guaranteed on the emulator); multi-select/bulk share were not
|
||||
re-exercised on device (their code is unchanged from the previous pass); the
|
||||
light theme and `:app:lintDebug` were not run (the only known lint issues are the
|
||||
two pre-existing `NewApi` errors for `android:windowLightNavigationBar`).
|
||||
|
||||
### Review fixes (same pass)
|
||||
|
||||
The review's three findings were addressed with no intended UI change, and the
|
||||
two build checks were re-run on the resulting tree:
|
||||
|
||||
- `gradle --offline :app:testDebugUnitTest --rerun-tasks` → `BUILD SUCCESSFUL`;
|
||||
the 31 result XMLs again aggregate to **265 tests, 0 failures, 0 errors, 0
|
||||
skipped** (the removed `artifactMetaLine` assertions were replaced by
|
||||
`isVideoContentType` coverage in the same `FormatTest` method).
|
||||
- `gradle --offline :app:assembleDebug --rerun-tasks --no-build-cache` succeeded
|
||||
→ `app-debug.apk` **18,011,393 bytes**, sha256
|
||||
`2adaf03e5ac0bdb29b012d1487a0e10917f8ebabda973ddc63c7315b6df25dda`; it was
|
||||
published to `…/artifacts/140/3/pipelines-debug-wip-c700b28.apk` and
|
||||
`curl -I http://10.0.0.249:8080/artifacts/140/3/pipelines-debug-wip-c700b28.apk`
|
||||
returned `HTTP/1.1 200 OK`, `Content-Length: 18011393`, with a streamed
|
||||
`GET | shasum -a 256` matching the local `2adaf03e…`.
|
||||
|
||||
The device render was **not** re-captured: `emulator-5554` is shared and, while
|
||||
this pass ran, another lane replaced the installed app with a build whose dex has
|
||||
no `ArtifactType` class (`dumpsys package … lastUpdateTime` moved from this pass's
|
||||
`16:24:02` install to `16:24:20`, and the installed `base.apk` sha no longer
|
||||
matched `2adaf03e…`), so any capture could not be attributed to this build. The
|
||||
wide/narrow captures above predate the refactor; the refactor changes no UI
|
||||
pixels, so they remain representative of the gallery this code renders.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user