Create new endpoint to save style editor schema per content type#36070
Create new endpoint to save style editor schema per content type#36070dario-daza wants to merge 12 commits into
Conversation
|
Claude finished @dario-daza's task in 5m 23s —— View job PR Review
Overall the design is solid: the race condition fix (striped lock + re-read inside the lock) is correct, the normalization of Backend1.
Logger.warn(this, "No metadata patch found for " + idOrVar);The OpenAPI description explicitly says an empty body "is treated as a no-op — the current metadata is returned unchanged with HTTP 200." Every health-check or defensive caller that sends 2. Lock-timeout (
3. Other write methods in 4.
Frontend5.
#schemaLoaded = false;
effect(() => {
const contentType = this.$contentType();
if (contentType && !this.#schemaLoaded) {
this.#schemaLoaded = true;
untracked(() => this.#loadFromMetadata(contentType));
}
});If the parent ever passes a different content type to the same component instance (e.g., in a navigation flow where the component is not destroyed between routes), #loadedForId: string | null = null;
effect(() => {
const contentType = this.$contentType();
if (contentType && contentType.id !== this.#loadedForId) {
this.#loadedForId = contentType.id;
untracked(() => this.#loadFromMetadata(contentType));
}
});6. Spec tests hit the raw relative URL, not the interceptor-prefixed one
const METADATA_URL = `v1/contenttype/id/${MOCK_CONTENT_TYPE.id}/metadata`;
// ...
httpController.expectOne(METADATA_URL); // expects 'v1/...' not '/api/v1/...'The spec does not include Tests7. Concurrency test is non-deterministic
No other correctness or security issues found. The lock logic, permission checks, error handling, and OpenAPI spec are all correct. |
…or-schema-per-content-type
|
Pull Request Unsafe to Rollback!!!
|
…or-schema-per-content-type
…or-schema-per-content-type
…ed lock Moves the read-merge-save logic and DOT_STYLE_EDITOR_SCHEMA normalization out of ContentTypeResource into ContentTypeHelper#mergeAndSaveMetadata. The operation is now serialized per Content Type using a JVM-local striped lock (DotConcurrentFactory.getIdentifierStripedLock), re-reading inside the lock to prevent lost updates from concurrent PATCH requests on the same Content Type. Adds a concurrency integration test that asserts both keys survive when two threads patch simultaneously. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Pull Request Unsafe to Rollback!!!
|
Security ReviewNo high-confidence security findings on the changes in this PR. |
| if (!raw) { | ||
| return; | ||
| } | ||
| if (typeof raw !== 'string') { | ||
| console.warn('[StyleEditorBuilder] DOT_STYLE_EDITOR_SCHEMA is not a string; ignoring'); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Are different error cases?
Maybe can add console.warn in the first too
|
Question: is This new endpoint ( My concern is the interaction with the regular update path (
So if any client does a normal full-CT PUT without carrying
Mainly want to make sure the schema persisted here survives a subsequent normal CT save. |
Proposed Changes
Create the new
PATCH /v1/contenttype/id/{idOrVar}/metadataendpoint to avoid editing other Content Type information when creating and saving a Style Editor Schema for a Content Type.BE
PATCH /v1/contenttype/id/{idOrVar}/metadataendpoint to handle the metadata of the Content Types, specifically theDOT_STYLE_EDITOR_SCHEMAthat is related to the Style Editor Schema.FE
DotCrudServicewithhttp.This PR fixes: #35781
This PR fixes: #35979