"""Reproduction: Stale ERROR_CODES registry in test_schemas.py.

Expected: test_error_codes_registry_complete should enumerate ALL error codes
          registered in ERROR_CODES, including the 5 new codes added after
          the test was written (314, 315, 321, 322, 323).
Actual:   The test's expected_codes dict is missing 5 entries that exist in
          the actual ERROR_CODES registry, causing an AssertionError.
"""
from anima.core.schemas import ERROR_CODES


def test_error_codes_registry_has_new_codes():
    """ERROR_CODES registry contains codes 314, 315, 321, 322, 323."""
    # These codes exist in the actual registry but the test
    # test_error_codes_registry_complete is missing them.
    new_codes = {314, 315, 321, 322, 323}
    missing_from_test = new_codes - {
        # These are the codes the test currently expects:
        1, 2, 3, 10, 300, 301, 310, 311, 312, 313, 320,
    }

    # The test's expected set is stale -- it doesn't include the new codes
    assert missing_from_test, (
        "Expected the test's hardcoded set to be missing new codes, "
        "but all new codes are accounted for. Fix may already be applied."
    )

    # Verify the new codes actually exist in the registry
    for code in new_codes:
        assert code in ERROR_CODES, (
            f"Error code {code} not found in ERROR_CODES registry. "
            f"Available codes: {sorted(ERROR_CODES.keys())}"
        )

    print(f"Confirmed: ERROR_CODES has {len(ERROR_CODES)} entries")
    print(f"Test only expects 11, missing: {sorted(missing_from_test)}")


if __name__ == "__main__":
    test_error_codes_registry_has_new_codes()
    print("PASS: Issue confirmed -- test is stale and needs updating")
