Skip to content

Always run build:gutenberg -- --dev after downloading built asset#11294

Closed
desrosj wants to merge 3 commits intoWordPress:trunkfrom
desrosj:fix/block-bindings
Closed

Always run build:gutenberg -- --dev after downloading built asset#11294
desrosj wants to merge 3 commits intoWordPress:trunkfrom
desrosj:fix/block-bindings

Conversation

@desrosj
Copy link
Member

@desrosj desrosj commented Mar 19, 2026

A side effect of the changes from Core-64393 has surfaced that is potentially affecting anyone looking to run WordPress from src/.

Previously, the relevant block editor-related files were subject to version control within the src/ directory. They were always present, and they were updated from the dependencies installed through npm when npm run build:dev was run. Because of this, someone could clone wordpress-develop and immediately run the PHPUnit tests without having to run a build script (the files were already in the right spots).

The copy:block-json Grunt task was also responsible for generating the src/wp-includes/blocks/blocks-json.php file and was run before any grunt copy commands were run. This ensured it was present in src/ before copying all of the files over to build on npm run build.

The side effect of this is that when the PHPUnit test suite is run from src/, there are unexpected failures whenever anyone:

  • Runs npm run build and not npm run build:dev
  • Does not run any build script at all assuming the files are in place.

This issue surfaced in WordPress/phpunit-test-runner#307 and there are many Hosting Test reporters failing with the same errors currently. This is due to the fact that the phpunit-test-runner always runs npm run build as a part of the setup. I haven't found specific reasoning why. But if I had to guess, it's because npm run build:dev was not necessary previously. So running build ensured both ways of running the test suite would work.

On one hand, the test runner is _doing_it_wrong() because regardless of whether the tests are being run from build or src, npm run build is always the command that's run. But given that the files were removed from version control within src/, I think it makes sense to always run build:gutenberg -- --dev to ensure that the expected source files are present in the src/ directory.

Also worth noting is that #11064 aims to restore the files that were removed from version control along with the associated history. Once this happens, this likely wouldn't be necessary anymore (the files will again always at least exist because they are versioned). But because these files have gone missing unexpectedly, this is what I recommend as a fix until #11064 is merged.

Trac ticket: Core-64393.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet 4.6
Used Claude to investigate the root cause, and recommend a possible way to fix the issue. An approach different than the one suggested was ultimately used.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@desrosj desrosj self-assigned this Mar 19, 2026
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props desrosj.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@desrosj
Copy link
Member Author

desrosj commented Mar 19, 2026

Merged in r62052.

@desrosj desrosj closed this Mar 19, 2026
@desrosj desrosj deleted the fix/block-bindings branch March 19, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant