CEXT-6509 Manage Admin UI Component Additions and Removals During Application Upgrade - #626
Conversation
🦋 Changeset detectedLatest commit: a8ecc56 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
e301d3c to
4d99a20
Compare
…fallback Implements the dedicated POST .../refresh endpoint on lib-admin-ui and wires it into the Admin UI upgrade apply path. Falls back to re-registering on a 404, since not every Commerce instance exposes the route (PaaS controls its own upgrade cadence). Also extracts the __OW_NAMESPACE lookup into a reusable helper and trims caller-context from JSDoc.
iivvaannxx
left a comment
There was a problem hiding this comment.
I'm checking plan and apply logic but maybe you can act on the below comments now
29972b3 to
3f96584
Compare
iivvaannxx
left a comment
There was a problem hiding this comment.
An empty adminUi block should be treated the same as no Admin UI config. Then we can base register/unregister on whether components exist and drop the synthetic extension component.
Probably you can fix install requiring at least a component before running, seems it's a related concern.
This PR works around a lot, trying to respect that when it's not very correct IMO.
Description
Adds upgrade
plan/applysupport to the Admin UI domain so that application upgrades (not just fresh installs/uninstalls) reconcile the registered Admin UI extension to match the target configuration.planAdminUidiffs the installed baseline against the target config component-by-component — the top-levelmenu, per-entitygridColumns, per-idmassActions, and orderviewButtons— emitting oneadd/removeoperation per component that appeared or disappeared. Because Commerce registers the extension as a single unit (no per-component API), the operations collapse to one whole-extensionAdminUiExtensionActionon the plan:register(enable SDK → register).refresh(re-register to re-sync from the App Registry).unregister(validated, 404-tolerantDELETE).Also includes: a strict
unregisterExtensionForUpgradefor the upgrade removal path (throws on any non-404 failure, treats 404 as already-removed), arefreshExtensionwrapper (interim re-POST until CEXT-6559's/refreshships), and a gracefulblockedresult when the runtime namespace is unavailable rather than throwing and crashing the planning pass.Related Issue
CEXT-6509 — Manage Admin UI Component Additions and Removals During Application Upgrade.
Motivation and Context
The Admin UI domain could install and uninstall an app's extension, but an upgrade had no way to reconcile Admin UI state when the config changed between versions. A developer who added a menu entry, dropped an order-grid column, or added a mass action in a new app version would leave the merchant with an admin that no longer matches the deployed code. This change makes upgrades converge the registered extension to exactly match the target config, as a sibling of the merged webhooks upgrade (#621) and the in-flight eventing upgrade (#624).
How Has This Been Tested?
planandapplylayers:plan:register/refresh/unregisterclassification, per-component add/remove detection, modification-skip (no op for a component changed on both sides), empty-block no-op, duplicate-id disambiguation, and ablockedresult when__OW_NAMESPACEis unavailable.apply: enable-then-register onregister, re-register onrefresh, strictunregister(throws on non-404, tolerates 404), no-op, and cleanup-resource reuse from the plan.pnpm --filter @adobe/aio-commerce-lib-app test),typecheckclean,lint(Biome + Redocly) clean.order.gridColumns→ columns removed viarefresh;order.gridColumns→ columns re-added viarefresh;adminUiblock → extensionunregistered (menu + columns gone);registered fresh;product.gridColumns(multi-entity) and an ordermassAction(array component) → both appeared;Screenshots (if appropriate):
N/A
Types of changes
Checklist: