fix: update stale Twitter URLs, extract error message constant, improve HMAC perf and code style#5
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
…ve HMAC perf and code style - Replace 6 stale twitter.com/stripestatus URLs with status.stripe.com in user-facing error messages (HttpURLConnectionClient, StripeRequest, LiveStripeResponseGetter) - Extract duplicated IOException error message into ApiConnectionException.create() factory method to eliminate 6 copies of the same string across 3 files - Use StringBuilder instead of String concatenation in Webhook.Util.computeHmacSha256 to avoid O(n^2) copying - Replace .size() == 0 with .isEmpty() in Webhook and RequestTelemetry Co-Authored-By: Jason Kelley <kllyjsn@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Why?
Six user-facing
ApiConnectionExceptionerror messages direct developers tohttps://twitter.com/stripestatusfor Stripe status updates. This URL is stale — Stripe's actual status page ishttps://status.stripe.com. Every developer who hits a connection error gets a misleading link.Additionally, the identical 6-line error message string was copy-pasted across 3 files (6 call sites), making future updates fragile and error-prone.
What?
twitter.com/stripestatusreferences withhttps://status.stripe.comin user-facing error messagesApiConnectionException.create(String url, Throwable cause)factory method that centralizes the error message, then replace all 6 inline copies acrossHttpURLConnectionClient,StripeRequest, andLiveStripeResponseGetterStringBuilderinstead ofString +=concatenation inWebhook.Util.computeHmacSha256to avoid O(n²) copying.size() == 0with.isEmpty()inWebhook.SignatureandRequestTelemetryNote for reviewers:
ApiConnectionException.create()is a new public API addition (additive only, no breaking changes). The JAPI compliance check in CI should confirm."you should check"due to string concatenation across lines ("persists," + "you should"→ no space). The new centralized message fixes this — verify this is acceptable.BaseStripeTestrequirestripe-mockand couldn't be run locally; CI will validate.See Also
Link to Devin session: https://app.devin.ai/sessions/a768b314be3e4a0cb33f4b226c4bed82
Requested by: @kllyjsn