Repository navigation
fix(jsonrpc): preserve absolute columns in long parse errors - #4228
Open
zakazaka95 wants to merge 1 commit into
Open
zakazaka95 wants to merge 1 commit into
zakazaka95 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Continues #4020 following the invitation to resubmit, and addresses #3914 against current main (
301cbb99).Long requests can lose the beginning of a line from the diagnostic window, causing the reported column to restart inside the excerpt. Track discarded rune starts and trim at UTF-8 boundaries so the reported position remains absolute while the caret stays aligned with the displayed text. This retains current main’s JSON-v2 error handling and comma adjustment.
The three chunked cases now have literal expected JSON responses in a separate
TestHandleParseErrorChunked, as requested in the earlier review. The long formatting expression is split as requested too.Validation
Linux validation and benchmark run:
go test -short ./jsonrpcandgo vet ./jsonrpcpass.Requested benchmarks
Five runs per case, 2 seconds each, CPU=1 and GOMAXPROCS=1, on the same Linux runner. Values below are medians against
301cbb99.These benchmarks use ASCII request bodies. The regression cases also cover mixed-width UTF-8 and a discarded newline. The extra prefix scan costs time on large requests; an ASCII-word fast path reduces that cost.