Skip to content

Add CROSSREF_MODE=local support via LocalCrossrefAdapter#1095

Merged
florath merged 2 commits intomainfrom
feature/crossref-local-mode
Mar 16, 2026
Merged

Add CROSSREF_MODE=local support via LocalCrossrefAdapter#1095
florath merged 2 commits intomainfrom
feature/crossref-local-mode

Conversation

@coding-ai-assistant
Copy link
Contributor

Summary

  • Extracts _CrossrefHttpClient wrapping the existing aiohttp logic
  • Adds create_crossref_client() factory: returns LocalCrossrefAdapter when CROSSREF_MODE=local, otherwise the live HTTP client
  • _search_by_issn() delegates to the factory instead of calling _get_journal_by_issn() directly
  • aletheia-crossref-adapter is optional; a clear ImportError is raised if CROSSREF_MODE=local but the package is not installed

Installation

pip install -e aletheia-probe-crossref-platform/provider/
pip install -e aletheia-probe-crossref-platform/adapter/

Usage

CROSSREF_MODE=local \
CROSSREF_PGHOST=crossref-platform-postgres.aletheia-probe-crossref-platform.svc.cluster.local \
CROSSREF_PGPASSWORD=<password> \
aletheia-probe evaluate ...

Test plan

  • Existing tests/unit/backends/test_crossref_analyzer.py passes (remote mode unchanged)
  • CROSSREF_MODE=local routes through LocalCrossrefAdapter
  • CROSSREF_MODE=local without adapter installed raises clear ImportError

florath added 2 commits March 16, 2026 16:08
- Extract _CrossrefHttpClient wrapping the existing aiohttp logic
- Add module-level create_crossref_client() factory: returns
  LocalCrossrefAdapter when CROSSREF_MODE=local, otherwise the HTTP client
- _search_by_issn() now delegates to the factory instead of calling
  _get_journal_by_issn() directly
- aletheia-crossref-adapter is an optional dependency; ImportError is
  raised with a clear message if CROSSREF_MODE=local but the package
  is not installed
- Add dict[str, str] type params to _CrossrefHttpClient.__init__ headers
- Add return type annotation to create_crossref_client factory function
- Add explicit result type annotation to suppress no-any-return error
- Add mypy ignore_missing_imports override for aletheia_crossref_adapter
@florath florath merged commit 62629a8 into main Mar 16, 2026
21 checks passed
@florath florath deleted the feature/crossref-local-mode branch March 16, 2026 16:47
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.

1 participant