Skip to content

perf(commands): target quicklink command refresh - #602

Closed
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-commands-targeted-refresh-wave5
Closed

perf(commands): target quicklink command refresh#602
JustYannicc wants to merge 121 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-commands-targeted-refresh-wave5

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added refreshCommandsForQuickLinkChange() to rebuild only quicklink-derived commands from the warm command cache.
  • Wired quicklink create/update/delete/duplicate IPC handlers to refresh the targeted command slice before broadcasting commands-updated, with full-refresh fallback on targeted errors or missing cache.
  • Added focused quicklink command-cache regression and benchmark coverage for ordering, deeplinks, icon/iconName handling, alias/runtime metadata behavior, disk-cache subtitle stripping, deletion, no-cache fallback, and discovery-error safety.

Why

Quicklink CRUD previously invalidated the whole command cache, so the next command-list read could serve stale fallback data while starting full app/settings/script/extension discovery. Quicklink changes only need to replace the quicklink command slice when a warm command cache exists.

Compatibility impact

  • Preserves Raycast-compatible command ordering: apps, settings, extensions, scripts, quicklinks, then built-in system commands.
  • Keeps existing deeplink assignment, command aliases, runtime metadata application, and disk-cache serialization through publishCommandCache().
  • Keeps the legacy full refresh path for cold/missing cache or targeted refresh failure.

How tested

  • node scripts/test-quicklink-command-refresh-cache.mjs
  • node scripts/test-extension-command-refresh-cache.mjs
  • node scripts/test-command-metadata-cache.mjs
  • node scripts/bench-script-command-discovery.mjs
  • ./node_modules/.bin/tsc -p tsconfig.main.json --noEmit --pretty false
  • LSP references for refreshCommandsForQuickLinkChange() and LSP diagnostics for touched files.

Performance evidence

Quicklink benchmark from node scripts/test-quicklink-command-refresh-cache.mjs with 40 iterations, 2,008 base commands, and 80 quicklinks:

  • Legacy invalidate + full refresh simulation: median 10.303 ms, 40 structural discovery starts.
  • Targeted quicklink refresh: median 2.678 ms, 0 structural discovery starts, 40 quicklink discovery starts.
  • Avoided structural discovery starts: 40.

Baseline checks kept for comparison:

  • Extension targeted refresh: median 2.162 ms vs legacy median 10.259 ms on 2,006 base commands, avoiding 40 structural discovery starts.
  • Script command discovery: discovery 11.0 ms; cached execution lookup 3.2 ms / 0 bytes; invalidated discovery 5.0 ms reading 1.3 MiB; invalidated execution lookup 9.1 ms reading 1.3 MiB.

Stack validation

  • Branch starts from ac90ce403aeddab98d0a1b245afce268c48b8bfd.
  • LSP references found declaration plus main IPC import/call sites for refreshCommandsForQuickLinkChange().
  • LSP diagnostics returned no errors for src/main/commands.ts, src/main/main.ts, and scripts/test-quicklink-command-refresh-cache.mjs.
  • npm is disabled on this Mac, so dependencies were hydrated with pnpm install --no-frozen-lockfile; no pnpm lockfile was staged.

Replaces

N/A. Implements the wave5 quicklink targeted-refresh slice on top of the wave4 integrated stack.

(cherry picked from commit 83c2a89)
(cherry picked from commit 0a7560b)
# 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
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated PR #620: #620

@JustYannicc JustYannicc closed this Jul 5, 2026
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