fix(scenario): orthogonal review hardening — binding fingerprint guard, strict image digest, typed publisher errors, T029m human-loop closure

This commit is contained in:
2026-09-11 10:10:01 +03:00
parent 1d48625b10
commit 1411c03f9b
19 changed files with 401 additions and 31 deletions

View File

@@ -161,5 +161,27 @@ def test_main_publishes_end_to_end_with_fake_client(monkeypatch, tmp_path):
assert code == 0
assert seen["kwargs"]["base_url"] == "http://gitea.test"
assert seen["kwargs"]["headers"] == {"Authorization": "token token-value"}
def test_main_types_transport_errors(monkeypatch, tmp_path, capsys):
import httpx
import src.scripts.publish_catalog as module
catalog_file = tmp_path / "catalog.json"
catalog_file.write_bytes(_RAW)
monkeypatch.setenv("PUBLISHED_CATALOG_GITEA_URL", "http://gitea.test")
monkeypatch.setenv("PUBLISHED_CATALOG_GITEA_TOKEN", "token-value")
monkeypatch.setenv("PUBLISHED_CATALOG_GITEA_REPO", "o/r")
class _BoomClient(_FakeClient):
def __init__(self, **kwargs) -> None:
super().__init__(_FakeResponse(404), _FakeResponse(201, {}))
def get(self, url, params=None):
raise httpx.ConnectError("boom")
monkeypatch.setattr(module.httpx, "Client", lambda **kwargs: _BoomClient(**kwargs))
code = main(["--catalog", str(catalog_file), "--baseline-set", "ss-prod-visual", "--version", "1"])
assert code == 1
assert "PUBLISH_UNAVAILABLE" in capsys.readouterr().out
# #endregion Test.Tooling.PublishCatalog.Main
# #endregion Test.Tooling.PublishCatalog