Skip to content

refactor(sources): split acquisition components (#371) - #371

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/source-acquisition-components
Apr 23, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/source-acquisition-components

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026

Copy link
Copy Markdown
Owner

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

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
@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 6 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 18f840f2-cbda-41a4-bbbc-397a8e440499

📥 Commits

Reviewing files that changed from the base of the PR and between eea7f11 and 7d2fa6d.

📒 Files selected for processing (3)
  • polylogue/sources/source_acquisition.py
  • polylogue/sources/source_acquisition_components.py
  • tests/unit/sources/test_source_laws.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/source-acquisition-components

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity Sinity changed the title refactor(sources): split acquisition components refactor(sources): split acquisition components (#371) Apr 23, 2026
@Sinity
Sinity merged commit 9018e64 into master Apr 23, 2026
10 of 13 checks passed
@Sinity
Sinity deleted the feature/refactor/source-acquisition-components branch April 23, 2026 00:04
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@Sinity
Sinity requested a review from Copilot May 1, 2026 01:54
@Sinity
Sinity removed the request for review from Copilot May 1, 2026 02:15
Sinity added a commit that referenced this pull request May 7, 2026
## 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
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.

refactor: split source acquisition into explicit components

1 participant