Registry: list a domain's scenarios with a version in production

This commit is contained in:
2026-11-22 20:34:38 -06:00
parent e1f388c702
commit ccaa6fca12
2 changed files with 22 additions and 1 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
"""What this module covers: the registry's promotion checks, promotion and retirement, the lineage of a version, and
"""What this module covers: the registry's promotion checks, promotion and retirement, the scenarios in production, the lineage of a version, and
what its run stored (`registry.artifacts`, `registry.artifact`, `registry.routines`).
Fixtures: `production_ready` (from `conftest.py`), a PROD version whose run recorded every routine and its model;
@@ -108,6 +108,19 @@ def test_retire_and_lineage(production_ready):
registry.retire(domain, scenario, second)
def test_in_production_lists_the_scenarios_holding_the_alias(production_ready):
"""Only scenarios of the domain with a version in production are listed; a candidate or a retired one is not.
Fails if `in_production` stops reading the `produccion` alias or leaks another domain's models."""
domain, scenario, version = production_ready("v1")
production_ready("v1-dx", scenario="diagnostico")
assert registry.in_production(domain) == []
registry.promote(domain, scenario, version)
assert registry.in_production(domain) == [scenario]
assert registry.in_production("cama") == []
registry.retire(domain, scenario, version)
assert registry.in_production(domain) == []
@pytest.mark.parametrize("domain, scenario", [("cacu' OR '1'='1", None), ("cacu", "x' OR name LIKE '%")])
def test_version_filters_reject_anything_but_known_names(mlflow_tracking, domain, scenario):
with pytest.raises(ValueError):