Skip to content

Refine Nexus bridge schemas and typing#46

Merged
Daliys merged 3 commits into
ForkHorizon:developmentfrom
air17:feature/update-schemas
Jun 12, 2026
Merged

Refine Nexus bridge schemas and typing#46
Daliys merged 3 commits into
ForkHorizon:developmentfrom
air17:feature/update-schemas

Conversation

@air17

@air17 air17 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new private types module for the NexusUnity Python bridge and refactors the codebase to use these shared type definitions. It also significantly expands the input schema for the core Unity scene manager tool, providing more precise and structured validation for various GameObject operations. Additionally, the test suite for routing logic is expanded with new test cases to improve coverage and reliability.

Key changes include:

Type System Improvements

  • Added a new _types.py module defining shared type aliases and TypedDict classes for JSON-RPC requests, responses, errors, tool/resource definitions, and other payloads. All relevant modules now import and use these types for better type safety and clarity. [1] [2] [3] [4] [5]

  • Refactored the call_unity function and related code to use the new type definitions (JsonObject, JsonRpcRequest, JsonRpcResponse, JsonRpcError), improving error handling consistency and type correctness. [1] [2]

Schema and Validation Enhancements

  • Overhauled the inputSchema for the unity_scene_manager tool in schemas.py to use oneOf with detailed sub-schemas for each supported action (e.g., create, destroy, duplicate, rename, transform, set active, set parent, set sibling index), providing more granular input validation and documentation for tool consumers.

  • Updated all static tool and resource definitions to use the new ToolDefinition and ResourceDefinition types, ensuring consistent schema typing. [1] [2]

Test Suite Improvements

  • Expanded the routing test suite with new tests for handler registration, fallback logic, transform application, scene manager actions, error handling, write-and-compile workflows, and compilation waiting logic, improving coverage and robustness of the routing layer. [1] [2] [3] [4]

Copilot AI review requested due to automatic review settings June 12, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR refines the Unity Hierarchy Manager JSON schema into action-specific variants and tightens up the Python bridge’s internal typing, while adding tests to cover new routing/schema behaviors.

Changes:

  • Reworked unity_hierarchy_manager inputSchema from a single schema with an action enum into a oneOf of action-specific variants (including aliases and stricter parameter requirements).
  • Introduced shared internal TypedDict/type aliases for JSON-RPC payloads and updated routing/transport code to use them.
  • Added/extended unit tests to validate schema structure and routing behavior (including set_sibling_index and instance_id 0 handling).

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Editor/nexus_bridge/schemas.py Converts hierarchy manager schema to oneOf variants and adds stronger internal typing for tool/resource definitions.
Editor/nexus_bridge/routing.py Refactors helpers to use typed JSON-RPC payloads and adjusts transform/test-wait logic.
Editor/nexus_bridge/_types.py Adds internal TypedDict/type aliases for JSON-RPC structures and bridge payloads.
Editor/nexus_bridge/_transport.py Updates call_unity signatures/structures to use the shared types and structured error payloads.
Editor/tests/test_schemas.py Adds tests asserting the new action-variant schema behavior for hierarchy manager.
Editor/tests/test_routing.py Adds routing tests for set_sibling_index and transform application with instance_id 0.
Files not reviewed (2)
  • Editor/nexus_bridge/_types.py.meta: Generated file
  • Editor/tests/test_schemas.py.meta: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Editor/nexus_bridge/routing.py Outdated
Comment thread Editor/nexus_bridge/_types.py
Comment thread Editor/nexus_bridge/_transport.py
@Daliys Daliys merged commit a8a42ea into ForkHorizon:development Jun 12, 2026
5 checks passed
@air17 air17 deleted the feature/update-schemas branch June 12, 2026 18:30
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.

3 participants