fix: PR #180 follow-up tidy-ups + release v7.12.0#182
Conversation
- 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
📝 WalkthroughWalkthroughThis 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. Changesv7.12.0 Release and Download Fixes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (6)
docs/CHANGELOG.mdpyproject.tomlsrc/__init__.pysrc/config.pysrc/db/adapter.pysrc/telegram_backup.py
💤 Files with no reviewable changes (1)
- src/config.py
| try: | ||
| result.update(json.loads(cached_stats)) | ||
| except json.JSONDecodeError: | ||
| except json.JSONDecodeError, TypeError: |
There was a problem hiding this comment.
🧩 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")
PYRepository: 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.
|
🐳 Dev images published!
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 Report❌ Patch coverage is
❌ 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@@ 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
🚀 New features to boost your workflow:
|
Follow-up to #180 (merged). Applies the small punch-list items from the review and cuts the v7.12.0 release.
Changes
config.backoff_min/config.backoff_maxwere never read; the backoff math uses the module-levelBACKOFF_*globals.get_statscached-stats parse is back toexcept (json.JSONDecodeError, TypeError)so non-str/bytes cached values stay caught..partcleanup 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.timeoutlocal (getattr default) instead of re-readingself.config.download_timeout_seconds.Release
pyproject.toml+src/__init__.pyto 7.12.0 (minor — feat: decoupled async media download queue with concurrent downloads #180 addedDOWNLOAD_TIMEOUT_SECONDS,BACKOFF_MIN/MAX_SECONDS,FLOOD_WAIT_LOG_THRESHOLD).docs/CHANGELOG.mdentry crediting @smbdspk.Verification
Summary by CodeRabbit
New Features
Bug Fixes
Documentation