Skip to content

refactor(adapters): extract JobBoardPort Protocol from JobBoardAdapter ABC#2

Merged
grimlor merged 2 commits into
mainfrom
refactor/job-board-port-protocol
May 12, 2026
Merged

refactor(adapters): extract JobBoardPort Protocol from JobBoardAdapter ABC#2
grimlor merged 2 commits into
mainfrom
refactor/job-board-port-protocol

Conversation

@grimlor

@grimlor grimlor commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary

Introduce a @runtime_checkable JobBoardPort Protocol in ports.py as the structural type boundary for job board integrations. Callers (registry, session throttle, test fixtures) now depend on the Protocol rather than the concrete ABC.

JobBoardAdapter ABC is retained as a convenience base class providing default rate_limit_seconds and kwargs-tolerant __init__. Concrete adapters continue inheriting it unchanged.

Changes

  • Create src/jobsearch_rag/adapters/ports.py with JobBoardPort Protocol
  • Update AdapterRegistry TypeVar bound, dict type, and return type
  • Replace type: ignore pragma with cast() in registry.register()
  • Update throttle() parameter type in session.py
  • Export JobBoardPort from adapters __init__.py
  • Update test type annotations and isinstance checks
  • Use Mapping for adapter_override factories parameter (covariance)

Verification

  • Full test suite (965 tests) passing
  • Pyright: 0 errors
  • Ruff: all checks passed

…r ABC

Introduce a @runtime_checkable JobBoardPort Protocol in ports.py as the
structural type boundary for job board integrations. Callers (registry,
session throttle, test fixtures) now depend on the Protocol rather than
the concrete ABC.

JobBoardAdapter ABC is retained as a convenience base class providing
default rate_limit_seconds and kwargs-tolerant __init__. Concrete
adapters continue inheriting it unchanged.

- Create src/jobsearch_rag/adapters/ports.py with JobBoardPort Protocol
- Update AdapterRegistry TypeVar bound, dict type, and return type
- Replace type: ignore pragma with cast in registry.register()
- Update throttle() parameter type in session.py
- Export JobBoardPort from adapters __init__.py
- Update test type annotations and isinstance checks
- Use Mapping for adapter_override factories parameter (covariance)
@grimlor grimlor self-assigned this May 11, 2026
@grimlor grimlor closed this in #4 May 12, 2026
@grimlor grimlor reopened this May 12, 2026
@grimlor
grimlor merged commit a166ae3 into main May 12, 2026
12 checks passed
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