Skip to content

fix(viewer): show the tile's own icon when a thumbnail cannot be made - #437

Merged
GeiserX merged 1 commit into
mainfrom
ai/thumb-error-fallback
Sep 8, 2026
Merged

fix(viewer): show the tile's own icon when a thumbnail cannot be made#437
GeiserX merged 1 commit into
mainfrom
ai/thumb-error-fallback

Conversation

@GeiserX

@GeiserX GeiserX commented Sep 8, 2026

Copy link
Copy Markdown
Owner

One tile in the shared media grid came up as the browser's broken-image glyph with a filename printed across it.

That happens when the viewer cannot produce a thumbnail at all: the video is undecodable, or ffmpeg takes longer than the 15 seconds it is given, so the request answers 404 and the <img> has nothing to draw.

The tile already has a picture for exactly that situation. While it waits its turn in the queue it shows a play symbol for video and a picture symbol for anything else, and that is what it now keeps when the thumbnail fails. The failure is remembered only for the current view, so switching tab or chat clears it and the file is tried again next time.

Testing

  • tests/test_gallery_thumb_batching.py gains a case that runs the real queue: an errored tile is recorded, stays admitted so the queue does not re-issue it, frees its slot exactly like a successful load, cannot be resurrected by a later load event, and does not survive a view change.
  • Three mutations each turn it red: routing the error handler back to settleThumb, dropping !thumbFailed(item.id) from the tile, and leaving the failure set uncleared on reset.
  • Full suite: 3932 passed, 168 skipped. ruff check and ruff format --check clean.

Summary by CodeRabbit

  • Bug Fixes

    • Media gallery tiles now display file or video icons when thumbnail generation fails or times out, instead of broken-image placeholders.
    • Failed thumbnail states are cleared when switching views, allowing thumbnails to be retried.
  • Documentation

    • Updated Docker image references, build commands, migration examples, and project version information to 8.9.2.
    • Added changelog details for the improved thumbnail fallback behavior.

Some videos cannot be decoded, or take longer than the 15s the viewer
allows, so the thumbnail answers 404 and the grid painted the browser's
broken-image glyph with the file name across the tile. The tile already
draws a play or picture icon while it waits its turn, so a tile that
fails now keeps that icon instead. The record is cleared with the view,
so a file that failed once is retried the next time it is opened.

Version 8.9.2.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9473ef00-c455-4e72-9395-c76a6d2d5512

📥 Commits

Reviewing files that changed from the base of the PR and between 965fc21 and dba6c3c.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • README.md
  • docker-compose.yml
  • docs/CHANGELOG.md
  • pyproject.toml
  • scripts/migrate-sqlite-to-postgres.py
  • src/__init__.py
  • src/web/templates/index.html
  • tests/test_gallery_thumb_batching.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The release updates project and Docker version references from 8.9.1 to 8.9.2. Gallery tiles now record failed thumbnails, display fallback icons, and clear failure state when the view resets.

Changes

Gallery thumbnail failure handling

Layer / File(s) Summary
Thumbnail failure handling and validation
src/web/templates/index.html, tests/test_gallery_thumb_batching.py, docs/CHANGELOG.md
Failed thumbnail requests are recorded, rendered with fallback icons, removed from retry admission, and cleared during view resets. Tests cover queue behavior and template wiring. The changelog documents the fix.

Release version alignment

Layer / File(s) Summary
Version references and release examples
pyproject.toml, src/__init__.py, docker-compose.yml, README.md, scripts/migrate-sqlite-to-postgres.py
Project metadata, package version values, Docker Compose images, README examples, and migration commands now reference 8.9.2.

Priority: ⬇️ Low — Impact reflects low issue severity.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to dba6c

Gallery tiles now retain meaningful fallback icons when thumbnails fail, while failed files can be retried after changing views. The release version references are aligned, with no remaining concrete merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (5 skipped: 5 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main viewer fix: preserving the tile's own icon when thumbnail generation fails.
Description check ✅ Passed The description clearly explains the failure scenario, user-visible behavior, state-reset behavior, and test coverage. It omits several template checklist sections, but the core change and validation …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. (5 skipped: 5 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ai/thumb-error-fallback

Warning

Some tools did not complete. Review the errors below.

🔧 ast-grep (0.45.2)
src/web/templates/index.html

ast-grep timed out on this file


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

🐳 Dev images published!

  • drumsergio/telegram-archive:dev
  • drumsergio/telegram-archive-viewer:dev

The dev/test instance will pick up these changes automatically (Portainer GitOps).

To test locally:

docker pull drumsergio/telegram-archive:dev
docker pull drumsergio/telegram-archive-viewer:dev

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.60%. Comparing base (965fc21) to head (dba6c3c).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #437   +/-   ##
=======================================
  Coverage   94.60%   94.60%           
=======================================
  Files          29       29           
  Lines       11447    11447           
=======================================
  Hits        10829    10829           
  Misses        618      618           
Files with missing lines Coverage Δ
src/__init__.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GeiserX
GeiserX merged commit 8987607 into main Sep 8, 2026
11 checks passed
@GeiserX
GeiserX deleted the ai/thumb-error-fallback branch September 8, 2026 11:26
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