Skip to content

Port Angular Restaurant Sample to 0.9 and Stabilize Tests#1189

Merged
josemontespg merged 10 commits intogoogle:mainfrom
josemontespg:port-angular-restaurant-sample-to-09
Apr 15, 2026
Merged

Port Angular Restaurant Sample to 0.9 and Stabilize Tests#1189
josemontespg merged 10 commits intogoogle:mainfrom
josemontespg:port-angular-restaurant-sample-to-09

Conversation

@josemontespg
Copy link
Copy Markdown
Collaborator

@josemontespg josemontespg commented Apr 15, 2026

This PR ports the Angular restaurant sample app to version 0.9.

Credits to @gspencergoog for the first port attempt in #1101, I reused most of his work to create this PR.

Key Changes

  • Angular Renderer: Updated ComponentHostComponent to handle property updates reactively using Angular Signals.
  • Tests: Modernized tests in renderers/angular to use the real ComponentBinder service and formal ComponentModel instances instead of object-literal mocks.
  • Web Core: Minor updates to data-context.
  • Agent: Updated the restaurant finder agent and examples for 0.9.
  • Added client support for streaming responses.

Fixes #701

Screenshots

Light Dark
Single Column light_mode_5_tall dark_mode_5_tall
Double Column light_mode_10_tall dark_mode_10_tall

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 migrates the Angular renderer and the restaurant finder sample to version 0.9. Key updates include the implementation of reactive property updates and weight support in ComponentHostComponent, the addition of stable change detection in ListComponent, and a specialized path resolution logic in DataContext. The restaurant finder agent was also updated with a monkey patch for ADK compatibility and refined LLM instructions. Feedback focuses on ensuring the weight signal is updated during property changes, improving type safety by replacing any with specific models, addressing the impact of the new path resolution logic on global state access, and correcting the action handling in the client to ensure the backend receives the expected event format.

Comment thread renderers/angular/src/v0_9/core/component-host.component.ts Outdated
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment on lines +362 to +366
private resolvePath(path: string): string {
if (path.startsWith('/')) {
return path;
}
if (path === '' || path === '.') {
// In A2UI v0.9, all paths generated by the prompt-first LLM must begin with a leading `/`
// to satisfy RFC 6901 JSON Pointer validation.
// Thus, paths like `/imageUrl` are effectively relative to this DataContext.
let relPath = path.startsWith('/') ? path.substring(1) : path;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This change to resolvePath effectively disables absolute path resolution (paths starting with /) by treating them as relative to the current DataContext. While the comment explains this is to accommodate LLM behavior in v0.9, it breaks standard JSON Pointer expectations and prevents components from accessing global state outside their nested scope. This might lead to issues if a component genuinely needs to reference data at the root of the model.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure about this one. @jacobsimionato is the assumption in code here correct?

Comment thread samples/client/angular/projects/restaurant/src/app/client.ts Outdated
Copy link
Copy Markdown
Collaborator

@jacobsimionato jacobsimionato left a comment

Choose a reason for hiding this comment

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

Wow, you worked through a lot of issues to get this running. Thank you so much for going on the journey - looks great and will really help our users figure out how to use A2UI!

Let's sync about the relative/absolute path thing tomorrow!

Comment thread renderers/angular/src/v0_9/catalog/basic/list.component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment thread renderers/angular/src/v0_9/core/component-host.component.ts
Comment thread renderers/web_core/src/v0_9/rendering/data-context.ts Outdated
Comment thread samples/agent/adk/restaurant_finder/agent.py
Comment thread specification/v0_9/json/basic_catalog.json Outdated
@ditman
Copy link
Copy Markdown
Collaborator

ditman commented Apr 15, 2026

@josemontespg I landed the styling changes for angular. You could potentially rebase this PR and apply this stylesheet to make the sample look more like the Lit one? And see what I ended up messing up in the Angular theming :P

@josemontespg
Copy link
Copy Markdown
Collaborator Author

@josemontespg I landed the styling changes for angular. You could potentially rebase this PR and apply this stylesheet to make the sample look more like the Lit one? And see what I ended up messing up in the Angular theming :P

This PR got big enough already. Created #1200 to track this work

@josemontespg josemontespg force-pushed the port-angular-restaurant-sample-to-09 branch from 26d74e1 to 7df12f8 Compare April 15, 2026 21:20
Copy link
Copy Markdown
Collaborator

@jacobsimionato jacobsimionato left a comment

Choose a reason for hiding this comment

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

Nice work, @josemontespg !!

private processParts(parts: any[]): Types.ServerToClientMessage[] {
const messages: Types.ServerToClientMessage[] = [];
for (const item of parts) {
if (item.kind === 'text') continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ha, this looks way better

Comment thread specification/v0_10/json/basic_catalog.json
@josemontespg josemontespg merged commit 2964cbd into google:main Apr 15, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Apr 15, 2026
@josemontespg josemontespg deleted the port-angular-restaurant-sample-to-09 branch April 15, 2026 22:17
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.

Update restaurant sample to use v0.9

4 participants