Skip to content

test: opt out of telemetry before test modules import the MCP server - #1386

Merged
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
airbytehq:mainfrom
suryakant-source:suryakant-source-patch-1
Oct 17, 2026
Merged

Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
airbytehq:mainfrom
suryakant-source:suryakant-source-patch-1

Conversation

@suryakant-source

Copy link
Copy Markdown
Contributor

Fixes #1369

Problem

airbyte/mcp/server.py builds the MCP app, including its Segment sink, at import time. _segment_write_key() only returns None when DO_NOT_TRACK or AIRBYTE_OFFLINE_MODE is set. The autouse do_not_track fixture sets DO_NOT_TRACK per test, which runs after collection. Test modules that import the app at module level (for example test_mcp_arg_trace_parity.py) therefore create it with Segment enabled, and CI sends tool_call telemetry to the production source.

Change

Set DO_NOT_TRACK=true at module level in tests/conftest.py, so it is in place before any test module is imported. This is the same value the existing fixture already sets for every test, so test behavior is otherwise unchanged. 4 lines added, nothing removed.

How I checked

Probe plugin that calls airbyte.mcp.server._segment_write_key() right after pytest collection with DO_NOT_TRACK and AIRBYTE_OFFLINE_MODE unset:

  • before the change: key is set (Segment sink would be active)
  • after the change: None

I did not run the full test suite or look at the warehouse data, so the issue's claim about which tests produce the 94% of failures is not something I verified. I did not touch the CI workflow.

I used an AI coding assistant while preparing this change, and I reviewed the diff and the check above myself.

@github-actions github-actions Bot added the community PRs from community contributors label Oct 15, 2026
@octavia-bot
octavia-bot Bot marked this pull request as draft October 15, 2026 08:54
@octavia-bot

octavia-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

Note

📝 PR Converted to Draft

More info...

Thank you for creating this PR. As a policy to protect our engineers' time, Airbyte requires all PRs to be created first in draft status. Your PR has been automatically converted to draft status in respect for this policy.

As soon as your PR is ready for formal review, you can proceed to convert the PR to "ready for review" status by clicking the "Ready for review" button at the bottom of the PR page.

To skip draft status in future PRs, please include [ready] in your PR title or add the skip-draft-status label when creating your PR.

@github-actions

Copy link
Copy Markdown

👋 Welcome to PyAirbyte!

Thank you for your contribution from suryakant-source/PyAirbyte! We're excited to have you in the Airbyte community.

💡 Show Tips and Tricks

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/suryakant-source/PyAirbyte.git@suryakant-source-patch-1' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/suryakant-source/PyAirbyte.git@suryakant-source-patch-1'

PR Slash Commands

As needed or by request, Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /uv-lock - Updates uv.lock file
  • /test-pr - Runs tests with the updated PyAirbyte
  • /prerelease - Builds and publishes a prerelease version to PyPI
📚 Show Repo Guidance

Helpful Resources

If you have any questions, feel free to ask in the PR comments or join our community:

📝 Edit this welcome message.

@suryakant-source
Suryakant Sahoo (suryakant-source) marked this pull request as ready for review October 15, 2026 08:54
@aaronsteers
Aaron ("AJ") Steers (aaronsteers) merged commit c80c74e into airbytehq:main Oct 17, 2026
19 of 20 checks passed
@aaronsteers

Copy link
Copy Markdown
Member

Suryakant Sahoo (@suryakant-source) - Thank you for this contribution! Much appreciated. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community PRs from community contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: unit tests send tool-call telemetry to prod Segment (94% of mcp_events failures)

2 participants