From 2f94657ade5a1518e3ec7246b62f4866788d90ed Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Mon, 11 May 2026 07:23:55 +0100 Subject: [PATCH] ML-179.2: track refactor task --- ...Presto-record-detail-layout-preparation.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 backlog/tasks/ml-179.2 - Refactor-Presto-record-detail-layout-preparation.md diff --git a/backlog/tasks/ml-179.2 - Refactor-Presto-record-detail-layout-preparation.md b/backlog/tasks/ml-179.2 - Refactor-Presto-record-detail-layout-preparation.md new file mode 100644 index 00000000..310b2d09 --- /dev/null +++ b/backlog/tasks/ml-179.2 - Refactor-Presto-record-detail-layout-preparation.md @@ -0,0 +1,54 @@ +--- +id: ML-179.2 +title: Refactor Presto record detail layout preparation +status: To Do +assignee: [] +created_date: "2026-05-10 20:30" +updated_date: "2026-05-10 20:30" +labels: [] +dependencies: + - ML-179.1 +documentation: + - presto/AGENTS.md + - presto/README.md + - docs/project-conventions.md +modified_files: + - presto/main.py +parent_task_id: ML-179 +priority: medium +ordinal: 8000 +--- + +## Description + + + +Follow-up to ML-179 and dependent on ML-179.1. Refactor the record detail view so detail measurement, drawing, and scrobble-button positioning share one prepared layout structure. Keep the Presto app single-file in presto/main.py and preserve current record detail behavior, scrolling, image loading, and scrobble UX. + + + +## Acceptance Criteria + + + +- [ ] #1 Record detail rendering uses one prepared layout representation for title, artists, cover, genres, metadata, purchased date, and optional scrobble button positioning. +- [ ] #2 Detail content height and scrobble-button bounds are derived from the prepared layout rather than duplicated formulas in separate measure, draw, and hit-test paths. +- [ ] #3 Drag redraws for the detail view reuse prepared layout data and do not measure text, join display strings, sanitize text, compute layout heights, or fetch images in the scroll hot path. +- [ ] #4 Detail cover image behavior is preserved: prefer thumb_url then mini_cover_url then micro_cover_url, cache bytes separately from row thumbnails, and show placeholders during drag or failures as before. +- [ ] #5 Back navigation from detail to day or search results preserves the existing source-screen behavior and reset semantics from ML-179.1. +- [ ] #6 The change is behavior-preserving for detail display, detail scrolling, scrobble button visibility, scrobble tap handling, and image placeholder behavior. +- [ ] #7 Presto syntax verification passes with python3 py_compile from the presto directory, and final notes state whether physical-device behavior was verified. + + +## Implementation Plan + + + +1. Start after ML-179.1 is complete so the detail event path, navigation helpers, and reset semantics are already tightened. +2. Inspect current detail functions in `presto/main.py`, especially `draw_record_detail`, `_measure_detail_content`, `_draw_detail_title_artists`, `_draw_detail_info_below_cover`, `_scrobble_button_hit_test`, and cover drawing. +3. Introduce a compact prepared detail layout structure stored on detail state or on the selected record dict, containing sanitized/wrapped display lines, section heights, total content height, and optional scrobble-button content-relative bounds. +4. Update detail preparation to run when a record detail page is opened, when selected record/layout data is missing, or when content must be refreshed; do not run it inside drag redraw hot paths. +5. Update detail drawing to consume the prepared layout for text sections and button placement while preserving clipping, scroll indicators, cover image positioning, and placeholder behavior. +6. Update scrobble hit testing to use the same prepared scrobble-button bounds used by drawing, adjusted by the current detail scroll offset. +7. Run the Presto syntax check from `presto/` using `python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"` and record whether physical-device behavior was verified. +