5.0 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, documentation, modified_files, parent_task_id, priority, ordinal
| id | title | status | assignee | created_date | updated_date | labels | dependencies | documentation | modified_files | parent_task_id | priority | ordinal | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ML-185.2 | Use API-sized covers in Presto | Done |
|
2026-05-15 21:22 | 2026-05-16 20:23 |
|
|
|
|
ML-185 | medium | 21000 |
Description
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 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.
Acceptance Criteria
- #1 Record-list rows fetch and draw the API-provided 80 px small cover variant.
- #2 Record-detail pages fetch
covers.mediumand keep the intendedDETAIL_COVER_SIZE = px(200)400 px detail-cover layout area 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 named cover contract and intended 400 px detail-cover layout.
- #6 The Presto syntax check and smoke tests pass, with physical device verification only claimed if run on the device.
Implementation Plan
- Add small helper(s) for reading the named cover object from API records, returning
smallfor list rows andmediumfor detail pages. - Replace legacy
mini_cover_url/micro_cover_url/thumb_urlselection and preload checks with the new named cover helpers. - 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_optionsand max-width/max-height fitting behavior while preservingDETAIL_COVER_SIZE = px(200). - Keep row and detail image cache keys separate and preserve the existing drag behavior that shows placeholders when data is not already cached.
- 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. - Run
python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"frompresto/andmise run testfor the Presto smoke suite.
Implementation Notes
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.
Final Summary
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 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 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.