Skip to content

fix(python-sdk): support relative data binding paths in v0.9 streaming parser#1179

Open
jacobsimionato wants to merge 4 commits intogoogle:mainfrom
jacobsimionato:fix_parser
Open

fix(python-sdk): support relative data binding paths in v0.9 streaming parser#1179
jacobsimionato wants to merge 4 commits intogoogle:mainfrom
jacobsimionato:fix_parser

Conversation

@jacobsimionato
Copy link
Copy Markdown
Collaborator

Description of Changes

Modified the A2uiStreamParser in the Python SDK to conditionally skip the heuristic that automatically prepends a leading slash (/) to data binding path strings. This heuristic is now restricted to v0.8 catalogs. For v0.9, the parser accurately preserves relative paths (no leading slash) and absolute paths (leading slash).

Also added comprehensive test coverage:

  • test_v08_path_heuristic_adds_slash: Ensures v0.8 still receives the auto-prefixed slash.
  • test_v09_path_heuristic_relative_path: Ensures v0.9 preserves relative paths natively.
  • test_v09_path_heuristic_absolute_path: Ensures v0.9 still supports explicit absolute paths.

Rationale

A2UI Protocol v0.9 introduces relative path resolution for components inside collection scopes (such as templates inside List, Column, etc.). The previous streaming parser heuristic aggressively forced all paths to be absolute, which broke this core v0.9 feature. This fix properly aligns the streaming parser with the v0.9 specification.

Testing/Running Instructions

Reviewers can verify these changes locally by running the test suite:

  1. Navigate to the Python SDK directory: cd agent_sdks/python
  2. Run the parser tests via uv: export PYTHONPATH=$PYTHONPATH:$(pwd)/src && uv run pytest tests/parser/
  3. Verify that all tests pass, specifically the new path heuristic tests in test_streaming_v08.py and test_streaming_v09.py.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements version-specific path handling in the A2uiStreamParser to allow relative paths in v0.9 while maintaining the leading-slash heuristic for v0.8. It includes new test cases for both versions to verify these behaviors. Feedback indicates that the path placeholder logic remains destructive for v0.9 absolute paths because it clears object metadata, and it is suggested to restrict this logic to v0.8 as well.

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

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant