Skip to content

PROD-2350: match page zones and template sections by ID, not position/name - #198

Merged
5PK merged 1 commit into
mainfrom
PROD-2350
Jul 29, 2026
Merged

PROD-2350: match page zones and template sections by ID, not position/name#198
5PK merged 1 commit into
mainfrom
PROD-2350

Conversation

@5PK

@5PK 5PK commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes PROD-2350: page zones were mapped to target template sections by array position, so a page push silently misplaced content whenever the source and target templates listed their sections in a different order.
  • Adds SectionMapper (same pattern as ModelMapper/ContainerMapper) to persist source↔target pageItemTemplateID pairs, seeded from the confirmed savePageTemplate response and backfilled when an up-to-date template is skipped.
  • translateZoneNames, the template-pusher section payload builder, and TemplateMapper.hasTemplateChanged all now prefer this ID mapping — falling back to a direct name match (and finally position, for translateZoneNames) only when no mapping exists yet (bootstrap / brand-new section).
  • Also closes two related latent bugs found along the way: renaming a section on the source could cause the template pusher to create a duplicate section on the target instead of updating the existing one, and the old reference-name-sort comparison in hasTemplateChanged could produce a false "unchanged" verdict if two sections traded reference names and item orders at once.

Test plan

  • npx tsc --noEmit — clean
  • npx jest — 104 suites / 1870 tests pass
  • New regression test reproduces the exact PROD-2350 repro (reordered-but-same-named sections) and confirms correct zone placement
  • New tests cover: SectionMapper CRUD, template-pusher section-ID seeding/backfill/bootstrap-fallback/rename handling, and the hasTemplateChanged false-negative fix

🤖 Generated with Claude Code

…/name

Page zone content was translated to target template sections by array
position, so pages silently landed content in the wrong zone whenever
source and target templates defined their sections in a different order.
The same reference-name matching also affected template-pusher's section
payload construction and its up-to-date change detection, risking
duplicate sections or a missed update whenever a section was renamed.

Adds SectionMapper (mirroring ModelMapper/ContainerMapper) to persist
source/target pageItemTemplateID pairs, seeded from the confirmed
savePageTemplate response and backfilled when an up-to-date template is
skipped. translateZoneNames, the template payload builder, and
hasTemplateChanged now prefer this ID mapping, falling back to a direct
name match (and finally position) only when no mapping exists yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@5PK
5PK merged commit 4b73f3c into main Jul 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants