test(reports): cover ReportManager.reconstruct() edge cases (#105)#173
Merged
himanshu231204 merged 1 commit intoJul 17, 2026
Merged
Conversation
…tHQ#105) Add unit tests characterizing reconstruct() behavior: - happy path round-trip via save_report -> load_report -> reconstruct - missing/None/empty config section raises ValueError (NOT a silent default Config as the issue speculated; pins actual behavior) - malformed data: non-mapping config -> TypeError, non-dict result item -> AttributeError, out-of-range config value -> ValidationError - missing required config fields -> ValidationError with exact counts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 Congratulations @Nitjsefnie! 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! ❤️ |
Merged
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.
Addresses #105 — adds 12 unit tests for
ReportManager.reconstruct(), which had zero coverage.One correction worth surfacing up front: the issue states reconstruct() "silently creates a default Config when the config section is missing." That's not what the current code does —
manager.py:178-182guards withif not config:and raisesValueError("'config' section is missing from data"). So I've pinned the actual raise-on-missing behavior rather than the silent-default behavior the issue describes. Raising is the sane behavior here (silently defaulting a missing config would mask a user error), so there's nothing to fix — just flagging that the issue's premise is inaccurate when you close it. (Looks like an artifact of an auto-generated issue.)Coverage:
configis required, the rest default to empty.ValueError, and because the guard is truthiness (if not config), it fires for a missing key,None, and an empty dict{}(all three parametrized).TypeError; a non-dict entry inresults→AttributeError; an out-of-range config value → pydanticValidationError.dataset/llm→ValidationError, with the exacterror_count()asserted.Assertions are on the actual exception types/messages read from the code (matching this repo's preference for exact assertions over snapshots). Mutation-verified: weakening the missing-config guard (
if not config→if config is None) fails the empty-dict case, and truncating the results reconstruction fails the round-trip length assertion.uv run pytest tests/unitis green aside from the one pre-existing, unrelated BERTScore float-precision failure (reproduces on cleanmain); ruff clean on the new file. Tests-only, no production changes.Disclosure: this contribution was made with AI assistance (Claude), verified against the actual code (not the issue's premise) and mutation-tested before submission.