fix(reports): add extension handling to TerminalReport.generate_to_file (#83)#190
Merged
Merged
Conversation
TerminalReport.generate_to_file wrote the raw output path with no extension logic, while markdown, JSON, and HTML generators default to a format extension or normalize a wrong suffix. Now terminal defaults to report.txt when no extension is given and normalizes a non-.txt suffix to .txt, matching the other generators (issue #83).
|
🎉 Congratulations @himanshu231204! Your pull request has been successfully merged into main. 🚀 Thank you for contributing to OpenAgentHQ and helping improve the project. We truly appreciate your contribution and hope to see you back with more amazing PRs! Happy Open Sourcing! ❤️ |
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
TerminalReport.generate_to_filewrote the rawoutput_pathwith no extension logic, while every other report generator applies consistent extension handling:MarkdownReport-> defaults toreport.mdJSONReport-> defaults toreport.jsonHTMLReport-> defaults toreport.htmland normalizes a wrong suffix to.htmlComparisonReport-> defaults tocomparison.txtThis inconsistency meant a call like
generate_to_file(report, "my_run")produced a file namedmy_runwith no extension, unlike the other formats. The terminal test even hard-codedreport.txt, masking the gap. (issue #83)Changes
openagent_eval/reports/terminal.py—generate_to_filenow mirrors the HTML generator's robust pattern:Behavior:
report.txt.log) -> normalized to.txt.txt-> preserved as-istests/unit/test_reports/test_terminal.py— added three tests covering default, normalization, and passthrough paths.Testing
uv run pytest tests/unit/test_reports/-> 98 passeduv run ruff checkon changed files -> cleantest_generate_to_file_defaults_to_txt,test_generate_to_file_normalizes_wrong_suffix,test_generate_to_file_keeps_txt_suffixChecklist
ruffpassesreportstest suite passes (no regressions)fix/83-terminal-report-extensionoffmain, not developed onmain