Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version in lockstep (enforced by `scripts/release/version_sync_check.py`).
### Changed

- **The data gap healer's 1,154-line `worker/jobs/data_gap_adapters.py` splits by role (Wave 7b).** `data_gap_heal_context.py` holds `RequestBudget`, `HealContext`, `HealSpec` and `_beat`; `data_gap_heal_runners.py` holds the `_run_*` writers, `_eventlog_heal` and `_replay_run_single_stock`; `data_gap_adapters.py` keeps only `HEAL_SPECS` and `run_refresh_adapters`; `data_gap_executor.py` holds `_verify_covered`, the dispatchers, `_verify_and_mark` and `execute_run`. Imports run one way (context ← runners ← adapters ← executor) and there is no re-export shim, so every importer now 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`. Function bodies are unchanged. No runtime behaviour changes.
- The worker scheduler's last 38 inline `add_job` sites (42 jobs) moved out of `worker/scheduler.py` into four job families under `worker/schedule/`: `vrp.py` (11), `surface.py` (8), `ops.py` (5) and `market_data.py` (14: 13 jobs plus the loop that registers the 5 UW historical-alpha captures). Each block keeps its role guard, and the scheduler-jobs golden is byte-identical for every role. `scheduler.py` goes from 1115 to 191 lines; `main()` now holds only settings, the schema gate, the failure listener, the heartbeat and start. No job, trigger or schedule changed. (Wave 7a)

## [0.13.25] — 2026-10-05

Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Worker roles: `ai-deepseek` (provider-pinned, what prod runs); legacy `ai` (clai
| API contract models | `src/uw_scan/models/` (`__init__.py` is export-only; implementations live in domain modules) |
| Persistence — aggregate shim | `src/uw_scan/storage/repository.py` (thin `Repository` assembly; exports only `Repository`, so import other names from their domain module; do not add query methods here) |
| Persistence — domain modules | `src/uw_scan/storage/{audit,cockpit,external_api,fetchers,flow,gex,gold,gold_etf,health,jobs,market_data,matrix_state,options,rates_repository,scan_outputs,scan_results,scan_runs,trade_insights_ai,volatility_raw,volatility_v2,watchlist,ws_consumer_state}.py`. New domains go in their own module/mixin and are added to `repository.py` only for assembly/re-export compatibility |
| Scheduled jobs | `src/uw_scan/worker/scheduler.py` (`main()`: settings, schema gate, listener, the jobs not yet in a family, start) + `worker/schedule/{gold,macro,regime,fundamentals,scan_core,ai}.py` (one `register(sched, settings[, *, ticker_filter])` per job family, each block keeping its role guard) + `worker/schedule/roles.py` (`_pinned`, `_owns_global_daily_jobs`, `_worker_groups`, `_is_primary_worker`, ticker sharding) + `worker/db.py` (`repo_session`, `external_api_recorder`, `uw_client`, `research_budget_ok`). Family modules never import `scheduler`. Golden of every role's jobs: `tests/unit/worker/test_scheduler_jobs_golden.py` |
| Scheduled jobs | `src/uw_scan/worker/scheduler.py` (`main()`: settings, schema gate, listener, heartbeat, start) + `worker/schedule/{gold,macro,regime,fundamentals,scan_core,ai,vrp,surface,ops,market_data}.py` (one `register(sched, settings[, *, ticker_filter])` per job family, each block keeping its role guard) + `worker/schedule/roles.py` (`_pinned`, `_owns_global_daily_jobs`, `_worker_groups`, `_is_primary_worker`, ticker sharding) + `worker/db.py` (`repo_session`, `external_api_recorder`, `uw_client`, `research_budget_ok`). Family modules never import `scheduler`. Golden of every role's jobs: `tests/unit/worker/test_scheduler_jobs_golden.py` |
| Advisory locks (single-flight jobs) | `src/uw_scan/storage/advisory_locks.py` — the one registry of lock keys (import asserts no two names resolve to the same key) + `single_flight()` (session-scoped `pg_try_advisory_lock`; a held lock means skip). Add a new key here, never a magic number in a job |
| Worker schema gate (deploy ordering) | `src/uw_scan/worker/schema_gate.py` + migration `158_schema_version.sql` — `migrate_runner` writes the last applied file into `uw_scan.schema_version` after a full apply; `scheduler.main()` waits (INFO, no job failures) until that is at least the newest migration in its own image, because Watchtower ignores `depends_on` |
| UW daily-budget governor (live/research pools, hot fast lane) | `src/uw_scan/sources/uw_budget.py` (pool split + `may_spend` + `read_snapshot`) + `worker/schedule/scan_core.py` `_live_max_tickers` + `worker/db.py` `research_budget_ok` + `worker/jobs/full_scan_hot.py` + config `uw_*_ceiling`/`full_scan_hot_*`/`gex_scan_*_interval_minutes` + migration `096` (`watchlist.hot`) + `web/components/watchlist/HotButton.tsx`; plan `docs/superpowers/plans/2026-07-04-uw-budget-scaling.md` |
Expand Down
2 changes: 1 addition & 1 deletion src/uw_scan/worker/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Files

- `scheduler.py` — `BlockingScheduler` entrypoint (`python -m uw_scan.worker.scheduler`). **The authoritative job wiring**, together with `schedule/*.py` — `jobs/` has ~73 modules; read `scheduler.py` plus the family modules for what actually runs, when, and on which worker role.
- `schedule/{gold,macro,regime,fundamentals,scan_core,ai}.py` — one job family each, registered from `scheduler.main()` via `register(sched, settings[, *, ticker_filter])`; each block keeps its role guard. `schedule/roles.py` holds the role/shard predicates and `db.py` the shared `repo_session` / `external_api_recorder` / `uw_client` / `research_budget_ok`. A family module never imports `scheduler` (circular import); the golden `tests/unit/worker/test_scheduler_jobs_golden.py` pins every role's job list.
- `schedule/{gold,macro,regime,fundamentals,scan_core,ai,vrp,surface,ops,market_data}.py` — one job family each, registered from `scheduler.main()` via `register(sched, settings[, *, ticker_filter])`; each block keeps its role guard. `schedule/roles.py` holds the role/shard predicates and `db.py` the shared `repo_session` / `external_api_recorder` / `uw_client` / `research_budget_ok`. A family module never imports `scheduler` (circular import); the golden `tests/unit/worker/test_scheduler_jobs_golden.py` pins every role's job list.
- `jobs/full_scan.py` / `jobs/ohlc_pull.py` / `jobs/rescan_loop.py` — the core scan/OHLC/rescan trio; the rest of `jobs/` is per-feature (gold, rates, regime, skew, `vrp_*`, `option_surface_*`, data_freshness/gap, `trade_insights_ai*`, …)
- `volatility_jobs.py` — `daily_spy_ohlc_refresh`, `nightly_vol_analytics_rollup` (Volatility tab v2)
- `massive_ws_consumer.py` + `ws_tick_buffer.py` + `ws_db_writer.py` — the standalone spot WS consumer process (see below)
Expand Down
Loading
Loading