fix: resolve mypy errors, fix arxiv test session isolation, and add premerge script

- Remove unused type:ignore comment in scholars.py
- Fix 51 mypy errors across test files (Any return types, cast(), protocol stubs)
- Fix arxiv unit test failures caused by session isolation (patch_session_factory fixture)
- Fix integration test rate-limit bleed between search and create
- Add scripts/premerge.sh for local CI verification
- Add docs/website/.docusaurus/ to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Justin Visser 2026-03-02 12:46:10 +01:00
parent 49cf7034b2
commit 87aa89b58c
17 changed files with 129 additions and 28 deletions

View file

@ -1,4 +1,5 @@
from types import SimpleNamespace
from typing import Any, cast
import pytest
@ -42,9 +43,9 @@ async def test_create_hydration_skips_when_global_throttle_active(
)
result = await scholar_helpers.hydrate_scholar_metadata_if_needed(
db_session=None,
db_session=cast(Any, None),
profile=profile,
source=object(),
source=cast(Any, object()),
user_id=7,
)
@ -77,9 +78,9 @@ async def test_create_hydration_runs_when_throttle_is_clear(
)
result = await scholar_helpers.hydrate_scholar_metadata_if_needed(
db_session=None,
db_session=cast(Any, None),
profile=profile,
source=object(),
source=cast(Any, object()),
user_id=8,
)
@ -109,7 +110,7 @@ async def test_initial_scrape_job_enqueued_on_create(
)
queued = await scholar_helpers.enqueue_initial_scrape_job_for_scholar(
session,
cast(Any, session),
profile=profile,
user_id=9,
)
@ -134,7 +135,7 @@ async def test_initial_scrape_job_not_enqueued_when_disabled(
)
queued = await scholar_helpers.enqueue_initial_scrape_job_for_scholar(
session,
cast(Any, session),
profile=profile,
user_id=11,
)