Fix governed runtime model registration
This commit is contained in:
@@ -135,3 +135,31 @@ def test_generated_sidecar_passes_exact_runtime_contract(tmp_path: Path) -> None
|
||||
assert validated.model_sha256 == evidence["checksums"]["model"]
|
||||
assert validated.runtime_manifest_sha256 == payload["metadata"]["runtime_manifest_sha256"]
|
||||
assert module._write_manifest_atomically(manifest_path, payload) is False
|
||||
|
||||
|
||||
def test_model_registry_definition_is_runtime_ready_without_mutating_server_owned_row() -> None:
|
||||
from app.services.source_registry_service import SourceRegistryService
|
||||
|
||||
definition = SourceRegistryService.definition_for("model")
|
||||
|
||||
assert definition.ingest_status == "configured"
|
||||
assert definition.freshness_status == "current"
|
||||
script = SCRIPT.read_text(encoding="utf-8")
|
||||
assert 'source.ingest_status = "configured"' not in script
|
||||
assert 'source.freshness_status = "current"' not in script
|
||||
|
||||
|
||||
def test_model_registry_status_migration_is_narrow_and_restores_write_guard() -> None:
|
||||
migration = (
|
||||
ROOT
|
||||
/ "backend"
|
||||
/ "alembic"
|
||||
/ "versions"
|
||||
/ "202608230001_configure_model_source_registry.py"
|
||||
).read_text(encoding="utf-8")
|
||||
|
||||
assert "WHERE source_key = 'model'" in migration
|
||||
assert "registry_owner' = 'server'" in migration
|
||||
assert migration.count("DISABLE TRIGGER trg_source_registry_write_guard") == 1
|
||||
assert migration.count("ENABLE TRIGGER trg_source_registry_write_guard") == 1
|
||||
assert 'down_revision = "202608010001"' in migration
|
||||
|
||||
Reference in New Issue
Block a user