Skip to content

Repoint saved Elastic Path commerce bindings for 0.4.0 - #442

Open
field123 wants to merge 4 commits into
masterfrom
chore/ep-binding-migration
Open

Repoint saved Elastic Path commerce bindings for 0.4.0#442
field123 wants to merge 4 commits into
masterfrom
chore/ep-binding-migration

Conversation

@field123

Copy link
Copy Markdown
Collaborator

0.4.0 publishes Elastic Path's own product and cart response shapes instead of the Shopify-lineage normalization the package inherited (ADR-0002), so every saved binding into the old shape resolves to nothing. Migration 259 repoints them server-side on project load, which removes the window between the platform repoint landing and the projects being fixed.

Rewrites only the deterministic renames. Paths whose replacement needs a judgement call are left alone and collected into a worklist logged with the project id, so the manual pass is generated rather than hunted for: price.value and the cart totals that were bare numbers, path, $ctx.cartData, the search-hit fields, and currentProduct.extensions.

Reads bundle.map directly rather than unbundling. A data token on a page's Open Graph image leaves a bare ObjectPath where the model allows only String, ImageAssetRef or TemplatedString, so unbundling such a project throws; a bundled migration keeps it loadable. That schema gap is upstream's and still open.

Expressions are free-form JavaScript, so the rewrite skips string literals, comments and template-literal text, recurses into ${} interpolations, stops at computed access, and is idempotent.

Also drops 257-add-code-component-subtree-prefetching-config.ts. The upstream merge renumbered it to 258 but kept the original, so check-bundle-migrations rejected every change under bundle-migrations/ and no new migration could be committed. It is byte-identical to its 258 copy, which still runs, and was never the tail of the sorted list, so no bundle carries its name. Closes #413.

Verified against a production storefront export (iso-storefront, 6,960 instances, stamped 257): 4 bindings repointed, 6 worklist entries, and the rewritten paths render real Elastic Path data in Studio. The 90 checked-in bundles change only their version stamp.

The upstream merge renumbered 257-add-code-component-subtree-prefetching-config
to 258 but kept the original alongside it, so check-bundle-migrations rejects
every change under bundle-migrations/ with "Invalid migration index" and no new
migration can be committed.

The file is byte-identical to its 258 copy, which still runs, and it was never
the tail of the sorted list, so no bundle has ever been stamped with its name.

Closes #413
@elasticpath/plasmic-ep-commerce-elastic-path 0.4.0 publishes Elastic Path's own
product and cart response shapes instead of the Shopify-lineage normalization it
inherited (ADR-0002), so every saved binding into the old shape resolves to
nothing. Migrating server-side removes the window between the platform repoint
landing and the projects being fixed.

Rewrites the deterministic renames only. Paths whose replacement needs a
judgement call — price.value and the cart totals that were bare numbers, path,
$ctx.cartData — are left alone and collected into a worklist logged with the
project id, so the manual pass is generated rather than hunted for.

Reads bundle.map directly rather than unbundling. A data token on a page's Open
Graph image leaves a bare ObjectPath where the model allows only String,
ImageAssetRef or TemplatedString, so unbundling such a project throws; a bundled
migration keeps it loadable.

Expressions are free-form JavaScript, so the rewrite skips string literals,
comments and template-literal text, recurses into ${} interpolations, stops at
computed access, and is idempotent.
Migrating a production storefront export surfaced five old-shape reads the
0.4.0 runbook did not list: the two search-hit fields beside _highlightedName,
_score, and currentProduct.extensions, which moved to Elastic Path's own
attributes.extensions. All are reported rather than rewritten.

Import passes an entity carrying neither projectId nor pkgId, so the worklist
logged no owner at all; it falls back to the entity id.
@field123

Copy link
Copy Markdown
Collaborator Author

Deploy ordering: do not deploy this ahead of the 0.4.0 publish and the platform repoint. platform/canvas-packages and platform/loader-bundle-env still pin ^0.2.0, so if 259 runs first, projects get bindings repointed to attributes.* while Studio still serves components publishing the old shape, and working projects render blank until the repoint lands.

Order: publish 0.4.0 → move both pins → deploy 259.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-wab-tests Runs the wab e2e tests in a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate bundle migration: two files numbered 257, and 257/258 are byte-identical

1 participant