Repository navigation
Test the curl-config, header and UTF-8 helpers directly - #4
Merged
Merged
Conversation
curlQuote, headerSafe and parseStatus were only exercised end to end, and cleanUtf8 only on one invalid byte and one truncation. The new tests pin their current behavior: every byte value quotes to one line with no raw control character or bare quote, header values lose only control characters, curl's write-out is read as a status or -1 (000 included), and cleanUtf8 replaces overlong, surrogate, out-of-range, stray and cut-off sequences byte by byte while never exceeding its limit or splitting a character. Tests only; no change to the header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (scored against the diff and CI run 36685477444):
Observations (judgment calls, no change made):
Summary: a tests-only change, green on every platform. No mechanical fixes were needed. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
Stage B (unit-test expansion) cycle: five direct tests are added for
trace_client::detailhelpers that were previously exercised only end to end, or only on one input. The tests describe current behavior;trace_client.hppis not modified.cleanUtf8ReplacesEveryMalformedSequence: well-formed 1–4 byte text and an embedded NUL pass through. Overlong 2- and 3-byte forms, UTF-16 surrogates, code points past U+10FFFF, stray continuation bytes, a cut-off trailing sequence and a lead byte with no continuation each become one U+FFFD per byte.cleanUtf8NeverExceedsTheByteLimit: a limit of 0, plain truncation, and a U+FFFD or 4-byte character that would not fit are all left out whole rather than cut.curlQuoteKeepsEveryValueOnOneConfigLine: backslash, quote and\n \r \t \vare escaped, other control bytes are dropped, and UTF-8 and DEL are kept. A property check runs over all 256 byte values and confirms the result has no raw control character and no unescaped quote inside the surrounding pair. This is the curl-config injection boundary described in "How a report is sent".headerSafeDropsControlCharactersOnly: CR, LF, TAB, NUL and DEL are dropped; spaces and UTF-8 are kept.parseStatusReadsCurlsWriteOutOrReportsNoAnswer:201," 401\r\n"and999are read as statuses;000(curl's "no response"), empty input, whitespace only, four digits, non-digits and a status line all give-1. The test is guarded to the system-curl transport, the only build whereparseStatusexists.No production behavior was found to disagree with the README while these were written, so no bug issue was filed.
Deferred
System32\curl.exeexists) is not picked up. The issue asks the owner to choose between honoring the override and documenting the current precedence, and the choice touches thecurl.exelookup, which is part of the security boundary. It stays open for that decision.Test plan
make test(g++, C++11,-Werror):31 tests, 0 failed checks(26 → 31, all five new tests printok)make test STD=c++2a(the local g++ predates the-std=c++20spelling):31 tests, 0 failed checksmake test-libcurl:31 tests, 0 failed checks(parseStatustest compiled out)Build: linux (g++/clang++ × c++11/17/20), linux-libcurl, linux-sanitizers, macos, windowsNo tracking issue: this coverage gap was found during triage.
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson