Skip to content

test(tools): cover execute_menu_item payload and response normalization - #1478

Open
YMY873 wants to merge 1 commit into
CoplayDev:betafrom
YMY873:test/execute-menu-item-contract
Open

YMY873 wants to merge 1 commit into
CoplayDev:betafrom
YMY873:test/execute-menu-item-contract

Conversation

@YMY873

@YMY873 YMY873 commented Oct 19, 2026 •

Copy link
Copy Markdown

Description

Adds unit coverage for the execute_menu_item MCP tool, which was previously
quarantined in KNOWN_UNTESTED. No production code changes.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Changes Made

  • New Server/tests/test_execute_menu_item.py with 8 tests covering:
    • camelCase menuPath forwarding (a snake_case key would be silently
      ignored by Unity)
    • None/absent menu_path is omitted instead of sent as null
    • the resolved unity_instance reaches the transport helper
    • dict responses are wrapped in MCPResponse even when Unity adds extra
      status / result keys
    • error payloads stay failures, and non-dict payloads pass through unchanged
    • registration stays in the core group with destructiveHint=True
  • Removed execute_menu_item from KNOWN_UNTESTED in
    Server/tests/test_tool_test_symmetry.py (the guard fails on stale entries).

Compatibility / Package Source

  • Unity version(s) tested: N/A — Python-only test change
  • Package source used (#beta, #main, tag, branch, or file:): N/A
  • Resolved commit hash from Packages/packages-lock.json (if using a Git package URL): N/A

Testing/Screenshots/Recordings

  • Python tests (cd Server && uv run pytest tests/ -v)
  • Unity EditMode tests
  • Unity PlayMode tests
  • Package import/compile check
  • Not applicable (explain why in Additional Notes)

Result: 1599 passed, 2 skipped. The new file alone: 8 passed.

Documentation Updates

  • I have added/removed/modified tools or resources
  • If yes, I have updated all documentation files using:
    • The LLM prompt at tools/UPDATE_DOCS_PROMPT.md (recommended)
    • Manual review of the generated changes

No docs change: tool signatures and the generated reference are untouched.

Related Issues

N/A — small test-only change, no tracking issue.

Additional Notes

Unity EditMode/PlayMode/package-import checks are not applicable: this PR only
touches Server/tests/** and no MCPForUnity/** files, so no Editor is required.
CI will therefore only run python-tests (and skip unity-tests / e2e-bridge
by path filter), which is expected rather than a failure.

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for menu-item execution, including path handling, instance forwarding, response formats, and failure behavior.
    • Added this functionality to the tool-coverage checks, helping detect regressions in menu actions.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0cef870b-50c6-463e-8f54-3fe95ca55685
📥 Commits

Reviewing files that changed from the base of the PR and between 308efc0 and 48da676.

📒 Files selected for processing: 2
  • Server/tests/test_execute_menu_item.py
  • Server/tests/test_tool_test_symmetry.py
💤 Files with no reviewable changes: 1
  • Server/tests/test_tool_test_symmetry.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The pull request adds tests for execute_menu_item argument forwarding, response handling, and registration metadata. It also removes the tool from the untested-tool quarantine.

Changes: Execute Menu Item Test Coverage

Layer / File(s) Summary
Execute menu item behavior and coverage
Server/tests/test_execute_menu_item.py, Server/tests/test_tool_test_symmetry.py
Tests check path and Unity-instance forwarding, response normalization, failure propagation, unchanged string responses, and registration metadata. The tool is removed from KNOWN_UNTESTED.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: scriptwonder

Merge Risk: ⚪ Minimal · up to 48da6

The new tests and coverage-list update are ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description follows the repository template. It identifies the test-only change, lists the covered cases, records the Python test results, explains why Unity checks do not apply, and addresses doc…
Title check Passed The title clearly and concisely describes the main change: adding test coverage for execute_menu_item payload handling and response normalization.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description follows the repository template. It identifies the test-only change, lists the covered cases, records the Python test results, explains why Unity checks do not apply, and addresses documentation and related issues.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants