test(providers): cover env omission and singular server merge in MCP transform by he-yufeng · Pull Request #10634 · promptfoo/promptfoo · GitHub
Skip to content

test(providers): cover env omission and singular server merge in MCP transform - #10634

Open
he-yufeng wants to merge 1 commit into
promptfoo:mainfrom
he-yufeng:test/mcp-transform-env-coverage
Open

test(providers): cover env omission and singular server merge in MCP transform#10634
he-yufeng wants to merge 1 commit into
promptfoo:mainfrom
he-yufeng:test/mcp-transform-env-coverage

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #10510 (superseded by #10557). Two of the four transform tests from that PR still add coverage that current main does not have, so here they are on their own:

  1. env stays absent when a stdio server declares none. transformMCPServerConfigToClaudeCode spreads config.env conditionally; this pins that the key is omitted entirely (not emitted as env: undefined) so the SDK never sees a phantom empty env.
  2. A singular server entry lands in the same map as servers. The two shapes are merged before transformation; this pins parity for the singular form, including env forwarding, alongside a servers entry in one call.

Both pass against main as of today and fail when the corresponding line is removed (checked locally by deleting the conditional spread and the config.server merge).

To verify

  • npx vitest run test/providers/mcp/transform.test.ts

…transform

Two cases from promptfoo#10510 that current main still lacks after promptfoo#10557:
the conditional env spread must omit the key entirely (no phantom
env: undefined reaching the SDK), and a singular server entry must
land in the same output map as servers entries.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.67%. Comparing base (2e05188) to head (6133a2f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10634      +/-   ##
==========================================
- Coverage   82.68%   82.67%   -0.02%     
==========================================
  Files         946      946              
  Lines       81074    81074              
  Branches    27179    27179              
==========================================
- Hits        67034    67025       -9     
- Misses      14040    14049       +9     
Flag Coverage Δ
backend 84.08% <ø> (-0.02%) ⬇️
site 21.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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