Repository navigation
Sign Reprint pulls with one key per machine - #6169
Merged
Merged
Conversation
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.
Related issues
STUDIO_ENABLE_PULL_REPRINT). Follows Report app-initiated push and pull failures to Sentry #6163–Let a given pull selection replace an interrupted one #6167.How AI was used in this PR
Claude Opus 5.5 (Claude Code), running as Franklin, Chris's agent, found this while stress-testing Reprint pull on real WordPress.com sites, then wrote the fix and tests and ran the reproduction below. Chris reviews before merge.
Proposed Changes
AUTH_UNKNOWN_KEY(HTTP 403). Studio generated a Reprint key per local site, and Jetpack keeps one key per site (Reprint export: update Reprint to 0.11.2 and accept public-key signed requests jetpack#53537: "Installing a key replaces the previous one"). The second pull installed its key over the first one's, and the first pull's next request was refused.~/.studio/reprint-key.pem, passed topreflight,pull-filesandpull-dbas--private-key-path. Every local site on the machine installs the same key, so they no longer replace each other's.reprint keygen) on first use. It is written to a temporary file and hard-linked into place, so pulls that start at the same time end up with the same key. This also removes thepull-metadataandkeygenReprint calls from the start of each pull.--private-key-pathtakes precedence over them, and the next pull installs the machine key.Testing Instructions
With
STUDIO_ENABLE_PULL_REPRINT=1, start two pulls of the same remote into two different local sites, about two seconds apart:files-pullwithAUTH_UNKNOWN_KEY.~/.studio/reprint-key.pem. Afterwards there is a single key file with mode0600.Unit tests:
npx vitest run apps/cli/lib/pull apps/cli/commands/tests/pull.test.ts. The new test checks that three pulls starting together get one key, and that it signs for the public key it reports. The same key-creation code was also run on a Windows 11 VM, with the same result.Pre-merge Checklist