Repository navigation
feat: export build-time API source analysis - #115
Merged
Merged
Conversation
betegon
marked this pull request as ready for review
October 29, 2026 10:11
Contributor
There was a problem hiding this comment.
Nice extraction overall: build, typecheck and all 179 tests pass locally, and the entry stays isolated from the root bundle. I probed the built dist/source-analysis.js against the real operation catalog and found two problems worth fixing before this ships as a public entry:
- A shorthand
methodgets reported as GET. Inproperty(), aShorthandPropertyAssignmentreturnsinitializer(file, member.name), which isundefinedwhen the name is a parameter. Callers readundefinedas "absent", so the request falls back todefaultMethod. Repro: withrequests: [{ functionName: "apiRequest", pathArgument: 0, optionsArgument: 1 }], the codefunction call(method) { return apiRequest(/projects/${o}/${p}/, { method }); }resolves toGET getProjectwithmethods: ["GET"]. The equivalent{ method: method }correctly yields "Dynamic request identity". Sincemethodsis what consumers use for destructive-command policy, a dynamic DELETE showing up as a read is the wrong way to fail. Fix: returnmember.name(orinitializer(...) ?? null) so the existing unknown/null handling applies. Add a test next to the trailing-spread case. - Unsupported module shapes drop edges with no diagnostic.
sourceModuleonly maps.jsto.ts/.tsx, so extensionless ("./a") and directory ("./lib") imports, which are common under bundler resolution, don't resolve. A helper calling an SDK operation through them ends up with empty usage. The same happens for default imports and exports and for class methods. The Toolkit parity run works because that code uses explicit.jsspecifiers, but other consumers will get false negatives that look exactly like "no API usage". The README says ambiguity produces diagnostics, so either resolve the common candidates (.ts,.tsx,/index.ts,/index.tsx) or report relative imports that don't match any supplied source, and document the supported shapes (named and namespace imports only, top-level functions and consts).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e50c287. Configure here.
sentry-junior
Bot
dismissed
their stale review
October 29, 2026 12:08
Addressed in follow-up review.
2 tasks done
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.

Extracts the source analyzer from Toolkit #1658 into the optional
@sentry/api/source-analysisentry. Consumers use the shared engine with their own source and the published operation catalog:Follows named/default imports, relative files, directory indexes, re-exports and helpers. Default identifier exports preserve wrapper/factory identity and call-site query context while retaining their public export summaries. Factory/wrapper conventions and boolean markers are explicit inputs; CLI routes and destructive-command policy stay in Toolkit.
The analyzer ships with the SDK and runs during each consumer's build. TypeScript is an optional peer isolated from the client, browser and catalog entries. Class/member dispatch and advanced module resolution remain outside its documented scope.
Validated: build, typecheck, 234 SDK tests and 2 Node tests, including packed imports and NodeNext types. A temporary adapter against the packed SDK passed 35 Toolkit tests and preserved existing command/API relationships across 535 source files and 136 command exports. CLI adoption follows the SDK release.
Closes #114 (v1.0 subissue).