Repository navigation
Publishing: Validate segment values on scheduled publish, publish with descendants and create/update-and-publish (closes #24558) - #24559
Conversation
IsPropertyDataValid only validated the default segment, so an invalid value in another segment was published by every path that relies on it alone: scheduled publish, the descendants of a branch publish, and create/update-and-publish. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Claude finished @Zeegaan's task in 1m 4s —— View job PR ReviewTarget: Before this PR,
CriticalNone. ImportantNone. Suggestion
What I checked
Nice, focused fix with good test coverage. 👍 |
There was a problem hiding this comment.
🟡 Changes recommended
Validation skips invalid culture-specific block values in non-default segments when CultureImpact.All is used, allowing invalid content to pass and requiring a context-preservation fix with a regression test.
1 open issue
What changed in this PR
This PR addresses #24558 by extending shared publishing validation to non-default segment values, covering scheduled publishing, branch descendants, and create/update-and-publish flows.
Changes:
- Validates segment overrides within the affected cultures while preserving default-segment mandatory rules.
- Adds unit tests for valid and invalid segment values and culture filtering.
- Adds integration tests for scheduled publishing and branch-descendant rejection.
| File | Description |
|---|---|
tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Services/PropertyValidationServiceTests.cs |
Tests segment validation and exclusion of unaffected cultures. |
tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Publish.cs |
Tests rejection of invalid segments during scheduled and descendant publishing. |
src/Umbraco.Core/Services/PropertyValidationService.cs |
Adds non-default segment checks to shared publishing validation. |
Review effort: Balanced
|




Prerequisites
If there's an existing issue for this PR then this fixes #24558
Fixes #24558
Description
A value in a non-default segment that fails the property's validation was published by a scheduled publish, for the descendants of Publish with descendants, and by create-and-publish / update-and-publish. The same invalid value in the default segment stopped the publish.
Cause
PropertyValidationService.IsPropertyDataValidonly validated the default segment. It is the check the content service runs before publishing, so every path that relies on it alone let invalid segment values through. Publish and Save and publish were only protected becauseContentPublishingServiceruns a separate, segment-aware validation first. Publish with descendants runs that validation on the page you publish from, which is why only that page was validated.Change
IsPropertyDataValidnow also reports a property as invalid when it holds an invalid value in a non-default segment of the cultures being published. It follows the existing rules:Behaviour change
Anything that publishes through
IContentService.Publishdirectly is now rejected withFailedPublishContentInvalidwhen a segment value is invalid.Tests
PropertyValidationServiceTests: invalid and valid segment values for segment and culture+segment variation, and segment values of other cultures being ignored.ContentPublishingServiceTests: scheduled publish and a branch descendant, for both variations.PropertyValidationService.Not covered by a test: the create-and-publish and update-and-publish endpoints. They go through the same check.
How to test
ISegmentServicethat returns a "VIP members" segment.^[A-Z].*$.For Publish with descendants: give a child page an invalid VIP members value, and publish its parent with descendants including unpublished pages. The child is reported as invalid and is not published.
The issue is also labelled for 17 and 18. This PR only targets v19.
🤖 Generated with Claude Code