Skip to content

fix: preserve custom context containing large integers - #508

Draft
Kayvan-Zahiri wants to merge 1 commit into
rollbar:masterfrom
Kayvan-Zahiri:codex/preserve-large-integer-context
Draft

Kayvan-Zahiri wants to merge 1 commit into
rollbar:masterfrom
Kayvan-Zahiri:codex/preserve-large-integer-context

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Description of the change

A sufficiently large positive or negative integer in report_message(..., extra_data=...) causes the default, unbatched serializer to replace the entire custom context dictionary with "<class 'dict'>", losing neighboring fields too.

Return integers directly before the floating-point NaN/infinity checks. Python can JSON-encode these integers; converting them to float for math.isnan/math.isinf raises OverflowError. Preserve existing finite-float and non-finite labels.

Type of change

  • Bug fix

Related issues

Fixes #507

Validation

  • Before: 4 failed, 16 passed new cases. Failures cover positive/negative integers through both the transform and public report_message API. Batched-mode, ordinary numeric, boolean, NaN and infinity cases provide controls.
  • After: 57 relevant transformation/report-context tests passed.
  • Base test dependency suite: 328 passed, 85 skipped.
  • After installing the declared optional type/framework dependencies: 416 passed, 1 skipped, 3 failed (plus 10 subtests passed). Unchanged upstream with the new tests excluded produces 396 passed, 1 skipped, the same 3 failures: two threaded async-handler tests and test_report_exception_with_same_exception_as_cause, involving request-context state. Those baseline failures are not fixed here.
  • MyPy: success, 52 source files.
  • New test file passes Flake8. Changed production file retains two baseline Flake8 diagnostics (E301 at line 15, C901 on transform_custom); verified against unchanged upstream. No new diagnostic introduced.
  • git diff --check passes. Python 3.12; no full Python/framework version matrix run.
  • All reports use mocked transport. No hosted Rollbar account, real access token, events, paid resources, or UI automation.

Checklists

  • New tests cover the fix.
  • Relevant tests pass locally.
  • Full lint/suite green: baseline limitations documented above.
  • Human review / reviewer assignment pending.

AI assistance: OpenAI Codex investigated, implemented, tested, and drafted this PR. Human verification is not claimed.

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

Labels

None yet

1 participant