"""The registry is the cockpit SSOT: every entry declares a `tier` (deploy|research) and `execution`
(paper|live). `bybit_4edge` (the risk-parity BOOK of its sleeves) is the only `deploy` entry; everything
else is `research`. All trackers are `paper` today (no live execution yet).

2026-07-16 (plan `2026-07-16-book-representation-and-venue-cap.md`, Task A): the crypto deploy target
reverts to the `bybit_4edge` BOOK — an in-cluster measurement showed the per-sleeve allocation collapses to
`positioning` alone (~18% deployed) while the diversified book deploys 75% at lower risk
(funding-stress-checked). `positioning` moves back to a research constituent (still forward-tracked as
reference); `xsfunding`/`unlock` lose `promote_on_pass` (they are book constituents, not standalone deploy
edges — must not auto-promote and double-count the book)."""
from __future__ import annotations

from fxhnt.registry import STRATEGY_REGISTRY

_DEPLOY = {"bybit_4edge"}


def test_every_entry_has_tier_and_execution() -> None:
    for sid, e in STRATEGY_REGISTRY.items():
        assert e.get("tier") in {"deploy", "research"}, f"{sid} has no valid tier"
        assert e.get("execution") in {"paper", "live"}, f"{sid} has no valid execution"


def test_deploy_tier_is_exactly_the_bybit_4edge_book() -> None:
    deploy = {sid for sid, e in STRATEGY_REGISTRY.items() if e["tier"] == "deploy"}
    assert deploy == _DEPLOY


def test_research_tier_is_everything_else() -> None:
    research = {sid for sid, e in STRATEGY_REGISTRY.items() if e["tier"] == "research"}
    assert research == set(STRATEGY_REGISTRY) - _DEPLOY
    # the canonical research trackers are all present + research-tier (positioning is now a tracked
    # constituent of the book, not a standalone deploy edge).
    for sid in ("sixtyforty", "xsfunding", "unlock", "positioning"):
        assert STRATEGY_REGISTRY[sid]["tier"] == "research"
    # xsfunding/unlock are book constituents now — must NOT auto-promote (would double-count the book).
    for sid in ("xsfunding", "unlock"):
        assert "promote_on_pass" not in STRATEGY_REGISTRY[sid]
    # xvenue_carry retired 2026-07-07 — no longer registered
    assert "xvenue_carry" not in STRATEGY_REGISTRY
    # crypto_tstrend / stablecoin_rotation (standalone Binance tracks) retired 2026-07-13, Phase 0b Task 4
    assert "crypto_tstrend" not in STRATEGY_REGISTRY
    assert "stablecoin_rotation" not in STRATEGY_REGISTRY


def test_all_trackers_are_paper_today() -> None:
    assert all(e["execution"] == "paper" for e in STRATEGY_REGISTRY.values())
