Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove transitional XPath #1820

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open

Conversation

westonruter
Copy link
Member

Summary

This removes the transitional XPath logic from #1797. This PR should only be merged after #1797 has been live for a few weeks. The logic was put in place so that the new XPath format wouldn't immediately invalidate all existing optimizations applied with old URL Metrics.

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Optimization Detective Issues for the Optimization Detective plugin blocked labels Jan 23, 2025
@westonruter

This comment was marked as resolved.

@westonruter westonruter marked this pull request as ready for review January 25, 2025 02:19
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

codecov bot commented Jan 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.09%. Comparing base (b7c4475) to head (33d060a).
Report is 33 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1820      +/-   ##
==========================================
+ Coverage   65.47%   66.09%   +0.62%     
==========================================
  Files          85       88       +3     
  Lines        6748     6851     +103     
==========================================
+ Hits         4418     4528     +110     
+ Misses       2330     2323       -7     
Flag Coverage Δ
multisite 66.09% <100.00%> (+0.62%) ⬆️
single 38.78% <0.00%> (+0.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@westonruter This looks good to me, just one small note.

I wonder, do we already want to merge this for 1.0.0-beta2, or wait until the release after? The tentative 1.0.0-beta2 release is only 3 weeks away, so is this enough time to give users to have their data migrated?

Comment on lines 92 to 94
public function get( string $key ) {
if ( 'xpath' === $key ) {
return $this->get_xpath();
}
return $this->data[ $key ] ?? null;
}
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering whether we should actually remove this. Wouldn't it be a good idea to have the data always be in sync, no matter whether you use get_xpath() or get( 'xpath' )?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should remove it because the reason for it being added in the first place is no longer present. If we retain this then it would seem like we should to the same for all of the other getter methods as well, like is_lcp, get_intersection_ratio, and so on. But they're all just different ways of accessing the $this->data array.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's what I was getting at.

If we have dedicated methods but also this general getter, I think it's a slightly safer implementation to fall through to the relevant methods where they exist. We could have a method_exists( $this, "get_{$key}" ) check for example. That way it's ensured the return values will always be aligned, no matter what approach the caller chooses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants