Skip to content

Release 1.7.1: stop translating before after_setup_theme - #56

Merged
wpgaurav merged 3 commits into
mainfrom
chore/dataviews-22
Nov 28, 2026
Merged

wpgaurav merged 3 commits into
mainfrom
chore/dataviews-22

Conversation

@wpgaurav

@wpgaurav wpgaurav commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

What changed

Module_Controller::init() built the admin module list on plugins_loaded, and the titles and descriptions in that list are translated. WordPress 6.7 and newer report _load_textdomain_just_in_time was called incorrectly for any translation requested before after_setup_theme, so every admin request on a site with a language pack for the functionalities domain logged the notice.

Two changes were needed, because fixing either alone leaves the bug alive:

  1. Module_Registry::get_definitions() now carries structure only — icon, class, option, filter, controller. Labels moved to new get_labels() / get_label() methods that translate on demand.
  2. Module_Controller resolves the list lazily through a modules() accessor instead of an eager define_modules() call. All four read sites run at admin_menu or later.

get_admin_modules() still translates, so step 1 on its own left all 38 strings leaking — the worker fixture caught that.

A frontend request no longer builds 38 translated strings just to decide which modules to load.

Why a reviewer should trust it

The registry worker fixture now records the hook phase of every __() call, and ModuleRegistryTest::test_no_translations_run_before_after_setup_theme asserts zero early translations across frontend, admin, and current-version requests.

It was also verified against a live site running WordPress 7.1.5, using a probe that forces admin context, points the domain at a real directory through lang_dir_for_domain, and hooks doing_it_wrong_run:

1.7.0 1.7.1
Early-translation notices 1 0
Strings translated before after_setup_theme 38 0

The 1.7.0 run reproduced the reported notice verbatim.

Also in this release

  • DataViews 22.1.0, with a new webpack.config.js that bundles @wordpress/kebab-case and @wordpress/react-inert-value instead of leaving them external. WordPress 7.0 and 7.1 do not register them as scripts, so externalised the workspace would depend on handles that never load. Confirmed on WordPress 7.1.5: all 17 declared dependencies are registered and neither helper appears in the dependency list.
  • Workspace mount fix. mountWorkspace() climbs from the h1 to the block that is a direct child of the target, rather than taking the heading's next sibling, because the page heading now sits inside a header block.
  • bin/make-pot.sh raises PHP's memory limit to 512M. The DataViews bundle pushed wp7-admin.js past a megabyte and wp-cli's JavaScript parser exhausted the 128M default, which broke the template freshness check in CI. The limit is set inside the one shared script so the two sides cannot drift. The regenerated template has zero msgid changes — only line references.
  • Two packaging gaps closed. .distignore now excludes webpack.config.js and /build. The latter is wp-scripts' output directory: it is gitignored, so a release built from a clean checkout never saw it, but a package assembled from a working tree shipped a second copy of the bundle. build.sh now also requires the workspace asset file and both stylesheets, so a release cannot ship the bundle without the styles it needs — the same silent-404 shape as the earlier Prism incident.
  • Tested up to WordPress 7.2, with versions bumped in all six places the consistency test checks.

Verification

  • composer check — PHP lint on 63 files, phpcs 54/54, PHPUnit 181 tests
  • PHPUnit against a real WordPress checkout — 181 tests, 6987 assertions, nothing skipped
  • npm test — 19 tests
  • bin/make-pot.sh --check — template current
  • node --check on every file under assets/
  • Simulated package contains exactly the shipped set and no dev files

Notes

The DOM anchor in mountWorkspace() has not been exercised in a browser; everything around it was checked server-side.


Documentation links and readme refresh (second commit)

functionalities.dev now 301s to gauravtiwari.org, so every documentation link in the plugin went through a redirect. All 34 references now name the destination directly, each verified to return 200:

  • Docs pages → gauravtiwari.org/docs/functionalities/<section>/<page>/
  • Site root, module list, downloads, FAQ → the product page and its anchors

That includes the Plugin URI header and the dashboard footer link, whose visible text also read functionalities.dev. The translation template was regenerated because the Plugin URI msgid changed.

readme.txt gains a New in 1.7.1 section, and the changelog entry is rewritten for readers instead of naming internal methods — it now also covers the workspace loading and placement fixes, which are the parts users can actually see. The supported-versions answer and upgrade notice name 7.2.

README.md gains a short what's-new block. Its example module definition still showed titles inside get_definitions() — exactly the shape that caused this release's bug — so it now shows get_definitions() and get_labels() side by side with a note on why they are separate.

The admin bootstrap built its module list on `plugins_loaded`, and the
titles and descriptions in that list are translated. WordPress 6.7 and
newer report `_load_textdomain_just_in_time` was called incorrectly for
any translation requested before `after_setup_theme`, so every admin
request on a site with a language pack for the domain logged the notice.

Module_Registry::get_definitions() now carries structure only. Labels
moved to get_labels()/get_label(), and Module_Controller resolves the
list lazily on first use, which is `admin_menu` at the earliest. A
frontend request no longer builds 38 translated strings just to decide
which modules to load.

The registry worker fixture now records the hook phase of every
translation, and ModuleRegistryTest asserts no request translates before
after_setup_theme.

Also in this release:

- DataViews 22.1.0, with a webpack config that bundles the two helper
  packages WordPress 7.0 and 7.1 do not register as scripts.
- The WordPress 7 workspace mounts after the page heading's own block
  instead of the heading's next sibling.
- bin/make-pot.sh raises PHP's memory limit. The DataViews bundle pushed
  wp7-admin.js past a megabyte and wp-cli's JavaScript parser exhausted
  the 128M default, which broke the template freshness check in CI.
- .distignore excludes webpack.config.js and /build. The latter is
  wp-scripts' output directory: it is gitignored, so a release built from
  a clean checkout never saw it, but a package assembled from a working
  tree shipped a second copy of the bundle.
- build.sh requires the workspace asset file and both stylesheets so a
  release cannot ship the bundle without the styles it needs.
- Tested up to WordPress 7.2.
…s for 1.7.1

functionalities.dev now 301s to gauravtiwari.org, so every link in the plugin
went through a redirect: the docs pages to /docs/functionalities/<section>/<page>/
and the site root, module list, downloads and FAQ to the product page and its
anchors. All 34 references now name the destination directly, verified 200 each.
That covers readme.txt, README.md, the `Plugin URI` header and the dashboard
footer link, whose visible text said functionalities.dev.

readme.txt gains a "New in 1.7.1" section, and its changelog entry is rewritten
for readers rather than naming internal methods: it now also covers the
workspace loading and placement fixes, which users can see. The supported
versions answer and the upgrade notice name 7.2.

README.md gains a short what's-new block. Its example module definition still
showed titles inside get_definitions(), which is exactly the shape that caused
the early-translation notice, so it now shows get_definitions() with
get_labels() alongside and says why they are separate.
WordPress 7.2 rebuilt the block parser on top of a new WP_Block_Processor
class, so WP_Block_Parser::parse() instantiates it. The bootstrap requires
core's block-parser files by hand and did not know about the new one, so
every test that reached parse_blocks() died with `Class
"WP_Block_Processor" not found` on the WordPress trunk matrix legs.

That accounted for 13 errors and both reported failures: the
`expected size 5` assertion in UtilityModulesTest was downstream of the
fatal in a worker, not a separate problem.

The loader's existing file_exists guard means WordPress 6.3 through 7.1,
which do not ship the file, are unaffected. Verified against a trunk
sparse checkout (181 tests pass, previously 13 errors and 2 failures),
against WordPress 7.1.5, and with no checkout at all.
@wpgaurav
wpgaurav merged commit 56bfc32 into main Nov 28, 2026
11 checks passed
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