Conversation
Separate defect from the runtime Gutenberg-registry fix earlier on this branch: this is an install-time problem, not a runtime one. All six proof-command peerDependencies (@playwright/test, @wordpress/e2e-test-utils-playwright, @wordpress/env, axe-core, pixelmatch, pngjs) were exact-pinned despite being marked optional via peerDependenciesMeta. npm 7+ refuses to resolve an exact-pinned peer against an incompatible version already present in a consumer's tree, even when the peer is optional — so a plain `npm install block-runner` fails with ERESOLVE in any project (e.g. a @wordpress/scripts theme) that already has its own newer @playwright/test or @wordpress/e2e-test-utils-playwright for unrelated e2e tests. The only workarounds were --legacy-peer-deps (which disables peer-conflict checking for the whole install, not just this package) or --force. Publish caret ranges to consumers while keeping the proof command's own internal tooling versions exact-pinned via devDependencies, which is what src/proof/runner.ts and scripts/package-boundary-check.mjs now read from directly instead of peerDependencies. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Closing in favour of a simpler fix: bumping block-runner's own bundled @wordpress/blocks (and the paired @wordpress/block-editor / @wordpress/block-library) to a current version, rather than adding a runtime resolution-consistency shim. The shim genuinely fixes the class of bug (any future consumer version mismatch), but the team decided the added internal complexity isn't worth it versus just tracking a current WordPress version directly — with the trade-off understood that a future WP major bump on the consumer side could reintroduce the same failure mode until block-runner's own pin catches up again. Follow-up PR incoming with the version bump. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two separate defects found while investigating "block-runner breaks in real consumer projects" — a runtime resolution bug and an install-time peer-dependency pinning defect. Kept together since they were found together, but they're independent fixes.
Fix 1: keep headless Gutenberg registry aligned with block editor
Fixes
author()failing in consumers that install a newer top-level@wordpress/blocks. The failure was reported asconversion failed: Cannot read properties of undefined (reading 'align')atstage: intermediate,phase: source-analysis.Root cause
The headless bootstrap loaded
@wordpress/blocksrelative to block-runner, while core block save functions loaded their@wordpress/block-editorhelpers through the block-library dependency tree. npm can split those into separate package instances when a consumer also has a newer top-level@wordpress/blocks, leaving the save hook with an undefined attributes object.Fix
Resolve the blocks registry relative to the block editor used by the resolved block library, so block creation, serialisation, and save hooks use the same Gutenberg runtime.
Regression coverage
Extends the packed-package boundary test with a fresh consumer that installs
@wordpress/blocks@16.0.0alongside the packed tarball and verifiesauthor()returns a canonical plan.Verified with
npm run typecheck,npm run test:package, the headless smoke test, and the documented feature-note example against a freshly packed local build.Fix 2: loosen exact-pinned optional peer dependencies to caret ranges
Fixes a plain
npm install block-runnerfailing withERESOLVEin consumer projects that already depend on the same optional proof-command peers at a different (compatible) version — e.g. a@wordpress/scriptstheme that already has its own@playwright/testand@wordpress/e2e-test-utils-playwrightfor unrelated e2e tests.Root cause
All six proof-command
peerDependencies(@playwright/test,@wordpress/e2e-test-utils-playwright,@wordpress/env,axe-core,pixelmatch,pngjs) were exact-pinned despite being marked optional viapeerDependenciesMeta. npm 7+ refuses to resolve an exact-pinned peer against an incompatible version already present in the consumer's tree, even when the peer is optional. The only workarounds were--legacy-peer-deps(which disables peer-conflict checking for the entire install, not just this package — in the real case this also silently let an incompatible ESLint version through, breakingeslintwithCannot find module 'eslint') or--force.Fix
Publish caret ranges (e.g.
^1.61.1instead of1.61.1) for the six optional proof peers, so a compatible version already in the consumer's tree resolves cleanly. The proof command's own internal tooling versions stay exact-pinned viadevDependenciesfor reproducible real-browser proof runs —src/proof/runner.tsandscripts/package-boundary-check.mjsnow read those exact versions fromdevDependenciesdirectly instead ofpeerDependencies.Verification
@playwright/test@^1.62.1and@wordpress/e2e-test-utils-playwright@^1.54.0already present — plainnpm installfailed withERESOLVEon@playwright/test@1.61.1as described above.npm install(no--legacy-peer-deps, no--force, nooverrides) now succeeds cleanly —@playwright/test@1.63.0and@wordpress/e2e-test-utils-playwright@1.54.0resolve and dedupe against block-runner's peer ranges.npm run typecheck,npm run build,npm test(706 passed, 4 skipped, 0 failed), and the targeted packaging boundary test all pass against the fixed tree.