Retry packages when wp.org API returns stale version data#70
Merged
Conversation
When the SVN changelog flags a package as changed but the wp.org API returns cached data (versions_json unchanged), keep the package dirty for up to 24 hours after last_committed. After the retry window expires, advance last_synced_at to prevent infinite retries from non-version SVN changes (readme, assets, etc.). Adds stale_retried and stale_expired counters to update logs and sync run stats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract shouldAdvanceSyncedAt into a testable function with explicit syncAdvance/syncRetry/syncExpire return values. Add tests covering versions changed, unchanged within window, unchanged after window, nil last_committed, and boundary conditions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
versions_jsonagainst existing DB value after each API fetchlast_synced_at(non-version change)last_synced_atnormallystale_retried/stale_expiredin both update logs and sync run statsContext
Race condition: SVN commit detected → pipeline fetches wp.org API → API returns cached/stale data →
last_synced_atadvanced → package never retried. Real example:woocommerce-germanized4.0.0 was tagged and confirmed on the API at2026-03-26 8:29am GMT, but our pipeline synced 2 minutes later with stale data (3.20.7) and stayed stuck for 6+ hours.A one-time
./wppackages update --forceshould be run after deploy to heal any currently stuck packages.🤖 Generated with Claude Code