fix(json): flatten view command JSON output for --fields filtering#495
Merged
fix(json): flatten view command JSON output for --fields filtering#495
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
15899fe to
1037646
Compare
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 1071 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 95.68% 95.67% -0.01%
==========================================
Files 180 180 —
Lines 24704 24724 +20
Branches 0 0 —
==========================================
+ Hits 23637 23653 +16
- Misses 1067 1071 +4
- Partials 0 0 —Generated by Codecov Action |
issue view, event view, and trace view commands yielded wrapper objects
(e.g., { issue, event, trace }) as their CommandOutput data. When --fields
was used, filterFields looked for field names at the top level of this
wrapper, so --fields shortId,title returned {} because those fields
lived inside the nested 'issue' object.
Add jsonTransform to all three view commands that spreads the primary
entity as the top-level object:
- issue view: { ...issue, event, trace }
- event view: { ...event, trace }
- trace view: { ...summary, spans }
This makes --fields shortId,title work directly on issue properties,
while enrichment data remains accessible via --fields event.id or
--fields trace.traceId.
The jsonTransform also handles spanTreeLines exclusion (previously done
via jsonExclude) since the transform controls the full JSON shape.
1037646 to
d9400d7
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
issue view,event view, andtrace viewcommands yielded wrapper objects (e.g.,{ issue, event, trace }) as theirCommandOutputdata. When--fieldswas used,filterFieldslooked for field names at the top level of this wrapper, so--fields shortId,titlereturned{}because those fields lived inside the nestedissueobject.Fix
Add
jsonTransformto all three view commands that spreads the primary entity as the top-level object:{ ...issue, event, trace }{ ...event, trace }{ ...summary, spans }This makes
--fields shortId,titlework directly on issue properties, while enrichment data remains accessible via--fields event.idor--fields trace.traceId.Test plan
bun test test/commands/trace/view.func.test.ts— updated assertions for flattened JSON structuresentry issue view <id> --json --fields shortId,title,countshould return filtered fields instead of{}