pull-reprint: stop touching internal Reprint state directly - #4491
pull-reprint: stop touching internal Reprint state directly#4491fredrikekelund wants to merge 7 commits into
pull-reprint: stop touching internal Reprint state directly#4491Conversation
pull-reprint: stop touching internal Reprint state directly
There was a problem hiding this comment.
To reiterate: I will remove this file before merging. It's here to make testing easier.
📊 Performance Test ResultsComparing 746ff2f vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
| return entries.filter( ( entry ) => entry.isDirectory ); | ||
| } | ||
|
|
||
| export async function fetchJetpackPullTree( |
There was a problem hiding this comment.
How do the token mapping and parent collapse behave now that values come from buildTreeFromRemote? fetchRemoteFileTree appends a slash to directory paths, so on this branch the values arrive as below, which means the CONTENT_DIR_TOKENS lookup on line 48 and the parent check on line 92 both compare against a key that never matches.
values: [ "plugins/akismet/", "plugins/", "uploads/" ]
only: [ ".../plugins/akismet/", ".../plugins/", ".../uploads/" ]
Related question: does preserveUnselectedLocalContent still treat a selected directory as covered when the prefix ends in a slash, given its check is absolutePath === prefix || startsWith(prefix + '/')?
There was a problem hiding this comment.
Now that downloadSkippedFiles is gone, what fetches the media library? --filter=essential-files still tells Reprint to exclude :wp-uploads:, and the same filter keeps the remote upload proxy enabled, so I am unsure whether pulled sites are meant to depend on the remote for media permanently. If that is the intent, should the comment above and the uploads entry in the picker be updated to match?
| // 4. Flatten the raw download into the site directory. Reprint uses the | ||
| // remote URL to locate the pull state, though this step makes no request. | ||
| await runStep( __( 'Flattening layout' ), [ | ||
| 'flat-docroot', |
There was a problem hiding this comment.
With restoreSelectedSymlinks removed, how does a selected plugin that is a symlink on the remote end up at wp-content/plugins/<name>? is_selected_for_pulling still returns false when the remainder under an --only prefix is empty, so the files seem to land under the link target while the link itself is never listed.
| savePullSelection( session, selection ); | ||
| return selection; | ||
| } | ||
| const tree = await fetchJetpackPullTree( wpComAccessToken, wpComSiteId ); |
There was a problem hiding this comment.
With the raw-scratch reset removed, how does a pull recover when raw/ is non-empty and no cursor exists? Studio does not pass --on-fs-root-nonempty, so Reprint falls back to error and throws "Filesystem root is not empty and no cursor found". Does the move to state/remotes/<md5(url)>/pull/state.json put existing scratches from older builds into exactly that state?
|
Thanks for the review, @gavande1! Several good feedback items 👍 My work is a bit spread out atm. I'll try to consolidate it, but it may be best to inherit one or two of these issues into another PR. I've pushed fixes related to the No need to review again just yet. I'll revisit all of this tomorrow |
Related issues
--target-*options for theapply-runtimecommand WordPress/reprint#540How AI was used in this PR
Codex wrote the whole thing based on a detailed upfront plan that I drafted with Claude. The process was highly iterative.
Proposed Changes
The
pull-reprintcommand in Studio currently both reads and writes private Reprint state. This was implemented as a temporary measure to make selective sync work, and I'm now working on making the necessary upstream changes and then adapting Studio accordingly.Here are the specific changes in this PR:
import-metadatacommand (see Expose source layout and pull artifact status through import-metadata WordPress/reprint#436).pullcommand to get the file tree.pull-files --onlyshould support file paths, not just directories WordPress/reprint#539), the file selector has been made to only display directories. This should be reverted once we have an upstream fix in place.--target-engineand--target-sqlite-pathto theapply-runtimeReprint command. If a user pulls a remote site for the first time and deselects the database, this ensures Reprint still knows to configure the site to use a SQLite database. This part depends on--target-*options for theapply-runtimecommand WordPress/reprint#540.This PR depends on WordPress/reprint#436 and WordPress/reprint#540 being included in the bundled PHAR. To make things easier for testers, I've simply committed the patched PHAR.
Testing Instructions
npm run cli:buildcdinto itSTUDIO_ENABLE_PULL_REPRINT=1 studiodev pull-reprintPre-merge Checklist