Skip to content

fix: PR #180 follow-up tidy-ups + release v7.12.0#182

Merged
GeiserX merged 1 commit into
mainfrom
fix/pr180-followup-v7.12.0
Jun 2, 2026
Merged

fix: PR #180 follow-up tidy-ups + release v7.12.0#182
GeiserX merged 1 commit into
mainfrom
fix/pr180-followup-v7.12.0

Conversation

@GeiserX

@GeiserX GeiserX commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Follow-up to #180 (merged). Applies the small punch-list items from the review and cuts the v7.12.0 release.

Changes

  1. Remove dead configconfig.backoff_min / config.backoff_max were never read; the backoff math uses the module-level BACKOFF_* globals.
  2. Restore TypeError armget_stats cached-stats parse is back to except (json.JSONDecodeError, TypeError) so non-str/bytes cached values stay caught.
  3. .part cleanup inside the retry loop — the stale partial is now removed at the start of each download attempt instead of once before the loop, so retries (incl. FileReference refresh) start clean.
  4. Log the resolved timeout — timeout log lines use the in-scope timeout local (getattr default) instead of re-reading self.config.download_timeout_seconds.

Release

Verification

  • 1794 tests pass, ruff + format clean locally.

Summary by CodeRabbit

  • New Features

    • Added configurable media download timeout settings
    • Introduced tunable exponential backoff parameters for retry behavior
  • Bug Fixes

    • Improved resilience for download retries with partial file cleanup
    • Enhanced Telegram file reference refresh during downloads
    • Fixed concurrent symlink creation handling
    • Improved database operation retry logic
    • Resolved Windows compatibility issue in authentication setup
  • Documentation

    • Updated changelog for v7.12.0 release with new configuration options and fixes

- remove unused config.backoff_min/backoff_max (code uses module globals)
- restore TypeError handling in get_stats cached-stats parse
- move .part cleanup inside the download retry loop
- log the resolved timeout local instead of re-reading config
- bump to 7.12.0 and document the new release
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR releases v7.12.0 with a version bump across package metadata, configuration cleanup removing backoff settings initialization, and download/retry resilience improvements including fixed timeout error logging and .part file cleanup in retry loops plus broader error handling in cached statistics parsing.

Changes

v7.12.0 Release and Download Fixes

Layer / File(s) Summary
Release version metadata bump
pyproject.toml, src/__init__.py, docs/CHANGELOG.md
Version updated from 7.11.7 to 7.12.0 across package metadata; CHANGELOG entry documents new timeout and backoff configuration, transient retry behavior, Telegram file reference refresh, symlink creation robustness, database lock resilience, and Windows auth fixes.
Configuration cleanup: remove backoff settings
src/config.py
Removed backoff_min and backoff_max attribute initialization from Config.__init__ that previously loaded BACKOFF_MIN_SECONDS and BACKOFF_MAX_SECONDS environment variables.
Download retry timeout and cleanup improvements
src/telegram_backup.py
Fixed timeout error logs in both deduplicated and non-deduplicated download paths to use computed timeout variable instead of config reference; moved .part file cleanup into the non-deduplicated retry loop to ensure each attempt starts with a clean temporary file.
Cached statistics parsing error resilience
src/db/adapter.py
Broadened exception handler in DatabaseAdapter.get_cached_statistics to catch TypeError alongside json.JSONDecodeError when parsing cached JSON, falling back to default statistics on either error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main change: follow-up tidy-ups from PR #180 and release v7.12.0.
Description check ✅ Passed Description covers the punch-list items, release notes, and verification. The template's Testing section lacks explicit checks, but core information is present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pr180-followup-v7.12.0

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/db/adapter.py`:
- Line 1122: The except clause using invalid Python syntax `except
json.JSONDecodeError, TypeError:` must be replaced with a proper tuple or
separate handlers; update the exception handling around the JSON parsing in
src/db/adapter.py to use `except (json.JSONDecodeError, TypeError):` (or
separate `except json.JSONDecodeError:` and `except TypeError:`) so both
exceptions are caught correctly under Python 3, keeping the existing error
handling logic in the same block where the JSON parsing occurs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cc3cc00b-b46c-4934-8ab8-2dfb57cd8148

📥 Commits

Reviewing files that changed from the base of the PR and between 466f192 and 005fc07.

📒 Files selected for processing (6)
  • docs/CHANGELOG.md
  • pyproject.toml
  • src/__init__.py
  • src/config.py
  • src/db/adapter.py
  • src/telegram_backup.py
💤 Files with no reviewable changes (1)
  • src/config.py

Comment thread src/db/adapter.py
try:
result.update(json.loads(cached_stats))
except json.JSONDecodeError:
except json.JSONDecodeError, TypeError:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the syntax at the changed line and confirm parseability.
set -euo pipefail

fd -p src/db/adapter.py
python - <<'PY'
import ast, pathlib
p = pathlib.Path("src/db/adapter.py")
src = p.read_text(encoding="utf-8")
ast.parse(src)
print("OK: src/db/adapter.py parses successfully")
PY

Repository: GeiserX/Telegram-Archive

Length of output: 509


Fix invalid Python except tuple syntax (parse-time failure).

src/db/adapter.py:1122 uses except json.JSONDecodeError, TypeError: which is invalid in Python 3 (“multiple exception types must be parenthesized”).

Proposed fix
-            except json.JSONDecodeError, TypeError:
+            except (json.JSONDecodeError, TypeError):
                 pass
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/db/adapter.py` at line 1122, The except clause using invalid Python
syntax `except json.JSONDecodeError, TypeError:` must be replaced with a proper
tuple or separate handlers; update the exception handling around the JSON
parsing in src/db/adapter.py to use `except (json.JSONDecodeError, TypeError):`
(or separate `except json.JSONDecodeError:` and `except TypeError:`) so both
exceptions are caught correctly under Python 3, keeping the existing error
handling logic in the same block where the JSON parsing occurs.

@github-actions

github-actions Bot commented Jun 1, 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 Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (466f192) to head (005fc07).

Files with missing lines Patch % Lines
src/db/adapter.py 0.00% 1 Missing ⚠️
src/telegram_backup.py 50.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
- Coverage   92.25%   92.25%   -0.01%     
==========================================
  Files          24       24              
  Lines        6895     6893       -2     
==========================================
- Hits         6361     6359       -2     
  Misses        534      534              
Files with missing lines Coverage Δ
src/__init__.py 100.00% <100.00%> (ø)
src/config.py 96.14% <ø> (-0.03%) ⬇️
src/db/adapter.py 88.22% <0.00%> (ø)
src/telegram_backup.py 90.78% <50.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 e951733 into main Jun 2, 2026
9 of 10 checks passed
@GeiserX GeiserX deleted the fix/pr180-followup-v7.12.0 branch June 2, 2026 00:05
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