Skip to content

Upgrade node & composer packages - #1263

Merged
gabrielcld2 merged 8 commits into
developfrom
feature/upgrade-dependencies
Sep 3, 2026
Merged

Upgrade node & composer packages#1263
gabrielcld2 merged 8 commits into
developfrom
feature/upgrade-dependencies

Conversation

@gabrielcld2

@gabrielcld2 gabrielcld2 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Approach

  • Upgrade both node & composer packages to the latest
  • Fix linting issues due to packages upgrades
  • Fix failing e2e tests

QA notes

  • Ensure the plugin works as before
  • Ensure e2e tests, linting, and unit tests pass in GH action

Not for merge -- diagnosing the bulk_sync_started asset_count and
deactivation_modal_viewed failures via CI logs.
Analytics.track() passed a full absolute URL via apiFetch's `path`
option, which builds a URL relative to the REST API root instead of
using one verbatim -- the resulting request 404'd, so the client-side
`deactivation_modal_viewed` event never reached the server. Use `url`
instead, which apiFetch passes through unmodified. trackReliable()'s
sendBeacon() path was unaffected since it builds its own URL.

Also fixes the wp-cli debug helper in sync-analytics.spec.js's
temporary instrumentation to use wpEvalFile (plain `wp eval` can't see
get_plugin_instance()), so it can gather evidence for the still-open
bulk_sync_started asset_count failure on the next CI run.
fakeCloudinaryConnected() bypasses Connect::verify_connection() (to
avoid live API calls), which is what normally sets auto_sync to 'off'
on a real connect -- so it stayed at its 'on' default. Visiting the
Cloudinary admin page then kicks off a background autosync thread
that can claim the test's freshly-inserted attachment (setting its
`queued` meta) before the manual /sync REST call's build_queue() gets
to it, leaving nothing for the manual queue to find.

Turn auto_sync off alongside the other preconditions so this test
exercises the manual sync path in isolation, matching its own
`trigger: manual` assertion. Confirmed via temporary CI instrumentation
(removed here) that image_delivery persisted correctly and matching
attachments existed at read time -- the option build_queue() writes
was simply never created because the query it ran during the manual
REST request found nothing.

Also removes the now-unneeded diagnostic prints from the previous
commit.
Not for merge -- the auto_sync=off fix didn't resolve asset_count
still being 0; checking what build_queue()'s query actually sees at
REST-call time.
rest_start_sync() read the just-built queue's total back from the
_cloudinary_sync_queue option *after* calling start_queue(), which
already kicks off the background sync threads for it. A thread that
finishes (or errors out) fast enough calls stop_queue(), which
deletes that option, before the original request gets a chance to
read it back -- so the analytics event it fires can report
asset_count: 0 even though build_queue() found and queued assets
moments earlier in the same request.

Have Sync_Queue capture the total synchronously as build_queue() computes
it (get_last_built_total()), and read that instead of re-reading the
racy shared option.

Confirmed via temporary CI instrumentation (removed here): the
auto_sync=off fix from the previous commit was necessary but not
sufficient -- with it in place, build_queue() still found the test's
attachment and started processing it (visible via a leaked "Asset in
sync loop." meta on prior attempts' attachments), just not fast enough
to beat this race.

@utkarshcloudinary utkarshcloudinary left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

@gabrielcld2
gabrielcld2 merged commit 7189ead into develop Sep 3, 2026
7 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.

3 participants