fix: #3612553 Fix page_edit's stale component classifier and add a provider fallback to AiAssistant

Imports two verified fixes found during a live functional pass over all 29 AI Agent tools this module ships (see the Initialize issue context: https://www.drupal.org/project/varbase_ai_figma/issues/3612553).

Problem/Motivation

  1. CanvasPageEdit's page_edit tool (add/swap actions) could not place any vartheme_bs5 theme SDC component ("Unknown component" for e.g. card-icon), even though a full page build via create_canvas_page could. Its classify()/buildInputs()/declaredProps() were a stale copy of CreateCanvasPage's pre-SDC-support logic.
  2. AiAssistant::ask()/askJson() (backing improve_text, alt_text, meta_description, translate_page, ab_variants) resolved a single AI provider and returned an empty result on any failure, with no fallback. A site whose primary default provider is unhealthy (expired key, outage) fails all 5 tools even when another configured provider is healthy.

Proposed resolution

  1. Ported CreateCanvasPage's SDC-aware branch (sdc. id lookup + findSdcComponentId() bare-leaf-name lookup against Component config entities with source: sdc) into CanvasPageEdit::classify(), and the matching prop_field_definitions-based branches into buildInputs()/declaredProps().
  2. Refactored AiAssistant::resolveDefault() into resolveCandidates() (every configured default provider, de-duplicated, in priority order) so ask()/askJson() try every candidate before giving up.

Both reproduced and re-verified against a live site.

AI-Generated: Yes (implementation drafted and verified with Claude Code).

Checkpoints

  • File an issue about this project
  • Addition/Change/Update/Fix to this project
  • Testing to ensure no regression
  • Automated unit/functional testing coverage
  • Developer Documentation support on feature change/addition
  • User Guide Documentation support on feature change/addition
  • UX/UI designer responsibilities
  • Accessibility and Readability
  • Reviewed by a human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Update Release Notes
  • Release in MRs
Edited by Rajab Natshah

Merge request reports

Loading