chore: rsvpFormFields BE shape migration shim#164
Merged
Conversation
Adds transitional dual-shape support for rsvpFormFields while ESP BE PR #903 (https://git.corp.adobe.com/wcms/events-service-platform/pull/962/files sibling: PR #903) is in flight. The BE is moving from the legacy { required: string[], visible: string[] } shape to the new { fields: [...] } shape — a breaking change. Until #903 ships to dev/stage/prod and stored events are normalized, EMC must work against both shapes. Save side (useEventFormSave.ts): - isRsvpFormFieldsRejection() detects 400 responses whose validation errors point at rsvpFormFields (Ajv errors don't include the field name in `message`, so we also walk `errors[].instancePath`). - toLegacyRsvpFormFieldsPayload() rewrites the new {fields} payload to the legacy {required, visible} shape. Per-field `options` overrides aren't representable in the legacy shape and are dropped with a console.warn so QA can see the loss. - Update and create branches send the new shape first and retry with the legacy payload on rsvpFormFields-flavored 400s. Read side (eventFormMappers.ts): - readRsvpFormFields() adapts either GET shape to the array form the form state expects. Without it, events stored under the legacy shape would open with an empty RSVP fields list. All temporary code is tagged `rsvp-shape-migration` so the cleanup after #903 ships is a clean grep-and-delete; the structural fixes from the prior `fix: rsvp form fields handling` commit are permanent and must stay (see header comment in useEventFormSave.ts for the checklist). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
qiyundai
approved these changes
May 26, 2026
Collaborator
|
Is the revert requirement time sensitive? Or we can rely on this shim to be forward compatible? |
Collaborator
Author
I'd say revert should be done once BE finishes migration. Currently without this fallback the regular event creation flow is failing. Merge this PR only if BE https://git.corp.adobe.com/wcms/events-service-platform/pull/903 is not merged to dev and QA is blocked. |
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.
Summary
Transitional dual-shape support for
rsvpFormFieldswhile ESP BE PR #903 is in flight. PR #903 changes the schema from the legacy{ required: string[], visible: string[] }to the new{ fields: [...] }— a breaking change. Until #903 ships everywhere and stored data is normalized, EMC must work against both shapes.Save side (
useEventFormSave.ts):{ fields }shape first.400whose validation errors point atrsvpFormFields, retry with the legacy{ required, visible }payload.optionsoverrides are not representable in the legacy shape and are dropped with aconsole.warnso QA can see the loss.Read side (
eventFormMappers.ts):readRsvpFormFields()adapts either GET shape to the array form the form state expects.Why stacked on
bugfixes/configsThis PR is stacked on PR #162 (
bugfixes/configs) which contains the structural fixes that must remain after this migration is reverted (speciallyHandledFieldsentry,Array.isArrayguard,result.error.messageextraction). Keeping them in separate PRs means:After #162 merges to
dev, GitHub will auto-retarget this PR todev.Cleanup after BE migration
All temporary code is tagged
rsvp-shape-migration. Once ESP #903 has shipped to dev/stage/prod and stored events return the new shape on GET, revert this PR —git revertof the merge commit ondevremoves everything tagged and nothing else. The cleanup checklist is in the header comment ofuseEventFormSave.ts.Test plan
rsvpFormFieldspopulated against a pre-#903 ESP BE — observe theconsole.warnand verify the legacy retry succeeds.🤖 Generated with Claude Code