Skip to content

refactor(b09): bind trend universe to RunContext during execute_cycle - #359

Merged
Pigbibi merged 1 commit into
mainfrom
codex/b09-binance-runcontext-universe
Oct 9, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
codex/b09-binance-runcontext-universe

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

B09 PR-1 (mechanical): move cycle-scoped TREND_UNIVERSE mutations onto RunContext / ContextVar so module globals are not rewritten across execute_cycle runs.

  • Add run_context.py (RunContext, bind/reset/resolve/set).
  • execute_cycle binds a per-cycle universe copy; finally only resets ContextVar (no module restore write).
  • Wrappers read via resolve_trend_universe(TREND_UNIVERSE); unbound path keeps module fallback.
  • ExecutionRuntime.run_context field only — no changes to SUBMISSION_* / release_runtime_state_owner / runtime_call_client.
  • STRATEGY_RUNTIME activation left for B09 PR-2 (documented in plan).

Does not touch LB-HK / Firstrade.

Plan: workspace qsl-arch-next-01/B09-binance-runcontext-plan.md.

Test plan

  • python -m unittest tests.test_run_context -v
  • tests.test_state_service / test_trend_pool_loading / test_cycle_service / test_runtime_support
  • CI green

Move cycle-scoped TREND_UNIVERSE mutations onto RunContext/ContextVar so
module globals are not rewritten across cycles. Keep unbound fallback for
compat. Do not change STRATEGY_RUNTIME activation or submission/owner rules.
@Pigbibi
Pigbibi merged commit 9d4c75d into main Oct 9, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/b09-binance-runcontext-universe branch October 9, 2026 08:55
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.

1 participant