-
Notifications
You must be signed in to change notification settings - Fork 10
perf(native): skip backfill on clean incrementals #1082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -753,15 +753,17 @@ async function tryNativeOrchestrator( | |
| // stale native binaries). WASM handles those — backfill via WASM so both | ||
| // engines process the same file set (#967). | ||
| // | ||
| // Runs on every successful orchestrator pass (not just full builds): on | ||
| // incrementals the orchestrator's change detection treats files outside | ||
| // Rust's narrower file_collector as `removed` and deletes their nodes + | ||
| // file_hashes rows. Without re-running the backfill we'd lose the symbols | ||
| // for those files and permanently break the JS-side fast-skip pre-flight | ||
| // (#1054, #1068). The function is cheap (single fs scan + DB query) when | ||
| // nothing is missing, and on no-op rebuilds the missing-set is re-derived | ||
| // from `nodes`, so it catches whatever Rust just deleted. | ||
| await backfillNativeDroppedFiles(ctx); | ||
| // Runs on full builds and on incrementals when the orchestrator reports | ||
| // any deletions. The orchestrator's `detect_removed_files` filter (#1070) | ||
| // skips files outside its narrower file_collector, so on a current binary | ||
| // an unchanged 1-file rebuild reports `removedCount=0` and the backfill | ||
| // call is pure overhead (fs walk + 2 DB queries + 48-file WASM re-parse). | ||
| // Legacy binaries lacking the filter still report `removedCount>0` and | ||
| // get the gap-repair behavior #1068 introduced. | ||
| const removedCount = result.removedCount ?? 0; | ||
| if (result.isFullBuild || removedCount > 0) { | ||
| await backfillNativeDroppedFiles(ctx); | ||
| } | ||
|
Comment on lines
+763
to
+766
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a user adds a new file with an unsupported-Rust extension (Clojure, Julia, R, Erlang, F#, Gleam) during an incremental pass, the current binary's orchestrator neither processes it nor increments
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed — this is a real but narrow correctness gap. Tracked in #1083 for follow-up. The PR's primary motivation is the measured +144% CI regression on 1-file rebuilds, which affects every user on every incremental. The dropped-language addition case is rare (user adds a new |
||
|
|
||
| closeDbPair({ db: ctx.db, nativeDb: ctx.nativeDb }); | ||
| return formatNativeTimingResult(p, structurePatchMs, analysisTiming); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isFullBuildisFullBuildis typed asisFullBuild?: boolean, so supported binaries between 3.9.1 and the version that first started emitting this field may leave it absent. On a fresh full build with such a binary,result.isFullBuildisundefined(falsy) andremovedCountis0(nothing existed to delete), so the condition isfalseand the backfill is skipped entirely. The non-Rust-extension files (Clojure, Julia, R, etc.) are then absent fromnodes/file_hashes, and the fast-skip pre-flight introduced in #1054 will reject every subsequent incremental until a forced full rebuild occurs. The same branch already uses!!result.isFullBuildat line 741, so this is a shared assumption — but it's worth confirming that all binaries ≥ 3.9.1 reliably setisFullBuild: trueduring every full-build code path, or adding a version-range guard here to fall back to unconditional backfill for binaries that are known not to emit the field.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version gate at
shouldSkipNativeOrchestrator(semverCompare(engineVersion, '3.9.1') < 0→ skip) means any binary that reachestryNativeOrchestratoris ≥ 3.9.1.is_full_build: boolwas added to the RustBuildPipelineResultin #758 (3.8.0 era) and is serialized via serde with noskip_serializing_if— so it's always emitted astrueorfalse, never absent, on any 3.9.1+ binary. The defensive!!result.isFullBuildat line 741 is a stylistic safeguard for the historicalOption<bool>shape that was never actually used. The new gate at line 764 already coerces via||, so the practical risk surface is empty under the version gate.