Skip to content

fix: getUPS() returns immediately instead of hitting dead endpoint#34

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/getups-skip-dead-endpoint
Draft

fix: getUPS() returns immediately instead of hitting dead endpoint#34
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/getups-skip-dead-endpoint

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

@toddr-bot toddr-bot commented Apr 8, 2026

What

getUPS() now returns an error tuple immediately instead of making an HTTP request to a dead UPS endpoint.

Why

The qcostcgi.cgi endpoint was retired by UPS. Every call to getUPS() waited 30 seconds for an HTTP timeout before failing with a croak. Callers who haven't migrated away from getUPS() paid a 30-second penalty on every call for no reason.

How

Removed the HTTP request code from getUPS(). The function now emits its deprecation warning (unchanged) and returns (undef, undef, $error_message) immediately. This is backward-compatible — callers checking the third return value for errors see an informative message. Callers using eval {} to catch the croak will no longer see a die, which is strictly more graceful.

Net: -161 lines, +25 lines. The dead URL construction, HTTP call, and response parsing are gone.

Testing

  • Updated t/getups.t to verify: deprecation warning still emitted, error tuple returned immediately, no HTTP calls made
  • Full test suite passes (make test)

Note: PR #33 adds request validation tests for getUPS() that test the URL construction code removed here. Those tests would need updating if this merges first.

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 25 insertions(+), 161 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The qcostcgi.cgi endpoint was retired by UPS years ago. Previously,
every getUPS() call would wait 30 seconds for an HTTP timeout before
failing. Now it returns (undef, undef, $error) immediately with an
informative message, saving callers 30 seconds of dead wait time.

The deprecation warning is preserved unchanged. No behavior change
for callers who already check the error return value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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