Repository navigation
test(mcp): remove outdated FastMCP middleware discovery assumptions - #1066
Merged
Merged
Conversation
Member
Author
|
super flaky asserts that arent needed anymore |
Contributor
posthog-python Compliance ReportDate: 2026-10-15T17:00:25.393860+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
There was a problem hiding this comment.
Approved.
Contained test-only adjustment with no runtime changes or open substantive review concerns. The current-head reviewer reported no findings.
- PostHog Review (Standard) reviewed the current head: no findings.
- posthog[bot] reviewed the current head.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 0L, 0F substantive, 2L/1F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T0 auto-approve: T0-deterministic (2L, 1F, single-area, test) |
| stamphog 2.5.1 | .stamphog/policy.yml @ 5fc5a35 · reviewed head 5fc5a35 |
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.
💡 Motivation and Context
FastMCP 4.0.11 with MCP 2.3.0 returns middleware-injected tools from
get_tool(). Two assertions intest_fastmcp_v4.pyassume it returnsNone, causing three test cases to fail before PostHog instrumentation runs.These failures also reproduce on main. They caused the MCP SDK v2 Python 3.10 check to fail in #1063. The two Python 3.14 MCP jobs were cancelled.
Remove the outdated discovery assertions. Keep every subsequent check for application-owned argument preservation, analytics argument stripping, tool results, and captured events. No SDK runtime code changes.
This keeps the real
ToolInjectionMiddlewareintegration tests. Explicit coverage for middleware tools that remain invisible toget_tool()before listing is a separate follow-up.💚 How did you test it?
Using Python 3.13, FastMCP 4.0.11, and MCP 2.3.0:
test_fastmcp_v4.pypass after the change.uv run --no-sync pytest posthog/test/mcp --timeout=30 -q: 498 passed, 22 skipped, with one existing deprecation warning.git diff --checkpass.origin/mainreported no actionable findings.📝 Checklist
If releasing new changes
sampo addto generate a changeset file. Not needed for this test-only change.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi used Git, GitHub CLI, uv, pytest, Ruff, and isolated autoreview. The fix removes assertions about FastMCP discovery rather than requiring the opposite behavior, so these tests remain focused on PostHog instrumentation. Human review is required.