-
Notifications
You must be signed in to change notification settings - Fork 843
Agents Manager: Add caching and proxy protection for unified experience check #46368
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
Conversation
…ce check - Add transient caching (1 minute) to avoid remote API calls on every page load - Add proxy detection to limit feature to proxied requests during internal testing - Support both Simple sites (wpcom_is_proxied_request) and WoA/Garden sites (A8C_PROXIED_REQUEST constant/server var) - Add connection state check before making API call - Rename method to fetch_unified_experience_preference() for clarity - Add tests for proxy detection scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
…ference - Add tests using pre_http_request filter to mock API responses - Test successful API response returning enabled preference - Test successful API response returning disabled preference - Test transient caching prevents repeated API calls - Test API failures are cached to avoid hammering the API - Mock Jetpack connection by setting user_tokens option 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
jom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works well.
|
Is refreshing every minute necessary? Could it be cached for longer, and/or can you think of any other ways to invalidate on the rare occasions where it needs to be? |
|
@WPprodigy This will just be used to opt-in to internal testing. I think with the proxy check now we should be okay? |
Fixes #46237 (comment)
Proposed changes:
wpcom_is_proxied_request()) and WoA/Garden sites (viaA8C_PROXIED_REQUESTconstant/server variable)get_unified_experience_from_wpcom()tofetch_unified_experience_preference()for clarityOther information:
Jetpack product discussion
N/A - Internal tooling improvement
Does this pull request change what data or activity we track or use?
No changes to tracking.
Testing instructions:
should_use_unified_experience()returnsfalse(the unified experience is disabled)cd projects/packages/jetpack-mu-wpcom && composer test-php -- --filter=Agents_Manager_TestMy testing
I have made the following manual tests: