perf(runtime): cancel extension HTTP work on abort - #609
Closed
JustYannicc wants to merge 121 commits into
Closed
Conversation
(cherry picked from commit 39b567a)
(cherry picked from commit 23ddb55)
(cherry picked from commit 59166b4)
(cherry picked from commit 83c2a89)
(cherry picked from commit 0a7560b)
(cherry picked from commit 17fb535)
# Conflicts: # src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…launcher surfaces # Conflicts: # src/renderer/src/raycast-api/list-runtime-renderers.tsx # src/renderer/src/raycast-api/list-runtime.tsx
…IO stalls # Conflicts: # src/renderer/src/CameraExtension.tsx
# Conflicts: # src/renderer/src/raycast-api/list-runtime.tsx
…resh overhead # Conflicts: # scripts/bench-script-command-discovery.mjs # scripts/benchmark-file-search-delete-batch.mjs # scripts/lib/script-command-runner-harness.mjs # scripts/lib/ts-import.mjs # scripts/test-file-search-delete-batch.mjs # scripts/test-script-command-runner.mjs # src/main/file-search-index.ts # src/main/main.ts
…hurn # Conflicts: # scripts/lib/script-command-runner-harness.mjs # scripts/lib/ts-import.mjs # scripts/test-extension-lifecycle-sandbox.mjs # scripts/test-script-command-runner.mjs # src/main/main.ts # src/renderer/src/ExtensionView.tsx
… hot paths # Conflicts: # scripts/test-use-frecency-sorting.mjs # src/renderer/src/raycast-api/form-runtime.tsx # src/renderer/src/raycast-api/grid-runtime-hooks.ts # src/renderer/src/raycast-api/grid-runtime-items.tsx # src/renderer/src/raycast-api/hooks/use-frecency-sorting.ts
# Conflicts: # .github/workflows/project-checks.yml # package.json # scripts/file-search-perf-harness.mjs # scripts/test-browser-search-performance.mjs # scripts/test-file-search-perf-harness.mjs # scripts/test-root-search-perf.mjs # src/renderer/src/CameraExtension.tsx # src/renderer/src/hooks/useBrowserSearch.ts # src/renderer/src/raycast-api/list-runtime.tsx
…cle and media fixes # Conflicts: # scripts/lib/ts-import.mjs # scripts/measure-extension-bundle-cache.mjs # src/main/commands.ts # src/main/extension-runner.ts # src/main/main.ts # src/renderer/src/ExtensionView.tsx # src/renderer/src/raycast-api/grid-runtime-hooks.ts # src/renderer/src/raycast-api/list-runtime-hooks.ts
Collaborator
Author
|
Superseded by the consolidated runtime/lifecycle/media PR: #622 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
cancelHttpRequest(requestId)through preload and the renderer Electron API type.httpRequestand one-argumenthttpDownloadBinary(url)compatibility while allowing an optional request ID for cancelable binary downloads.http-request-cancelmap for canceling Node HTTP(S) binary downloads and curl fallback processes.Why
The renderer bridge already generated request IDs and attempted to call
electronBridge.cancelHttpRequest, while main already listened forhttp-request-cancel. The preload/type surface did not expose that method, and binary follow-up downloads did not receive a request ID, so a fetch for binary content could outlive abort/unmount and resolve stale data after the text probe was canceled.Compatibility impact
Raycast-compatible call shapes are preserved: existing callers can still call
httpRequest(options)andhttpDownloadBinary(url). The optional request ID is only used by SuperCmd extension fetch cancellation, and non-http/FormData fallback behavior is unchanged.How tested
node scripts/test-extension-fetch-proxy-abort.mjsnode scripts/test-use-fetch-stale-runs.mjs./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit --pretty false./node_modules/.bin/tsc -p tsconfig.main.json --pretty falsesrc/renderer/src/extension-fetch-bridge.ts,src/main/preload.ts,src/renderer/types/electron.d.ts, orsrc/main/main.ts.npm run typecheck:rendererandnpm run build:mainwere blocked by the local machine npm policy/parity guard, so directtscbinaries from a temporary siblingnode_modulessymlink were used instead. The symlink was removed before commit.Performance evidence
ac90ce403aeddab98d0a1b245afce268c48b8bfdfailed because the old binary follow-up receivedundefinedinstead of the activeextensionFetch:*request ID.node scripts/test-extension-fetch-proxy-abort.mjspasses 4/4, including binary follow-up cancellation, single cancel emission, listener cleanup, and stale byte rejection.Stack validation
codex/perf-wave4-integrated-stack-20260705at exact SHAac90ce403aeddab98d0a1b245afce268c48b8bfd.codex/perf-runtime-cancel-extension-http-20260705.git diff --checkpassed.Replaces
None.