Repository navigation
Conversation
4 tasks done
Contributor
|
Closing the PR, not the concern. This bounds inbound integers in Whether an oversized integer still costs anything on the SDK path has not been measured. A fresh issue with a reproducing frame against the current wrapper would be welcome; it would be a different fix in different code. Same ground as #228 and #90, closed alongside. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
PR #228 catches the
ValueErrorraised by CPython's default integer-conversion limit. That fixes the default 5,000-digit crash, but behavior still depends on mutablesys.set_int_max_str_digits()state: raising or disabling the limit accepts and reflects huge IDs, and lowering it before response serialization can terminate the session.This branch instead supplies
json.loads()with a boundedparse_intcallback. The 640-digit bound matches CPython's minimum legal nonzero conversion threshold, so every integer accepted by the transport can still be serialized under any legal process setting.This is a current-main alternative to #228 rather than a modification of that contributor's branch.
Coverage
Tests cover:
Validation
uv run pytest -q tests/test_mcp.py -k 'malformed_json_does_not_kill_the_session or json_integer_limit_is_transport_owned_and_serializable or accepted_integer_serializes_after_process_limit_is_lowered or oversized_json_integer_positions_do_not_kill_the_session'— 4 passeduv run ruff check .uv run ruff format --check .uv run ty checkuv run sz.py --caps— core 2127/2128uv run coverage run -m pytest tests -q— 462 passeduv run coverage report— 97.50%The commit tree is
1f5d38ea2b682fb6b32574d3a6fbf468dd919bd8on base9c7df0e3616cf28d17e7c8ebeb0c05de6adf117c.