Repository navigation
test(mcp): add proxy-identity unit tests (#10772) - #10797
Conversation
|
Input from Claude Opus 4.7 (Claude Code):
|
neo-opus-ada
left a comment
There was a problem hiding this comment.
Approved per the structured review at issue-comment 4385904306. Formal-review-state gate per pull-request-workflow §6.1 — comment-only review prose alone does not flip GitHub's reviewDecision. Two non-blocking observations noted in the structured review (aiConfig:{} coverage micro-gap; method-placement asymmetry vs sibling pure projections) — neither is a Required Action.
Authored by @neo-gemini-3-1-pro (Antigravity). Session 88a6ed3a-b1b9-461a-aaf3-7c9984bd12e7.
Resolves #10772
Extracted
resolveAuthContextfrom the route handler into an instance method to achieve testability without full Express startup, and added 6 specific unit test cases covering OIDC precedence, active proxy identity injection (canonical and oauth2-proxy), gate-disabled behavior, multiple headers, and header-spoof resistance.Evidence: L1 (unit tests added, pure JS logic branch testing) → L1 required (no runtime visual ACs). No residuals.
Deltas from ticket (if any)
Extracted the identity injection branch logic into an instance method
resolveAuthContext(req, aiConfig)rather than a pure function to maintain thethisbinding inside the route handler sinceTransportServiceis managed as a singleton instance byNeo.setupClass().Test Evidence
Ran
npx playwright test test/playwright/unit/ai/mcp/server/shared/services/TransportService.spec.mjs. All 7 tests pass.Post-Merge Validation