perf(init): run org detection in background during preamble#443
Draft
MathurAditya724 wants to merge 2 commits intomainfrom
Draft
perf(init): run org detection in background during preamble#443MathurAditya724 wants to merge 2 commits intomainfrom
MathurAditya724 wants to merge 2 commits intomainfrom
Conversation
Start DSN scanning and org-list fetching concurrently with the preamble user-interaction phase (experimental confirm + git status check) so the results are already available when the wizard later needs to resolve the org for project creation. On a cold start (no DSN cache), this eliminates 2-5s of blocking latency that previously occurred deep inside the wizard's suspend/resume loop. The background promises are .catch()-wrapped so failures fall back to the existing synchronous path. When the org is already explicit (e.g., `sentry init acme/my-app`), background detection is skipped entirely.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 111 passed | Total: 111 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1101 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.09% 95.09% —%
==========================================
Files 165 166 +1
Lines 22424 22444 +20
Branches 0 0 —
==========================================
+ Hits 21324 21343 +19
- Misses 1100 1101 +1
- Partials 0 0 —Generated by Codecov Action |
Replace the BgOrgDetection type and promise-threading through WizardOptions with a simpler warm/consume prefetch module. init.ts calls warmOrgDetection() to start background work, and local-ops.ts transparently consumes the cached results via resolveOrgPrefetched() and listOrgsPrefetched() — no plumbing needed between the two.
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.
Summary
resolveOrg) and org-list fetching (listOrganizations) concurrently with thesentry initpreamble phase (experimental confirm + git status check), so results are ready when the wizard later needs the org for project creation.createSentryProject→resolveOrgSlug.sentry init acme/my-app), background detection is skipped entirely.How it works
Changes
src/lib/init/types.tsBgOrgDetectiontype with pre-started promise fieldssrc/commands/init.tsrunWizard()when org is unknownsrc/lib/init/local-ops.tsresolveOrgSlug()accepts optionalBgOrgDetectionto use pre-fetched resultstest/commands/init.test.tsRisk
Low. Background promises are
.catch()-wrapped — if they fail, the existing synchronous path runs as a fallback. No behavioral change for the user; only latency improvement.