Problem/Motivation
The block visibility condition response_status stores a status_codes list in config, but the schema type condition.plugin.response_status does not declare FullyValidatable and places no constraints on the values inside status_codes. Any integer (or, with no Choice constraint, any value coercible to integer) is currently accepted at the typed-config layer, even though the plugin's form only exposes 200, 403, and 404, and ResponseStatus::evaluate() is hard-coded around those three codes.
Proposed resolution
In core/modules/system/config/schema/system.schema.yml, on condition.plugin.response_status:
- Add
FullyValidatable: ~at the type level. - Add a
Choiceconstraint withchoices: [200, 403, 404]on each item of thestatus_codessequence, matching the codes built byResponseStatus::buildConfigurationForm().
Remaining tasks
Reviews.
User interface changes
None. The condition's checkbox form already restricts UI input to the supported codes; this change closes the gap for config that bypasses the form (config import, configuration actions, programmatic edits).
Introduced terminology
API changes
None.
Data model changes
Config schema constraints.
Release notes snippet
N/A
Issue fork drupal-3525392
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
penyaskitoComment #3
penyaskitoComment #4
penyaskitoComment #5
irafah commentedI will look at this issue.
Comment #7
irafah commentedI raised a merge request for this issue. The description doesn't have many details, so I just created a validation to make it fully validated, but let me know if anything else is needed.
The "Lint" tests passed, but there's a "DEFAULT: PHP 8.3 MySQL 8.0" test that failed. It seems to be related to something else, so please advise on how to proceed.
Thank you!
Comment #8
irafah commentedComment #9
smustgrave commentedSeems like something we will need test coverage for.
Comment #10
penyaskitoThis needs defining constraints in the config schema as explicit in the issue summary + tags, not any change to form validation.
Comment #11
rodrigoaguileraTriaging this I think this still a good issue for novices. For example you can look at following issue for inspiration
#3541535: Make the `field_config_base` structure fully validatable by adding a StringEqualsConcatenatedValuesConstraint
As @penyaskito mentioned is not about form validation but adding constraints. Feel free to open a new branch
The Drupal Contribution Mentoring team is triaging issues for Drupalcon Vienna 2025, and we are reserving this issue for Mentored Contribution during the event.
After October 17th, this issue returns to being open to all. Thanks!
Comment #13
penyaskitoComment #15
penyaskitoComment #17
penyaskitoComment #18
penyaskitoComment #19
borisson_Looks great, I don't know what else I'd ask for
Comment #21
alexpottCommitted and pushed 65c72ba0665 to main and f17f0cea804 to 11.x. Thanks!