close
Skip to content

Mark --filter=skipped-earlier runs complete#265

Open
epeicher wants to merge 1 commit into
trunkfrom
fix/mark-skipped-earlier-complete
Open

Mark --filter=skipped-earlier runs complete#265
epeicher wants to merge 1 commit into
trunkfrom
fix/mark-skipped-earlier-complete

Conversation

@epeicher

Copy link
Copy Markdown
Collaborator

What it does

A completed files-sync --filter=skipped-earlier run (the second phase that downloads the deferred uploads) is now recorded as complete in the state file. Previously it was left at in_progress forever, so a later files-sync saw a non-complete state and took the resume path instead of treating the sync as done.

Rationale

In ImportClient::run_files_sync, the --filter=skipped-earlier branch sets status = "in_progress", runs the fetch pipeline, and then returns — short-circuiting before the code path that marks the run complete:

$this->state["status"] = "in_progress";
$this->state["stage"]  = "fetch-skipped";
$this->save_state($this->state);
$this->run_files_sync_pipeline();
return;   // <- never reaches the "complete" marking

So even after a fully successful skipped-earlier fetch, the state stayed in_progress.

Implementation

After the pipeline returns, mark the run complete. The partial case is guarded first: if the pipeline yielded mid-fetch (it hit its --max-exec budget or a server timeout and returned status = "partial", exit code 2), it returns without marking complete so the next invocation resumes from the cursor.

$this->run_files_sync_pipeline();

$pipeline_status = $this->state["status"] ?? null;
if ($pipeline_status === "partial") {
    return; // yielded mid-fetch; resume on the next run
}

$this->state["status"] = "complete";
$this->save_state($this->state);
// ... emit the "complete" lifecycle event (command files-pull, stage fetch-skipped)

Testing instructions

The E2E import-40-defer-uploads test now asserts that after the --filter=skipped-earlier run the persisted state status is complete (it was in_progress before this fix):

cd tests/e2e && npm run test -- tests/import-40-defer-uploads.test.js

The full Import/ PHPUnit suite is green (264 tests) and WPCS reports no new violations.

The skipped-files fetch branch in run_files_sync returned right after
running the pipeline, before the code that sets status = "complete". So
after a fully successful --filter=skipped-earlier run the state was left
at "in_progress" forever, and later runs took the resume path instead of
treating the sync as done.

Mark the run complete once the pipeline finishes, unless it returned
"partial" (meaning it yielded mid-fetch on its execution budget and needs
another invocation), and emit the matching complete lifecycle event.
@github-actions

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.7

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 7.31 s 7.20 s ⚪ +101 ms (+1.4%) 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 2.88 s 2.84 s ⚪ +38 ms (+1.3%) 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 10.18 s 10.04 s ⚪ +139 ms (+1.4%)

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