feat(a2ui-toolkit): validate catalog-derived child ref-fields (#1948)#1960
Merged
Conversation
#1944 closed the singular-child + cycle gaps for the `child`/`children` fields. This extends both the dangling-ref check and the cycle graph to every child reference a component makes, derived from the catalog rather than a hardcoded field list, matching the .NET sibling (microsoft/agent-framework#6494). A property is treated as a child reference only when its catalog schema marks it `"format": "componentRef"` (single) or `"componentRefList"` (list); an array property whose `items` is an object schema has its marked sub-properties honoured per element (this is how Tabs `tabItems[].child` is found, derived, never hardcoded). `child`/`children` stay implicit references always, so the #1944 and catalog-free structural behaviour is unchanged. An unmarked property is data, never a reference: a bare data string ("$289") and a bare ref string ("card") are otherwise indistinguishable, so shape-based detection is unsafe. A new `collectComponentRefEdges` / `_collect_component_ref_edges` returns (path, ref) pairs consumed by both the dangling-ref check and the cycle adjacency, so a cycle routed through a marked field (e.g. Modal `content`) is now detected. Paths are byte-aligned with the sibling toolkits: single-ref `components[i].<field>`, list-ref `components[i].<field>[k]`, nested `components[i].<arrayField>[k].<refField>`. Extended fields are gated on a marked catalog; with no catalog only `child`/`children` are checked, exactly as before. Note: hosts must enrich their catalogs to emit the `format` markers for this to fire; the dojo demos pass no catalog, so there is no dojo behaviour change. Catalog producers emitting markers is downstream follow-up. Tests (vitest + unittest): Modal trigger/content dangling, unmarked data string not flagged, nested tabItems[k].child per-index, cycle through a marked field, list-ref array per-index, and marked fields ignored without a catalog. All #1944 child/children + deep-chain tests stay green.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1781601470' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1781601470' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1781601470' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1781601470' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1781601470' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1781601470' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1781601470
Commit: fedbb37 |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/event-throttle-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/mcp-middleware
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/vercel-ai-sdk
@ag-ui/watsonx
@ag-ui/a2ui-toolkit
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
AlemTuzlak
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1948.
What
#1944 closed the singular-
child+ cycle gaps, scoped to thechild/childrenfields. This extends both the dangling-ref check and the cycle graph to every child reference a component makes, derived from the catalog rather than a hardcoded field list — covering Modaltrigger/content, TabstabItems[].child, etc. Kept byte-aligned with the .NET sibling (microsoft/agent-framework#6494).How
A property is a child reference only when its catalog schema marks it:
"format": "componentRef"— single ref"format": "componentRefList"— list ref (array of ids, or a{ componentId, path }template)For an array property whose
itemsis an object schema, marked sub-properties are honoured per element (this is howtabItems[].childis found — derived, never hardcoded).Why a marker and not shape inference: the validator catalog carries no machine-readable ref marker today, and a ref value (
"card") is indistinguishable from a data value ("$289") — both are bare strings. Shape-based detection would flag every non-id data string as a dangling child. So detection is marker-driven; an unmarked property is data, never a reference.child/childrenremain implicit references always, so #1944 and the catalog-free structural path are unchanged.A new
collectComponentRefEdges/_collect_component_ref_edgesreturns(path, ref)pairs consumed by both the dangling check and the cycle adjacency, so a cycle routed through a marked field (e.g. Modalcontent) is now detected.Path grammar (byte-aligned across TS / Python / .NET)
components[i].<field>components[i].<field>[k]components[i].<field>components[i].<arrayField>[k].<refField>(and[j]if that sub-field is itself a list)Error code reuses
unresolved_child(field-specific paths); cycle stayschild_cycle.Gating & scope
Extended fields are derived only when a marked catalog is supplied; with no catalog, only
child/childrenare checked — exactly as before. The dojo demos pass no catalog, so there is no dojo behaviour change; this fires for hosts that supply a marked catalog. Enriching catalog producers to emitformatmarkers is downstream follow-up, out of scope here.Tests
vitest + unittest, byte-aligned: Modal trigger/content dangling, unmarked data string not flagged, nested
tabItems[k].childper-index, cycle through a marked field, list-ref array per-index, marked fields ignored without a catalog. All #1944 child/children + deep-chain tests stay green. TS 90/90, Python 89/89,tsc --noEmitclean.Cross-language parity
.NET ships in microsoft/agent-framework#6494 (
xunit 117/117). Emitted paths diffed byte-for-byte across all three toolkits before commit.