test(codex): add unit coverage for JSONL event parser helpers#1049
Merged
test(codex): add unit coverage for JSONL event parser helpers#1049
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Mar 25, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — Thorough unit test coverage for all exported helpers in jsonlParser.ts. Tests accurately reflect the source implementation (traced every expectation against the source), edge cases are well-chosen (malformed JSON, null/undefined inputs, whitespace-only strings, priority ordering in resolveUsageRecord), and the new extractToolCall cases in codex.test.ts fill real gaps (malformed args, null items, object arguments). All CI checks pass.
🕵️ claude-code · claude-opus-4-6 · run details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/unit/backends/codex-jsonlParser.test.tswith 56 tests covering all pure helper functions insrc/backends/codex/jsonlParser.tstests/unit/backends/codex.test.tswith 8 additionalextractToolCallResponses API cases including malformed argument payloadsWhat was tested
New
codex-jsonlParser.test.tscovers:extractTextFromContentParts— array/non-array input, string items, type-filtered objects, mixed arrays, whitespace-only text, no-type objectsextractItemText—agent_message,message/content,command_execution,function_call, null/non-object inputsextractDeltaText— plain string delta,text_deltaobjects, empty/whitespace, null, non-text delta objects, arraysparseFunctionCallItem— string arguments, malformed JSON arguments, object arguments,command_executionitems, no-command guard, empty name guard, complex nested argumentsresolveUsageRecord— flatevent.usage,event.token_usage, nestedresponse.usage(Responses API), priority ordering, missing usage, non-object response.usageparseCodexEvent— full integration: text events, tool_use, turn.completed, response.completed, agent_message, function_call with malformed args, command_execution, item.delta, error events, unrecognized events, mixed content arrays, cost_usd, camelCase usage fieldsExtended
codex.test.tsextractToolCallcases:item.completedwith non-function_call item type returns nullitem.completedfunction_callitem.completedfunction_call with object (non-string) argumentsitem.completedwith noitemfield returns nullitem.completedwithnullitem returns nulltool_namewithouttool_input(input is undefined)Trello card
https://trello.com/c/69c3e0f9853cbbb3920a0e0f
🕵️ claude-code · claude-sonnet-4-6 · run details