Skip to content

test(relay): pin a 500-level JSON message round trip - #473

Merged
shigechika merged 1 commit into
mainfrom
test/json-depth-500
Oct 6, 2026
Merged

shigechika merged 1 commit into
mainfrom
test/json-depth-500

Conversation

@shigechika

Copy link
Copy Markdown
Owner

Follow-up to #462.

#462's probe established how deep json.loads goes before it raises. Measured on macOS:

Python deepest message that parses
3.10, 3.11 994 levels (the recursion limit)
3.12, 3.13 about 10 000 levels
3.14 about 52 000 levels

Deeper input becomes a per-message RecursionError, never a crash. Real MCP messages stay within a few dozen levels.

This adds one unit test, TestDeepJsonMessage, which pins 500 levels, the depth guaranteed on every supported Python. It covers both directions:

  • the stdin request reaches upstream intact;
  • the upstream result reaches stdout intact.

The mock response body is passed as a string, because pytest-httpx deep-copies a json= object and copy.deepcopy itself hits the recursion limit at this depth.

The test runs in under a second, inside the existing suite. It passes locally on Python 3.10 through 3.14.

🤖 Generated with Claude Code

#462 follow-up. CPython 3.10/3.11 parse up to 994 levels (the recursion
limit); 3.12+ go far deeper. Real MCP messages stay within a few dozen
levels. This pins 500 levels, the depth guaranteed to work on every
supported Python, through both directions: the stdin request reaching
upstream and the upstream result reaching stdout.

The mock body is a string because pytest-httpx deep-copies a json=
object, and copy.deepcopy hits the recursion limit at this depth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shigechika
shigechika requested a balanced review from Copilot October 6, 2026 09:25
@github-actions github-actions Bot added the ai-review Admitted for review by pr-gate.yml label Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@shigechika
shigechika requested a balanced review from Copilot October 6, 2026 09:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

AI review (gpt-6.1-sol)

Verdict: no blocking findings.

Scope: full PR diff.

No findings clear the reporting bar this round.

Advisory per-push review (round 1) generated by ai-review — verify findings before acting.

@shigechika
shigechika enabled auto-merge (squash) October 6, 2026 09:32
@shigechika
shigechika merged commit 89aac20 into main Oct 6, 2026
16 checks passed
@github-actions github-actions Bot removed the ai-review Admitted for review by pr-gate.yml label Oct 6, 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