Skip to content

Treeshake common types schema#1035

Merged
nan-yu merged 3 commits intogoogle:mainfrom
jiahaog:treeshaek
Mar 30, 2026
Merged

Treeshake common types schema#1035
nan-yu merged 3 commits intogoogle:mainfrom
jiahaog:treeshaek

Conversation

@jiahaog
Copy link
Copy Markdown
Member

@jiahaog jiahaog commented Mar 30, 2026

Description

Today, the system prompt includes common types schemas that may not be used by catalog or server to client schemas. This results in unnecessary input tokens.

Drop the whole common types schema section from the prompt if there are no common types.

Towards #1004.

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

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 introduces a mechanism to prune unused common types from the A2uiCatalog schema by implementing a new private method, _with_pruned_common_types, which identifies reachable definitions through a breadth-first search of schema references. A corresponding test case has been added to ensure that only referenced types are retained. A performance improvement was suggested to replace the list-based queue with collections.deque for more efficient popping during the reference collection process.

@jiahaog jiahaog marked this pull request as draft March 30, 2026 08:03
@jiahaog jiahaog force-pushed the treeshaek branch 2 times, most recently from c9cc5f5 to 2eae4f1 Compare March 30, 2026 09:39
@jiahaog jiahaog marked this pull request as ready for review March 30, 2026 09:48
@jiahaog
Copy link
Copy Markdown
Member Author

jiahaog commented Mar 30, 2026

@nan-yu can you take a look? Thanks!

Copy link
Copy Markdown
Collaborator

@nan-yu nan-yu left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good.

@nan-yu nan-yu merged commit 1ea689d into google:main Mar 30, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 30, 2026
@jiahaog jiahaog deleted the treeshaek branch March 31, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants