fix(decisions): count a state nested past the depth limit as no text, so its byte drops keep main's error

This commit is contained in:
mateo-berri 2026-10-30 17:50:44 -07:00
parent 45d80099a8
commit 691b35c5f5
2 changed files with 4 additions and 4 deletions

View file

@ -262,7 +262,7 @@ def _holds_no_text(value: object, depth: int = 0) -> bool:
if isinstance(value, str):
return not value.strip()
if depth >= DEFAULT_MAX_RECURSE_DEPTH:
return False
return True
if _is_json_object(value):
return all(_holds_no_text(item, depth + 1) for name, item in value.items() if name != "type")
if _is_json_array(value):

View file

@ -489,7 +489,7 @@ def _nested_once(inner: object, _: int) -> object:
return [inner]
def test_input_has_no_text_stops_walking_a_state_nested_past_the_stack() -> None:
deepest_state: Final = reduce(_nested_once, range(sys.getrecursionlimit() * 2), "")
def test_input_has_no_text_counts_a_state_nested_past_the_stack_as_no_text() -> None:
deepest_state: Final = reduce(_nested_once, range(sys.getrecursionlimit() * 2), "Product photo")
assert input_has_no_text(DecisionsIRState(state=deepest_state, images=())) is False
assert input_has_no_text(DecisionsIRState(state=deepest_state, images=())) is True