WIP: capture and display trace IDs in API error output#185
Open
afinetooth wants to merge 1 commit into
Open
Conversation
Adds a `headers` getter and `trace_id` helper to Api::HTTPError. The helper probes common CDN/cloud tracing headers (cf-ray, x-request-id, x-amzn-requestid, x-amzn-trace-id, x-trace-id) and returns the first match. The CLI's error rescues for InternalServerError, UnprocessableEntity and the generic HTTPError now print "Trace ID: ..." alongside the existing status/response so users can include it when contacting support. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
Coverage Report for CI Build 25443965755Coverage increased (+0.06%) to 94.129%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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
Adds tracing-header diagnostics to API error output so users (and Coveralls support) can correlate failed requests with CDN/server logs.
Status: WIP — code complete, no specs yet.
What changes
Api::HTTPErrornow exposesheaders : HTTP::Headers(the full response headers from the failing response).Api::HTTPError#trace_idreturns the first match among common tracing headers:cf-ray,x-request-id,x-amzn-requestid,x-amzn-trace-id,x-trace-id. Returnsnilif none are present.Api::InternalServerError,Api::UnprocessableEntity, and the genericApi::HTTPErrornow print aTrace ID: …line (when one exists) alongside the existing diagnostic block, so users can include it when contacting Coveralls support.No behavior change for happy-path requests. Pure diagnostic enhancement on the error path.
What's left to ship
Api::HTTPError#trace_idcovering each header name + thenilcase.trace_idis present, the heredoc emits a blank line. Decide whether to suppress it.For the next Claude Code session
This repo has the
superpowersplugin available globally. Recommended flow:superpowers:writing-plans— scope the spec additions and any cosmetic cleanup explicitly.superpowers:test-driven-development— write the failing specs first, then rerun the suite.superpowers:verification-before-completion—make testandmake buildbefore requesting review.superpowers:requesting-code-review— when the checklist above is empty.Test plan
make testpasses after specs are added.make buildproduces a binary that surfaces aTrace ID:line when the server returns a 500 with acf-rayheader (manual smoke test against a mock server is sufficient).🤖 Generated with Claude Code