Repository navigation
perf(completion): keep Tab completion off telemetry and heavy imports - #2064
ryandemelo wants to merge 1 commit into
Conversation
Shell completion scripts run `openspec __complete <type>` on every Tab press. Each press loaded 344 modules (zod, yaml, fast-glob, ora) and, with telemetry on, waited for the usage request before exiting. - Skip the telemetry and completion-tip hooks for `__complete`. The scripts send stderr to /dev/null, so the first-run notice would also be marked seen there without anyone reading it. - Load `ora` only in install and uninstall, which use the spinner. - Load `listSchemas` from the resolver inside `getSchemaNames` instead of through the artifact-graph barrel, which also pulls in fast-glob. Completing changes or specs now loads 48 modules (commander only), and schemas loads 219. Part of Fission-AI#2026, items 1 and 2.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughShell completion now bypasses CLI telemetry and completion-tip hooks. It also defers loading spinner and schema modules until their related operations run. Tests check the completion command paths and loaded modules. ChangesShell Completion Module Loading
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change limits extra work during hidden shell completion while preserving the normal paths for user-run completion commands. The supplied context identifies no specific issue requiring a merge hold. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Part of #2026 (items 1 and 2)
What this changes
Shell completion scripts run
openspec __complete <type>on every Tab press. Each press loaded 344 modules, including zod, yaml, fast-glob and ora, and with telemetry on it waited for the usage request before exiting.__completeskips the telemetry and completion tip hooks. The scripts send stderr to/dev/null, so this also stops a first Tab press from marking the telemetry notice as seen where nobody can read it.oraloads only incompletion installanduninstall, the two places that show a spinner.getSchemaNamesloadslistSchemasfromresolver.jswhen it runs, instead of importing it through theartifact-graphbarrel, which also pulls in fast-glob.Every other command, including the
completioncommands a person runs, is tracked as before. Completion output is unchanged.How you verified it
macOS, Homebrew Node 25.9, sample project with two changes and one spec. Medians of 30 runs after 5 warmups, telemetry off, so the times leave out the request wait this also removes.
openspec __completechangesspecsschemasOutput was identical before and after for all three.
Tests:
startup-modules.test.ts:__complete changesand__complete specsload only commander and never the telemetry module, and__complete schemasloads neither fast-glob nor ora. All three fail onmain.cli-is-json-run.test.ts:isTabCompletionRunmatches the hidden resolver alone, socompletion installand friends stay tracked.pnpm build && pnpm test && pnpm exec tsc --noEmit && pnpm lintall pass (6412 tests).Notes
__complete schemasstill loads yaml and zod, becauseresolver.jsimports the schema parser at the top. That fits with item 6.pnpm changesetif this affects users, and committed the fileSummary by CodeRabbit