Repository navigation
fix(config): one boolean vocabulary for every flag, and DB_TYPE case can no longer skip migrations - #346
Conversation
…can no longer skip migrations Thirteen flags parsed as .lower() == "true" accepted only that literal string: DOWNLOAD_MEDIA=1 silently disabled all media capture, ENABLE_LISTENER=yes silently disabled real-time capture — natural spellings, because four sibling flags in the same file accepted 1/yes/on. Nothing was logged; the run looked normal while capture degraded. The mirror flaw: a typo in those four raised 'Invalid boolean value: ture' without naming the variable. All seventeen flags now parse through one named-variable helper accepting 1/true/yes/on and 0/false/no/off (case-insensitive) and rejecting anything else with the variable named in the error. The one test that pinned 'nonsense means False' now pins the loud rejection instead. entrypoint.sh compared DB_TYPE literally while Python lowercases it, so DB_TYPE=PostgreSQL matched NEITHER branch — migrations silently skipped, app started against a zero-table PostgreSQL. DB_TYPE is normalised once at the top, and an unrecognised database configuration now refuses to start loudly instead of falling through. shellcheck clean.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change centralizes boolean environment parsing, applies it across configuration flags, improves invalid-value errors, and adds validation for unsupported database types before startup continues. ChangesConfiguration validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The configuration changes standardize boolean parsing and safely normalize DB_TYPE matching while preserving unset handling. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 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 |
|
🐳 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 |
|
🐳 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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #346 +/- ##
==========================================
+ Coverage 93.74% 93.76% +0.01%
==========================================
Files 27 27
Lines 9963 9977 +14
==========================================
+ Hits 9340 9355 +15
+ Misses 623 622 -1
🚀 New features to boost your workflow:
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
…can no longer skip migrations (#346) * fix(config): one boolean vocabulary for every flag, and DB_TYPE case can no longer skip migrations Thirteen flags parsed as .lower() == "true" accepted only that literal string: DOWNLOAD_MEDIA=1 silently disabled all media capture, ENABLE_LISTENER=yes silently disabled real-time capture — natural spellings, because four sibling flags in the same file accepted 1/yes/on. Nothing was logged; the run looked normal while capture degraded. The mirror flaw: a typo in those four raised 'Invalid boolean value: ture' without naming the variable. All seventeen flags now parse through one named-variable helper accepting 1/true/yes/on and 0/false/no/off (case-insensitive) and rejecting anything else with the variable named in the error. The one test that pinned 'nonsense means False' now pins the loud rejection instead. entrypoint.sh compared DB_TYPE literally while Python lowercases it, so DB_TYPE=PostgreSQL matched NEITHER branch — migrations silently skipped, app started against a zero-table PostgreSQL. DB_TYPE is normalised once at the top, and an unrecognised database configuration now refuses to start loudly instead of falling through. shellcheck clean. * style(tests): satisfy ruff import order and SIM117 on the new config tests
Two config footguns that fail silently in opposite directions.
Thirteen boolean flags accepted only the literal string "true": DOWNLOAD_MEDIA=1 turned all media capture off, ENABLE_LISTENER=yes turned real-time capture off — no warning, nothing in the logs, while four sibling flags happily accepted 1/yes/on. And in the mirror direction, a typo on those four raised "Invalid boolean value: ture" without naming which variable carried the typo.
Every flag now parses one vocabulary (1/true/yes/on — 0/false/no/off) through a single parser, and a bad value names its variable in the error. scripts/entrypoint.sh additionally lower-cases DB_TYPE before matching, so DB_TYPE=PostgreSQL no longer falls through the exact-match into the no-migration path and boots the app on an unmigrated schema — an unrecognised DB config now refuses to start loudly instead.
Regression tests cover the full vocabulary on representative flags, the named-variable error, and the entrypoint case normalisation.
Summary by CodeRabbit
yes,no,on, andoffare supported consistently.