Repository navigation
feat(ai): add UI5 Web Components support to the assistant - #396
Conversation
PetyaMarkovaBogdanova
left a comment
There was a problem hiding this comment.
Three things worth reviewing further though:
-
version on the displayed context vs. the enum-primed version can diverge.
_buildWebComponentContextBlock shows control.version (already normalized at source). But webcEnumRegistry.prime() may be called with webcTree.versionInfo.version as a fallback, which goes through the registry normalizer. If the tree's primary version differs from the element's own version, the AI sees one version but enums were resolved against another. Probably harmless in practice, but worth confirming the fallback path uses the same version that's shown. -
Slots reuse aggregation data shape.
_renderAggregationsSection(control.aggregations, 'Slots:') assumes webcMain formats slot data in the same shape as aggregations. If slot data arrives with different nesting, the section silently emits nothing. There's no test exercising a real slot payload through the prompt builder with web component data — the PromptBuilder tests likely use hand-crafted fixtures. -
Single-value enums are silently dropped.
parseEnumUnion requires count >= 2. A property constrained to exactly one valid value won't be annotated as an enum. This is a deliberate guard against false positives, but it means the AI won't see enum hints for those properties.
|
Point 1 and 2 fixed! |
Summary
The AI assistant treated UI5 Web Components (
ui5-*custom elements) like classicsap.mcontrols: it inventedsap.*-style APIs, guessed enum values, and had no event data. Web-component metadata the inspector had already computed was dropped before reaching the assistant's context.Changes
System prompt
Web component context block
isWebComponent,tag, andversionfrom the panel into the assistant snapshot.Events
Version normalization
Normalize the runtime-reported version to a clean semver before it is used for:
Multi-runtime wrapper pages can report a malformed version, e.g.:2.0.0/../../react@18.2.0
This broke enum resolution and allowed a path-traversal-shaped string to reach a
chrome.storagekey.Normalized at the source (
WebComponentsToolsAPI) and defensively at the registry boundary.Testing