Skip to content

fix: resolve relative paths, add session log, remove /app ownership#147

Merged
GeiserX merged 3 commits intomainfrom
ai/fix-142-144
May 7, 2026
Merged

fix: resolve relative paths, add session log, remove /app ownership#147
GeiserX merged 3 commits intomainfrom
ai/fix-142-144

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented May 6, 2026

Summary

Test plan

  • 178 tests pass locally (config, db_base, db_init, db_migrate, issue_fixes)
  • ruff check . + ruff format --check . pass
  • CI tests pass (telethon-dependent tests need CI's pydantic version)
  • Docker build succeeds with read-only /app

Closes #142, closes #144

Summary by CodeRabbit

  • New Features

    • Real-time message edit/delete tracking with immediate DB updates
    • Chat action monitoring (title/photo/member changes) and pinned/unpinned handling
    • Mass-operation protection with per-chat rate limiting
  • Improvements

    • More robust absolute-path handling for session and database files
    • Environment defaults adjusted for Python runtime behavior and module path
  • Tests

    • New unit tests covering path resolution, session-path logging, and runtime assumptions

- Apply os.path.abspath() to all DB/session path resolution (#144)
  so relative env vars resolve against the filesystem root, not WORKDIR
- Log Telethon session DB path at INFO before client creation (#142)
  to distinguish session DB errors from main application DB errors
- Remove /app from chown in Dockerfile (#145 comment) — static code
  should not be writable at runtime; add PYTHONDONTWRITEBYTECODE=1
  and PYTHONUNBUFFERED=1
- Align entrypoint.sh path priority with Python code (DATABASE_PATH →
  DATABASE_DIR → DB_PATH → BACKUP_PATH) and resolve to absolute

Closes #142, closes #144
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

🐳 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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Review 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: Pro

Run ID: 0d0801e6-d35d-439e-a626-a5bf9c44d765

📥 Commits

Reviewing files that changed from the base of the PR and between 2c7be23 and 6cfbf6a.

📒 Files selected for processing (3)
  • scripts/entrypoint.sh
  • src/config.py
  • tests/test_issue_fixes.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • scripts/entrypoint.sh
  • src/config.py
  • tests/test_issue_fixes.py

📝 Walkthrough

Walkthrough

Normalize DB/session filesystem paths to absolute values, log resolved Telethon session DB paths before client creation, limit Docker chown to /data and extend ENV, update entrypoint DB resolution, and add tests validating logging and path normalization.

Changes

Absolute Path Resolution & Session Logging

Path normalization & session logging

Layer / File(s) Summary
Runtime Configuration
Dockerfile
Non-root user ownership restricted to /data only; ENV extended with PYTHONPATH=/app, PYTHONDONTWRITEBYTECODE=1, and PYTHONUNBUFFERED=1.
Configuration Resolution
src/config.py
backup_path and session_dir normalized to absolute paths; database_path normalizes DATABASE_PATH/DATABASE_DIR/DB_PATH to absolute when provided (fallback remains joined with backup_path).
Database URL Construction
src/db/base.py, alembic/env.py, src/db/migrate.py
Computed SQLite paths are converted to absolute via os.path.abspath(...) before directory creation and before forming sqlite+aiosqlite:///... URLs.
Migration Entrypoint
scripts/entrypoint.sh
Entrypoint computes _DB_FILE by precedence across DATABASE_PATH, DATABASE_DIR, DB_PATH, and BACKUP_PATH, then uses realpath -m to produce an absolute DB_PATH; existing DATABASE_URL parsing not changed.
Session Path Logging
src/connection.py, src/telegram_backup.py, src/listener.py
Each connection point logs the resolved Telethon session database path (self.config.session_path) before instantiating TelegramClient.
Tests & Validation
tests/test_issue_fixes.py
Adds tests verifying session-path INFO logs occur before TelegramClient() calls, asserts relative DB paths are normalized to absolute in SQLite URLs, and checks Dockerfile runtime assumptions (no hardcoded /app writes; sys.dont_write_bytecode alignment).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • GeiserX/Telegram-Archive#120: Implements related absolute-path normalization, session logging, and listener behavior exercised by these tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the three main changes: resolving relative paths, adding session logging, and removing /app ownership in Dockerfile.
Description check ✅ Passed Description covers all key changes, lists affected files, and provides a test plan. All required template sections are addressed.
Linked Issues check ✅ Passed All code changes directly address requirements from #142 (session DB logging) and #144 (absolute path resolution), with bonus entrypoint.sh fix.
Out of Scope Changes check ✅ Passed All changes are scoped to the three linked issues and the bonus entrypoint.sh env var priority fix. No unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 85.19% which is sufficient. The required threshold is 80.00%.

✏️ 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 ai/fix-142-144

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/db/base.py (1)

191-207: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

_safe_url() doesn't apply abspath, so the logged path diverges from the actual URL

_safe_url() re-derives db_path from env vars without os.path.abspath(), so when a relative path is configured the "Initializing database" log line will show the relative path while the real connection uses the absolute one. Low impact (logging only), but confusing.

✏️ Suggested fix
         if not db_path:
             backup_path = os.getenv("BACKUP_PATH", "/data/backups")
             db_path = os.path.join(backup_path, "telegram_backup.db")
+        db_path = os.path.abspath(db_path)
         return f"sqlite+aiosqlite:///{db_path}"
🤖 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/base.py` around lines 191 - 207, _safe_url currently reconstructs the
SQLite db_path from env vars (DATABASE_PATH/DB_PATH, DATABASE_DIR, BACKUP_PATH)
but does not call os.path.abspath, so logged path can differ from the actual
connection path; update the _safe_url method to normalize the computed db_path
with os.path.abspath() before returning (apply after determining db_path in the
SQLite branch) so the returned "sqlite+aiosqlite:///{db_path}" matches the real
absolute path used by the connection.
scripts/entrypoint.sh (1)

229-237: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

realpath -m is bypassed when DATABASE_URL contains a relative SQLite path

Lines 233–237 overwrite DB_PATH by stripping the URL prefix after realpath -m has already run. If DATABASE_URL=sqlite:///relative/path.db is set, the extracted path is still relative and the migration check at line 239 (if [ -f "$DB_PATH" ]) will resolve against $PWD (/app) instead of the intended root.

✏️ Suggested fix
-    if [[ "$DATABASE_URL" == sqlite+aiosqlite:///* ]]; then
-      DB_PATH="${DATABASE_URL#sqlite+aiosqlite:///}"
-    elif [[ "$DATABASE_URL" == sqlite:///* ]]; then
-      DB_PATH="${DATABASE_URL#sqlite:///}"
-    fi
+    if [[ "$DATABASE_URL" == sqlite+aiosqlite:///* ]]; then
+      DB_PATH="$(realpath -m "${DATABASE_URL#sqlite+aiosqlite:///}")"
+    elif [[ "$DATABASE_URL" == sqlite:///* ]]; then
+      DB_PATH="$(realpath -m "${DATABASE_URL#sqlite:///}")"
+    fi
🤖 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 `@scripts/entrypoint.sh` around lines 229 - 237, The current flow runs realpath
-m on DB_PATH before you strip SQLite URL prefixes from DATABASE_URL, so when
DATABASE_URL contains a relative path (handled by the conditions that check
sqlite+aiosqlite:/// and sqlite:///), the extracted path remains relative; move
or repeat the realpath -m normalization to occur after you handle DATABASE_URL
(i.e., after the if [[ "$DATABASE_URL" == sqlite+aiosqlite:///* ]] / elif [[
"$DATABASE_URL" == sqlite:///* ]] blocks that set DB_PATH) so DB_PATH is always
an absolute path before the subsequent file existence check.
src/telegram_backup.py (1)

136-137: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

SyntaxError: Python 2 except syntax

except ValueError, TypeError: is invalid in Python 3 — it's a SyntaxError at parse time. The entire module will fail to import.

🐛 Fix
-    except ValueError, TypeError:
+    except (ValueError, TypeError):
🤖 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/telegram_backup.py` around lines 136 - 137, The except clause uses Python
2 syntax ("except ValueError, TypeError:") which causes a SyntaxError; update
the exception handling around the block that sets log_threshold_seconds so it
uses modern syntax — either a tuple form "except (ValueError, TypeError):" or
separate except blocks — ensuring the same fallback assignment to
log_threshold_seconds = 10 is preserved and no other exceptions are swallowed.
🧹 Nitpick comments (4)
src/db/migrate.py (1)

91-91: 💤 Low value

abspath only applied to env-var-derived paths, not caller-supplied paths

If a caller passes an explicit relative sqlite_path, it won't be normalized to absolute. Consider moving abspath outside the if sqlite_path is None: block to cover both cases (same applies to verify_migration at line 199).

✏️ Suggested fix
     if sqlite_path is None:
         sqlite_path = os.getenv("DATABASE_PATH")
         if not sqlite_path:
             db_dir = os.getenv("DATABASE_DIR")
             if db_dir:
                 sqlite_path = os.path.join(db_dir, "telegram_backup.db")
         if not sqlite_path:
             sqlite_path = os.getenv("DB_PATH")
         if not sqlite_path:
             backup_path = os.getenv("BACKUP_PATH", "/data/backups")
             sqlite_path = os.path.join(backup_path, "telegram_backup.db")
-        sqlite_path = os.path.abspath(sqlite_path)
+    sqlite_path = os.path.abspath(sqlite_path)
🤖 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/migrate.py` at line 91, The code only normalizes sqlite_path with
os.path.abspath when sqlite_path is None, so caller-supplied relative paths are
left unnormalized; move the os.path.abspath(sqlite_path) call out of the
if-block so sqlite_path is normalized regardless of being provided or derived,
and make the same change inside verify_migration (ensure the variable
sqlite_path in both migrate-related functions is passed through os.path.abspath
immediately after determination). Ensure you update any subsequent logic that
assumes None vs str accordingly (keep the same variable name sqlite_path).
tests/test_issue_fixes.py (3)

287-297: ⚡ Quick win

Scan is too narrow to catch a /app write regression.

You're scanning only telegram_backup.py and listener.py, but #144/#145 affect config.py, db/base.py, db/migrate.py, alembic/env.py, etc. A regression that re-introduces "/app/..." in any of those wouldn't be caught.

-        src_dir = pathlib.Path(__file__).parent.parent / "src"
-        for py_file in (src_dir / "telegram_backup.py", src_dir / "listener.py"):
-            content = py_file.read_text()
-            self.assertNotIn("APP_DIR", content)
-            self.assertNotIn('"/app/', content)
+        src_dir = pathlib.Path(__file__).parent.parent / "src"
+        for py_file in src_dir.rglob("*.py"):
+            content = py_file.read_text()
+            self.assertNotIn("APP_DIR", content, f"{py_file} contains APP_DIR")
+            self.assertNotIn('"/app/', content, f"{py_file} contains hardcoded /app/ path")
🤖 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 `@tests/test_issue_fixes.py` around lines 287 - 297, Update the
test_no_hardcoded_app_directory_writes test to scan all source .py files instead
of only telegram_backup.py and listener.py: use the existing src_dir
(Path(__file__).parent.parent / "src") and iterate over src_dir.rglob("*.py")
(or explicitly include config.py, db/base.py, db/migrate.py, alembic/env.py) and
assert that neither "APP_DIR" nor '"/app/' appears in any file content; keep the
same assertions but run them per-file so regressions in any module are caught.

299-306: 💤 Low value

This test is essentially a tautology.

hasattr(sys, "dont_write_bytecode") is True on every CPython build. It doesn't verify that PYTHONDONTWRITEBYTECODE=1 is honored, nor that the Dockerfile sets it. Either drop it, or check the Dockerfile content directly (similar to test_no_hardcoded_app_directory_writes):

-    def test_pythondontwritebytecode_prevents_pyc_creation(self):
-        """PYTHONDONTWRITEBYTECODE=1 means sys.dont_write_bytecode is respected."""
-        import sys
-        self.assertTrue(hasattr(sys, "dont_write_bytecode"))
+    def test_dockerfile_sets_pythondontwritebytecode(self):
+        """Dockerfile must set PYTHONDONTWRITEBYTECODE=1 so /app stays read-only."""
+        import pathlib
+        dockerfile = (pathlib.Path(__file__).parent.parent / "Dockerfile").read_text()
+        self.assertIn("PYTHONDONTWRITEBYTECODE=1", dockerfile)
+        self.assertIn("PYTHONUNBUFFERED=1", dockerfile)
🤖 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 `@tests/test_issue_fixes.py` around lines 299 - 306, The test
test_pythondontwritebytecode_prevents_pyc_creation is a tautology because
hasattr(sys, "dont_write_bytecode") is always True; replace it with a meaningful
assertion that inspects the project Dockerfile (or build config) to ensure
PYTHONDONTWRITEBYTECODE=1 is set (mirroring the approach used in
test_no_hardcoded_app_directory_writes), or simply remove the test; update the
test function name and body accordingly so it reads the Dockerfile content and
asserts the presence of the PYTHONDONTWRITEBYTECODE=1 directive.

186-271: 💤 Low value

Path assertions are POSIX-only, but CI is Linux-only so no action required.

os.path.isabs("C:\\foo") is True on Windows but url_path.endswith("/telegram_backup.db") won't be, and assertEqual(url_path, "/data/backups/telegram_backup.db") would fail on Windows. All CI workflows run on ubuntu-latest only, so this is safe in practice. If you want defensive future-proofing, consider adding @unittest.skipUnless(os.name == "posix", ...) to these tests.

🤖 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 `@tests/test_issue_fixes.py` around lines 186 - 271, Several tests (e.g.,
test_relative_db_path_gets_resolved_to_absolute,
test_absolute_db_path_remains_unchanged,
test_relative_database_path_env_gets_resolved,
test_absolute_database_path_env_remains_unchanged,
test_default_path_is_absolute, test_relative_database_dir_gets_resolved,
test_relative_backup_path_gets_resolved) make POSIX-specific path assertions;
guard them with a platform check to avoid Windows failures by adding
`@unittest.skipUnless`(os.name == "posix", "POSIX-only path assertions") above
each test or the test class, and import os and unittest.skipUnless where tests
are defined so DatabaseManager path behavior is only asserted on POSIX
platforms.
🤖 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 `@tests/test_issue_fixes.py`:
- Line 17: The async test class TestSessionPathLogging (and any other bare async
test classes in this file) should inherit from unittest.IsolatedAsyncioTestCase
instead of being bare classes so asyncio tests run under unittest; update their
class definition(s) to subclass IsolatedAsyncioTestCase and convert any plain
assert statements to unittest assertions (e.g., self.assertEqual,
self.assertTrue) and use MagicMock/AsyncMock for async dependencies where
applicable; adjust any async test methods to be async def test_* methods that
use await as needed.
- Around line 123-175: The tests are calling TelegramListener.create() but the
session-path/info log and TelegramClient instantiation happen in connect(), so
change both tests to call listener.connect(listener.config) instead of create();
keep the TelegramClient patch (patch("src.listener.TelegramClient") /
side_effect=track_client) and logger patch as before, and additionally stub out
get_db_manager (patch or set listener.get_db_manager to a simple stub returning
a db with get_all_chats), RealtimeNotifier (patch
"src.listener.RealtimeNotifier"), and db.get_all_chats to avoid downstream calls
during connect() so the test focuses only on the ordering/logging behavior of
connect() vs TelegramClient creation.

---

Outside diff comments:
In `@scripts/entrypoint.sh`:
- Around line 229-237: The current flow runs realpath -m on DB_PATH before you
strip SQLite URL prefixes from DATABASE_URL, so when DATABASE_URL contains a
relative path (handled by the conditions that check sqlite+aiosqlite:/// and
sqlite:///), the extracted path remains relative; move or repeat the realpath -m
normalization to occur after you handle DATABASE_URL (i.e., after the if [[
"$DATABASE_URL" == sqlite+aiosqlite:///* ]] / elif [[ "$DATABASE_URL" ==
sqlite:///* ]] blocks that set DB_PATH) so DB_PATH is always an absolute path
before the subsequent file existence check.

In `@src/db/base.py`:
- Around line 191-207: _safe_url currently reconstructs the SQLite db_path from
env vars (DATABASE_PATH/DB_PATH, DATABASE_DIR, BACKUP_PATH) but does not call
os.path.abspath, so logged path can differ from the actual connection path;
update the _safe_url method to normalize the computed db_path with
os.path.abspath() before returning (apply after determining db_path in the
SQLite branch) so the returned "sqlite+aiosqlite:///{db_path}" matches the real
absolute path used by the connection.

In `@src/telegram_backup.py`:
- Around line 136-137: The except clause uses Python 2 syntax ("except
ValueError, TypeError:") which causes a SyntaxError; update the exception
handling around the block that sets log_threshold_seconds so it uses modern
syntax — either a tuple form "except (ValueError, TypeError):" or separate
except blocks — ensuring the same fallback assignment to log_threshold_seconds =
10 is preserved and no other exceptions are swallowed.

---

Nitpick comments:
In `@src/db/migrate.py`:
- Line 91: The code only normalizes sqlite_path with os.path.abspath when
sqlite_path is None, so caller-supplied relative paths are left unnormalized;
move the os.path.abspath(sqlite_path) call out of the if-block so sqlite_path is
normalized regardless of being provided or derived, and make the same change
inside verify_migration (ensure the variable sqlite_path in both migrate-related
functions is passed through os.path.abspath immediately after determination).
Ensure you update any subsequent logic that assumes None vs str accordingly
(keep the same variable name sqlite_path).

In `@tests/test_issue_fixes.py`:
- Around line 287-297: Update the test_no_hardcoded_app_directory_writes test to
scan all source .py files instead of only telegram_backup.py and listener.py:
use the existing src_dir (Path(__file__).parent.parent / "src") and iterate over
src_dir.rglob("*.py") (or explicitly include config.py, db/base.py,
db/migrate.py, alembic/env.py) and assert that neither "APP_DIR" nor '"/app/'
appears in any file content; keep the same assertions but run them per-file so
regressions in any module are caught.
- Around line 299-306: The test
test_pythondontwritebytecode_prevents_pyc_creation is a tautology because
hasattr(sys, "dont_write_bytecode") is always True; replace it with a meaningful
assertion that inspects the project Dockerfile (or build config) to ensure
PYTHONDONTWRITEBYTECODE=1 is set (mirroring the approach used in
test_no_hardcoded_app_directory_writes), or simply remove the test; update the
test function name and body accordingly so it reads the Dockerfile content and
asserts the presence of the PYTHONDONTWRITEBYTECODE=1 directive.
- Around line 186-271: Several tests (e.g.,
test_relative_db_path_gets_resolved_to_absolute,
test_absolute_db_path_remains_unchanged,
test_relative_database_path_env_gets_resolved,
test_absolute_database_path_env_remains_unchanged,
test_default_path_is_absolute, test_relative_database_dir_gets_resolved,
test_relative_backup_path_gets_resolved) make POSIX-specific path assertions;
guard them with a platform check to avoid Windows failures by adding
`@unittest.skipUnless`(os.name == "posix", "POSIX-only path assertions") above
each test or the test class, and import os and unittest.skipUnless where tests
are defined so DatabaseManager path behavior is only asserted on POSIX
platforms.
🪄 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: b8e57e46-267a-4acb-af2f-4796758388cd

📥 Commits

Reviewing files that changed from the base of the PR and between 8a88cb1 and 2c7be23.

📒 Files selected for processing (10)
  • Dockerfile
  • alembic/env.py
  • scripts/entrypoint.sh
  • src/config.py
  • src/connection.py
  • src/db/base.py
  • src/db/migrate.py
  • src/listener.py
  • src/telegram_backup.py
  • tests/test_issue_fixes.py

Comment thread tests/test_issue_fixes.py
# ============================================================


class TestSessionPathLogging:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Make the async test classes use unittest.IsolatedAsyncioTestCase.

Per coding guidelines for tests/**/*.py ("Use unittest.TestCase with MagicMock/AsyncMock for test consistency"), and to match the rest of this file (TestRelativeDbPathResolution, TestDockerfileAssumptions). Right now these two classes are bare classes that only run because pytest-asyncio happens to collect them — they’re also using assert instead of self.assert*.

-class TestSessionPathLogging:
+class TestSessionPathLogging(unittest.IsolatedAsyncioTestCase):
...
-class TestListenerSessionPathLogging:
+class TestListenerSessionPathLogging(unittest.IsolatedAsyncioTestCase):

As per coding guidelines: "Use unittest.TestCase with MagicMock/AsyncMock for test consistency".

Also applies to: 86-86

🤖 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 `@tests/test_issue_fixes.py` at line 17, The async test class
TestSessionPathLogging (and any other bare async test classes in this file)
should inherit from unittest.IsolatedAsyncioTestCase instead of being bare
classes so asyncio tests run under unittest; update their class definition(s) to
subclass IsolatedAsyncioTestCase and convert any plain assert statements to
unittest assertions (e.g., self.assertEqual, self.assertTrue) and use
MagicMock/AsyncMock for async dependencies where applicable; adjust any async
test methods to be async def test_* methods that use await as needed.

Comment thread tests/test_issue_fixes.py Outdated
- Add DB_PATH env var check to src/config.py (was missing, causing
  inconsistency with db/base.py, alembic/env.py, and migrate.py)
- Fix entrypoint.sh to respect DB_PATH env var without overwriting
  a pre-set value, using intermediate _DB_FILE variable
- Add priority comment in entrypoint.sh documenting the fallback chain:
  DATABASE_PATH > DATABASE_DIR > DB_PATH > BACKUP_PATH/telegram_backup.db
- Remove stale unittest.main() from test_issue_fixes.py (pytest-style
  classes don't need it, and it would skip async tests)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

🐳 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

The session path log is emitted in connect(), not in the create()
factory method. Tests now properly exercise the connect() path and
mock get_db_manager + RealtimeNotifier dependencies.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🐳 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
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.06%. Comparing base (8a88cb1) to head (6cfbf6a).

Files with missing lines Patch % Lines
src/config.py 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
- Coverage   94.07%   94.06%   -0.01%     
==========================================
  Files          21       21              
  Lines        6127     6136       +9     
==========================================
+ Hits         5764     5772       +8     
- Misses        363      364       +1     
Files with missing lines Coverage Δ
src/connection.py 96.71% <100.00%> (+0.02%) ⬆️
src/db/base.py 97.93% <100.00%> (+0.01%) ⬆️
src/db/migrate.py 94.69% <100.00%> (+0.09%) ⬆️
src/listener.py 97.99% <100.00%> (+<0.01%) ⬆️
src/telegram_backup.py 96.11% <100.00%> (+<0.01%) ⬆️
src/config.py 96.12% <87.50%> (-0.32%) ⬇️
🚀 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 df663eb into main May 7, 2026
11 checks passed
@GeiserX GeiserX deleted the ai/fix-142-144 branch May 7, 2026 08:11
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.

[Bug]: mismatch between configured&reported path to db and the actual used (under /apps) Inform about opening session DB

1 participant