Fix: Revamp Action Parsing to More Robustly Handle Complex and Nested Types - #201
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a robust type analysis system to handle complex and nested type hints in MADSci action parsing, fixing issues #199 and #184.
Key Changes
- New
type_analyzer.pymodule providing recursive type unwrapping and special type detection - Updated action argument parsing to use the new type analyzer
- ActionResult types now properly recognized and handled
- ClassVar fields filtered out when parsing ActionFiles
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| type_analyzer.py | New module for recursive type analysis with depth protection and special type detection |
| helpers.py | Updated to use TypeAnalyzer; added ClassVar filtering and ActionResult handling |
| abstract_node_module.py | Refactored argument parsing to leverage TypeAnalyzer for complex nested types |
| test_type_analyzer.py | Comprehensive test suite (871 lines) covering all type analysis scenarios |
| test_argument_parsing.py | Integration tests (1200 lines) for argument parsing with complex types |
| test_action_parsing_integration.py | End-to-end tests (1321 lines) for realistic action parsing scenarios |
| test_helpers.py | Added tests for ActionResult return types |
| ruff.toml | Added ARG002 to test file ignores (removes noqa comments) |
| Various test files | Removed unnecessary noqa:ARG002 comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
PR Info
ActionFailedresponses lead to parsing error #199Optional[Annotated[LocationArgument]]and other similiar type hinting constructions lead to improperly parsed arguments #184This PR revamps the type parsing used in the Node's action parser to better handle various complex and nested types, fixing related bugs and ensuring less brittle and more robust action parsing moving forward.
Developer Checklists
I have: