Repository navigation
Pin the widget dashboard packages to the 202609031004 dev release - #51939
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so: 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
202609031004, plus dataviews so their types unify
8d728a9 to
f424e39
Compare
Runtime validationTested across both ends of the supported WordPress range and four Gutenberg states, on the two pages that consume the polyfill bundle. The pin is identical in every cell, so any differences between them come from runtime rather than this change. The Gutenberg rungs are chosen to sit on either side of the thresholds in
No breakage in any cell. Provenance read with the package provenance module in the Debug Helper plugin; "idle" means registered but unused on that screen. The per-package thresholds resolve independently, which the 7.0.4 + 23.5.0 cell shows cleanly: Where the pin applies, and where it does notOf the three pinned packages, only one is externalized.
In the two cells with Gutenberg 23.9.0, the polyfill stops deregistering the module, and Gutenberg's copy wins, with script modules being first-wins. That last case is benign. Both copies export the same six symbols, The Gutenberg 23.8.0 cells are the mirror case and confirm the deregistration path: there Icons
Two observations unrelated to this changeThe Traffic summary metric values render at a smaller type size on WP 7.0.4 with Gutenberg off, and larger everywhere else. It follows whichever runtime provides Gutenberg 23.5.0 cannot run on WordPress 7.1 at all. It fatals with Environment restoredBack on WP 7.1, Gutenberg deactivated at 23.9.0, major Core auto-updates re-enabled. |
f2a372d to
64397ad
Compare
64397ad to
d26d7e1
Compare
its lock/unlock pair cannot span a stable and a prerelease copy
d26d7e1 to
a8060e7
Compare
kangzj
left a comment
There was a problem hiding this comment.
Tests well for me 👍 Took it for a spin on the docker env (WP 7.1, Gutenberg 23.9.0) with Gutenberg on and off - the dashboard renders, resize / move / widget options / inserter all work and the layout survives a reload, and with Gutenberg off @wordpress/widget-primitives is served from the polyfill bundle like the description says. No console errors in any run. Approving, with a couple of suggestions - two inline, and two here because there's no diff line to hang them on.
One small thing on the description: "collapses @wordpress/private-apis onto a single copy" isn't quite what the lock ends up with - there are still two copies (1.54.0 for wp-build-polyfills and charts, which declare it under devDependencies), more on that inline.
Suggestions with nowhere to anchor
- widget-dashboard 0.7.1 starts honouring
gridSettings.columns(0.6.0 hard-coded 4, 0.7.1 runs it throughresolveDashboardColumnCapwith floor 1 and no ceiling), anduseDashboardGridSettingspasses the stored preference straight through -normalizeGridSettingsonly snapsrowHeight. I tried it: adashboardGridSettingspreference withcolumns: 2re-lays the whole dashboard out at 2 columns on this branch (Top pages goes full width, Top referrers takes half), where trunk ignores it. Nothing in PA ever wrotecolumnsas far as I can tell so there's no stale data out there, but the placements are authored for 4, so I'd pincolumnsin the hook rather than leave it to whatever is in user meta. Not a blocker, just feels like a cheap guard. - Only the root manifest moved - 86 nested
link:manifests (packages/externals,packages/fields,packages/widgets-toolkit,routes/*,widgets/*) still saywidget-dashboard 0.6.0/widget-primitives 0.6.0/dataviews 18.1.0. pnpm doesn't care, but the last group bump (#51701) updated them in lockstep, and hello-world is what people copy from, so probably worth keeping them in sync (or a note on why not).
Testing - docker env on this PR head (a8060e7), Playwright at 1440x900, "before" build = merge base 1f94226.
| What was checked | What happened | Status |
|---|---|---|
pnpm install --frozen-lockfile on the PR head |
Lock in sync with the manifests + pnpmfile hook, supply-chain policy check passes | ✅ |
jetpack build --deps packages/premium-analytics, plus my-jetpack / plugins/jetpack / plugins/premium-analytics |
Clean builds, polyfill export-contract and boot-asset validators pass | ✅ |
premium-analytics tsgo --noEmit |
No errors | ✅ |
| premium-analytics jest | 155 suites / 3040 tests pass | ✅ |
wp-build-polyfills node --test |
Pass | ✅ |
| Storybook vitest (js-packages/storybook) | 251 files / 1266 tests pass, zero Cannot unlock |
✅ |
| Stats v2 dashboard, Gutenberg 23.9.0 active | 11 widgets render, 0 page/console errors; provenance shows widget-primitives / boot / route from Gutenberg | ✅ |
| Stats v2 dashboard, Gutenberg deactivated | 11 widgets, 0 errors; @wordpress/widget-primitives served from jetpack-wp-build-polyfills/build/modules/widget-primitives, boot / route / a11y from core |
✅ |
| Customize → resize Traffic summary (drag handle +120px) | 416px → 632px, snaps to one grid row | ✅ |
| Customize → move Top pages after Top referrers (mouse drag, and keyboard Space / → / Space) | Order becomes Traffic summary > Top referrers > Top pages > Devices with both sensors | ✅ |
| Widget options popover, Add widget inserter | Popover shows the width options, inserter lists the widgets with live data | ✅ |
| Done → reload | One POST /wp/v2/users/me, resized height and new order persist |
✅ |
| Polyfill bundle served to the other 11 consumers | Asset hashes for private-apis / rich-text / theme / views / notices / boot / route / a11y identical before and after; only widget-primitives changes (36f1b5f4… → a2955fa4…) and it exports the same 6 symbols as 0.6.0 |
✅ |
| Another wp-build page (Newsletter), Gutenberg on and off | Loads fine, only a pre-existing jetpackConfig is missing console error that is there on trunk too |
✅ |
Stored dashboardGridSettings.columns: 2 preference |
Trunk ignores it, this branch lays out at 2 columns (see suggestion above); default preference unchanged at 4 | ✅ |
Forced wp-private-apis polyfill path (WP < 7.1) |
Env is WP 7.1 so not exercised live; bundle hash unchanged from trunk (0881669ca00af9ea3176) |
|
| Bundle size | dashboard route 1578 → 1593 KB min (+15 KB), externals 1879 → 1868 KB, whole build 55.7 → 55.3 MB | ✅ |
Evidence - dashboard on the merge base vs this PR, and the customize flow recorded on the PR build.
| Before (trunk 1f94226) | After (PR a8060e7) |
|---|---|
![]() |
![]() |
Thanks Damián!
| if ( pkg.dependencies?.[ '@wordpress/private-apis' ] ) { | ||
| pkg.dependencies[ '@wordpress/private-apis' ] = '1.54.2-next.v.202609031004.0'; | ||
| } |
There was a problem hiding this comment.
This lifts every stable consumer in the repo onto the dev release (mu-wpcom, the jetpack plugin's admin-ui / edit-post peers etc), and it still leaves two copies in the lock because devDependencies aren't touched - wp-build-polyfills and charts stay on 1.54.0. Which is actually what we want for the polyfill bundle I think (1.54.2-next dropped @wordpress/reusable-blocks from the allowlist, so the stable reusable-blocks the jetpack plugin still depends on would throw on opt-in against the dev copy - latent today since nothing loads it in tests), but it's kinda accidental as written.
I gave the reverse a spin - only rewrite the prerelease range, and point it at the stable line the repo already pins: the lock collapses to ONE private-apis copy (1.54.0), PA typecheck passes and the Storybook suite is the same 251 files / 1266 tests green. Plus it stops matching by itself once the pins move to stable, so the follow-up can't be forgotten. What do you think?
| if ( pkg.dependencies?.[ '@wordpress/private-apis' ] ) { | |
| pkg.dependencies[ '@wordpress/private-apis' ] = '1.54.2-next.v.202609031004.0'; | |
| } | |
| if ( pkg.dependencies?.[ '@wordpress/private-apis' ]?.includes( '-next' ) ) { | |
| pkg.dependencies[ '@wordpress/private-apis' ] = '1.54.0'; | |
| } |
There was a problem hiding this comment.
Went with the reverse, with one twist: the rule rewrites only -next ranges to the version premium-analytics declares, rather than a literal 1.54.0, so the next stable bump of private-apis moves the target too (charts and social-previews still pin theme@2.1.1-next on trunk, which declares a prerelease range, and a literal would split the copies again there). One private-apis copy in the lock, devDependencies untouched, and the rule is inert once nothing asks for a prerelease.
| @@ -7947,8 +7947,8 @@ packages: | |||
| resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==} | |||
| hasBin: true | |||
|
|
|||
| '@bufbuild/protobuf@2.12.1': | |||
| resolution: {integrity: sha512-BvAMfS6LrgZiryOAZ4pBYucu4wG/Ei/9o9DZ9akbREnMLbPJiom2i8b9C8IsKErQoiKqVhrerzt3kOT/RrzLHg==} | |||
| '@bufbuild/protobuf@2.14.1': | |||
There was a problem hiding this comment.
A few unrelated transitive bumps ride along in here (@bufbuild/protobuf 2.12.1 → 2.14.1, @codemirror/lang-markdown, @lezer/*, @redux-saga/*) - nothing in the manifests asks for them, so I guess pnpm install resolved fresh. Regenerating from trunk's lock (git checkout origin/trunk pnpm-lock.yaml && pnpm install) should keep them where they are and still update the widget-dashboard subtree + the pnpmfile checksum. Not a big deal, just keeps the lock diff to what the PR is about.
There was a problem hiding this comment.
Regenerated from the trunk's lock as suggested. The diff now includes the widget-dashboard subtree and the private-apis collapse; the transitive bumps are gone.
rewrites only -next ranges to the version premium-analytics declares; lock regenerated from trunk's
widget-dashboard 0.7.1 honours a stored columns preference; placements are authored for four
|
Applied the two suggestions without a diff line to hang them on: columns are pinned on read in useDashboardGridSettings (with a test; stored columns: 2 now lay out at four), and the 86 nested link: manifests name the same versions as the root. Reset is in the description now too. Thanks for the thorough run. |



What?
Pins three
@wordpress/*dependencies to the202609031004Gutenberg development release, published under thenextdist-tag:widget-dashboard,widget-primitivesanddataviews.Premium Analytics picks up the widget dashboard policy API (
WidgetDashboard.Policy), which governs what users may do on a dashboard: customize, reset, insert, and per instance remove, move, resize and edit.dataviewscrosses a major version boundary, from 18.1.0 to 19.0.1.Why?
The two widget packages cannot move alone.
widget-primitives@0.6.2-nextdeclaresdataviews@^19.0.1-nextas a floor, so leavingdataviewsat 18.1.0 givesFieldtwo type identities, andWidgetAttributeField<Attributes>stops unifying. Type checking fails inpackages/fields/src/report-params-field/report-params-field.tsx. Addingdataviewsmakes the set installable; nothing beyond it is required.wp-build-polyfillsmoves the same two shared entries because Premium Analytics consumes@wordpress/widget-primitivesas a script module served by the polyfill bundle rather than from its own bundle.Everything else stays on stable on purpose.
A wider pin was measured and rejected: pinning all 39
@wordpress/*entries across both packages produced 34 duplicated packages in the Premium Analytics tree against 33 for this three-entry pin, so it does not reduce duplication.ui,iconsandstyle-runtimestay duplicated under either strategy becausecharts,jetpack-componentsandjetpack-connectionhold the stable copies, and neither pin touches those.The wider pin's only measurable gain was a single
dataviewscopy instead of two, at the cost of movingprivate-apis,rich-text,route,theme,views,bootanda11yonto the dev release for the eleven other projects that consume the polyfill bundle, and draggingcore-dataacross a major that Premium Analytics does not need.How?
projects/packages/premium-analytics/package.json
Pins
widget-dashboard,widget-primitivesanddataviewsto their202609031004versions, as exact pins rather than ranges, since a caret over a prerelease admits a confusing mix of stable and prerelease resolutions.projects/packages/wp-build-polyfills/package.json
Pins
widget-primitivesanddataviewsto the same versions, so the module the polyfill bundle serves matches what Premium Analytics builds against..pnpmfile.cjs
Collapses any prerelease
@wordpress/private-apisrange onto the versionpremium-analyticsdeclares (1.54.0today), so the lock holds a single copy.widget-dashboardunlocks@wordpress/components' private APIs, and that lock/unlock pair resolves through a module-scoped registry, so both sides must be the same copy. The rule matches only-nextranges and leavesdevDependenciesalone: it stops applying by itself once the pins move to stable, and the polyfill bundle keeps serving the stableprivate-apisits other consumers expect.The dev-release
widget-dashboarddeclares^1.54.2-next…while the stablecomponentsthis repo resolves declares^1.54.0, and a prerelease range and a stable one never converge on one package. Without it, every Premium Analytics story fails to import withCannot unlock an object that was not locked before. It lives in.pnpmfile.cjsrather thanpnpm-workspace.yaml, per the repo convention enforced bycheck-pnpm-workspace-yaml.mjs.pnpm-lock.yaml
Regenerated from trunk's lock with the rule above, so the diff carries only the widget-dashboard subtree and the
private-apiscollapse.routes/dashboard/hooks/use-dashboard-grid-settings
Pins
columnstoWIDGET_DASHBOARD_COLUMN_COUNTon read, as the wp-admin dashboard does. 0.7.1 honours a storedcolumns, and preferences written by the removed Columns control still carry one; the placements are authored for four.Nested package.json files
The
link:manifests underroutes/,widgets/andpackages/name the same versions as the root manifest, as the last group bump did.changelog/pin-widget-dashboard-dev-release
One entry per touched package, both
patch/changed.Testing
Type checking passes on
premium-analyticswith no errors.The Storybook suite passes in full: 251 files, 1266 tests, 46 skipped, nothing failing. Without the
private-apiscollapse, the same run has 80 files failing to import, so it is what makes this pin viable rather than a convenience.Four narrower attempts did not hold, for the record: adding
@wordpress/private-apisto Vite'sdedupelist, and pinningprivate-apisinpremium-analytics,componentsinpremium-analytics, andcomponentsinjs-packages/storybook.None of them help because a prerelease range and a stable one cannot resolve to a single package, no matter which manifest asks.
The handles and modules the polyfill bundle serves to other projects remain unchanged by this pin, except for
@wordpress/widget-primitives, which other consumers register but do not use.To reproduce:
jetpack build --deps packages/premium-analytics, then open Stats v2 and confirm the dashboard renders, its widgets accept resize and move, and the Customize flow works. The package provenance module in the Debug Helper plugin shows which runtime serves each package;@wordpress/widget-primitivesshould appear asPOLYFILLand active on that screen.Follow-ups
@wordpress/private-apisrule in.pnpmfile.cjstogether with these pins. It only matches prerelease ranges, so it is inert once the group moves together onlatest.latestdist-tag. Renovate covers all three in theBundled @wordpress/* monorepogroup, but it will not proposewidget-dashboard0.7.0 ordataviews19.0.0: both compare lower than these prerelease pins. Move those two by hand when they ship; 0.7.1 / 19.0.1 and later are picked up on their own.dataviewsresolves to two copies in the Premium Analytics tree, 18.1.0 viaadmin-uiand 19.0.1 here. Pinningadmin-uitoo was measured and made things worse (35 duplicates), so this is left for the stable release to resolve.charts,jetpack-components,jetpack-connection) pin the stableui,iconsandcomponents, so those stay duplicated in the tree regardless of this change.