Skip to content

Commit da26fe4

Browse files
committed
test(gooddata-eval): cover multi-run reasoning_steps retention
Addresses CodeRabbit nitpick on PR #1708: a later run returning no reasoning events must not clobber an earlier run's captured steps (runner.py:120's `or` pattern, same as conversation_id/response_id).
1 parent 389905b commit da26fe4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/gooddata-eval/tests/test_runner.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,22 @@ def test_run_items_reasoning_steps_empty_when_chat_result_has_none():
277277
assert report.items[0].reasoning_steps == []
278278

279279

280+
def test_run_items_reasoning_steps_keeps_earlier_run_when_later_run_is_empty():
281+
"""A later run with no reasoning events must not clobber an earlier run's steps (runner.py:120's `or`)."""
282+
283+
class _MixedReasoningBackend:
284+
def __init__(self):
285+
self.calls = 0
286+
287+
def ask(self, item: DatasetItem) -> ChatResult:
288+
self.calls += 1
289+
steps = ["step one", "step two"] if self.calls == 1 else []
290+
return ChatResult.model_validate({"textResponse": "answer", "reasoningSteps": steps})
291+
292+
report = run_items([_item()], _MixedReasoningBackend(), runs=2)
293+
assert report.items[0].reasoning_steps == ["step one", "step two"]
294+
295+
280296
def test_run_items_callback_exception_is_logged_not_swallowed(capsys):
281297
"""A raising callback prints a traceback to stderr but the run continues."""
282298
backend = _FakeBackend([_chat_with(_viz_obj())] * 2)

0 commit comments

Comments
 (0)