Skip to content

Add a script that screenshots a PR before and after - #1436

Closed
crimsonsunset wants to merge 56 commits into
dannyvfilms:latestfrom
crimsonsunset:tooling/pr-screenshots
Closed

crimsonsunset wants to merge 56 commits into
dannyvfilms:latestfrom
crimsonsunset:tooling/pr-screenshots

Conversation

@crimsonsunset

Copy link
Copy Markdown

Summary

scripts/pr_screenshots.py captures before/after screenshots of a PR (merge-base vs head) at desktop and phone width in light and dark, and with --post writes them into the PR description. It exists so UI PRs can carry visual proof without taking shots by hand across branches.

Changes overview

  • scripts/pr_screenshots.py: serves each commit from a throwaway git worktree with its own SQLite database and a private Redis (port 6391), drives headless Chromium, uploads images to the fork and rewrites a marked block of the PR description.
  • scripts/pr_screenshots_seed.py: seeds a shots user, movies, and a band/album/tracks. Tolerates fields and routes a commit does not have yet.
  • docs/agents/pr_screenshots.md: usage, page selection, requirements, limits.
  • AGENTS.md: one line in the Agent Docs list.

Key technical decisions

  • Worktrees, not branch switching, so the working tree is never touched.
  • Images upload through the undocumented uploads.github.com/user-attachments/assets endpoint using the gh token. It only accepts repos you can push to, so images go to the fork and are referenced from the upstream PR.
  • Pages per PR live in a PR_PAGES dict, not a config file.

Test plan

Docs

  • docs/agents/pr_screenshots.md

- The artist view already built genre_chips from MusicBrainz, but the
  template never rendered them.
- Register a Genres sidebar section for music_artist so the layout
  settings can show and reorder it.
- After the write transaction, fill an album saved without genres from
  its MusicBrainz release group, then resync the play.
- Plays fall back to the album artist's genres when the album has none.
- Store artist genres from scrobbles as names, matching the artist page,
  instead of raw MusicBrainz genre objects.
- Fork-only: GITHUB_TOKEN here cannot push to dannyvfilms packages.
- Drop the legacy yamtrack alias so the fork does not create one.
Add a post-listen signal and store the scrobble origin URL
Album and podcast show rows already store genres, but those detail
pages never rendered them. Register the album sidebar section the
same way artist pages already do.
Season metadata already copies the show's genres. The episode page
never rendered them.
- Nested under the album, on the same media details shell as artist and album.
- Genre chips use the track list, then the album list when the track has none.
- Nest the track URL under its album and redirect the short track path.
- Show track-then-album genre chips and play history with the origin link.
- Link each album track title to that page.

Refs #5
- Record http(s)-only origin links and skipped listens with no end date.
- Note the sidebar track number, duration, and album-credit artist line.
- Fetch the recording when the user has no listen, and do not write it back.
- Show release date, runtime when the track has none, cover when the album has none, and genres when both are empty.

Refs #5
- Record the change set as branch commits plus dirty and untracked files.
- Record the fallback: one app's tests, or the fast suite for cross-cutting paths.
- Record how Sortable moves off jsDelivr onto a local static file.
- Record the settings page label, collapse, and control visibility changes.
- Add scripts/test.sh --affected, which maps a diff to labels or the fast suite.
- Leave the no-arg suite and the CI job unchanged.
- Record which test executed each line and run only those on a pull request.
- Fall back to the import walk when the map is missing or the file is new.
- Ship Sortable 1.15.3 from the app so reorder survives the live Content Security Policy.
- Show configured row titles, real filter labels, and the row controls without hovering.
- Opening an unknown artist page was storing the first search result
- Ray Treblo was attached to Ray Charles and imported his discography
- Give sections and rows their own drag handles, and keep Sortable bound after Add Row or Delete.
- Keep desktop rows on one line and list each active filter as a pill under the row name.
- Pin DEBUG off in the test subprocess so a developer DEBUG=True does not load the debug toolbar.
- Add django-browser-reload to the dev group, enabled only under DEBUG when installed.
- Add scripts/dev.sh and npm run dev, with --css and --celery options.
- Restore the rule the filter button used before pills: statuses count as filters.
- Match uv.lock to the == pin in pyproject.toml so uv sync --locked passes.
…s-usable

Make Home Screen settings usable
Mix listens store the track permalink on origin_url. The album page uses that for the external-link chip and the link under the track.
Multi-Scrobbler sends it as spotify_id. The album page shows that the same way it shows a SoundCloud permalink.
…ay-link

Show a SoundCloud play link on a music album
- Copy the first non-empty list onto the related rows that are still empty, including after a listen hook writes one.
- Show artist genres on the album and artist pages when the album itself has none.
…hree.

- The artwork opens the track.
- Each label opens that album, artist, or track.
- Phased plan for per-media-type tile field settings with live preview

Refs #11
- PATCH fans the three legacy preference names out to every type
- GET omits a name when types disagree
- Lists-index cards always show the item count
- Store the old card preferences in tile_metadata and drop those columns.
- Each field chooses hover or dormant, and a drag sets the order for every type.
- Drag reorders a whole line, and each line chooses hover or dormant.
- A flat field list still loads as one property per line.
- Upsert tile-seed rows for demo and joe so a fresh database can show every media type.
- Leave every other library row alone, and document the command in docs/local-sample-library.md.
- Switch types at /settings/tiles/<type> without dropping unsaved edits.
- Read last played, author, show, and track number from the columns library rows actually store.
- Preview music from a play and the person tile from a cast credit.
- Per-type title lines, hover bleed, and a show or hide for the score.
- A score on a subtitle line uses the same yellow star as the title row.
- The sample TV show is Rocky and Bullwinkle so a one-line title overflows.
- All sits next to the 1, 2, and 3 line counts, including hover.
- Choosing All on the resting title forces the hover reveal to All too.
- Copy from uses the settings menu, with similar types listed first.
- Fields the destination cannot show sit in Available until they are moved.
- Progress draws a poster bar that follows hover or dormant.
…ttings

Add per-media-type tile subtitle settings
- Join his GCD migration with the tile migrations already applied in production.
- Join his episode index with the music origin URL migration.
- Keep the card rating button and apply per-type score visibility on top of it.
- Nest the track URL under its album and redirect the short track path.
- Show track-then-album genre chips and play history with the origin link.
- Link each album track title to that page.

Refs #5
- Fetch the recording when the user has no listen, and do not write it back.
- Show release date, runtime when the track has none, cover when the album has none, and genres when both are empty.

Refs #5
- Opening an unknown artist page was storing the first search result
- Ray Treblo was attached to Ray Charles and imported his discography
- Add scripts/test.sh --affected, which maps a diff to labels or the fast suite.
- Leave the no-arg suite and the CI job unchanged.
- Record which test executed each line and run only those on a pull request.
- Fall back to the import walk when the map is missing or the file is new.
- Shallow checkout left origin/latest missing and the test job exited early
- origin_url only exists once the listen-hooks PR lands
test: run the Django tests the diff covers
Keep latest's genre fallback and origin_url play history. The track page still uses them.
feat: music track detail page with MusicBrainz lookup
- Serves the merge-base and head from throwaway worktrees with a seeded database
- Captures desktop and phone in light and dark, and can post them to the PR description
- Document usage in docs/agents/pr_screenshots.md
@crimsonsunset

Copy link
Copy Markdown
Author

Wrong base: branch carried fork-only commits. Reopening from upstream latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant