docs: clarify RunResult.events testing surface#5525
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR updates the RunResult.events documentation to define it as the small, testing-oriented surface for asserting what happened during a voice.testing run (per #5410), and clarifies the event types it can contain.
Changes:
- Expands the
RunResult.eventsdocstring to describe its intent (test assertions) and discourage depending on lower-level internals. - Enumerates the concrete event wrapper types (
ChatMessageEvent,FunctionCallEvent,FunctionCallOutputEvent,AgentHandoffEvent) present inevents. - Specifies that events are presented in chronological order.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """ | ||
| return self._recorded_items |
There was a problem hiding this comment.
events returns the underlying _recorded_items list directly. Since this docstring now positions RunResult.events as the recommended external testing surface, callers can easily (and accidentally) mutate the list and corrupt the recorded event stream for subsequent assertions/debug output. Consider returning an immutable view (e.g., a tuple) or a shallow copy, or explicitly document that the returned list must be treated as read-only.
| """ | |
| return self._recorded_items | |
| Returns a shallow copy of the recorded events so callers cannot mutate | |
| the internal event stream. | |
| """ | |
| return list(self._recorded_items) |
Fixes #5410
Documents
RunResult.eventsas a small, testing-oriented surface, enumerates the event types it contains, and clarifies that callers should use it for run assertions instead of depending on lower-level session internals or raw media artifacts.