Skip to content

Fix: dev main conflict - #2096

Merged
KMchaudhary merged 5 commits into
developfrom
fix/dev-main-conflict
Aug 26, 2026
Merged

KMchaudhary merged 5 commits into
developfrom
fix/dev-main-conflict

Conversation

@KMchaudhary

Copy link
Copy Markdown
Collaborator

No description provided.

KMchaudhary and others added 5 commits July 30, 2026 16:50
sync Develop to Main for v2.1.0 release.
* fix: stop translating during plugins_loaded (_load_textdomain_just_in_time) (#2057)

* Resync package-lock.json to fix npm ci failures (#2062)

* fix: resync package-lock.json so npm ci works again

`npm ci` has been failing on every pull request, which takes down both the JS
unit tests and the Plugin Check workflow before either does any real work:

  npm error `npm ci` can only install packages when your package.json and
  npm error package-lock.json are in sync.
  npm error Missing: @opentelemetry/core@2.2.0 from lock file
  npm error Missing: markdown-it@12.3.2 from lock file
  ... and ~40 more

The lock had drifted from the dependency tree it is supposed to describe: 42
transitive packages were absent, and markdown-it was recorded as 14.2.0 hoisted
at the top level when its only consumer, markdownlint 0.25.1 (a dev tool pulled
in by @wordpress/scripts), requires 12.3.2. `npm install` regenerates it
correctly, nesting markdown-it 12.3.2 under markdownlint with its matching
linkify-it, mdurl and uc.micro.

Nothing is upgraded by this. Comparing the two lock files package by package:
42 added, 6 removed, and zero version changes to any package that was already
locked. The six removals are the incorrectly hoisted markdown-it and its
dependencies, which reappear nested at the versions their consumer asks for.
package.json is untouched.

Verified locally, running exactly what the two failing workflows run:

  npm ci              exit 0  (2617 packages; previously EUSAGE)
  npm run test:unit   exit 0  (8 suites, 96 tests)
  npm run build:prod  exit 0  (no errors)

This is a pre-existing breakage rather than a regression from any recent branch:
the same failure reproduces against an untouched checkout of develop.

* fix: stop shipping the PHP test suite in the distribution build

Plugin Check fails with one error:

  FILE: tests/php/AddonDependencyMessagesTest.php
  ERROR missing_direct_file_access_protection

.distignore excluded phpunit.xml.dist and the JS tests but never the tests/
directory itself, so all seven PHP test files were rsynced into the plugin ZIP.
Plugin Check runs against that unzipped ZIP, so it scanned them.
AddonDependencyMessagesTest.php is the only one with a top-level require_once
— executable code at file scope with no ABSPATH guard — hence the single error.
The other five are pure namespace and class declarations with no side effects,
and tests/bootstrap.php defines ABSPATH itself, which is why neither tripped it.

The error is not new. It arrived with the #465 fix in 25f58d3 and was masked
because npm ci failed earlier in the same job, so Plugin Check never reached
the check. Fixing the lock in this branch is what exposed it.

Excluding tests/ is the right fix rather than adding an ABSPATH guard: the
suite is not usable from the ZIP anyway (phpunit.xml.dist is already excluded)
and a guard would exit under the PHPUnit CLI. The pattern is anchored so it
means this plugin's suite and not vendor/**/tests/.

Verified by running the real Plugin Check against distribution builds of both
revisions, under the genuine godam slug so text-domain checks behave as in CI:

  before   1 error   tests/php/AddonDependencyMessagesTest.php
  after    0 errors

The rsync -rc --exclude-from=.distignore the deploy action performs was
reproduced locally: the delta is exactly the seven test files, nothing else.
composer phpunit still passes (55 tests, 125 assertions) — .distignore has no
bearing on the repo checkout that CI tests from.

* Fix built-file references and guard form-field hooks in init (#2063)

* fix: restore built-file references in the translation template

WordPress resolves JS translations by hashing the *enqueued* script path:
_load_script_textdomain_from_src() looks for
languages/godam-<locale>-md5( 'assets/build/js/media-library.min.js' ).json,
having first stripped '.min' ("Translations are always based on the unminified
filename"). translate.wordpress.org derives those filenames from the POT's own
file references. So a JS string whose only reference is under assets/src can
never be resolved — that path is not what gets enqueued, and .distignore strips
it from the release anyway.

Excluding assets/build from make-pot did exactly that. Measured on the POT
currently in develop: 1268 entries lost their built-file reference, every one of
the 47 built files the shipped POT referenced went to 0, and 407 entries were
left with a .js reference only under assets/src. Every string behind the 17
wp_set_script_translations() calls silently stopped translating.

Scanning both trees is necessary but not sufficient: '*.min.js' is in make-pot's
hard-coded exclude list, so a plain scan still skips most of assets/build. An
explicit --include="assets/build" outranks it, because IterableCodeExtractor
scores an include by path depth (2) against a single-segment exclude (1). Hence
two passes, merged — built references for the runtime, source references and
translator comments for humans. bin/make-pot.sh carries the reasoning, and it
refuses to run without assets/build rather than silently producing a POT with no
built references, which is how this went unnoticed.

Verified end to end by generating a fr_FR PO from the new POT and running the
real `wp i18n make-json`, then checking each filename against the md5 core
computes:

  built JS bundles referenced      38
  resolvable at runtime            38     (develop: 0)

Against the last shipped POT: 0 built-file references lost, 3 gained, 47 strings
gained, 3 dropped. The 3 are stale — they exist in neither assets/src nor
assets/build, so they were left over from an older build.

* fix: guard the form-field hooks and dependency reads that moved to init

Three follow-ons from moving translation off `plugins_loaded` in #2057.

WPForms and Fluent Forms field construction moved to `init`, which is later than
the `wpforms_loaded` / `fluentform/loaded` hooks it replaced. Those hooks carried
a guarantee `init` does not: the form plugin had booted, so its classes existed.
On `init` the only remaining gate is `is_plugin_active()`, which stays true when
a plugin is listed in active_plugins but aborted its own bootstrap — a failed
requirements check, a license bail, fatal-recovery mode. In that state
WPForms_Field_GoDAM_Video is never declared (its file declares the class only
inside `if ( class_exists( 'WPForms_Field' ) )`) and Recorder_Field cannot load at
all, because it does `extends BaseFieldManager` unconditionally. Either one is a
fatal on every request, front end included. Both call sites now check first.

Abstract_Addon read $dep['check'] without isset() in both loops, while the same
loops had just gained `$dep['message'] ?? ''`. An entry with only name + message —
an easy assumption now that message is optional — emits `Undefined array key
"check"` from every plugins_loaded, twice per add-on, which under
WP_DEBUG_DISPLAY prints into the page: the symptom class #465 was about. An entry
with no usable check still counts as satisfied, as before.

The media list table's sortable-columns filter was left registered at file scope
while the other two moved to admin_init, so it ran on front-end, REST and cron
requests, and advertised convert_status as sortable even when the API key check
had declined to add the column. All three now register together, and the key
check moved into the callbacks — so admin_init no longer resolves the API key
(potentially an HTTP call) on every admin request including admin-ajax.php, for
a column that renders on one screen.

Tests: the two source-shape guards were pinned so tightly that any future
add_action( 'wpforms_loaded', … ) in that file would fail CI; they now name the
callback they care about. Added guards for the class_exists checks and for all
three column hooks, plus two behavioural tests for the malformed dependency
entry — phpunit.xml.dist converts warnings to exceptions, so an unguarded read
fails rather than passing quietly. Each new guard was mutation-checked: reverting
the fix it covers turns it red.

60 tests, 139 assertions. phpcs clean.

* chore: date 2.1.1 and correct two entries this branch invalidated

The release date moves to August 6, 2026 in both CHANGELOG.md and readme.txt.

Two entries described behaviour that no longer matches the code:

"built from source instead of compiled assets" was the bug, not the fix — that
is what dropped every built-file reference and stopped JS strings translating.
The template now covers both trees.

The API key is no longer re-verified on any admin request either, not just
front-end/REST/cron: the check moved into the column callbacks, so it happens on
the media library screen and nowhere else.

* chore: inline the pot script instead of a shell wrapper

Two composer commands rather than bin/make-pot.sh. Same output — verified
byte-identical apart from the POT-Creation-Date header — and the reasoning lives
in scripts-descriptions where composer will show it.

Dropped the assets/build presence check with it. Without a build, pass 1 finds
nothing to merge and the POT quietly comes out with source references only,
which is the failure this whole change is about, so the script description says
to build first.

* chore: write the 2.1.1 changelog for users, not for us

Dropped "PHP unit tests now run on every pull request". readme.txt is what
wordpress.org shows someone deciding whether to update, and our CI has no
bearing on their site. The v2.1.0 "Chore:" entry earns its place by being about
security advisories; this one was about us.

Restated the rest as what a site owner sees. The i18n fix is a debug log that
stops filling up, not a set of call sites moved off an action. The API key change
is fewer outbound requests on page views, not an HTTP call relocated between
hooks.

"47 strings" is now 34. 47 is the msgid delta against the 2.1.0 tag, but 13 of
those come only from assets/src/blocks/godam-player/track-uploader.js, which
nothing in the repo imports — so they are extractable, not translatable, and no
user will ever see them. The remaining 34 are real player UI: transcript,
chapters, comments, sharing, sign-in.

Also restored assets/build to pass 2's exclude in the pot script, per review.
Pass 1's --include already covers build, so this only saves a redundant scan:
the generated POT is byte-identical either way, which is why languages/ is
unchanged here.

* fix: correct the media-column docblock, unbundle the workflow comment

The docblock claimed all three hooks "defer to rtgodam_is_api_key_valid() there".
Two do — manage_media_columns and manage_upload_sortable_columns, the pair that
decide whether the column exists. rtgodam_add_status_columns_content() does not,
and does not need to: manage_media_custom_column only fires for a column
manage_media_columns already returned.

The head.sha comment is out. Whether these workflows should test the pushed
commit or the merge result is its own question, and arguing for it in a comment
here bundles that decision into a translation fix. Handled separately.

* test: make the #465 guards behavioural instead of source regexes

The old assertions read the source and matched patterns against it, which was
wrong in both directions. `add_action( 'wpforms_loaded', … )` appearing anywhere
in that file failed CI even if unrelated, while adding a fresh `__()` inside
`boot_addons()` reintroduced the bug with all five assertions still green.

tests/stubs/hooks.php is a small Plugin API: registration is recorded, and a hook
can be run on demand. tests/stubs/i18n.php records every translation call. Between
them a test can run `plugins_loaded` and assert nothing translated while it did,
which covers the property rather than four known call sites.

The suite now drives the real path: construct Addon_Registry so its constructor
registers on plugins_loaded, register an add-on whose dependency is unmet and
whose message translates, fire plugins_loaded, assert the translation log is
empty, then fire admin_notices and assert the text appears. Same for the
version-compatibility notice, the admin-only guard, the media column registration
(by loading the transcoder functions file and reading the registry), and both form
integrations — including that each survives its host plugin being in
active_plugins without having bootstrapped, which is the fatal the class_exists
guards prevent.

Verified by mutation. Every one of these is caught:

  fresh __() inside boot_addons()                     3 failures
  WPForms field moved back to wpforms_loaded          1 failure
  WPForms class_exists guard removed                  1 error
  Fluent Forms class_exists guard removed             1 error
  sortable filter dropped from the registration       1 failure
  dependency message resolved during plugins_loaded   2 failures

The first is the one the old tests let through.

Also drops the file-scope require from AddonDependencyMessagesTest now that the
bootstrap loads the class — that require was what tripped Plugin Check's
missing_direct_file_access_protection while tests were still shipping.

* ci: test the merge result, not the pushed commit (#2065)

Both test workflows pinned `ref: github.event.pull_request.head.sha`, which opts
out of checkout's default `refs/pull/N/merge`. They therefore tested the branch as
written rather than as it will exist on the base, so a change landing on develop
that breaks a branch stayed green on that branch's PR and only failed later, on
the release PR into main.

Removing the override restores the default. plugin_check_on_pull_request.yml
already checks out the merge ref, so this makes the three consistent.

phpcs_on_pull_request.yml keeps its override deliberately: it posts inline review
comments, which have to anchor to commits that exist on the pull request.

* fix: regenerate the POT from a clean build

The committed POT was generated against a working assets/build that had drifted
from what `npm ci && npm run build:prod` produces from scratch, so it recorded
3276 build reference lines across 1551 distinct positions where a clean build
yields 1744 across 77. The Translation Template job caught it on the first run,
which is what the job is for.

It also still carried the pre-docblock line numbers for
admin/godam-transcoder-functions.php — 464/473 rather than 466/475 — because that
file gained two comment lines after the POT was last generated.

Regenerated after `rm -rf assets/build && npm ci && npm run build:prod`. Both
figures now match what CI produced: 1744 build reference lines, and 466/475 for
the transcoder references.

---------

Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com>
Run Copilot code review on GitHub-hosted runners
Copilot AI balanced review requested due to automatic review settings August 26, 2026 13:37
@KMchaudhary
KMchaudhary merged commit 4c9eb84 into develop Aug 26, 2026
7 of 9 checks passed
@KMchaudhary
KMchaudhary deleted the fix/dev-main-conflict branch August 26, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated GitHub Copilot code-review setup workflow.

Changes:

  • Adds manual and file-scoped workflow triggers.
  • Defines the required copilot-setup-steps job with read-only permissions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

❌ Status: Failed

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
17 1 16

❌ Errors (1)

📁 readme.txt (1 error)
📍 Line 🔖 Check 💬 Message
0 outdated_tested_upto_header Tested up to: 7.0 < 7.1. The "Tested up to" value in your plugin is not set to the current version of WordPress. This means your plugin will not show up in searches, as we require plugins to be compatible and documented as tested up to the most recent version of WordPress.

⚠️ Warnings (16)

📁 readme.txt (2 warnings)
📍 Line 🔖 Check 💬 Message
0 mismatched_plugin_name Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM".
0 trademarked_term The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name.
📁 composer.json (1 warning)
📍 Line 🔖 Check 💬 Message
0 missing_composer_json_file The "/vendor" directory using composer exists, but "composer.json" file is missing.
📁 assets/build/blocks/godam-gallery-v2/render.php (2 warnings)
📍 Line 🔖 Check 💬 Message
15 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids".
23 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids".
📁 assets/build/css/main.css (1 warning)
📍 Line 🔖 Check 💬 Message
0 EnqueuedStylesScope This style is being loaded in all contexts.
📁 assets/src/libs/analytics.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/08/26/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
📁 assets/build/js/main.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/08/26/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

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.

6 participants