fix(completions): populate project cache from listProjects#517
Merged
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Telemetry
Other
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 126 passed | Total: 126 | 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 1047 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.79% 95.79% —%
==========================================
Files 180 180 —
Lines 24860 24897 +37
Branches 0 0 —
==========================================
+ Hits 23813 23850 +37
- Misses 1047 1047 —
- Partials 0 0 —Generated by Codecov Action |
…completions Shell completions showed org slugs but not projects because only DSN resolution populated the project_cache table. Commands like `project list` fetched projects from the API but never cached them. Add `cacheProjectsForOrg()` batch function (following the `setOrgRegions()` pattern) and call it from `listProjects()` at the API layer. This means every command that lists projects (project list, findProjectsByPattern, findSimilarProjects, etc.) now automatically seeds the completion cache. After running `sentry project list myorg/`, tab completion for `sentry issue list myorg/<TAB>` now suggests projects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
229ed8d to
187ea25
Compare
This was referenced Mar 20, 2026
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
Shell completions showed org slugs but not projects after the slash. The completion PR (#465) described "lazy project cache population" but only DSN resolution actually wrote to the
project_cachetable. Commands likeproject list,issue list, etc. fetched projects but never cached them for completions.Adds
cacheProjectsForOrg()at the API layer (inlistProjects()), mirroring howlistOrganizations()callssetOrgRegions(). Every command that lists projects now automatically seeds the completion cache.Changes
src/lib/db/project-cache.ts— AddcacheProjectsForOrg()batch function using transactional upsert (same pattern assetOrgRegions())src/lib/api/projects.ts— Call cache afterlistProjects()returns (best-effort, wrapped in try/catch)test/lib/db/project-cache.test.ts— 4 new tests: batch insert, idempotency, empty no-op, no conflict with DSN cache keysTest Plan
bun test test/lib/db/project-cache.test.ts— 26 tests pass (4 new)bun test test/lib/complete.test.ts— 20 tests passbun run typecheck— cleanbun run lint— cleansentry project list myorg/, thensentry issue list myorg/<TAB>— projects now complete