ML-185: simplify presto artwork handling (requirements)
This commit is contained in:
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
id: ML-185
|
||||||
|
title: Simplify Presto artwork handling
|
||||||
|
status: To Do
|
||||||
|
assignee: []
|
||||||
|
created_date: "2026-05-15 21:19"
|
||||||
|
updated_date: "2026-05-15 21:40"
|
||||||
|
labels:
|
||||||
|
- api
|
||||||
|
- presto
|
||||||
|
- artwork
|
||||||
|
dependencies: []
|
||||||
|
documentation:
|
||||||
|
- docs/architecture.md
|
||||||
|
- docs/project-conventions.md
|
||||||
|
- presto/AGENTS.md
|
||||||
|
- presto/README.md
|
||||||
|
modified_files:
|
||||||
|
- lib/music_library_web/controllers/collection_json.ex
|
||||||
|
- test/music_library_web/controllers/collection_controller_test.exs
|
||||||
|
- test/prod.hurl
|
||||||
|
- presto/main.py
|
||||||
|
- presto/README.md
|
||||||
|
- presto/tests/conftest.py
|
||||||
|
- presto/tests/test_screens.py
|
||||||
|
priority: medium
|
||||||
|
ordinal: 19000
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
<!-- SECTION:DESCRIPTION:END -->
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
<!-- AC:BEGIN -->
|
||||||
|
|
||||||
|
- [ ] #1 Collection API record JSON exposes four named cover variants: original, large, medium, and small.
|
||||||
|
- [ ] #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.
|
||||||
|
- [ ] #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.
|
||||||
|
- [ ] #4 Presto documentation and test fixtures describe the new cover contract and no longer refer to the legacy cover URL fields.
|
||||||
|
- [ ] #5 Relevant Phoenix and Presto tests are updated and pass.
|
||||||
|
<!-- AC:END -->
|
||||||
|
|
||||||
|
## Implementation Plan
|
||||||
|
|
||||||
|
<!-- 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.
|
||||||
|
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 -->
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
id: ML-185.1
|
||||||
|
title: Expose named cover sizes in collection API
|
||||||
|
status: To Do
|
||||||
|
assignee: []
|
||||||
|
created_date: "2026-05-15 21:20"
|
||||||
|
updated_date: "2026-05-15 21:40"
|
||||||
|
labels:
|
||||||
|
- api
|
||||||
|
- artwork
|
||||||
|
dependencies: []
|
||||||
|
documentation:
|
||||||
|
- docs/architecture.md
|
||||||
|
- docs/project-conventions.md
|
||||||
|
modified_files:
|
||||||
|
- lib/music_library_web/controllers/collection_json.ex
|
||||||
|
- test/music_library_web/controllers/collection_controller_test.exs
|
||||||
|
- test/prod.hurl
|
||||||
|
parent_task_id: ML-185
|
||||||
|
priority: medium
|
||||||
|
ordinal: 20000
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||||
|
|
||||||
|
Update the collection JSON record representation so API clients receive a single named cover set instead of the current Presto-specific flat URL fields.
|
||||||
|
|
||||||
|
Context for implementer: `MusicLibraryWeb.CollectionJSON` currently builds `cover_url`, `thumb_url`, `mini_cover_url`, and `micro_cover_url` from `MusicLibrary.Assets.Transform`. The asset controller already accepts `Transform.new(hash: record.cover_hash, width: width)` for resized variants and `Transform.new(hash: record.cover_hash)` for the original/converted image. The required named variants are: `original` with no width transform, `large` at 1000 px width, `medium` at 460 px width, and `small` at 80 px width.
|
||||||
|
|
||||||
|
<!-- SECTION:DESCRIPTION:END -->
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
<!-- AC:BEGIN -->
|
||||||
|
|
||||||
|
- [ ] #1 Collection API responses that render records include a named cover object with original, large, medium, and small URLs.
|
||||||
|
- [ ] #2 The generated URLs encode no width for original, 1000 px for large, 460 px for medium, and 80 px for small.
|
||||||
|
- [ ] #3 Legacy flat cover URL fields are removed from the collection JSON contract unless a compatibility decision is explicitly documented during implementation.
|
||||||
|
- [ ] #4 Controller tests assert the new cover contract for collection record responses.
|
||||||
|
- [ ] #5 Production Hurl smoke coverage captures and requests a cover URL from the new contract.
|
||||||
|
<!-- AC:END -->
|
||||||
|
|
||||||
|
## Implementation Plan
|
||||||
|
|
||||||
|
<!-- SECTION:PLAN:BEGIN -->
|
||||||
|
|
||||||
|
1. Confirm every collection API action that renders a record flows through `MusicLibraryWeb.CollectionJSON.record/1`.
|
||||||
|
2. Replace the flat cover URL fields with a named cover object, using module-level width constants for `large`, `medium`, and `small` so the contract is easy to audit.
|
||||||
|
3. Update `test/music_library_web/controllers/collection_controller_test.exs` expected JSON to assert the four named variants and their encoded widths.
|
||||||
|
4. Update `test/prod.hurl` to capture a cover URL from the new cover object.
|
||||||
|
5. Run `mix test test/music_library_web/controllers/collection_controller_test.exs` and any focused asset-controller test if URL generation or transform behavior changes.
|
||||||
|
<!-- SECTION:PLAN:END -->
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
id: ML-185.2
|
||||||
|
title: Use API-sized covers in Presto
|
||||||
|
status: To Do
|
||||||
|
assignee: []
|
||||||
|
created_date: "2026-05-15 21:22"
|
||||||
|
updated_date: "2026-05-15 21:40"
|
||||||
|
labels:
|
||||||
|
- presto
|
||||||
|
- artwork
|
||||||
|
dependencies:
|
||||||
|
- ML-185.1
|
||||||
|
documentation:
|
||||||
|
- docs/project-conventions.md
|
||||||
|
- presto/AGENTS.md
|
||||||
|
- presto/README.md
|
||||||
|
modified_files:
|
||||||
|
- presto/main.py
|
||||||
|
- presto/README.md
|
||||||
|
- presto/AGENTS.md
|
||||||
|
- presto/tests/conftest.py
|
||||||
|
- presto/tests/test_screens.py
|
||||||
|
parent_task_id: ML-185
|
||||||
|
priority: medium
|
||||||
|
ordinal: 21000
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
||||||
|
|
||||||
|
Update the Presto application so it trusts the collection API to provide display-ready cover sizes.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
<!-- SECTION:DESCRIPTION:END -->
|
||||||
|
|
||||||
|
## Acceptance Criteria
|
||||||
|
|
||||||
|
<!-- AC:BEGIN -->
|
||||||
|
|
||||||
|
- [ ] #1 Record-list rows fetch and draw the API-provided 80 px small cover variant.
|
||||||
|
- [ ] #2 Record-detail pages fetch and draw the API-provided 460 px medium cover variant centered within the 480 px display.
|
||||||
|
- [ ] #3 Presto image drawing no longer selects JPEG scale flags or resizes covers to fit a bounding box.
|
||||||
|
- [ ] #4 Missing or failed cover downloads still render placeholders, and drag redraws still avoid network fetches.
|
||||||
|
- [ ] #5 Presto README, Presto guidance, and smoke-test fixtures match the new named cover contract.
|
||||||
|
- [ ] #6 The Presto syntax check and smoke tests pass, with physical device verification only claimed if run on the device.
|
||||||
|
<!-- AC:END -->
|
||||||
|
|
||||||
|
## Implementation Plan
|
||||||
|
|
||||||
|
<!-- SECTION:PLAN:BEGIN -->
|
||||||
|
|
||||||
|
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.
|
||||||
|
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.
|
||||||
|
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 -->
|
||||||
Reference in New Issue
Block a user