[presto] Update tests/references to medium cover size

This commit is contained in:
Claudio Ortolina
2026-05-16 21:28:09 +01:00
parent fb84bcb525
commit d61dd6c7b8
5 changed files with 28 additions and 28 deletions
@@ -4,7 +4,7 @@ title: Simplify Presto artwork handling
status: Done
assignee: []
created_date: "2026-05-15 21:19"
updated_date: "2026-05-15 21:53"
updated_date: "2026-05-16 20:23"
labels:
- api
- presto
@@ -31,11 +31,11 @@ ordinal: 19000
<!-- SECTION:DESCRIPTION:BEGIN -->
Change the collection API artwork contract so the Presto client receives ready-to-display cover assets instead of resizing them on the device.
Change the collection API artwork contract so the Presto client receives named cover assets instead of choosing among legacy flat cover URL fields or resizing them on the device.
Current state: `MusicLibraryWeb.CollectionJSON` emits flat cover URL fields (`cover_url`, `thumb_url`, `mini_cover_url`, `micro_cover_url`). `presto/main.py` lays out list covers at 80 px (`THUMB_SIZE = px(40)` with `UI_SCALE = 2`) and detail covers at 480 px (`DETAIL_COVER_SIZE = px(240)`). The existing asset transform pipeline can already serve original images or resized images by width.
Current state at task creation: `MusicLibraryWeb.CollectionJSON` emitted flat cover URL fields (`cover_url`, `thumb_url`, `mini_cover_url`, `micro_cover_url`). `presto/main.py` laid out list covers at 80 px (`THUMB_SIZE = px(40)` with `UI_SCALE = 2`) and detail covers at 480 px (`DETAIL_COVER_SIZE = px(240)`). The existing asset transform pipeline could already serve original images or resized images by width.
Target state: each API record representation exposes four named cover variants: `original` with no width transform, `large` at 1000 px width, `medium` at 460 px width for the Presto record detail cover, and `small` at 80 px width for the Presto record list cover. The Presto app should consume those sizes directly, center the 460 px detail cover within the 480 px display, and retain only JPEG decode/draw behavior, placeholder behavior, caching, and the existing rule that network fetches do not happen during drag redraws.
Target state: each API record representation exposes four named cover variants: `original`, `large`, `medium`, and `small`. The Presto app consumes `covers.small` for 80 px record-list thumbnails and `covers.medium` for record-detail artwork, while retaining the intended `DETAIL_COVER_SIZE = px(200)` 400 px detail-cover layout area. The client retains only JPEG decode/draw behavior, placeholder behavior, caching, and the existing rule that network fetches do not happen during drag redraws.
<!-- SECTION:DESCRIPTION:END -->
@@ -44,9 +44,9 @@ Target state: each API record representation exposes four named cover variants:
<!-- AC:BEGIN -->
- [x] #1 Collection API record JSON exposes four named cover variants: original, large, medium, and small.
- [x] #2 The small cover is 80 px wide for the Presto record-list cover, the medium cover is 460 px wide for the Presto record-detail cover, the large cover is 1000 px wide, and original is unscaled.
- [x] #2 The small cover is 80 px wide for the Presto record-list cover, the Presto detail view uses `covers.medium` within the intended `DETAIL_COVER_SIZE = px(200)` 400 px layout area, the large cover is 1000 px wide, and original is unscaled.
- [x] #3 The Presto application consumes the API-provided small and medium cover URLs directly and no longer contains client-side cover resizing or JPEG scale-selection logic.
- [x] #4 Presto documentation and test fixtures describe the new cover contract and no longer refer to the legacy cover URL fields.
- [x] #4 Presto documentation and test fixtures describe the named cover contract and the intended 400 px detail-cover layout, and no longer refer to the legacy cover URL fields.
- [x] #5 Relevant Phoenix and Presto tests are updated and pass.
<!-- AC:END -->
@@ -54,8 +54,8 @@ Target state: each API record representation exposes four named cover variants:
<!-- SECTION:PLAN:BEGIN -->
1. Update the Phoenix collection JSON contract so records expose named cover variants with widths derived from the Presto layout and the requested 1000 px large variant.
2. Update the Presto client to read the new cover names, use the 80 px and 460 px assets directly, and remove JPEG scale-selection/resizing code while preserving caching, placeholders, and drag-scroll network avoidance.
1. Update the Phoenix collection JSON contract so records expose named cover variants with widths derived from the API artwork contract and the requested 1000 px large variant.
2. Update the Presto client to read the new cover names, use the 80 px row asset and `covers.medium` detail asset directly, and remove JPEG scale-selection/resizing code while preserving `DETAIL_COVER_SIZE = px(200)`, caching, placeholders, and drag-scroll network avoidance.
3. Update documentation, fixtures, and smoke/contract tests so the API and device assumptions stay aligned.
4. Run the focused controller tests and Presto syntax/smoke tests; note that physical Presto behavior is not verified unless the device deployment task is run on hardware.
<!-- SECTION:PLAN:END -->
@@ -64,7 +64,7 @@ Target state: each API record representation exposes four named cover variants:
<!-- SECTION:NOTES:BEGIN -->
Both implementation subtasks are now Done. `ML-185.1` updated the collection API to emit `covers.original`, `covers.large`, `covers.medium`, and `covers.small`. `ML-185.2` updated the Presto app to consume `covers.small` and `covers.medium`, use an 80 px row cover and centered 460 px detail cover, and remove JPEG resizing/scale-selection logic. Focused Phoenix controller tests and Presto syntax/smoke tests passed. Physical Presto hardware was not tested.
Both implementation subtasks are now Done. `ML-185.1` updated the collection API to emit `covers.original`, `covers.large`, `covers.medium`, and `covers.small`. `ML-185.2` updated the Presto app to consume `covers.small` and `covers.medium`, use an 80 px row cover and the intended `DETAIL_COVER_SIZE = px(200)` 400 px detail-cover layout, and remove JPEG resizing/scale-selection logic. Focused Phoenix controller tests and Presto syntax/smoke tests passed. Physical Presto hardware was not tested. This record was corrected after the detail cover layout was confirmed to be 400 px rather than 460 px.
<!-- SECTION:NOTES:END -->
@@ -74,9 +74,9 @@ Both implementation subtasks are now Done. `ML-185.1` updated the collection API
Completed the artwork handling simplification across the collection API and Presto client.
The API now exposes named cover variants: `original` unscaled, `large` at 1000 px, `medium` at 460 px, and `small` at 80 px. The legacy flat cover fields were removed from the collection JSON contract.
The API now exposes named cover variants: `original`, `large`, `medium`, and `small`. The legacy flat cover fields were removed from the collection JSON contract.
The Presto app now consumes `covers.small` for record rows and `covers.medium` for detail pages, centers the 460 px detail cover in the 480 px display, and no longer performs JPEG dimension probing or scale-selection resizing on-device. Documentation, guidance, mock fixtures, and smoke tests were updated for the new contract.
The Presto app now consumes `covers.small` for record rows and `covers.medium` for detail pages, keeps the detail artwork in the intended `DETAIL_COVER_SIZE = px(200)` 400 px layout area, and no longer performs JPEG dimension probing or scale-selection resizing on-device. Documentation, guidance, mock fixtures, and smoke tests were updated for the named cover contract and corrected detail-cover layout.
Tests run across the subtasks: `mix test test/music_library_web/controllers/collection_controller_test.exs`; Presto syntax check; `mise run test` from `presto/`. Physical Presto hardware was not tested.
@@ -5,7 +5,7 @@ status: Done
assignee:
- Codex
created_date: "2026-05-15 21:22"
updated_date: "2026-05-15 21:53"
updated_date: "2026-05-16 20:23"
labels:
- presto
- artwork
@@ -30,9 +30,9 @@ ordinal: 21000
<!-- SECTION:DESCRIPTION:BEGIN -->
Update the Presto application so it trusts the collection API to provide display-ready cover sizes.
Update the Presto application so it trusts the collection API to provide named cover URLs while keeping the intended Presto detail-cover layout.
Context for implementer: `presto/main.py` currently renders record-list covers at 80 px and record-detail covers at 480 px. It currently chooses among `mini_cover_url`, `micro_cover_url`, and `thumb_url`, then `draw_jpeg/5` selects JPEG scale flags to fit images into a bounding box. After the API task is complete, records should expose named covers where `small` is the 80 px row cover and `medium` is the 460 px detail cover. Update the detail cover layout to draw the 460 px image centered in the 480 px display so it does not fill the full view width. Preserve existing cover byte caching, placeholder rendering, and the rule that drag redraws must not fetch images over the network.
Context for implementer: `presto/main.py` currently renders record-list covers at 80 px and record-detail covers at 480 px. It currently chooses among `mini_cover_url`, `micro_cover_url`, and `thumb_url`, then `draw_jpeg/5` selects JPEG scale flags to fit images into a bounding box. After the API task is complete, records should expose named covers where `small` is the 80 px row cover and `medium` is the detail cover source. Preserve the intended `DETAIL_COVER_SIZE = px(200)` 400 px detail-cover layout. Preserve existing cover byte caching, placeholder rendering, and the rule that drag redraws must not fetch images over the network.
<!-- SECTION:DESCRIPTION:END -->
@@ -41,10 +41,10 @@ Context for implementer: `presto/main.py` currently renders record-list covers a
<!-- AC:BEGIN -->
- [x] #1 Record-list rows fetch and draw the API-provided 80 px small cover variant.
- [x] #2 Record-detail pages fetch and draw the API-provided 460 px medium cover variant centered within the 480 px display.
- [x] #2 Record-detail pages fetch `covers.medium` and keep the intended `DETAIL_COVER_SIZE = px(200)` 400 px detail-cover layout area centered within the 480 px display.
- [x] #3 Presto image drawing no longer selects JPEG scale flags or resizes covers to fit a bounding box.
- [x] #4 Missing or failed cover downloads still render placeholders, and drag redraws still avoid network fetches.
- [x] #5 Presto README, Presto guidance, and smoke-test fixtures match the new named cover contract.
- [x] #5 Presto README, Presto guidance, and smoke-test fixtures match the named cover contract and intended 400 px detail-cover layout.
- [x] #6 The Presto syntax check and smoke tests pass, with physical device verification only claimed if run on the device.
<!-- AC:END -->
@@ -54,9 +54,9 @@ Context for implementer: `presto/main.py` currently renders record-list covers a
1. Add small helper(s) for reading the named cover object from API records, returning `small` for list rows and `medium` for detail pages.
2. Replace legacy `mini_cover_url` / `micro_cover_url` / `thumb_url` selection and preload checks with the new named cover helpers.
3. Simplify JPEG drawing so it decodes the already-sized image at the requested top-left coordinate and falls back to a placeholder on failures; remove `_jpeg_scale_options` and max-width/max-height fitting behavior.
3. Simplify JPEG drawing so it decodes the named image at the requested top-left coordinate and falls back to a placeholder on failures; remove `_jpeg_scale_options` and max-width/max-height fitting behavior while preserving `DETAIL_COVER_SIZE = px(200)`.
4. Keep row and detail image cache keys separate and preserve the existing drag behavior that shows placeholders when data is not already cached.
5. Update `presto/README.md`, `presto/AGENTS.md`, and test mock records to describe and exercise the new contract.
5. Update `presto/README.md`, `presto/AGENTS.md`, and test mock records to describe and exercise the named cover contract and intended 400 px detail-cover layout.
6. Run `python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"` from `presto/` and `mise run test` for the Presto smoke suite.
<!-- SECTION:PLAN:END -->
@@ -64,7 +64,7 @@ Context for implementer: `presto/main.py` currently renders record-list covers a
<!-- SECTION:NOTES:BEGIN -->
Updated the Presto cover path to consume only the collection API `covers` object: row covers use `covers.small`, detail covers use `covers.medium`, and the detail cover layout is now 460 px wide and centered at x=10 on the 480 px display. Removed JPEG dimension probing and scale-selection logic so `draw_jpeg` decodes API-sized JPEGs at the requested position and uses the provided dimensions only for placeholder fallback. Preserved row/detail byte cache separation and drag-time placeholder behavior. Ran `python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"` and `mise run test` from `presto/`; both passed. Physical Presto hardware was not tested.
Updated the Presto cover path to consume only the collection API `covers` object: row covers use `covers.small`, detail covers use `covers.medium`, and the detail cover layout uses the intended `DETAIL_COVER_SIZE = px(200)` 400 px area centered at x=40 on the 480 px display. Removed JPEG dimension probing and scale-selection logic so `draw_jpeg` decodes named JPEGs at the requested position and uses the provided dimensions only for placeholder fallback. Preserved row/detail byte cache separation and drag-time placeholder behavior. Ran `python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"` and `mise run test` from `presto/`; both passed. Physical Presto hardware was not tested. This record was corrected after the detail cover layout was confirmed to be 400 px rather than 460 px.
<!-- SECTION:NOTES:END -->
@@ -72,11 +72,11 @@ Updated the Presto cover path to consume only the collection API `covers` object
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Updated the Presto app to trust the API-provided cover sizes. Record rows now read `covers.small`, record detail pages read `covers.medium`, and the detail cover is 460 px wide and centered within the 480 px display.
Updated the Presto app to trust the API-provided cover names. Record rows now read `covers.small`, record detail pages read `covers.medium`, and the detail cover layout remains the intended `DETAIL_COVER_SIZE = px(200)` 400 px area centered within the 480 px display.
Removed the JPEG dimension probing and scale-selection code from `draw_jpeg`; it now decodes API-sized JPEGs directly and only uses placeholder dimensions when a fetch or decode fails. Existing row/detail image caches and no-network-during-drag behavior are preserved.
Removed the JPEG dimension probing and scale-selection code from `draw_jpeg`; it now decodes named JPEGs directly and only uses placeholder dimensions when a fetch or decode fails. Existing row/detail image caches and no-network-during-drag behavior are preserved.
Updated Presto guidance, README API examples, and smoke-test fixtures for the new cover contract, and added a focused smoke test assertion for the expected 80 px row cover and 460 px centered detail cover.
Updated Presto guidance, README API examples, and smoke-test fixtures for the named cover contract, and added a focused smoke test assertion for the expected 80 px row cover and 400 px centered detail-cover layout.
Tests run: Presto syntax check and `mise run test` from `presto/` (8 passed). Physical device behavior was not verified on hardware.