Files
fxhnt/tests/unit/test_forward_definition.py
jgrusewski a7533980da feat(forward): wire combined through the engine (recompute); drop track-level killswitch
combined_forward_nav now runs CombinedBookStrategy through forward_engine.run_track (DB anchor +
recompute) — the last track off the JSON ForwardTracker. The former ForwardTracker-level drawdown
killswitch overlay is intentionally dropped (a track throttle, not part of the edge; vestigial
research track, not capital). record_mode observed->recompute (version 2) -> clean re-inception.
Removes now-unused build_combined_forward_nav / CombinedBookForwardTracker registration in
migration_builders.py + the test_orchestration_assets.py test (its only exerciser). Also drops the
"combined" entry from the one-time migrate-forward-anchors builder map (record_mode is now
recompute, so the observed lambda:None placeholder would crash it; combined re-inceptions cleanly
through run_track with no JSON left to migrate).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 09:38:24 +02:00

30 lines
1.1 KiB
Python

from fxhnt.application.forward_definition import definition_hash, track_definition
from fxhnt.registry import STRATEGY_REGISTRY
def test_hash_is_stable_under_key_reordering():
assert definition_hash({"a": 1, "b": 2}, 1) == definition_hash({"b": 2, "a": 1}, 1)
def test_hash_changes_when_a_param_changes():
# the BTC-drop case: instruments 6 -> 5 must change the hash
six = definition_hash({"instruments": ["SPY", "IEF", "GLD", "PDBC", "DBMF", "BTC-USD"]}, 1)
five = definition_hash({"instruments": ["SPY", "IEF", "GLD", "PDBC", "DBMF"]}, 1)
assert six != five
def test_hash_changes_when_version_bumps():
assert definition_hash({"a": 1}, 1) != definition_hash({"a": 1}, 2)
def test_every_active_track_declares_a_definition():
for sid in STRATEGY_REGISTRY:
params, version, mode = track_definition(sid)
assert isinstance(params, dict) and isinstance(version, int)
assert mode in ("recompute", "observed")
def test_observed_mode_is_exactly_xsfunding():
observed = {sid for sid in STRATEGY_REGISTRY if track_definition(sid)[2] == "observed"}
assert observed == {"xsfunding"}