wisewigdocs

Applying a theme migration

compareThemeLayouts() reports layout differences; applyThemeMigration() turns that report into a next draft only after every loss or addition has an explicit decision. applyThemeMigrationToPages() applies the same resolved decisions to a validated page collection without changing stable page IDs, routes, or metadata.

  • Missing or incompatible current slots require discard before their content is omitted.
  • Required new slots require add; optional new slots require either add or skip.
  • In a page collection, every add decision also names the destination pageId; the framework never guesses where newly introduced layout content belongs.
  • Added sections are initialized from the component’s schema-approved default content.
  • The returned result is a draft only. In the multi-page Cloudflare path, switchThemePagesDraft() atomically saves the migrated pages resource and target theme pin with independent optimistic versions. A stale version rolls both writes back.
  • Managed Astro exposes only developer-registered releases through GET /api/admin/themes. Confirmed POST requests resolve explicit decisions in Astro and dispatch the validated collection to the selected tenant Worker.
  • Appearance-only changes have no missing, added, or incompatible slots. Layout changes identify stable slot IDs whose content would be discarded or initialized.
  • Publishing is separate, so the owner can inspect the server-rendered draft before making the new theme public.

The initial implementation covers the current typed component registry. Future component mappings can add explicit conversion decisions rather than silently coercing incompatible content.