Repository navigation
refactor(worker): scheduler jobs split into vrp/surface/ops/market_data families (Wave 7a) - #540
Merged
Merged
Conversation
added 7 commits
October 5, 2026 11:55
Pure move of the 11 VRP add_job blocks, their main()-local wrappers and _should_schedule_vrp_macro_entry out of scheduler.main(). Each block keeps its guard (massive-0 primary, the entry-capture pin, the global daily owner). Tests that imported or patched the moved names now point at schedule.vrp.
… (Wave 7a) Pure move of the 8 surface add_job blocks (vol + skew rollups, skew markout, skew swing greeks, option-surface capture, research capture + catch-up, IV canary), their wrappers and the option-surface / skew-swing predicates. Each block keeps its guard. _should_schedule_option_surface_capture stays importable from scheduler for tests/unit/test_scheduler_option_surface_gate.py.
Pure move of the 5 ops add_job blocks (data freshness monitor, pipeline benchmark, record-health snapshot, mcp_event retention, data gap healer), their wrappers and the benchmark / healer / mcp-retention predicates. Each block keeps its guard. _should_schedule_data_gap_healer stays importable from scheduler for tests/integration/worker/test_data_gap_healer_scheduler.py.
…y family (Wave 7a) Pure move of the last 14 add_job blocks (SPY OHLC, technicals daily + live, corporate actions, greek exposure, cockpit snapshot, UW-alpha captures, sector RS, release calendar, volatility backfill tick, SPX density, Theta Harvester scan + markout, trade-insight outcome backfill), their wrappers and the uw-alpha / sector-RS predicates. Each block keeps its guard. main() now holds only settings, the schema gate, the listener, the heartbeat and start. The telemetry test patches the two moved wrappers in their new module.
Blank lines only: collapses the gaps the moved blocks left in main().
…rom their family Both tests only call the predicates, so importing from schedule.surface / schedule.ops is the same check. worker/CLAUDE.md lists the four new families.
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
Wave 7a of the architecture remediation plan: the last 38 inline
add_jobsites (42 jobs) leaveworker/scheduler.pyfor four new job families underworker/schedule/. All four use the existing family shape,register(sched, settings).vrp.py(216 lines)_should_schedule_vrp_macro_entrysurface.py(265)_should_schedule_option_surface_capture,_should_schedule_skew_swing_greeksops.py(137)_should_schedule_pipeline_benchmark,_should_schedule_data_gap_healer,_should_schedule_mcp_event_retentionmarket_data.py(450)_should_schedule_uw_alpha_capture,_should_schedule_sector_rs_dailyscheduler.pygoes from 1115 to 191 lines.main()now holds only settings, the schema gate, the listener, the heartbeat and start.How the move was done: a script copied each block's lines verbatim, with the same indentation and the same nesting of role guards. It also kept wrapper names and kept lazy imports inside the wrappers. Only unused imports were pruned (ruff F401 --fix). The commits are one per family (pure moves), plus one format-only commit (blank lines in
scheduler.py) and one docs commit (the CLAUDE.md "Scheduled jobs" row and CHANGELOG[Unreleased], both bullets kept after rebasing onto #539).Acceptance
tests/unit/worker/test_scheduler_jobs_golden.pyand its fixture are byte-identical to main (git diff --quiet origin/mainon both), and every role passes.test_source_telemetry_wiring.pypasses.uv run pytest tests/unit/: 3160 passed.uv run ruff check src/ tests/ scripts/: clean.Test retargets (import and monkeypatch targets only)
test_source_telemetry_wiring.py: the release-calendar and technical-live cases now patch_external_api_recorder,_repo,_uw_clientanddatetimeonschedule.market_data. Before this change those patches would have missed silently.test_scheduler.py: three predicates are now imported from their new modules (ops,surface,roles).test_vrp_macro_entry_schedule.py: the predicate is imported fromschedule.vrp.tests/integration/worker/test_vrp_research_jobs.py:_repois patched onschedule.vrp. Without this, the patch would miss and the job would open its own connection.Notes
scheduler.py: two compatibility re-exports stay, for importers outside this wave's files._should_schedule_data_gap_healeris imported bytests/integration/worker/test_data_gap_healer_scheduler.py, a data_gap_* file that belongs to another lane._should_schedule_option_surface_captureis imported bytests/unit/test_scheduler_option_surface_gate.py._repoalso stays, because the heartbeat, 3 research scripts andtest_macro_state_jobsuse it.uw_scan.worker.src/uw_scan/worker/CLAUDE.mdstill lists only the old six families. That file was outside this wave's files.option_wizard_test_sched7adoes not exist locally, so CI covers the integration tests.🤖 Generated with Claude Code