Repository navigation
fix(exception-capture): normalize NaN rate-limit settings - #1210
marandaneto merged 1 commit into
Conversation
marandaneto
left a comment
There was a problem hiding this comment.
The code looks good; no qualifying findings. Verdict: correct.
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
💡 Motivation and Context
A NaN exception rate-limit setting passes the current range checks. A NaN refill interval then drops every autocaptured exception after the first with
ValueError: cannot convert float NaN to integer; a NaN bucket size never becomes rate limited.Treat NaN like the existing invalid-number inputs and use the logged maximum fallback. This matches the JS limiter’s NaN handling. Existing zero, boolean/type fallback, huge-integer, and infinity behavior stays covered.
💚 How did you test it?
pytest --verbose --timeout=30: 6207 passed, 26 skipped, 3 failed. The three failures are existing macOS metrics-fork cases:test_keeps_working_in_a_forked_child,test_exports_from_a_child_forked_during_an_export, andtest_records_in_a_child_forked_during_a_collection. All three also fail on an unchanged archive of base SHAac55b350a0f8391593de5f2e2b2fa0d6eebc80dcin the same environment; imported package paths were printed to verify the baseline. Child processes abort in macOS system-proxy handling after fork. No unrelated code was changed.📝 Checklist
If releasing new changes
sampo addto generate a changeset file.🤖 Agent context
Autonomy: Human-driven (agent-assisted).
Peter directed this contribution. A Codex GPT-6.1 Sol worker with high reasoning investigated and implemented it using Git/GitHub CLI, uv, pytest, Ruff, mypy and Sampo. The diagnosis traced the installed exception hook through the shared limiter to missing upload attempts, then compared the original JS normalization. The fix preserves existing clamping semantics instead of adding a new configuration error or changing infinity handling.
No human code review has occurred yet; the review checkbox is intentionally unchecked. Human review is required before merge. No public agent-session link is available; the behavior, verification commands and limits are described above.
DRI: @peterolkhov. GitHub denied the attempt to set the assignee with this account’s repository permissions; a maintainer will need to set that assignment.