github-actions[bot] commented on code in PR #69447:
URL: https://github.com/apache/doris/pull/69447#discussion_r4355895150
##########
.github/scripts/submit_review.py:
##########
@@ -207,6 +217,164 @@ def review_payload(submission, run, root, remaining):
}, counts, marker
+THREAD_MUTATION = """mutation($input: AddPullRequestReviewThreadInput!) {
+ addPullRequestReviewThread(input: $input) {
+ thread { id path line diffSide }
+ }
+}"""
+
+
+def diff_path(header):
+ value = header[4:]
+ if value.startswith('"'):
+ # Git quotes UTF-8 bytes with C escapes (including octal), not JSON.
+ value = codecs.escape_decode(value[1:-1].encode())[0].decode()
+ else:
+ value = value.split("\t", 1)[0]
+ return None if value == "/dev/null" else value[2:]
+
+
+def inline_locations(context, comments):
+ """Map the existing position schema using the authoritative local PR
diff."""
+ wanted = {(c["path"], c["position"]) for c in comments}
+ locations = {}
+ old_path = new_path = position = None
+ old_line = new_line = 0
+ with (context / "pr.diff").open() as handle:
Review Comment:
[P2] Preserve raw bytes and LF boundaries when reading the diff
On the UTF-8 runner, `Path.open()` strictly decodes the whole patch. Git
emits raw text bytes, and the existing
`regression-test/data/load_p0/stream_load/csv_with_none_utf8_data.csv` contains
invalid UTF-8 (`0xb4`) without NULs. A PR whose patch includes that row raises
`UnicodeDecodeError` here, even if every finding targets another source file,
preventing review delivery.
Default [universal newline
handling](https://docs.python.org/3/library/functions.html#open) also splits
bare carriage returns in CSV data: for patch bytes `+a\rb\n+c\n`, `+c` is diff
position 2, but this loop sees `+a`, `b`, `+c` and rejects position 2 as
non-commentable. The `test_csv_line_end_lf_crlf` fixtures already contain such
bytes.
Use byte-preserving decoding with LF-only iteration, or parse bytes and
decode only metadata, and cover both inputs. Changing only `newline="\n"`
leaves the decoding failure; `newline=""` still splits bare CR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]