Skip to content

fix(replay-parse-service): handle plain HTTPError from ballchasing client#743

Closed
ben4643 wants to merge 1 commit into
SprocketBot:mainfrom
ben4643:B++/FixParser
Closed

fix(replay-parse-service): handle plain HTTPError from ballchasing client#743
ben4643 wants to merge 1 commit into
SprocketBot:mainfrom
ben4643:B++/FixParser

Conversation

@ben4643
Copy link
Copy Markdown

@ben4643 ben4643 commented May 1, 2026

Summary

Fixes prod IndexError: tuple index out of range in parseReplay Celery task that made previously-uploaded replays permanently un-parseable.

_parse_ballchasing assumed ballchasing exceptions had args = (response, body) and used e.args[1]. python-ballchasing actually raises plain requests.HTTPError from raise_for_status()args is a 1-tuple (message,), so e.args[1] raises IndexError before the duplicate-replay (409) fast-path could run. Every retry of an already-uploaded replay then crashed.

Changes

  • New _extract_response_and_body(exc) helper — pulls Response and parsed body off exc.response.
  • Replaced the 6 e.args[1] / *e.args references in _parse_ballchasing with (response, body) from the helper.
  • Exceptions with no .response (e.g. ConnectionError) now re-raise instead of being silently misinterpreted as a known status code.

Tests

New tests/test_ballchasing_error_handling.py:

  • 409 duplicate-replay → fast-path returns existing replay's data, no IndexError
  • 400 failed-replay → original exception re-raises (not IndexError)
  • 429 rate-limit on get_replay → retries, succeeds on second call
  • Unknown exception (ConnectionError, no .response) → propagates unchanged

All 11 tests pass (4 new + 7 pre-existing).

Test plan

  • Re-run one of the failing prod task IDs (e.g. dc357bcc-8bcc-4321-bba4-6b66e261c64b) against staging and confirm no IndexError.
  • Submit a known-already-uploaded replay and confirm "Replay already parsed " log line appears, followed by successful stats fetch.
  • Submit a fresh replay and confirm normal upload path still works.

@gankoji
Copy link
Copy Markdown
Member

gankoji commented May 1, 2026

I'm not sure I see the point of this - this is cleaning up error handling for the ballchasing path, which at this point is both not active and fully deprecated.

@ben4643 ben4643 closed this May 2, 2026
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.

2 participants