feat(debug-files): add print-sources command#1138
Merged
Merged
Conversation
List the source files a debug information file references, reporting for each whether the source is embedded, available via a source link, or present on the local disk -- a read-only preview of what bundle-sources would collect. - dif: add listSources() on the new ObjectFile.debugSession() / DebugSession.files() / sourceByPath() wasm API (getsentry/symbolic#997). - command: src/commands/debug-files/print-sources.ts (local-only, auth:false). - tests for the dif primitive and the command; docs + skill regenerated. Depends on the debugSession() API from getsentry/symbolic#997. The dep bump to the published @sentry/symbolic (dev-tested here against a local build) is the only step remaining before this can open as a PR.
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 82.54%. Project has 5058 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.43% 81.44% +0.01%
==========================================
Files 392 393 +1
Lines 27191 27254 +63
Branches 17659 17699 +40
==========================================
+ Hits 22142 22196 +54
- Misses 5049 5058 +9
- Partials 1839 1847 +8Generated by Codecov Action |
`print-sources` lists referenced sources for every object in the archive, but `bundle-sources` only bundles one slice (first with debug info, else first). On fat Mach-O the preview could list sources that `bundle-sources` never collects without saying so. Centralize the slice-selection rule in `selectBundledObject` (shared by `createSourceBundle` and `print-sources`), expose `hasDebugInfo` on `listSources` output, and warn — mirroring `bundle-sources` — naming the exact slice that would be bundled when an archive has multiple objects.
…nt-sources Address review feedback on the multi-slice handling: - Expose `hasDebugInfo` on each `print-sources` output object so `--json` consumers can apply the same `selectBundledObject` rule as `bundle-sources` (the slice warning was previously stderr-only). - Record per-object `enumerationError` in `listSources` so a failed debug session is no longer indistinguishable from an object that genuinely references no sources; print-sources now warns and renders it distinctly. - Differentiate the footer hint between an archive with no objects, one whose source reads all failed, and a genuine "no referenced sources" result.
If `session.files()` throws partway through a slice, drop any entries already collected so `files` stays empty when `enumerationError` is set, honoring the `DifObjectSources` contract and avoiding a partial list in `--json` that the human formatter would hide.
Contributor
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 7455bf1. Configure here.
…rces hint When no sources are listed but at least one slice failed to enumerate (even if other slices genuinely reference none), the footer hint now reports a read error instead of "no referenced sources found", so it no longer contradicts the per-slice enumeration warnings.
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
Adds
sentry debug-files print-sources— a local-only command that lists the source files a debug information file references, reporting for each whether the source is embedded in the debug file, available via a source link, or present on the local disk. It is a read-only preview of whatbundle-sourceswould collect and always exits zero on a parseable file.Like
check,bundle-sources, andbundle-jvm, it makes no network requests — it parses the object in-process (Mach-O/dSYM, ELF, PE/PDB, Portable PDB, WebAssembly, Breakpad, source bundles) via the bundledsymbolicWASM module.Details
src/lib/dif/index.ts(listSources) built onObjectFile.debugSession()→session.files()/session.sourceByPath()exposed by@sentry/symbolic13.5.0 (getsentry/symbolic#997). Bumps the dependency13.4.0 → 13.5.0.type,url,debugId,sourceMappingUrl). The full sourcecontentsis intentionally not copied across the wasm/JS boundary for a listing — avoiding a per-file Rust-UTF-8 → JS-UTF-16 re-encode that the preview never needs.--jsonemits a structured envelope.Test plan
test/commands/debug-files/print-sources.test.ts— 6 cases (local source present/missing, no referenced sources,--jsonshape, validation errors for missing path and non-debug file).test/lib/dif/index.test.ts—listSourcesunit coverage updated for the newtypefield.@sentry/symbolic@13.5.0:pnpm vitest run test/lib/dif test/commands/debug-files→ 41 passed;typecheckandlintclean.