Skip to content

Advance the local index from completed files-pull mutations - #446

Open
adamziel wants to merge 1 commit into
adamziel/filter-skipped-filesfrom
adamziel/write-local-index-after-files-pull
Open

Advance the local index from completed files-pull mutations#446
adamziel wants to merge 1 commit into
adamziel/filter-skipped-filesfrom
adamziel/write-local-index-after-files-pull

Conversation

@adamziel

@adamziel adamziel commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

files-pull now advances <remote-state-directory>/local_index.jsonl only for local paths whose pull mutations complete. Selected, filtered, remapped, and preserve-local pulls therefore leave pending local work elsewhere visible to files-diff and files-push.

Implementation

The pull-side index-update WAL carries two projections. Every record carries the remote absolute path. Upserts also carry the remote-observed type, size, and ctime needed by remote-index.jsonl. A completed non-skipped local mutation carries its mapped local relative path and locally observed type, size, and ctime.

Applying a batch updates the remote index first, merges the local projection into local_index.jsonl second, and clears the WAL only after both replacements finish. The local merge synthesizes parent directories, recomputes directory emptiness, removes replaced or deleted subtrees, and returns the retained index to the raw path order consumed by PushPlan. It external-sorts streaming files rather than materializing either index in memory.

The empty WAL remains the unfinished files-pull marker. Resume and abort replay it. files-diff and files-push reject that marker, while files-pull rejects an unfinished files-push, so neither index writer can expose the other writer's intermediate state.

There is no post-fetch filesystem scan, local-index stage, building file, swap file, traversal cursor, or 1,000-step invocation limit. A successful initial pull with no recorded local paths creates an empty local index.

Testing

The focused importer suite passes 104 tests with 1,671 assertions and one skipped test. CI passes PHPUnit on PHP 8.1 through 8.4, exporter/importer E2E jobs from PHP 7.2 through 8.5, the Playground CLI E2E job, PHPStan, PHP compatibility, and the pull pipeline benchmark. PHP syntax and git diff --check also pass.

@github-actions

github-actions Bot commented Jul 31, 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

trunk baseline unavailable — showing PR numbers only.

Stage Wall time Resume attempts Status Details
playground-sqlite-db-pull 9.45 s 1 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.53 s 1 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 12.98 s

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

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

@adamziel
adamziel force-pushed the adamziel/write-local-index-after-files-pull branch from a127118 to 8a30670 Compare July 31, 2026 15:09
@adamziel
adamziel changed the base branch from trunk to adamziel/filter-skipped-files July 31, 2026 15:10
@adamziel
adamziel force-pushed the adamziel/filter-skipped-files branch from b4281a1 to 846efae Compare July 31, 2026 15:33
@adamziel
adamziel force-pushed the adamziel/write-local-index-after-files-pull branch from 8a30670 to 92b5ae8 Compare July 31, 2026 16:50
@adamziel adamziel changed the title Write the local index after files-pull scans the resulting filesystem root Jul 31, 2026
@adamziel
adamziel force-pushed the adamziel/write-local-index-after-files-pull branch from 92b5ae8 to 903340d Compare July 31, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant