Skip to content

[PHP] Share resumable file sync patch processing - #581

Open
adamziel wants to merge 2 commits into
codex/share-fresh-local-indexfrom
codex/share-file-sync-patch-processing
Open

[PHP] Share resumable file sync patch processing#581
adamziel wants to merge 2 commits into
codex/share-fresh-local-indexfrom
codex/share-file-sync-patch-processing

Conversation

@adamziel

Copy link
Copy Markdown
Collaborator

Adds one resumable processor for building a fresh local index and planning a patch against a saved index.

Push keeps its current path lists and progress labels. PushPlan now consumes operations from the shared processor instead of coordinating FreshLocalIndexProcessor and FileSyncPatchPlanner itself.

The two start methods make the patch direction explicit:

// Saved index -> current local tree. Used by push.
$processor = FileSyncPatchProcessor::start_to_fresh_local_tree(
	$work_directory,
	$filesystem_root,
	$saved_local_index,
	$storage_path
);

// Current local tree -> saved index. Used by mirror pull in the next PR.
$processor = FileSyncPatchProcessor::start_from_fresh_local_tree(
	$work_directory,
	$filesystem_root,
	$saved_local_index,
	$storage_path
);

The processor owns the scan, sort, patch planner, and their complete cursor. Callers store that cursor unchanged and consume one operation per planning step.

This also keeps selection roots safe in JSON cursors and lets a selected subtree be deleted without crossing a nested include or exclusion boundary.

Testing

The processor, planner, PushPlan, and real push endpoint suites cover both patch directions, interruption at every internal phase, arbitrary path bytes, exclusions, progress, and process resume.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.9

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 9.59 s 9.80 s ⚪ -214 ms (-2.2%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.72 s 3.80 s ⚪ -85 ms (-2.2%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.30 s 13.60 s ⚪ -299 ms (-2.2%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant