Repository navigation
refactor(healer): split data_gap_adapters.py by role (Wave 7b) - #539
Merged
Merged
Conversation
…dapters, executor (Wave 7b) data_gap_adapters.py was 1,154 lines. It now splits by role, with imports one way (context <- runners <- adapters <- executor) and no re-export shim: - data_gap_heal_context.py: RequestBudget, HealContext, HealSpec, _beat - data_gap_heal_runners.py: the _run_* writers, _eventlog_heal, _replay_run_single_stock - data_gap_adapters.py: HEAL_SPECS, run_refresh_adapters - data_gap_executor.py: _verify_covered, dispatchers, _verify_and_mark, execute_run Function bodies move unchanged. Every importer names the new home. The two test monkeypatches follow the module that looks the name up: _verify_covered on data_gap_executor, _replay_run_single_stock on data_gap_heal_runners.
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.
What
This PR splits
worker/jobs/data_gap_adapters.py(1,154 lines) into four modules by role. Imports run one way: context ← runners ← adapters ← executor. There is no re-export shim.data_gap_heal_context.pyRequestBudget,HealContext,HealSpec,_beatdata_gap_heal_runners.py_run_*writers,_recorder_hook,_uw_alpha_repo,_eventlog_heal,_replay_run_single_stockdata_gap_adapters.pyHEAL_SPECS,run_refresh_adaptersdata_gap_executor.py_verify_covered, the dispatchers,_verify_and_mark,execute_runHEAL_SPECSentries still point at the same functions, which now live indata_gap_heal_runners.src/andtests/now names the new home.worker/scheduler.pyandworker/schedule/**do not import this module and are untouched.data_gap_telemetry.pydocstring and the CHANGELOG[Unreleased]entry are updated.data_gap_heal_runners.pyis 16 lines over the 500-line target.Monkeypatch targets
Each patch now goes on the module whose globals look the name up.
tests/integration/worker/test_caveat_never_aborts_heal.pydata_gap_adapters._verify_covereddata_gap_executor._verify_covered(_verify_and_markcalls it there)tests/integration/worker/test_data_gap_adapters_replay.pydata_gap_adapters._replay_run_single_stockdata_gap_heal_runners._replay_run_single_stock(_run_pipeline_replaycalls it there)How the patches were verified:
monkeypatch.setattrdefaults toraising=True, so a patch on the wrong module raises instead of passing silently.monkeypatch.setattrline in turn and re-ran its test file. Both files fail without the patch (2 failed, and 2 failed + 1 passed), so each patch takes effect.Verification
521c4309and 110 passed on this branch. The set covers 13 integration files (tests/integration/worker/test_data_gap*, caveat, gold-posture, uw-alpha, freshness-autoheal, CLI) plustest_no_dead_adapters.py,test_data_gap_healer_specs.pyandtest_source_telemetry_wiring.py.uv run pytest tests/unit/: 3160 passed.uv run ruff check src/ tests/ scripts/: clean.ruff format --check, excepttests/integration/worker/test_data_gap_telemetry.py, which already fails it on main for an unrelated line. I left that file as it is.🤖 Generated with Claude Code