Fix: stop relying on undocumented HTTP::Headers#to_json in debug log#188
Open
afinetooth wants to merge 1 commit into
Open
Fix: stop relying on undocumented HTTP::Headers#to_json in debug log#188afinetooth wants to merge 1 commit into
afinetooth wants to merge 1 commit into
Conversation
The debug log line at jobs.cr:51 invoked `headers.to_pretty_json` on an HTTP::Headers value, which depends on an undocumented Crystal stdlib overload `HTTP::Headers#to_json(JSON::Builder)`. That overload vanished in Crystal 1.20.0, breaking the source build for Homebrew users without matching bottles, and was only restored in 1.20.1 as an explicit forwarder the Crystal team has signaled is unintentional. Convert HTTP::Headers to a plain Hash before serializing so we go through documented JSON paths only. Survives any future Crystal stdlib churn around HTTP::Headers serialization. Adds a regression spec exercising send_request under Log::Level::Debug. Closes #187 Refs coverallsapp/homebrew-coveralls#71 Refs crystal-lang/crystal#16886 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
Coverage Report for CI Build 25444807362Coverage increased (+0.1%) to 94.171%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
10 tasks
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
One-line fix at
src/coverage_reporter/api/jobs.cr:51, plus a regression spec.The debug-log line was calling
headers.to_pretty_jsonon anHTTP::Headersvalue, which silently relied on an undocumented Crystal stdlib overload (HTTP::Headers#to_json(JSON::Builder)). That overload vanished in Crystal 1.20.0 — the root cause of homebrew-coveralls#71 — and was only restored in 1.20.1 as an explicit forwarder the Crystal team has indicated was never intentional.This change converts
HTTP::Headersto a plainHashbefore serializing, so we go through documented JSON paths only. Survives any future Crystal stdlib churn aroundHTTP::Headersserialization.The data payload itself was never affected — it's already a plain
Hashmade of@config.to_h,@source_files.map(&.to_h), and@git_info. Only the debug log line touched a rawHTTP::Headersfor JSON.Test plan
crystal spec spec/coverage_reporter/api/jobs_spec.cr— 6 examples, 0 failures (the new regression spec passes)make testandmake buildAfter merge
make new_version(seeREADME.md); GitHub Actions will publish bottles.brew update && brew upgrade crystal && brew reinstall coveralls).Closes #187
Refs coverallsapp/homebrew-coveralls#71
Refs crystal-lang/crystal#16886
🤖 Generated with Claude Code