Skip to content

Draft: Angular Closure Compiler Investigation#3

Closed
josemontespg wants to merge 51 commits into
mainfrom
angular-closure-compiler-test
Closed

Draft: Angular Closure Compiler Investigation#3
josemontespg wants to merge 51 commits into
mainfrom
angular-closure-compiler-test

Conversation

@josemontespg
Copy link
Copy Markdown
Owner

Findings: Angular Explorer App with Google Closure Compiler

This document summarizes the findings and challenges encountered while attempting to compile the Angular Explorer application using the Google Closure Compiler with advanced optimizations and property renaming.

Objective

Compile the Angular explorer app using google-closure-compiler with property renaming on (ADVANCED optimizations) and verify it in an integration test.

Summary of Attempts and Results

1. Environment Setup and Dependencies

  • Java Requirement: Closure Compiler requires Java. Resolved by installing openjdk via Homebrew and adding it to the PATH.
  • Input: Initially targeted the production build output of Angular CLI (dist/a2ui_explorer/browser/*.js), which was already minified, making debugging difficult.

2. Resolving Initial Compiler Errors

  • Undeclared Variables: The compiler failed on localStorage being undeclared. Resolved by creating a custom externs.js file.
  • Charset Issues: The compiler mangled the ɵ character (used in Angular Ivy properties like ɵcmp) into ? when defaulting to US_ASCII output. Resolved by forcing --charset UTF-8.

3. Advanced Optimizations (ADVANCED) Challenges

  • Error: NG0906: The xu is not an Angular component, make sure it has the @Component decorator.
  • Root Cause: In ADVANCED mode, Closure Compiler aggressively renames or removes static properties like ɵcmp on component classes because it cannot trace their dynamic usage by Angular's runtime (which often uses string lookups).
  • Attempted Fixes:
    • Added externs to protect ɵcmp on Function.prototype and Object.prototype. This did not resolve the error, suggesting properties were still being stripped or renamed in a way the externs didn't cover.
    • Attempted to use tsickle to generate Closure-compatible annotations. Installation failed due to a peer dependency conflict with TypeScript 5.9 (tsickle expected ~4.7.2). Forced installation revealed no CLI tool was available in that version, requiring a complex Node API integration.

4. Working Solution (SIMPLE)

  • Result: Compiling with --compilation_level SIMPLE succeeded, and the application loaded successfully without runtime errors.
  • Trade-off: SIMPLE mode does not perform property renaming or aggressive dead code elimination, resulting in a larger file size (~1.84 MB vs ~462 KB in ADVANCED mode).

Recommendations for Future Work

  • To achieve successful ADVANCED compilation, a proper integration with a tool like tsickle or a compatible Angular-Closure builder is needed to ensure metadata properties are preserved or accessed via property access rather than strings.
  • For now, SIMPLE mode serves as the only working configuration for minifying the app with Closure Compiler in this environment.

josemontespg and others added 30 commits April 16, 2026 12:34
* Add Exmaples for how to use A2UI on Gemini Enterprise

* Add license

* Remove extra ' from script

* correct package name

* Rewrite with new A2UI SDK

* udpate README.md

* Update according to PR feedback

* Reformat with uv run pyink .

* Fix issues for deploying to Agent Engine

* Update cloud run scripts

* Fix package path in prompt_builder.py

* Add missing data file
…ct#1210)

* add web analogy to renderers and separate web from mobile
…boilerplate (a2ui-project#1211)

* Refactor catalog components: lift props to base class and add readonly keyword. Fixes a2ui-project#1199

* Address PR review comments: fix weight calculation, make componentId required, and fix import style

* Apply Prettier formatting to clean up excessive blank lines in catalog components

* Add unit tests for weight 0 and null in ColumnComponent, and fix logic error in flexStyle getter

* Apply flex weight as is, covering 0 and null cases

* Remove redundant non-null assertion from componentId in ButtonComponent
…-project#1209)

a2ui-project#1146 introduced ICON_NAME_OVERRIDES plus a toMaterialSymbol
function but left the previous ICON_MAP constant and getIconName
method in place. Both were unreferenced after render() switched
to toMaterialSymbol. Remove them.

Follow-up to a2ui-project#1146.
* Use the styles from web_core for the basic catalog.
* Tweak the a2ui_explorer so it has the same layout as Lit's
* Add a note to the README about how the basic catalog components load styles, which may impact how users build their apps.
* Remove the minimal catalog
* Fix small differences in styling with the Lit renderer.

* Add the restaurant theme (copied from Lit)

* Apply the theme. Remove some unused vars.

* Clear surfaces on interaction (similar to Lit)

* Add missing license header.
Updates theming documentation to match the v0.9 renderer changes.

---------

Co-authored-by: alan blount <alan@zeroasterisk.com>
* Use the correct props in tabs rendering.
* Update the component host so it looks at its componentKey every time it changes, not just on init.
* docs: feature quickstarts and add AG-UI guide

Surface the two canonical onboarding paths (Restaurant Finder demo and
A2UI + AG-UI) plus the A2UI Composer in README.md and docs/index.md, so
new users can pick the entry point that matches their stack instead of
landing on a single Lit-specific walkthrough.

Adds docs/guides/a2ui-with-any-agent-framework.md, a full guide covering:

- When to use A2UI + AG-UI vs A2A
- Frontend catalog wiring (Zod definitions + typed React renderers +
  <CopilotKit a2ui={{catalog}}> provider)
- The three A2UI operations an agent must emit
- Fixed-schema vs dynamic-schema authoring patterns
- Tool-call handling for interactive components
- Troubleshooting the common "surface never appears" / "data bindings
  show literal paths" failures

The guide is wired into mkdocs.yaml under Guides and replaces the
"TODO: Add a detailed guide" placeholder in concepts/transports.md.

* docs(a2ui-with-any-agent-framework): simplify per review

- Drop fixed/dynamic schema framing and the agent-side emission
  walkthrough; CopilotKit docs are the source of truth.
- Use npx copilotkit@latest init (generic CopilotKit setup), not the
  --framework a2ui starter.
- Mirror the Backend / Frontend / BYOC setup from the CopilotKit ADK +
  A2UI docs and link back for detail.
- Align README TL;DR and path-picker label with the same CLI.

* docs(transports): fix AG-UI guide blurb to match guide content

The link blurb promised catalog setup, A2UI operations, and fixed vs
dynamic schema patterns — none of which the guide covers. Describe what
the guide actually contains: CopilotKit setup and A2UI rendering.

* docs: apply review feedback on card copy

Per @zeroasterisk:
- Rename Restaurant Finder card/row to "Quickstart Restaurant Finder Demo"
- Mention Gemini-powered ADK agent (not just "Gemini agent")
- Reframe AG-UI card as "ready to ship" rather than "best for"
- README quickstart row links to a2ui.org/quickstart

* docs: add A2UI Theater entry to README and home page

Per @zeroasterisk — Theater is the no-install playground for stepping
through A2UI streaming scenarios across renderers. Worth surfacing
alongside Composer as a zero-friction onboarding option.

* docs(a2ui-with-any-agent-framework): expand BYOC inline

The custom-components section is the core of the guide — bringing your
own React components into an A2UI catalog. Replace the bare link with
the full three-step walkthrough (definitions → renderers → registration),
sourced verbatim from CopilotKit's shared a2ui.mdx snippet. Keep the
link to CopilotKit's BYOC docs as the source of truth for advanced
patterns.

---------

Co-authored-by: alan blount <alan@zeroasterisk.com>
…model. (a2ui-project#1232)

* Update README.md

* Update samples/agent/adk/restaurant_finder/README.md
* Cleanup Lit shell contacts (Part 1)

* Address review feedback: add snackbar fallback and fix lifecycle
a2ui-project#1244)

* refactor: split personalized_learning sample into agent and client directories

* style: fix python formatting in personalized_learning sample

* Create test_agent.py

* Create test_client.py

* Create test_e2e.py

* Update test_agent.py

* Update test_client.py

* Update test_e2e.py

* refactor: restore deleted tests and place them in correct directories

* style: fix formatting in test_integration.py
…ngine and Cloud Run issues (a2ui-project#1256)

* Add Exmaples for how to use A2UI on Gemini Enterprise

* Add license

* Remove extra ' from script

* correct package name

* Rewrite with new A2UI SDK

* udpate README.md

* Update according to PR feedback

* Reformat with uv run pyink .

* Fix issues for deploying to Agent Engine

* Update cloud run scripts

* Fix package path in prompt_builder.py

* Add missing data file

* Fix A2UI agents can not be deployed to Gemini Enterprise issues
…1261)

* Fix CI failures caused by private index URL in uv.lock

* Reformat the python sample agent
* Initial C++ port of the python agent SDKs

* Add CI for building and testing C++ agent SDK

* Implement basic catalog provider with bundled schema support

* Add Apache 2.0 license headers to C++ SDK

* Remove debug file logging across parser and streaming implementation modules

* Address review comments from Gemini

* Optimize string handling by migrating message constants and parser interface methods to std::string_view

* refactor: move implementation details to source files and finalize recursion depth constants in validator

* Implement inline catalog support and schema merging in schema/manager.cc

* Use named raw string delimiters in generated C++ schema constants

* Optimize extra component existence checks by using a set for lookups in streaming parser

* Add explicit validation checks for component schema fields and update google-adk dependency
…2ui-project#1242)

* Refactor primaryColor theme propagation and fix tests

* Use accent-color for checkbox and update tests
josemontespg and others added 21 commits April 23, 2026 14:58
…-project#1243)

* Add message editor to Inspect Panel and enable live reload

* Format JSON on blur in editors
Only the validator tests are wired up.

This commit groups the changes made to Validator.kt into 4 themes, each necessitated by specific failing tests in the conformance suite:

1. Heuristic Component Reference Resolution
- Changes: Added hardcoded field names ('child', 'children', 'explicitList') to extractComponentRefFields to identify references when not explicitly declared in schema.
- Necessity: Complex schemas (like in v0.9) didn't explicitly mark these as references, but Python validator assumed them.
- Failing Test: test_custom_catalog_0_9 (failed with "Component 'c1' is not reachable from 'root'")

2. Multi-Surface Validation Support
- Changes: Refactored validate to instantiate a new A2uiTopologyValidator for each message batch based on surfaceId, and updated findRootId to look up rootId per surface.
- Necessity: Conformance tests contain batches with messages for multiple surfaces, each needing independent root validation.
- Failing Test: test_validate_multi_surface_v08 (failed with "Missing root component: No component has id='root-a'")

3. Incremental Update Support (Nullable Root)
- Changes: Allowed findRootId to return null when no root-defining message is found, and updated topology validator to skip root check and traverse all nodes for cycles.
- Necessity: Incremental updates might not contain the root component in the current batch.
- Failing Test: test_incremental_update_no_root_v08 (failed with "Missing root component: No component has id='root'")

4. v0.9 createSurface Support
- Changes: Added recognition of createSurface messages in findRootId and defaulted root ID to 'root' for v0.9.
- Necessity: In v0.9, root is assumed to be 'root' when createSurface is used.
- Failing Test: test_validate_missing_root_v09 (failed because it expected failure but passed due to fallback to null root)

Also fixed findRepoRoot in build.gradle.kts to look for 'specification' directory instead of '.git', fixing resource loading in A2uiSchemaManagerTest.
* [Angular] Remove namespace from v0.8 types.

Make types.ts a flat-export of all types for the renderer (and
web_core), and tweak the public-api file to export * as Types so users
don't need to update their code.

Also, for internal imports, be more specific about what is being
imported and from where, instead of import * from types.

---

Co-authored-by: sugoi-yuzuru <75597583+sugoi-yuzuru@users.noreply.github.com>
…ect#1266)

* Remove redundant schema validation tests and legacy payload helper methods

* Remove example loading logic from A2uiCatalog and replace with standardized conformance test data files

* Migrate schema modifier tests from Python to conformance YAML files

* Add Schema Manager conformance tests

* Migrate streaming parser conformance tests to a dedicated configuration file and remove legacy parser tests.

* Migrate payload fixer unit tests to conformance test suite

* Migrate c++ parser tests to centralized conformance runner and consolidate utility tests

* Consolidate streaming parser tests into conformance tests

* Implement catalog conformance test runner

* Implement SchemaManager conformance tests in C++ and remove redundant schema manager test file

* Reorganize conformance test suite into modular subdirectories and update test loader paths

* Remove json-schema-validator dependency and modernize memory management in conformance tests

* Update the conformance tests for schema management

* Update README to reflect restructuring of conformance test suites and data directories

* Update s2c_schema path in validator

* Silence unused variable warning in example validation during JSON parsing

* Update conformance schema to make catalog fields optional in root and move validation to anyOf variants

* Standardize conformance test schema and update runners to support multi-step test definitions
…and enable corresponding conformance tests (a2ui-project#1273)

* Implement glob pattern support for file path matching in A2uiCatalog and enable corresponding conformance tests

* Address review comments
Updates Angular's generate-examples.mjs script by using node:util parseArgs to accept some input parameters so it can be configured when invoking it.

---

Co-authored-by: sugoi-yuzuru <75597583+sugoi-yuzuru@users.noreply.github.com>
* Try publishing markdown-it
* Use strict typing for component props, and fix uncovered type bugs

* Create a BaseCatalogComponent that provides type safe props

* Add color to the icon schema

* Add placeholder to TextField schema and use in component

* Add posterUrl to Video schema and use in component

* Remove redundant options evaluation in ChoicePicker

* Ignore Angular cache directory in renderers/angular
…lve installation issues in corporate proxy environments (a2ui-project#1313)
* Integrate jsoncons for robust JSON schema validation and refactor catalog structure to use standard $defs.

* test: add conformance validation tests for custom catalogs in v0.8 and v0.9

* Move get_reachable_components to A2uiStreamParserImpl and implement schema-based reference field discovery
…xed iframes (a2ui-project#1318)

- add missing node_modules dependencies for basic server app
Findings from attempting to compile Angular explorer app with Google Closure Compiler.

TAG=agy
CONV=fd344886-05dd-4e5c-9cc7-f470c15f2360
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.