"""The Positioning forward-tracked edge is registered with the right gate_spec and survives `_seed_registry`
(no prune). xvenue_carry was RETIRED 2026-07-07 (validated-but-not-live) — assert it is gone."""
from __future__ import annotations

from fxhnt.adapters.persistence.forward_nav import ForwardNavRepo
from fxhnt.registry import STRATEGY_REGISTRY

_GATE = {"gate_type": "reconciliation", "min_forward_days": 14}


def test_positioning_registered() -> None:
    e = STRATEGY_REGISTRY["positioning"]
    assert e["sleeve"] == "crypto-bybit"
    assert e["venue"] == "bybit-perp"
    assert e["gate_spec"] == _GATE


def test_xvenue_carry_retired() -> None:
    # Retired from forward-tracking 2026-07-07: validated-but-not-live, ~0 contribution. The
    # cross_venue_carry_eval research lib + deribit_funding_bars ingestion are kept, but the registered
    # forward track is gone so it no longer seeds a tracker or clutters the gate/cockpit.
    assert "xvenue_carry" not in STRATEGY_REGISTRY


def test_seed_registry_keeps_positioning_prunes_xvenue() -> None:
    """`_seed_registry` prunes UNKNOWN strategies; positioning is in the registry (survives), xvenue_carry
    was retired (must NOT be seeded)."""
    repo = ForwardNavRepo("sqlite://")
    repo.migrate()
    ids = {r.strategy_id for r in repo.registry()}
    assert "positioning" in ids
    assert "xvenue_carry" not in ids
    # the pre-existing book track is untouched (no accidental prune).
    assert "bybit_4edge" in ids
