Skip to content

fix(api): plot of the day shows light preview image in dark mode - #10308

Merged
MarkusNeusinger merged 3 commits into
mainfrom
claude/roc-curve-dark-mode-display-hmyr3m
Aug 17, 2026
Merged

fix(api): plot of the day shows light preview image in dark mode#10308
MarkusNeusinger merged 3 commits into
mainfrom
claude/roc-curve-dark-mode-display-hmyr3m

Conversation

@MarkusNeusinger

Copy link
Copy Markdown
Owner

Summary

  • Fixes a user bug report (on /roc-curve/python/altair, in German): the "plot of the day" on the landing page was not displayed correctly in dark mode — the terminal card rendered the light-background preview image on the dark page.
  • Root cause: GET /insights/plot-of-the-day only returned the legacy preview_url, which is an ORM synonym for preview_url_light. The frontend has been theme-aware since Phase C (selectPreviewUrl in app/src/utils/themedPreview.ts, and PlotOfTheDayData already declares the themed fields), but with no preview_url_dark in the payload it always fell back to the light image.
  • Fix: PlotOfTheDayResponse now carries preview_url_light / preview_url_dark, and _build_potd threads the dark URL through the candidate selection. No frontend change needed — PlotOfTheDayTerminal picks the dark variant up automatically.

Test plan

  • uv run pytest tests/unit/api/test_routers.py — 137 passed, including the extended test_potd_with_db which now asserts both themed URLs flow through to the response
  • uv run ruff check / ruff format --check / uv run mypy api/routers/insights.py — clean

Checklist

  • CHANGELOG.md updated under [Unreleased] (follow-up commit on this branch referencing this PR number)
  • Related documentation updated if behavior changed — none needed (no analytics events, workflows, or user-facing docs touched)

Generated by Claude Code

The plot-of-the-day response only carried the legacy preview_url (a
synonym for the light variant), so the landing-page terminal card always
rendered the light plot image in dark mode. The frontend has been
theme-aware since Phase C (selectPreviewUrl), it just never received
preview_url_dark from this endpoint.

Add preview_url_light / preview_url_dark to PlotOfTheDayResponse and
thread the dark URL through the candidate selection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162HVVDfD1xUDwP3Gs2b3ns
Copilot AI lite review requested due to automatic review settings August 17, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the “plot of the day” landing-page rendering in dark mode by making the GET /insights/plot-of-the-day API response theme-aware (light/dark preview URLs), aligning the endpoint with the already theme-aware frontend selection logic.

Changes:

  • Extend PlotOfTheDayResponse to include preview_url_light and preview_url_dark, while retaining the legacy preview_url.
  • Thread preview_url_dark through POTD candidate selection and response construction.
  • Update unit tests and add a changelog entry documenting the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
api/routers/insights.py Adds themed preview URL fields to the POTD response and threads the dark URL through selection/serialization.
tests/unit/api/test_routers.py Extends the POTD unit test to assert both preview_url_light and preview_url_dark are returned.
CHANGELOG.md Documents the dark-mode POTD preview fix under [Unreleased]Fixed.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread api/routers/insights.py
Review feedback: the themed URLs came from the candidate snapshot while
code/metadata came from the later full_impl query, so the two could
drift. Prefer full_impl's URLs, keeping the snapshot as fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162HVVDfD1xUDwP3Gs2b3ns
Copilot AI review requested due to automatic review settings August 17, 2026 19:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MarkusNeusinger
MarkusNeusinger merged commit 9a175e1 into main Aug 17, 2026
10 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the claude/roc-curve-dark-mode-display-hmyr3m branch August 17, 2026 19:20
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.

3 participants