Slice 104: GitHub Source Runtime Boundaries
Scope#
Split integrations/sources/github/adapter.py into focused GitHub runtime
modules without changing public behavior:
adapter.pystays theSourceRuntimeAdapterimplementation and dispatches pull-request versus issue inspection.client.pyownsghcommand execution, timeout/error conversion, JSON parsing, and typed payload retrieval.models.pyowns Pydantic models forgh --jsonpayloads.rendering.pyowns prompt-facing source-runtime text and titles.targets.pyownsSourceReftoghtarget argument policy.errors.pyowns unavailable-runtime diagnostics.
Out Of Scope#
- No GitHub API feature changes.
- No new GitHub source kinds.
- No move from
ghCLI to native GitHub API or MCP. - No source-address parser changes.
Design Notes#
The GitHub adapter reached 413 lines and mixes payload models, process execution, target argument policy, error shaping, source inspection flow, and prompt rendering. This is the same integration-boundary pressure that slice 96 fixed for filesystem runtime.
Cosmic Python's service-layer chapter frames ports and adapters as explicit
runtime dependencies: services depend on the port and the real app swaps in the
adapter (docs/reference/cosmic-python/chapter_04_service_layer.md). Here the
service-owned port remains SourceRuntimeAdapter; the split is inside the
concrete GitHub adapter.
Files#
src/codealmanac/integrations/sources/github/adapter.pysrc/codealmanac/integrations/sources/github/client.pysrc/codealmanac/integrations/sources/github/models.pysrc/codealmanac/integrations/sources/github/rendering.pysrc/codealmanac/integrations/sources/github/targets.pysrc/codealmanac/integrations/sources/github/errors.pytests/test_architecture.pydocs/python-port-live-agreement.mddocs/python-port/ownership-map.mddocs/python-port/idea-evolution.mddocs/python-port/next-agent-brief.mddocs/python-port/verification-matrix.mddocs/python-port/worklog.md
Tests#
- Focused GitHub runtime tests.
- Focused ingest GitHub-source test.
- Architecture guard preventing payload models, process execution, and
rendering helpers from returning to
adapter.py. - Fake-runner dogfood through
GitHubSourceRuntimeAdapter. - Full
uv run pytest. - Full
uv run ruff check ..