Skip to content

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
devin/1776171189-fix-stale-urls-and-code-quality
Open

fix: update stale Twitter URLs, extract error message constant, improve HMAC perf and code style#5
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1776171189-fix-stale-urls-and-code-quality

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot commented Apr 14, 2026

Why?

Six user-facing ApiConnectionException error messages direct developers to https://twitter.com/stripestatus for Stripe status updates. This URL is stale — Stripe's actual status page is https://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?

  • Fix stale URLs: Replace all 6 twitter.com/stripestatus references with https://status.stripe.com in user-facing error messages
  • Extract duplicated error message: Add ApiConnectionException.create(String url, Throwable cause) factory method that centralizes the error message, then replace all 6 inline copies across HttpURLConnectionClient, StripeRequest, and LiveStripeResponseGetter
  • Improve HMAC hex encoding perf: Use StringBuilder instead of String += concatenation in Webhook.Util.computeHmacSha256 to avoid O(n²) copying
  • Code style: Replace .size() == 0 with .isEmpty() in Webhook.Signature and RequestTelemetry

Note for reviewers:

  • ApiConnectionException.create() is a new public API addition (additive only, no breaking changes). The JAPI compliance check in CI should confirm.
  • The original error messages had a minor formatting bug: a missing space before "you should check" due to string concatenation across lines ("persists," + "you should" → no space). The new centralized message fixes this — verify this is acceptable.
  • Tests that extend BaseStripeTest require stripe-mock and couldn't be run locally; CI will validate.

See Also

Link to Devin session: https://app.devin.ai/sessions/a768b314be3e4a0cb33f4b226c4bed82
Requested by: @kllyjsn


Open with Devin

…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>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant