Skip to content

Commit 0928d23

Browse files
STHITAPRAJNASclaude
authored andcommitted
test(sessions): tighten v0 error_message truncation assertions per review
- Replace <= with == in the truncation test: the guard is deterministic so the result should be exactly 255 chars, not merely at most 255 - Assert the concrete expected string ("x" * 241 + "...[truncated]") rather than importing private module symbols, reducing coupling to internal implementation details - Add test_from_event_with_none_error_message to cover the falsy branch of the truncation condition and document that None passes through unchanged
1 parent f95ac48 commit 0928d23

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/unittests/sessions/test_v0_storage_event.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,24 @@ def test_from_event_preserves_short_error_message():
125125
storage_event = StorageEvent.from_event(session, event)
126126

127127
assert storage_event.error_message == short_error
128+
129+
130+
def test_from_event_with_none_error_message():
131+
session = Session(
132+
app_name="app",
133+
user_id="user",
134+
id="session_id",
135+
state={},
136+
events=[],
137+
last_update_time=0.0,
138+
)
139+
event = Event(
140+
id="event_id",
141+
invocation_id="inv_id",
142+
author="agent",
143+
timestamp=1.0,
144+
)
145+
146+
storage_event = StorageEvent.from_event(session, event)
147+
148+
assert storage_event.error_message is None

0 commit comments

Comments
 (0)