Skip to content

Profiled width candidates can deliver twice their advertised intrinsic width with Retina Quality #1111

Open

Description

@pirate-bot

Status (2026-10-11)

Fixed in PR #1177 (bugfix/1111 → development, approved by pirate-bot at 13fb6a0d). The PR fixes #1111 and #1113 together; they come from the same value.

  • Fix: 2x Retina candidates from the page profiler now deliver the width they advertise. The URL asks for the CSS width with dpr:2 (w:412/dpr:2 for an 824w candidate) instead of the already doubled width, which the CDN doubled again.
  • Scope: only sites with Retina images on, and only profiler-generated 2x candidates. Stored profiles are corrected too, with no JS change.
  • Tests: two new tests in tests/test-srcset.php, failing on development.
  • Not proven: the pixel size the live CDN delivers (the multiplier is taken from the plugin's own dpr:2 / 2x usage).

Summary

When Retina Quality is enabled, a page-profiler-generated srcset candidate can advertise a width such as 218w while delivering a resource with an intrinsic width of 436 pixels. The advertised width is expected to match the candidate resource's intrinsic width. The mismatch can cause browser DPR selection and Optimole DPR processing to compound, substantially increasing image dimensions, transfer size, and page-load time for affected images.

Customer context

Product / area: Optimole responsive images and Retina Quality
Version: Customer version not provided; inspected source is v4.2.10
Environment: WordPress frontend; Chrome DevTools and Lighthouse on a high-density display
Integration / third party: Optimole CDN image delivery
Reported error / symptom: A candidate advertised as 218w delivered a 436-pixel-wide resource; another URL requesting width 824 reportedly delivered 1648 pixels
Impact: The customer reported oversized payloads across a photography-heavy site and a PageSpeed lab LCP improvement from 9.4s to 5.8s when Retina Quality was disabled.

Reproduction notes

Reported and independently confirmed by support on the rendered page, but not reproduced locally during repository inspection.

  1. Enable Retina Quality on a page where Optimole's profiler generates missing responsive candidates.
  2. Load the page on a high-density display and let the browser select a generated w candidate.
  3. Compare the selected candidate's w descriptor and URL width parameter with the delivered resource's intrinsic width.
  4. The reported 218w candidate delivered 436 intrinsic pixels; disabling Retina Quality stopped the doubling.

Diagnosis

Conclusion

The page-profiler path records a DPR-multiplied width as a w descriptor and also retains dpr:2 for URL generation. The resulting URL contains both the multiplied width and the DPR transform while the emitted descriptor remains the stored width. The transcript includes a staff-verified runtime example where a 218w candidate delivered 436 intrinsic pixels, confirming the failing CDN interaction for the reported path.

Where this likely occurs

  • assets/js/modules/srcset-detector.js — optmlSrcsetDetector._generateResponsiveSizes() lines 410–460 computes targetWidth = baseWidth * dprValue, stores that value in w and the width descriptor, and separately stores the DPR value.
  • inc/tag_replacer.php — Optml_Tag_Replacer::add_missing_srcset_attributes() lines 487–515 passes the stored width and DPR to URL generation while emitting the stored descriptor unchanged.
  • inc/tag_replacer.php — Optml_Tag_Replacer::change_url_for_size() lines 790–810 places both w:<stored width> and dpr:2 in the transformed URL.
  • inc/tag_replacer.php — Optml_Tag_Replacer::filter_srcset_attr() lines 824–890 shows the older non-profiler path represents its Retina candidate with a 2x density descriptor instead.
  • Commit 8ab74741721c introduced profiler-based srcset handling; commit 49a757f34fd1 introduced the current breakpoint/DPR generation. Both are present from v4.1.0 through inspected v4.2.10.

Engineering notes

The defect is scoped to profiler-generated width candidates where Retina entries survive filtering and the CDN applies the supplied DPR. It is distinct from WordPress-generated srcsets handled by filter_srcset_attr(), which use a density descriptor for the added Retina candidate. The CDN implementation is not available in the workspace; its doubling behavior is supported here by the staff-verified runtime output in the transcript rather than local service-source inspection.

Test coverage status

tests/test-srcset.php lines 30–60 checks URL manipulation involving dpr:2, and assets/js/modules/__tests__/srcset-detector.test.js covers DPR variation selection. No test found during inspection validates a profiled DPR entry end to end against its emitted width descriptor and delivered intrinsic dimensions. Tests were not executed during this read-only investigation.

What to verify or explore next

  • Reproduce on a local WordPress page requiring profiler-generated srcset candidates with Retina Quality enabled.
  • Compare emitted width descriptors, transformed URL parameters, response intrinsic dimensions, and browser candidate selection at DPR 1 and DPR 2.
  • Run the targeted PHP srcset suite and JavaScript srcset-detector suite.
  • Confirm behavior against the current Optimole CDN contract for simultaneous width and DPR parameters.

Unknowns / follow-up

The exact customer plugin version and whether cached profile data changes the first affected response are unknown.

Confidence

Confidence: 98/100

Repository inspection confirms three independently verifiable defects in Optimole's page-profiler responsive-image path, and no matching GitHub issues were found. The reported Retina-disabled 1x behavior is intentional setting behavior covered by tests, so it is not included as a defect.


Source: HelpScout #3424946418
Generated by bug-report-triage (ID: bug-report-triage_6a87087cc5e402.90677248)

Activity

  1. added theissue type on Aug 20, 2026
  2. pirate-bot commented on Aug 27, 2026

    @pirate-bot
    CollaboratorAuthor

    Another customer reported this via support.

    Profiler-generated srcset candidates with dpr:2 advertise the URL's w: value as their width descriptor, while the CDN delivers twice that intrinsic width, causing browsers to select smaller candidates and overdownload pixels. This root cause stems from assets/js/modules/srcset-detector.js and inc/tag_replacer.php, which compute target widths by multiplying breakpoint widths by DPR and assign that value to both the CDN width and the w descriptor while retaining dpr: 2. To reproduce, enable Retina Quality, load a page where the profiler adds missing srcset attributes, and decode a resource containing w:<width>/dpr:2 with a matching <width>w descriptor to observe the intrinsic width doubling the descriptor value.


    Source: HelpScout #3432014705
    Generated by bug-report-triage (ID: bug-report-triage_6a9018cd69e796.72025073)

  3. self-assigned this
    on Oct 9, 2026
  4. milicavs commented on Oct 11, 2026

    @milicavs

    🧪 QA steps and test sandbox

    With Retina images on, the extra image sizes Optimole adds to a page after profiling it can be twice as big as they claim. A size listed as 824w actually downloads an 1648px wide image, so retina visitors download much heavier images than needed.

    Requires: your own Optimole account (API key), since the images are served from Optimole's CDN.

    Step Build Bot check
    Reproduce the bug Optimole 4.2.16 (released) ⏭️ Not checked: needs an Optimole account
    Verify the fix PR #1177 build 13fb6a0 ⏭️ Not checked: needs an Optimole account (the bot confirmed the build installs over the release)

    On the sandbox:

    • https://qa-optimole-wp-1111.s1-sandywp.com runs the release. Sign in to SandyWP and use the sandbox's Auto Login.
    • Step 2 is already done, and the Retina test page has three large images (2400, 2000 and 1800px wide).
    • Tools → QA Logs shows debug.log, which the public site can't read.
    • If it has stopped after a day without use, the next qa-playground run brings it back.

    Reproduce on Optimole 4.2.16:

    1. Optimole → connect with your API key.
    2. Optimole → Settings: make sure Retina images is on, then save.
    3. Open /?pagename=retina-test on a desktop browser and wait a few seconds, so Optimole profiles the page.
    4. Reload the page, then view the page source and find an image whose srcset has a /dpr:2/ URL.
    • Bug: the dpr:2 URL asks for the same width it advertises, for example w:824/dpr:2/… 824w. Open that URL: the image is 1648px wide.
    • Fixed: the dpr:2 URL asks for half the advertised width, for example w:412/dpr:2/… 824w, and the image it delivers is 824px wide.

    Verify the fix on the same sandbox:

    1. Download the PR build above, then go to Plugins → Add New Plugin → Upload Plugin and click Replace current with uploaded.
    2. Repeat the steps above from step 3.
    • Fixed: as above. Plugins still shows 4.2.16, since the build has no version bump.
    Edge cases
    • Retina images off: no dpr:2 entries in the generated srcset, same as before.
    • 1x entries (no dpr): their w: value still matches the descriptor, unchanged.
    • A page profiled before the update: after the update, reloading it gives the corrected URLs without re-profiling.
    • Image heights in the dpr:2 URLs are halved too (h: half the original), so images keep their aspect ratio.

    Fix: #1177 (open)

  5. pirate-bot commented on Oct 11, 2026

    @pirate-bot
    CollaboratorAuthor

    QA agent — 🟡 Needs human QA · Retina URLs and sizes pass locally; live CDN pixel dimensions remain unverified.

    Fresh and pre-update profiles now emit half-width Retina requests and one CSS slot per breakpoint. I verified Retina on/off saves with three large images and reproduced the old URL and sizes bugs on the base build. Both added tests pass on the candidate and fail on the base. Live CDN pixel dimensions still need verification with a real Optimole account.

    Worth a human look

    1. Verify delivered intrinsic widths and browser candidate selection at DPR 1 and DPR 2 using a real Optimole account and the live CDN.
    2. Check responsive selection on pages with pre-existing sizes attributes; PR fix: request the CSS width for Retina srcset entries and use it in sizes #1177 explicitly leaves their descending-condition ordering unchanged.
    Checks (5 passed · 1 not tested)
    • ✅ Saving Retina images on in Optimole Settings keeps it enabled after reload while the page profiler remains enabled.
    • ✅ After a desktop visitor profiles large content images and reloads, generated 2x candidates request half their advertised width and height with dpr:2; 1x URL widths remain equal to their descriptors.
    • ✅ Profiler-generated sizes contains one CSS-width max-width condition per breakpoint, not a second doubled Retina slot.
    • ✅ Installing the candidate over profiles saved by qa-base corrects Retina URL dimensions and duplicate sizes without re-profiling those pages.
    • ✅ With Retina images disabled and the page reloaded, profiled srcset omits dpr:2 candidates and retains unchanged 1x width candidates.
    • ⏸️ On the live Optimole CDN, a profiler-generated Retina width candidate delivers an image whose intrinsic pixel width equals its advertised width descriptor at DPR 1 and DPR 2.

    Full report, evidence and session trail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions