Skip to content

Fix: Revamp Action Parsing to More Robustly Handle Complex and Nested Types - #201

Merged
RyanTheRobothead merged 7 commits into
mainfrom
action_parsing_bugs
Dec 15, 2025
Merged

Fix: Revamp Action Parsing to More Robustly Handle Complex and Nested Types#201
RyanTheRobothead merged 7 commits into
mainfrom
action_parsing_bugs

Conversation

@RyanTheRobothead

Copy link
Copy Markdown
Member

PR Info

This 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:

  • Run Pre-commit and Unit Tests, and ensured that they pass
  • Created or updated documentation relevant to your change
  • Created or updated unit tests relevant to your change

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py module 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.

Comment thread src/madsci_node_module/madsci/node_module/abstract_node_module.py
Comment thread src/madsci_node_module/madsci/node_module/type_analyzer.py Outdated
Comment thread src/madsci_node_module/madsci/node_module/type_analyzer.py Outdated
Comment thread src/madsci_node_module/tests/test_argument_parsing.py Outdated
Comment thread src/madsci_node_module/tests/test_action_parsing_integration.py Outdated
Comment thread src/madsci_node_module/madsci/node_module/type_analyzer.py
Comment thread src/madsci_node_module/madsci/node_module/type_analyzer.py
Comment thread src/madsci_node_module/madsci/node_module/type_analyzer.py
@github-actions

github-actions Bot commented Dec 12, 2025

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/madsci_common/madsci/common/types
  action_types.py
  location_types.py
  src/madsci_node_module/madsci/node_module
  abstract_node_module.py 470-471, 484-488, 546
  helpers.py 149
  type_analyzer.py 122, 217, 270-271, 288-289, 305-306, 358-360, 368-370, 377-380
Project Total  

This report was generated by python-coverage-comment-action

@RyanTheRobothead
RyanTheRobothead merged commit 6003d36 into main Dec 15, 2025
4 checks passed
@RyanTheRobothead
RyanTheRobothead deleted the action_parsing_bugs branch December 27, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

2 participants