Repository navigation
refactor(sources): split acquisition components (#371) - #371
Conversation
Problem: source_acquisition mixed source walking with local file streaming, ZIP entry handling, split payload buffering, provider detection, and observation payload construction. What changed: add typed source acquisition components for normal files, ZIP entries, detected payloads, and split payload buffering while keeping iter_source_raw_data as the compatibility entrypoint for walking, cursor failure recording, and summary logging. Verification: ruff check polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.py tests/unit/sources/test_source_laws.py; mypy polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.py; pytest -q tests/unit/sources/test_source_laws.py; pytest -q tests/unit/pipeline/test_run_sources.py tests/unit/sources/test_source_laws.py. Ref #324
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 6 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
## Summary Splits local source acquisition into typed components for plain files, ZIP entries, split payloads, provider detection, blob streaming, and acquisition observations while preserving `iter_source_raw_data()` as the compatibility entrypoint. ## Problem Closes #324. `polylogue/sources/source_acquisition.py` mixed source walking with local file streaming, ZIP entry handling, split-payload buffering, provider detection, blob-store metadata construction, status heartbeats, observation payloads, cursor failures, and final iteration summaries. That made the local acquisition path difficult to reason about and risky to extend. ## Solution - Added `polylogue/sources/source_acquisition_components.py` with typed contexts for normal files and ZIP entries, detected payload records, serialized split-payload records, and a `SplitPayloadBuffer`. - Moved status heartbeat generation, acquisition observation payload construction, blob streaming, raw metadata construction, plain-file acquisition, ZIP preserved-entry acquisition, streamed JSON provider detection, and ZIP split materialization into the component layer. - Kept `polylogue.sources.source_acquisition.iter_source_raw_data()` as the stable entrypoint; it now focuses on source walking, zero-byte cursor failure recording, top-level read exception handling, and summary logging. - Updated source-law monkeypatch targets to the new component module and added direct coverage for the split-payload buffer boundary. ## Verification - `ruff check polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.py tests/unit/sources/test_source_laws.py` - `mypy polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.py` - `pytest -q tests/unit/sources/test_source_laws.py` -> `112 passed in 10.33s` - `pytest -q tests/unit/pipeline/test_run_sources.py tests/unit/sources/test_source_laws.py` -> `160 passed in 9.59s` - `devtools verify` -> all checks passed - `git push -u origin feature/refactor/source-acquisition-components` -> pre-push `devtools verify --quick` all checks passed
Summary
Splits local source acquisition into typed components for plain files, ZIP entries, split payloads, provider detection, blob streaming, and acquisition observations while preserving
iter_source_raw_data()as the compatibility entrypoint.Problem
Closes #324.
polylogue/sources/source_acquisition.pymixed source walking with local file streaming, ZIP entry handling, split-payload buffering, provider detection, blob-store metadata construction, status heartbeats, observation payloads, cursor failures, and final iteration summaries. That made the local acquisition path difficult to reason about and risky to extend.Solution
polylogue/sources/source_acquisition_components.pywith typed contexts for normal files and ZIP entries, detected payload records, serialized split-payload records, and aSplitPayloadBuffer.polylogue.sources.source_acquisition.iter_source_raw_data()as the stable entrypoint; it now focuses on source walking, zero-byte cursor failure recording, top-level read exception handling, and summary logging.Verification
ruff check polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.py tests/unit/sources/test_source_laws.pymypy polylogue/sources/source_acquisition.py polylogue/sources/source_acquisition_components.pypytest -q tests/unit/sources/test_source_laws.py->112 passed in 10.33spytest -q tests/unit/pipeline/test_run_sources.py tests/unit/sources/test_source_laws.py->160 passed in 9.59sdevtools verify-> all checks passedgit push -u origin feature/refactor/source-acquisition-components-> pre-pushdevtools verify --quickall checks passed