Skip to content

test: Remove manual transactions around MCP spans from the stdio transport - #6917

Closed
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/mcp-remove-stdio-transactions
Closed

test: Remove manual transactions around MCP spans from the stdio transport#6917
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/mcp-remove-stdio-transactions

Conversation

@alexander-alderman-webb

Copy link
Copy Markdown
Contributor

Description

Issues

Reminders

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

98557 passed | ❌ 1 failed | ⏭️ 6756 skipped | Total: 105314 | Pass Rate: 93.58% | Execution Time: 356m 1s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests 📉 -1
Failed Tests 📈 +1
Skipped Tests

➕ New Tests (1)

View new tests
  • test_continuous_profiler_auto_start_and_stop_sampled_span_streaming[experiment-gevent]
    • File: tests.profiler.test_continuous_profiler
    • Status: ❌ Failing

❌ Failed Tests

test_continuous_profiler_auto_start_and_stop_sampled_span_streaming[experiment-gevent]

File: tests.profiler.test_continuous_profiler
Suite: py3.6-gevent
Error: AssertionError: profiler should not be running assert '70522d25f80b4602bb784b9fea70df01' is None + where '70522d25f80b4602bb784b9fea70df01' = get_profiler_id()

Stack Trace
tests/profiler/test_continuous_profiler.py:896: in test_continuous_profiler_auto_start_and_stop_sampled_span_streaming
    assert get_profiler_id() is None, "profiler should not be running"
E   AssertionError: profiler should not be running
E   assert '70522d25f80b4602bb784b9fea70df01' is None
E    +  where '70522d25f80b4602bb784b9fea70df01' = get_profiler_id()

✅ Patch coverage is 100.00%. Project has 2506 uncovered lines.
❌ Project coverage is 89.81%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    89.84%    89.81%    -0.03%
==========================================
  Files          193       193         —
  Lines        24588     24588         —
  Branches      8744      8744         —
==========================================
+ Hits         22089     22082        -7
- Misses        2499      2506        +7
- Partials      1400      1400         —

Generated by Codecov Action

Comment thread tests/integrations/mcp/test_mcp.py
Comment thread tests/integrations/mcp/test_mcp.py
Comment on lines +657 to +658
assert tx["contexts"]["trace"]["status"] == "internal_error"
assert tx["contexts"]["trace"]["status"] == "internal_error"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate assertion in test_tool_handler_error_stdio

The third assertion checking tx["contexts"]["trace"]["status"] is an exact duplicate of the line above it, meaning the original span["tags"]["status"] check was lost during refactoring and nothing new is verified.

Evidence
  • In the original code, three distinct properties were asserted: span["data"][...], span["status"], and span["tags"]["status"].
  • After the refactor to remove the manual transaction wrapper, the assertions were mapped to tx["contexts"]["trace"].
  • assert tx["contexts"]["trace"]["status"] == "internal_error" appears on both lines 657 and 658, making the second one a no-op.
  • The duplicate was introduced because the original span["tags"]["status"] assertion was incorrectly replaced, losing its intent.
  • The equivalent FastMCP test (test_fastmcp.py lines 598-601) does not contain this duplicate assertion, confirming it is unintentional.

Identified by Warden · find-bugs · 2Z9-MNW

assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span["data"]
assert tx["contexts"]["trace"]["status"] == "internal_error"
assert SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in tx["contexts"]["trace"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Resource error test checks wrong dict level for MCP_TOOL_RESULT_IS_ERROR

Assertion checks tx['contexts']['trace'] instead of tx['contexts']['trace']['data'], so it never validates the attribute is actually absent.

Evidence
  • Old code checked SPANDATA.MCP_TOOL_RESULT_IS_ERROR not in span['data'] where span was the nested MCP span.
  • After removing the manual transaction wrapper, the assertion was migrated to tx['contexts']['trace'] but omitted the ['data'] segment.
  • In the same file, test_prompt_handler_with_error (line 970) correctly uses tx['contexts']['trace']['data'] for the identical check.
  • tx['contexts']['trace'] contains trace metadata keys (op, status, trace_id), not span attributes, so the assertion always trivially passes and cannot catch regressions.

Identified by Warden · find-bugs · VX5-C24

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.

1 participant