Skip to content

Move HeaderForward helpers to pkg/vmcp/headerforward#5302

Open
lorr1 wants to merge 1 commit into
mainfrom
vmcp-headerforward-move
Open

Move HeaderForward helpers to pkg/vmcp/headerforward#5302
lorr1 wants to merge 1 commit into
mainfrom
vmcp-headerforward-move

Conversation

@lorr1
Copy link
Copy Markdown
Contributor

@lorr1 lorr1 commented May 16, 2026

Summary

Related to #5289.

Type of change

  • Refactoring (no behavior change)
  • Bug fix
  • New feature
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test) — existing BuildHeaderForwardTripper and resolveHeaderForward tests moved alongside the helper, still pass against the new location.
  • Linting (task lint-fix) — clean.
  • E2E tests (task test-e2e)
  • Manual testing

API Compatibility

  • This PR does not break the v1beta1 API.

No CRD changes. The only API surface delta is the package path of BuildHeaderForwardTripper. The helper was exported only by PR #5301; this PR moves that export to its final home before broader use.

Changes

File Change
pkg/vmcp/headerforward/transport.go New — moved from pkg/vmcp/client/header_forward.go, package renamed.
pkg/vmcp/headerforward/transport_test.go New — moved from pkg/vmcp/client/header_forward_test.go.
pkg/vmcp/client/header_forward.go Deleted.
pkg/vmcp/client/header_forward_test.go Deleted.
pkg/vmcp/client/client.go Updated import + call site to headerforward.BuildHeaderForwardTripper.

Does this introduce a user-facing change?

No.

Special notes for reviewers

  • Branches off main, not off github_mcp_header (PR Wire HeaderForward into vMCP per-session HTTP client #5301). The two PRs are independent. Whichever merges first, the other's rebase is a one-line import-path update in mcp_session.go (PR Wire HeaderForward into vMCP per-session HTTP client #5301) or client.go (this PR).
  • pkg/vmcp/headerforward/wirefmt/ is unchanged — it owns the env-var wire format used by the operator to pass header-forward config into the vmcp pod; the new transport.go is the runtime that consumes that config.
  • No new logic, no new tests, no new error paths. If this PR's diff isn't entirely renames + import path changes, something is wrong.

Generated with Claude Code

Lift BuildHeaderForwardTripper and its supporting types out of
pkg/vmcp/client/ into the new sibling package pkg/vmcp/headerforward/.
The helper now has two consumers — pkg/vmcp/client (capability-discovery
HTTP client) and pkg/vmcp/session/internal/backend (per-session client)
— and is not logically part of either. A pkg/vmcp/headerforward/wirefmt
subpackage already exists, so the namespace is established.

Pure mechanical relocation: no behavior change, no signature change,
existing tests still cover the helper. This makes future vMCP
anti-pattern #8 cleanup (consolidation of the two parallel HTTP-client
builders) more straightforward.

Related to #5289 (the bug whose fix in PR #5301 motivated the export).
Copy link
Copy Markdown
Contributor Author

@lorr1 lorr1 left a comment

Choose a reason for hiding this comment

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

Automated review loop opened per user request.

Reviewed the mechanical move of header-forward helpers from pkg/vmcp/client/ to the new sibling package pkg/vmcp/headerforward/. No findings. The diff is a clean rename: package declarations updated, buildHeaderForwardTripper exported as BuildHeaderForwardTripper, single call site in pkg/vmcp/client/client.go updated with a 3-line wrap necessary to stay under the 130-char lll limit (141 chars unwrapped). Verified:

  • File-for-file diff vs origin/main shows only package rename, function-name capitalization, and an added package doc comment — no behavior change.
  • No leftover references to the old location/name (rg is clean).
  • pkg/vmcp/client/header_forward_integration_test.go correctly stayed in pkg/vmcp/client/: its subject is the NewHTTPBackendClient factory wiring and it only references the exported vmcpclient.NewHTTPBackendClient, no moved unexported types.
  • Test coverage parity: pkg/vmcp/headerforward/transport_test.go is byte-identical to the old header_forward_test.go after the package and function-name rewrites.
  • New file has a proper // Package headerforward ... doc comment naming both consumer packages.
  • Import grouping in client.go follows the standard 3-group convention.
  • SPDX headers preserved on both moved files.
  • pkg/vmcp/headerforward/wirefmt/ subpackage untouched.
  • Local go build ./pkg/vmcp/... and go test ./pkg/vmcp/headerforward/... ./pkg/vmcp/client/... both pass.

Note on CI: the Tests / Test Go Code (ubuntu-8cores-32gb) check failed due to a runner shutdown (task: Signal received: "terminated", The runner has received a shutdown signal) — infrastructure flake, not a real test failure. Will retrigger and confirm green.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.46%. Comparing base (4893b65) to head (ae10f1e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5302      +/-   ##
==========================================
- Coverage   68.46%   68.46%   -0.01%     
==========================================
  Files         620      620              
  Lines       63358    63360       +2     
==========================================
  Hits        43379    43379              
- Misses      16741    16746       +5     
+ Partials     3238     3235       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lorr1 lorr1 marked this pull request as ready for review May 16, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant