Problem/Motivation
AiFigmaInstaller::seedContextItems() writes a grouped scope_id => [value, ...] array straight into the AI Context item's scope field. Since drupal/ai_context 1.0.0-beta5, #3586405 replaced that map field with a multi-value scope_id + value field, so the write now throws:
InvalidArgumentException: The scope field accepts only Field API deltas (scope_id + value). Use AiContextItem::setScope() for grouped arrays of scope_id => [value, ...].
The exception is caught and logged as a warning, so nothing fails loudly:
[warning] Could not seed AI Context items: The scope field accepts only Field API deltas ... [OK] AI Figma applied successfully
The recipe reports success while no AI Context item is ever created. A site builder gets a silently incomplete install.
Two write sites in src/AiFigmaInstaller.php: the update path at line 127 ($entity->set('scope', $scope)) and the create path at line 139 ('scope' => $scope inside create(), which routes through the same rejecting setter).
Steps to reproduce
- Install a site with
drupal/ai_figmaanddrupal/ai_context1.0.0-beta5 or later. - Apply the AI Figma recipe.
- The apply reports success. No AI Context items exist, and the log carries the warning above.
Reproduced in CI on varbase_ai_figma_base: the The recipe seeded the AI Context items scenario fails on I should see "Figma Build Rules", on two independent merge requests (!16 and !17), neither of which changes any seeding code.
Proposed resolution
Assign the grouped array through AiContextItem::setScope(), which accepts it on both sides of the beta5 change, guarded by method_exists() so an older ai_context without the method keeps working. The create path must drop scope from create() and set it on the returned entity before save(), because create() goes through the same setter.
This mirrors the fix already made in varbase_ai_figma, #3621159. That subclass fix was necessary but not sufficient: VarbaseAiFigmaInstaller extends this class, and the parent's own seeding is what still fails.
Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Release
User interface changes
- None.
API changes
- None. A protected helper is added; no signature changes.
Data model changes
- None.
Release notes snippet
- Seed the AI Context items through
AiContextItem::setScope(), so they are created against AI Context 1.0.0-beta5 and later instead of being silently skipped.
Issue fork ai_figma-3621167
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments