Skip to content

Conversation

@nan-yu
Copy link
Collaborator

@nan-yu nan-yu commented Jan 27, 2026

Description

Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.

List which issues are fixed by this PR. For larger changes, raising an issue first helps reduce redundant work.

Pre-launch Checklist

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

Copy link
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 schema bundling and validation capabilities, which is a significant feature enhancement. The changes include a new build hook for packaging schema files, a robust A2uiSchemaManager for handling schema loading and bundling, and an A2uiValidator class. The addition of comprehensive unit and integration tests is commendable and ensures the reliability of the new functionality. I've identified a critical issue related to a missing import that would lead to a runtime error, a high-severity issue concerning error silencing that could complicate debugging, and a couple of medium-severity suggestions for code cleanup and correctness. Overall, this is a well-structured contribution.

role_description: str,
workflow_description: str = "",
ui_description: str = "",
selected_components: List[str] = [],
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The type hint List is used here but is not imported, which will cause a NameError at runtime. Since the project requires Python 3.10+, you can use the built-in list type hint instead.

Suggested change
selected_components: List[str] = [],
selected_components: list[str] = [],

Comment on lines 103 to 104
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This except Exception: pass block silently ignores all errors during schema loading from package resources, including potential JSON decoding errors or permission issues. This makes debugging very difficult. This pattern is repeated for other fallback mechanisms in this method. It's better to log the exception to provide visibility into why loading failed before proceeding to the next fallback method.

Suggested change
except Exception:
pass
except Exception as e:
logging.debug("Could not load schema '%s' from package: %s", filename, e)

Comment on lines 67 to 69
raise FileNotFoundError(
f"Could not load package resource {filename} in {self.package_path}: {e}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Wrapping all exceptions in FileNotFoundError can be misleading, especially for issues like JSON decoding errors or permission problems. Raising a more general IOError for unexpected failures would provide a clearer indication of the problem's nature and improve debuggability.

Suggested change
raise FileNotFoundError(
f"Could not load package resource {filename} in {self.package_path}: {e}"
)
raise IOError(
f"Could not load package resource {filename} in {self.package_path}: {e}"
) from e

self,
schema: Dict[str, Any],
source_properties: Dict[str, Any],
mapping: Dict[str, str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The mapping parameter is unused within the _inject_additional_properties function. It should be removed to simplify the method signature and improve code clarity.

@nan-yu nan-yu force-pushed the a2ui-validator branch 4 times, most recently from 45abdbb to 283be8d Compare January 28, 2026 18:31
- Add a base InferenceStrategy class
- Add PackSpecsBuildHook to copy JSON schemas into the package during
  build time.
- Update pyproject.toml to include assets and configure the build hook.
- Implement A2uiSchemaManager for robust schema loading,  pruning, and
  prompt generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant