[Tracker]
Update Summary: [One-line status update for stakeholders]
Short Description: [One-line issue summary for stakeholders]
Check-in Date: MM/DD/YYYY
Metadata is used by the AI Tracker. Docs and additional fields here.
[/Tracker]
Problem/Motivation
The config schema for Guardrail and Guardrail Set config entities in ai.schema.yml is incomplete. Several properties and plugin-specific schema definitions are missing, which causes strict config schema validation to fail.
The following issues exist in the current schema:
- The
ai.ai_guardrail.*config entity is missing theguardrail_settingsproperty. Every guardrail config entity stores its plugin-specific settings under this key, but the schema does not declare it. - There is no
ai.guardrail.settings.*wildcard fallback schema for guardrail plugin settings. This is needed as the base type for dynamic plugin-specific schema resolution. - The existing
RegexpGuardrailplugin (regexp_guardrail) has no correspondingai.guardrail.settings.regexp_guardrailschema definition — itsregexp_patternandviolation_messageconfiguration keys are completely undeclared. - The existing
RestrictToTopicplugin (restrict_to_topic) has no correspondingai.guardrail.settings.restrict_to_topicschema definition — itsvalid_topics,invalid_topics, message overrides, and LLM provider/model configuration keys are completely undeclared. - The
ai.ai_guardrail_set.*config entity is missing thestop_thresholdproperty. The entity stores this float value but the schema does not declare it.
Steps to reproduce
- Enable the AI module and create any guardrail config entity (e.g. a RegexpGuardrail or RestrictToTopic guardrail).
- Run config validation with strict schema checking enabled (e.g. via kernel tests with
$strictConfigSchema = TRUE). - Schema validation errors will appear for the missing properties and plugin settings.
Proposed resolution
Add the missing schema definitions to config/schema/ai.schema.yml:
- Add
guardrail_settingstoai.ai_guardrail.*with a dynamic type reference:ai.guardrail.settings.[%parent.guardrail] - Add
ai.guardrail.settings.*as a wildcard fallback mapping - Add
ai.guardrail.settings.regexp_guardrailwithregexp_patternandviolation_message - Add
ai.guardrail.settings.restrict_to_topicwithvalid_topics,invalid_topics, message overrides,llm_provider,llm_model, andllm_config - Add
stop_threshold(float) toai.ai_guardrail_set.*
AI usage
[x] AI Assisted Issue
Split out from #3582856 (comment #5 / comment #9) — the schema fixes were discovered while adding the InputLengthLimit guardrail plugin and should be backported independently as a bug fix.
Issue fork ai-3583785
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
Comment #2
ahmad khader commentedComment #4
ahmad khader commentedMoved to RTBC status, as it has already been reviewed in the parent issue. This MR is being backported independently as a bug fix.
Comment #5
marcus_johansson commentedGetting merged