Add comprehensive tests and CI for A2UI Composer#754
Add comprehensive tests and CI for A2UI Composer#754jacobsimionato merged 9 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request is a significant improvement, introducing a comprehensive testing suite with Vitest and React Testing Library, which was much needed. The bug fix for robust JSON parsing is also a critical enhancement, especially for handling varied LLM outputs. The overall restructuring of the project by moving the composer into its own tools directory is a good organizational change. I have one minor suggestion to improve the maintainability of the JSON parsing logic.
| try { | ||
| return parseRobustJSON(result); | ||
| } catch { | ||
| // If recursive call fails, return the first result | ||
| return result; | ||
| } |
There was a problem hiding this comment.
This logic for handling nested JSON is great. For better readability and to reuse the safe parsing utility you've already defined, you could simplify this try-catch block by using parseRobustJSONSafe. It achieves the same result (returning the string if the inner parse fails) but makes the intent more explicit.
// Attempt to parse the nested JSON string. If it fails, return the string itself.
return parseRobustJSONSafe(result, result);# Conflicts: # tools/composer/README.md
Summary
This PR introduces a robust testing infrastructure and a dedicated CI workflow for the A2UI Composer tool. It also includes critical bug fixes for JSON parsing of AI-generated content.
Key Changes
How to Test Locally
cd tools/composerpnpm test