Loading
feat: #3633456 Tag every AI Media request for Drupal AI Logging and observability
Issue: #3633456
AI Media calls already carried ai_media, ai_media_generator:<id> and the media type, but not the step, so AI Logging and AI Observability could not tell the media call from the "Ask AI" name, alt or title calls.
What changed
AiMediaRequest::tags()addsai_media:<generator>andai_media_step:<step>(generate,name,altortitle). The existing tags stay, so moderation rules and filters on them keep working.- The tags travel with the call; the AI module's provider proxy sets them with
setTag()(asetTag()made before the call would be reset by the proxy). - Docs: the tag table, and how to filter AI Logging and AI Observability by these tags. The Usage note on the Providers settings names them.
Tested
- Kernel
AiMediaRequestTest::testTagsAndParentIdchecks the new tags on the image call and the alt call, as the provider reports them. Passes locally on Drupal 11.4 (7 tests). - Dev site (Varbase 11, AI Logging 1.3.3): one SVG with OpenAI gpt-4.1-mini; the AI Logs entries carry
chat, ai_media, ai_media:svg, ai_media_step:generate, ai_media_generator:svg, ai_media_media_type:svg_ai_gen. - phpcs (Drupal, DrupalPractice) and phpstan level 0 clean; cspell clean on the changed files.
AI-Generated: Yes. Drafted and tested with Claude Code.
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
- UX/UI designer responsibilities
- Readability
- Accessibility
- Performance
- Security
- Documentation
- Reviewed by a human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release
Edited by Rajab Natshah