Skip to content

feat(web): add retry button for pending and failed themes - #692

Merged
ReenigneArcher merged 7 commits into
LizardByte:masterfrom
LuckyNoS7evin:feat/retry-item
Nov 1, 2026
Merged

ReenigneArcher merged 7 commits into
LizardByte:masterfrom
LuckyNoS7evin:feat/retry-item

Conversation

@LuckyNoS7evin

@LuckyNoS7evin LuckyNoS7evin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a Retry button to library rows on the Overview page, so a single item can be queued again without running a full theme scan.

The button appears for items that:

  • need attention (a recorded error, or a failed / unresolved status), or
  • are in ThemerrDB but don't have a theme yet (pending).

It isn't shown for items that already have a theme and no error, or for items missing from ThemerrDB.

How it works:

  • The button sits right after the item's status badge and wraps onto the next line on narrow screens. Its accessible name includes the visible "Retry" label followed by the item title, which is visually hidden.
  • New POST /api/tasks/retry endpoint in common/server_ui.py, with body {"server_id": "...", "item_id": "..."}.
  • It reuses themerr.mcp_tools.retry_items, so the web UI and the MCP tool apply the same rules. The item must be in the cached snapshot for that server. Theme updates and the server must be enabled. Items in ignored libraries are rejected. Items already queued or being processed are not queued twice.
  • It returns 202 and a toast message ("Retry queued. Follow progress in Activity." or "This item is already queued.").
  • Invalid or unknown items return a fixed 400 message. Auth, CSRF and body limits come from the existing BrowserSecurityMiddleware.
  • The request values are only compared against stored database rows and never reach the filesystem.
  • The button is hidden for the legacy default server, because retry_items only knows about saved servers.
  • The retry_items log message now says "Retry requested…" instead of "MCP retry requested…", since it has two callers.

Retrying an item whose Themerr theme is unchanged but flagged "Outdated" queues it as usual. Processing still skips the upload unless the ThemerrDB source has changed, which is the existing overwrite behaviour.

Screenshot

Library list (light and dark). Retry shows on the pending, failed, outdated and unresolved items:

Library list, light
Library list, dark

After clicking Retry:

Retry toast

Phone width (390px). Retry wraps beside its badge:

Library list, phone width

"Needs attention" filter:

Needs attention filter

Issues Fixed or Closed

Roadmap Issues

Testing

New tests in tests/functional/test_server_ui.py:

  • The button renders only for pending, failed, unresolved and errored items, not for complete or missing ones.
  • A valid cached item returns 202 and is queued. An item that is already queued returns the "already queued" message.
  • Invalid bodies, unknown servers or items, ignored libraries, disabled updates or a disabled server, and missing CSRF tokens are all rejected, and nothing is queued.

New test in tests/web/dashboard.test.mjs: retryItem posts the selected server and item and shows the response message.

  • pytest -o addopts='' -p no:cacheprovider (excluding tests/unit/test_notification_build.py, which needs PyInstaller locally): 1052 passed, 19 skipped
  • flake8 and git diff --check: clean
  • npm test: 115 passed. npm run build: OK
  • python scripts/localize.py --extract: adds Retry and Retry theme for to locale/themerr.po

Manual: built a linux/amd64 image from this branch, deployed it in Docker against a real Plex and Jellyfin setup, and used Retry from the Overview page.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

Claude Code helped explore the codebase, implement the change and tests, and capture the screenshots. I reviewed the changes and tested them on my own server.

@CLAassistant

CLAassistant commented Oct 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Show a Retry button on library items that need attention or are
in ThemerrDB but not downloaded yet. The button posts to a new
/api/tasks/retry endpoint, which reuses the existing retry_items
checks (cached item, enabled server and updates, ignored libraries)
and queues the item for processing.

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The retry flow looks sound; I found no functional defect. Please address the repository formatting requirement called out inline before merge. I also included the requested UI adjustment to keep Retry beside its status badge when space allows.

Verified locally: 152 focused Python tests (test_server_ui.py, test_mcp.py, and media-server processing tests), all 115 browser tests, npm run build, flake8 on the changed Python files, and no whitespace errors in the PR diff.

Verification limits: CI, CodeQL, common lint and localization workflows await maintainer approval. Sonar and the hosted documentation check passed. The local Dockle build stops because Doxygen is unavailable; live Plex/Jellyfin processing was not exercised.

Review completed by Codex | Model: gpt-6.1-sol | Thinking: xhigh

Comment thread tests/functional/test_server_ui.py Resolved
Comment thread web/templates/home.html Resolved
ReenigneArcher
ReenigneArcher previously approved these changes Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.13%. Comparing base (eaabaf3) to head (0e05008).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #692      +/-   ##
==========================================
+ Coverage   89.11%   89.13%   +0.02%     
==========================================
  Files          77       77              
  Lines        6355     6368      +13     
  Branches      903      904       +1     
==========================================
+ Hits         5663     5676      +13     
  Misses        478      478              
  Partials      214      214              
Flag Coverage Δ
Linux-aarch64 88.90% <100.00%> (+0.02%) ⬆️
Linux-x86_64 88.90% <100.00%> (+0.02%) ⬆️
Windows-AMD64 88.97% <100.00%> (+0.02%) ⬆️
Windows-ARM64 88.97% <100.00%> (+0.02%) ⬆️
jellyfin-connector 90.24% <ø> (ø)
macOS-arm64 88.90% <100.00%> (+0.02%) ⬆️
macOS-x86_64 88.90% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/common/server_ui.py 96.42% <100.00%> (+0.36%) ⬆️
src/themerr/mcp_tools.py 95.34% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eaabaf3...0e05008. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ReenigneArcher

Copy link
Copy Markdown
Member

Looks like the commit hook may not have ran? https://github.com/LizardByte/Themerr/actions/runs/41130567979/job/124555947694?pr=692

@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 94a43a1 into LizardByte:master Nov 1, 2026
30 checks passed
@LuckyNoS7evin
LuckyNoS7evin deleted the feat/retry-item branch November 1, 2026 20:32
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