-
Notifications
You must be signed in to change notification settings - Fork 109
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
Set development mode to 'plugin' in the dev environment and allow pages to be optimized when admin is logged-in (when in plugin dev mode) #1700
Conversation
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
+1 to set the development mode to "plugin" in our config. For the Optimization Detective specific tweaks, I am not sure it's a good idea to rely on it in all of these places.
The modified condition for od_can_optimize_response()
makes sense to me as that makes development a lot easier, and it's not very risky as it's a general on/off switch for almost the entire feature. But adjusting the TTLs and sample sizes I find questionable. These kinds of changes will mean that realistically we'll almost never naturally test this in the way that it actually behave, but only how it behaves with the development mode set to "plugin". Why are those tweaks necessary? And if they are, what is our strategy to mitigate that risk?
During development I have a plugin active which does this: add_filter( 'od_url_metric_storage_lock_ttl', '__return_zero' );
add_filter( 'od_url_metric_freshness_ttl', '__return_zero' );
add_filter( 'od_url_metrics_breakpoint_sample_size', function () { return 1; } );
add_filter( 'od_can_optimize_response', '__return_true' );
add_filter( 'od_maximum_viewport_aspect_ratio', function () { return PHP_INT_MAX; } );
add_filter( 'od_minimum_viewport_aspect_ratio', function () { return 0; } ); With the changes in this PR, such a plugin won't be necessary anymore to start development. These tweaks do a few key things to facilitate development:
|
@westonruter This only answers my first question, not the primary concern I'm raising. Makes sense that you may use a utility plugin like this for development, and I think for this kind of tweak that's actually better. This means at least that not everyone contributing to OD will get that experience by default, so we'll get some usage of the way this plugin behaves in production. I don't think the benefit of not needing such a helper plugin outweigh the risks of not running the code in the way it should usually behave out of the box. |
@felixarntz Well, then I guess what's the point of plugin development mode if enabling it doesn't get you what you need to start developing? So there's actually two levels of development mode essentially? A shallow development mode and a deep development mode? |
I think it's more nuanced, yes. Any of the changes currently in this PR could be implemented as dependent on the development mode config, but tweaking production behavior for development comes with the aforementioned risk, so I think this should be used very selectively. Examples where I think development mode makes sense:
Both of these are more or less on/off switches, but they don't tweak any more granular logic outcomes. There is definitely a fine line between the developer convenience and the risk of running a too altered version of the plugin in development mode, so it makes sense to discuss specific cases. But per the above, here I think tweaking numbers like TTL and sample sizes may go a bit too far. |
@felixarntz OK, makes sense. Undone in 6da3ddc. |
Co-authored-by: Mukesh Panchal <[email protected]>
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.
@ShyamGadde @westonruter Thanks for the updates, looks great!
Just a few documentation notes that I think should be revised.
Co-authored-by: Felix Arntz <[email protected]>
Summary
Fixes #1423
WP_DEVELOPMENT_MODE
constant toplugin
in development environment.