Repository navigation
Fix control panel invariants failing on partial updates - #2072
Merged
Merged
Conversation
|
@sneridagh thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
davisagli
approved these changes
Oct 25, 2026
Member
|
@jenkins-plone-org please run jobs |
1 similar comment
Member
|
@jenkins-plone-org please run jobs |
davisagli
force-pushed
the
fix-controlpanel-invariants
branch
from
November 1, 2026 19:54
8ca23a8 to
d7800c5
Compare
davisagli
approved these changes
Nov 1, 2026
Run the schema invariants with the registry proxy as context, so omitted fields resolve to their stored values instead of failing to adapt the portal to the schema.
davisagli
force-pushed
the
fix-controlpanel-invariants
branch
from
November 1, 2026 20:07
d7800c5 to
90091c6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A partial
PATCHto@controlpanels/<name>fails with HTTP 500 when the control panel schema has an@invariantthat reads a field the request omits:ControlpanelDeserializeFromJsonvalidates invariants through z3c.form'sIManagerValidatorwith only the submitted values and the portal as context. For omitted fields, z3c.form'sDatawrapper tries to adapt the context to the schema, which fails for the portal.Fix
Pass the registry proxy from
registry.forInterface(...)as the validator's context. The proxy provides the schema, so invariants read the stored registry values for omitted fields. The response format is unchanged: one{"message", "error"}entry per invariant error, masked asValidationError.Tests
New
test_controlpanel_deserializer.py, with a registry schema that has two optionalIntfields and an invariant comparing them:BadRequestwith a single error.Both tests fail with the
TypeErrorabove without the fix. The full suite passes locally (1429 tests).Found while reviewing #2071, which has the same issue but keeps this fix out of scope.
Note for reviewers
#2071 adds a different
src/plone/restapi/tests/test_controlpanel_deserializer.py, with tests for partial updates, unknown fields, field errors and invariants. Whichever PR merges second needs its tests merged into that file.