Repository navigation
Stored LCP image ID as an integer - #1213
Merged
Merged
Conversation
Collaborator
pirate-bot
approved these changes
Oct 29, 2026
Collaborator
There was a problem hiding this comment.
🟢 Approved
The LCP image ID is now stored and compared as an integer, and the new tests cover the REST path and legacy string IDs.
Validation details
- Files reviewed: 3/3 changed files.
- PHPUnit 9.6.22 on PHP 8.3.36 at HEAD:
cd /repo; set -o pipefail; timeout 280 vendor/bin/phpunit --do-not-cache-result --filter 'Test_Lazyload_Viewport::' 2>&1…printedOK (18 tests, 49 assertions)(run R3) forTest_Lazyload_Viewport. - PHPUnit at HEAD:
cd /repo; grep -n "^class" tests/test-page-profiler-shape.php; C=$(grep -o '^class [A-Za-z_]*' tests/test-page-profiler-…printedOK (27 tests, 53 assertions)(run R4) forTest_Page_Profiler_Shape. - By source, both new tests fail on pr-base code. A helper run against pr-base agreed, but it printed no run record.
- Source trace: the frontend sends an integer or null. A zero ID is stored with type
bg, so it never matches. - Security: the endpoint keeps its hash, time and origin checks. The ID is only compared, never printed raw.
Untested areas
- The end-to-end suite does not reach this behavior. Real page rendering was not checked in a browser.
🤖 Automated review · run code-review-agent_6ae31ef1400830.69474530.
🤖 Review agent — review posted ✅ on f0d986d7 · approved · 0 findings · 18 min
Run code-review-agent_6ae31ef1400830.69474530 · trail
Collaborator
|
🎉 This PR is included in version 4.2.18 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Fixed Optimole’s LCP image detection by storing the frontend profiler’s LCP image ID as an integer using
absint()and casting the ID to an integer during comparison. This restores correct strict comparisons so Optimole can applyfetchpriority="high"and avoid lazy-loading the LCP image when appropriate. The lookup also usesisset()to prevent missing IDs from being treated as0, while the comparison-time cast keeps existing cached profiles with string IDs working immediately without waiting for their seven-day TTL to expire.Closes #1202
Other information: