Plugin Directory: Delay trunk-only imports on tag-releasing plugins#8
Open
dd32 wants to merge 1 commit into
Open
Conversation
…o merge follow-up tag commit. Plugins that release from a tag commonly commit version-bumped files to /trunk first, then `svn cp trunk tags/X.Y` shortly after. Today's flow runs the import immediately on the trunk commit and publishes a trunk-fallback release; the follow-up tag commit then triggers a second import and re-publishes the same release from the tag. See r3530799 / r3530800 for an example. Delays trunk-only imports by 5 minutes when the plugin's current stable_tag is not 'trunk' (i.e. it currently releases from a tag, so a tag is likely incoming). Reinstates merge_plugin_data() and reshapes Plugin_Import::queue() so any pending future event is folded into the new request; the merged args determine the run time. The bulk re-index pull-forward from earlier in this PR and the new trunk-then-tag delay are now expressions of the same rule: "one pending event per plugin, run at the earlier of its existing schedule and the natural schedule of the merged args." Tag-touching changes, tag deletions, and plugins releasing from trunk run immediately (no behavior change). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Stacks on top of WordPress#631 to address the trunk-then-tag double-import problem.
The problem
Plugins that release from a tag commonly commit the version-bumped files to
/trunkfirst and thensvn cp trunk tags/X.Yshortly after — see r3530799 / r3530800 for a recent real-world example. Today the SVN watcher imports the trunk commit immediately: trunksStable Tagpoints at the new version but/tags/X.Ydoes not exist yet, so the importer falls back to publishing the release from trunk (with thestable_tag_invalid_trunk_fallbackwarning). The follow-up tag commit then triggers a second import that re-publishes the same release from the tag.The change
Reuses the merge model that this PR started with but expands it to cover this case.
Plugin_Import::queue()now:merge_plugin_data()and the per-key OR/union behavior).queue_run_time()helper. If the result is a trunk-only update on a plugin whose currentstable_tagis nottrunk, run in5 * MINUTE_IN_SECONDS; otherwise5s.min( existing_nextrun, queue_run_time(merged) )so a pending event is never pushed further out.That collapses two previously-separate rules into one:
now + 5min. If the follow-up tag commit arrives within that window, it merges in — the merged args are no longer trunk-only, soqueue_run_time()returnsnow + 5sand the event pulls forward to run as a single import that publishes from the tag. If no tag arrives, the event runs as scheduled and publishes from trunk-fallback, same as today (but only once).Why
stable_tag != trunkrather thantagged_versionsstable_tagis the directorys current view of where the plugin releases from; if its set to a version like1.2.2, the next release is almost certainly going to come in via a tag. A plugin thats genuinely releasing from trunk (e.g. brand-new plugins, or those that never tag) keepsstable_tag = trunkand doesnt get delayed.Edge cases
stable_tagpostmeta yet → no delay (the meta is falsy).Stable Tag→ delayed 5 min, then runs and no-ops at import time. Harmless.last_scheduled + 1hr, ornow + 1hrif a job is in flight) is preserved.Changes
Plugin_Import::queue()— unified merge model.Plugin_Import::queue_run_time()+Plugin_Import::is_trunk_only_update_on_tagged_plugin()— new run-time decision.Plugin_Import::merge_plugin_data()— restored from earlier in this PR.tests/Plugin_Import_Merge_Test.php— restored and expanded with cases for the trunk-only detection.Test plan
npm run plugins:test --filter Plugin_Import_Merge_Test— all merge + classification tests pass.stable_tagis1.0, commit a trunk-only change → verify an event is scheduled~now + 5min. Then commitsvn cp trunk tags/1.1→ verify the events args now include the tag and itsnextrunpulled forward to~now + 5s, then a single import runs and publishes fromtags/1.1.stable_tagistrunk(no tag history), commit a trunk-only change → verify the event is scheduled~now + 5s(no delay).stable_tagis1.0, queue a bulk re-index event 30 min out, then trigger a commit-drivenqueue()→ verify the event is pulled forward and the args merged (existing PR-631 behavior, unchanged).🤖 Generated with Claude Code