fix: add missing db stubs for src.database re-exports in test_security_regressions #927

Closed
sleepy wants to merge 0 commits from fix/security-regression-db-stub into dev
Owner

The _stub_core_database_for_route_imports helper only stubbed 7 core.database attributes, but src.database re-exports many more symbols. When chat_handler does from src.database import update_session_last_accessed, it failed because the stub was incomplete.

Changes:

  • Added all missing attributes to the core.database stub (update_session_last_accessed, get_session_by_id, archive_session, init_db, etc.)
  • Also stub src.database in sys.modules so re-exports resolve against the mock

Test-only fix — no source code changes.

The `_stub_core_database_for_route_imports` helper only stubbed 7 `core.database` attributes, but `src.database` re-exports many more symbols. When `chat_handler` does `from src.database import update_session_last_accessed`, it failed because the stub was incomplete. Changes: - Added all missing attributes to the `core.database` stub (update_session_last_accessed, get_session_by_id, archive_session, init_db, etc.) - Also stub `src.database` in sys.modules so re-exports resolve against the mock Test-only fix — no source code changes.
The _stub_core_database_for_route_imports helper only included 7 core.database
attributes, but src.database re-exports many more symbols. When chat_handler
does 'from src.database import update_session_last_accessed', it failed because
the stub was incomplete.

- Add all missing attributes to the core.database stub
- Also stub src.database so re-exports resolve against the mock
sleepy closed this pull request 2026-06-04 13:24:53 +02:00
Author
Owner

Merged to dev (commit 7d357b4). Test-only change — extends the db stub in _stub_core_database_for_route_imports with additional model/function stubs and a src.database module alias. All 66 security regression tests pass; full suite: 1120 passed, 9 pre-existing failures (unchanged).

**Merged to dev** (commit 7d357b4). Test-only change — extends the db stub in `_stub_core_database_for_route_imports` with additional model/function stubs and a `src.database` module alias. All 66 security regression tests pass; full suite: 1120 passed, 9 pre-existing failures (unchanged).

Pull request closed

Sign in to join this conversation.
No description provided.