Summary
Patternkit 9.1.3 adds configurable validation when editing and saving pattern
content, validity stamps for eligible published placements, and background
scanning of existing published block translations.
The new controls help sites improve schema compliance without introducing the
earlier render-time enforcement that was reverted for upgrade compatibility.
Existing invalid content can remain in the database; upgrading does not repair
that content or introduce a remediation dashboard.
Who is affected
| Audience | Impact and action |
|---|---|
| Site builders and administrators | Review the default-on enforcement setting, run database updates, and keep cron operating. |
| Content editors | Invalid input can block saving. Correct reported errors or follow the warning-and-confirmation flow when enforcement is disabled. |
| Pattern authors | Check required-string expectations and the supported token/placeholder boundaries. |
| Integration developers | Account for programmatic save behavior, revision context, and parent-resolution states when consuming stamps. |
What changed
Editor validation
The Prevent saving invalid pattern content setting is enabled by default.
It controls validation enforcement in the pattern configuration form and its
JSON Editor submission flow.
When enabled, validation errors block the form submission. When disabled,
the editor shows validation warnings on the first failed submission and allows
an explicit second submission with issues. The status report warns that
enforcement is disabled.
Administrators can change the setting in Patternkit's advanced settings.
The configuration key is patternkit.settings:render_validation_on_save.
Despite its name, it does not re-enable the reverted render-time enforcement.
Programmatic saves are not universally rejected by this setting. The entity
save integration logs invalidity and records eligible validity stamps rather
than throwing an enforcement exception from the save hook. Import and custom
save workflows should not treat the setting as a guarantee that all persisted
content conforms to its schema.
Validity stamps and background scanning
Update hooks add the validity-stamp table and placement metadata. Save-time
stamps use the pattern revision associated with the placement. Cron scanning
incrementally checks published block translations against the current default
pattern schema and writes its results.
These are different validation contexts. A cron result is not necessarily a
validation result for the older pattern revision a placement currently renders.
The infrastructure supports later remediation and render-policy work; those
future consumers are not introduced by this release.
Required actions by audience
Site builders and administrators
- Run the normal database-update and cache-rebuild steps for the module upgrade.
Pending hooks depend on the site's starting version and update history. - Review the validation setting before editors resume work. The post-update
enables it when no value exists and preserves an explicitly configured value. - Review validation warnings and remediate content that does not meet its
applicable schema. Temporarily disabling form enforcement allows an explicit
save with issues. It does not make that content valid. - Keep cron operating so background validity scanning can progress.
Pattern authors
Required strings
The JSON Editor treats empty required string fields as validation errors.
The JSON Schema required keyword checks whether a property exists, not whether
its string value is nonempty. Patternkit adds an editor check for empty or
whitespace-only required strings when a minLength constraint is not already
providing the nonempty check.
Use explicit schema constraints when the server must also reject empty values.
The constraint minLength: 1 rejects an empty string, but does not by itself
reject whitespace-only content. Do not assume the editor's additional required
field check changes the server's interpretation of JSON Schema.
Tokens and placeholders
Drupal tokens and supported editor placeholders can be stored in
format-constrained fields before their final values are available. Server-side
token handling bypasses the supported format check for recognized tokens;
it does not bypass regex pattern constraints or certify the value that a
token will eventually produce. Client and server recognition are not identical
for every placeholder shape.
The server also bypasses these format checks for empty strings. Declaring a
property required does not disable that bypass, so schema authors who need a
nonempty value must express that constraint separately. Submission enforcement
still follows the editor setting described above.
Integration developers
Reading validity results
Inject Drupal\patternkit\Validation\ValidityStampWriterInterface, which is
aliased to the patternkit.validity.stamp_writer service. Its getStamp()
method takes a block entity ID and language code and returns the stored row,
or NULL when no stamp exists. Absence of a stamp is not a valid result.
A stamp records the block and pattern revision IDs, validation result, token
presence, timestamp, and source. Inspect its revision IDs and source before
using it as evidence about current content. Save and cron checks use the
different schema contexts described above; a stored result is not universal
proof of validity for every placement.
Interpreting parent resolution
Parent resolution is separate from content validity:
| Interface constant | Meaning |
|---|---|
PARENT_PENDING |
A layout host has not yet been confirmed. This alone does not prove the block is orphaned. |
PARENT_RESOLVED |
A layout host is identified and its entity metadata is populated. |
PARENT_NOT_APPLICABLE |
The block is config-placed and has no layout host to resolve. |
The interface also provides stamp writing, deletion, and scan-candidate queries.
Passing NULL for parent resolution preserves an existing state during an
update. A new row defaults to pending. Use the interface constants rather than
interpreting parent resolution as a Boolean. Internal pending-save result and
store classes are implementation details, not the integration entry point.
Known limitations
- Client and server validators do not have universal parity for every schema
rule. Some required-string cases remain stricter in the editor. - Token support for format-constrained strings does not make token values valid
against arbitrary regexpatternconstraints. See the existing token issue. - Cron validates against the current default schema, not every placement's
pinned revision, and may discover blocks without layout-placement context. - Lifecycle cleanup and placement-resolution follow-ups need separately reviewed
public coverage. Their planned tooling is not delivered by this record.
References
Implemented in 9.1.3
- Validity-stamp infrastructure and save-time enforcement
- Client-side validation toggle
- Parent entity metadata
- Config-placement resolution state
- Required-string editor validation
Related behavior and upgrade context
Follow-up work
The release establishes validity tracking and configurable save-form controls.
Placement-context resolution, lifecycle cleanup, broader remediation tooling,
and later render-policy work remain separate follow-ups. Their completion is
not implied by this record.