fix(jsonview): preserve literal keys throughout the interactive explorer - #121
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
Make every interactive JSON-explorer object lookup use literal JSON member names instead of interpreting those names as GJSON path expressions.
This complements #86, which addresses the same class of bug in the static pretty renderer. The interactive explorer has its own independent lookup paths and remains affected without this change.
Related to #81.
Problem
The explorer enumerates real object member names with
@keys, but several rendering paths then feed those names back intogjson.Result.Get.Getparses its argument as a GJSON path, so a literal key such asa.bcan resolve the nested patha -> binstead of the top-level member named exactlya.b.For example:
{ "a.b": "literal-value", "a": {"b": "nested-value"} }can show
nested-valueunder thea.bkey even though the underlying JSON storesliteral-valuethere.The bug exists in four interactive paths:
Fixing only one of these leaves the same incorrect value substitution elsewhere in the explorer.
Fix
Once keys have been enumerated, materialize each object's literal map with
Result.Map()and index it directly by the key string. No GJSON path parsing is used for an already-known object member name.The change covers all four interactive paths above while leaving genuine navigation-path construction and user transformations unchanged.
Regression coverage
Added focused tests proving literal dotted keys remain distinct from nested paths in:
The fixtures deliberately contain both
"a.b"and nested{"a":{"b":...}}values so a path-based lookup deterministically returns the wrong value before the fix.Validation
The branch is based directly on current upstream
main(a7719136b8ed401b0c51a05553a5e4f720150307) and contains one DCO-signed commit. The production change is 9 additions / 4 deletions in handwritteninternal/jsonview/explorer.go, plus focused regression coverage. Full repository test execution is left to CI.Risk
Low. The explorer already has the literal member names. This change only stops reinterpreting those names as query expressions. Simple keys retain the same values, while keys containing GJSON path syntax now correctly refer to their own object members.