refactor(adapters): extract JobBoardPort Protocol from JobBoardAdapter ABC#2
Merged
Merged
Conversation
…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)
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduce a
@runtime_checkableJobBoardPortProtocol inports.pyas the structural type boundary for job board integrations. Callers (registry, session throttle, test fixtures) now depend on the Protocol rather than the concrete ABC.JobBoardAdapterABC is retained as a convenience base class providing defaultrate_limit_secondsand kwargs-tolerant__init__. Concrete adapters continue inheriting it unchanged.Changes
src/jobsearch_rag/adapters/ports.pywithJobBoardPortProtocolAdapterRegistryTypeVar bound, dict type, and return typetype: ignorepragma withcast()inregistry.register()throttle()parameter type insession.pyJobBoardPortfrom adapters__init__.pyMappingforadapter_overridefactories parameter (covariance)Verification