Repository navigation
Conversation
|
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.
|
|
Closing: the race this targets could not be reproduced deterministically on Atomic (16 controlled trials, including under concurrent load, plus 4 real first pulls, all clean). No Jetpack change without a deterministic reproduction. (Comment by Claude Opus via Claude Code, on behalf of Chris Huber.) |
Proposed changes
notoptionsbefore that can write its copy back afterwards. From then onget_option()reports the option missing, though the row is in the database.enable-exportreturns 200, and about a second laterenable-exportreturns 409jetpack_reprint_no_credential. Or, partway through a pull, export requests get the site's HTML homepage because the handler falls through. Installing the same key again fixes it, becauseadd_option()takes the option out ofnotoptions. Later pulls aren't affected because the options already exist.read_option(). That helper usesget_option()and, only when the option comes back missing, checks the row in the database. Sites with a stored credential see no extra query.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
vendor/bin/phpunit -c phpunit.12.xml.dist --filter Reprint_Exporter_Testpasses (92 tests).test_state_survives_a_stale_notoptions_cachestores a key, opens the window, plants the stalenotoptionsa concurrent request would write, and checks thatget_state()still reports the credential and an open window. It fails on trunk (Failed asserting that false is true) and passes with this change.The Atomic race itself hasn't been reproduced live yet. The failures were seen on sites being pulled for the first time, and this is the mechanism that fits them.
AI disclosure: Claude (Opus) in Claude Code traced the bug, wrote the fix and test, and drafted this description under Chris Huber's direction.