query: Unknown characters are silently ignored (.foo!!!, non-ASCII keys)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
The skipping happens in parser.go around lines 190-196, where the lexer discards characters that form no token; the identifier word-character check is nearby. Start by reading how the lexer handles unknown input, then run the tq examples from the issue (.foo!!!, .foo bar, .名前) to confirm current behavior. Done when unknown characters return a syntax error, Unicode letters work in bare keys, and the error suggests the quoted form. Confirm the breaking-change decision with maintainers first.
Written by the indexing model from the issue text.
Description
Problem
The lexer skips characters that do not form a token "to preserve legacy behavior", so malformed queries succeed and typos go unnoticed:
$ echo '{"foo":1}' | tq '.foo!!!'
1
$ echo '{"foo":1}' | tq '.foo bar'
"bar"
Non-ASCII identifiers are not word characters either, so .名前 is skipped and returns the root.
https://github.com/mojatter/tree/blob/2d4fd3d11f3e28c7c95f51d091b94ef0a6ed18f1/parser.go#L190-L196
Proposed fix
Make unrecognized characters a syntax error (pre-1.0 is the time to drop the legacy behavior), accept Unicode letters in bare identifiers, and add a hint like use ."foo-bar" for keys that need quoting.
- Dominant language
- Go
- Stars
- 7
- Forks
- 2
- Avg merge
- 11h 12m
- Merged PRs (30d)
- 43
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mojatter/tree
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
query: Read null like jq in key steps, comparisons and contains()Possibly taken @mojatter claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mojatter/tree#152 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
fix(handlers): explicitly set Content-Type header in static Index handlerPossibly taken @kage-zero claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Quick Open: restore dependency-directory exclusions in filesystem fallbackPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eugenioenko/ttt#1206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
open-policy-agent/opa#9426 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rorkai/App-Store-Connect-CLI#3192 ·
Maintainers usually reply within 1 day
-
t:urlDecodeUni does not map U+3002 and U+FF61 to a dot, unlike ModSecurityPossibly taken @fzipi claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day