fix(push-publish): apply field data-type change on the receiver (#36636) - #36746
fix(push-publish): apply field data-type change on the receiver (#36636)#36746nollymar wants to merge 2 commits into
Conversation
|
Claude finished @fabrizzio-dotCMS's task in 4m 36s —— View job Code Review — PR #36746
New IssuesNo blocking issues found. The change is small, well-scoped, and backed by meaningful tests. Notes (non-blocking):
Observations
Nothing here blocks merge. • |
10740da to
cf9be88
Compare
cf9be88 to
2a24c8a
Compare
When a Content Type field is deleted on the sending instance and immediately re-created with the same velocity variable but a different data type (e.g. Text → Whole Number), push publishing silently discarded the change on the receiver. The receiver's ContentTypeAPIImpl.transactionalSave diffs incoming fields against existing ones by id. But DeterministicIdentifierAPIImpl.resolveName was seeding the field id with variable + typeName only, so a re-created field kept the same id as the old one and was routed through the update branch of FieldFactoryImpl.dbSaveUpdate — which overwrites the incoming dataType/dbColumn with the existing field's values. Include the field's dataType in the deterministic id seed so a same-variable, different-dataType field gets a different id and is routed through delete-then-insert instead. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2a24c8a to
9cfca2b
Compare
Summary
Fixes #36636.
DeterministicIdentifierAPIImpl.resolveNamenow includes the field'sdataTypein the id seed (variable : typeName : dataType.value). When a Content Type field is deleted on the sender and immediately re-created with the same velocity variable but a different data type, the receiver'sContentTypeAPIImpl.transactionalSavenow sees the incoming field as a different id from the old one and routes it through delete-then-insert — instead of update, which would overwrite the incomingdataType/dbColumnwith the existing field's values inFieldFactoryImpl.dbSaveUpdate.Test plan
DeterministicIdentifierAPITest— added coverage for the new dataType-in-seed input.myFieldon the sender and content records carrying values for it.myFieldand re-create it with a different data type. Set a new value on the content.Data impact (unchanged from the issue's analysis)
Changing a field's data type is inherently destructive for that field's stored content:
FieldFactoryImpl.nextAvailableColumn, so existing values in the old column are not migrated.CleanUpFieldReferencesJobwipes the old column and thecontentlet_as_jsonentry for that variable when the field is deleted, so the sender loses the pre-existing values at that moment.This PR does not attempt to migrate values; it just ensures the data-type change is applied on the receiver instead of silently dropped.
🤖 Generated with Claude Code