fix(intern-decision-serve): 0.1.2 treats empty/null images as absent

Audit finding on 0.1.1: a Jev client that always sends an images array with no
images was rejected for nothing. Only a non-empty value is 422 now. Also aligns
the contract's response example with the wire (model is the name@revision
string, not an object).

Re-accepted live: images []/null -> 200, ["a.png"] -> 422; JevBench all 202/231,
hard 83/111, 0 changed rows across the bench's r1..r4 (924).
This commit is contained in:
vh
2026-09-30 13:04:31 -07:00
parent da50696fe8
commit 1866c003e8
14 changed files with 2893 additions and 11 deletions
@@ -109,8 +109,8 @@ def test_without_the_right_bearer_a_systemone_post_is_401_and_never_reaches_the_
assert engine.calls == []
@pytest.mark.parametrize("images", [["a.png"], [], "a.png"])
def test_images_any_value_at_all_is_422_before_the_engine_runs(images):
@pytest.mark.parametrize("images", [["a.png"], ["a.png", "b.png"], "a.png", {"a": "b"}, 7])
def test_a_nonempty_images_value_is_422_before_the_engine_runs(images):
engine = FakeEngine()
response = make_client(engine).post("/v1/systemone", json=body(images=images), headers=AUTH)
assert response.status_code == 422
@@ -119,6 +119,16 @@ def test_images_any_value_at_all_is_422_before_the_engine_runs(images):
assert engine.calls == []
@pytest.mark.parametrize("images", [[], None])
def test_an_empty_or_null_images_field_counts_as_absent(images):
"""Audit finding 2026-09-30: a Jev client that always sends the field with no images
must not be rejected for nothing."""
engine = FakeEngine()
response = make_client(engine).post("/v1/systemone", json=body(images=images), headers=AUTH)
assert response.status_code == 200
assert engine.calls == [{"state": "The deploy finished at 14:00.", "questions": {"decision": CHOICE}}]
def test_17_questions_is_422_not_a_chunked_2_call_request():
engine = FakeEngine()
questions = {f"q{i}": NOUL for i in range(17)}