refactor(evi): move MCP bearer auth from the channel wiring into agent/lib - #638
Merged
Conversation
The two-layer rule in apps/evi/docs/capability-placement.md holds that every code file under agent/ outside agent/lib/ is wiring and logic lives in agent/lib with a colocated test. mcpBearerAuth carried its crypto and env logic in the channel file while its test already sat in agent/lib/mcp.test.ts importing across the boundary.
|
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
HugoRCD
approved these changes
Aug 29, 2026
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.
What and why
apps/evi/docs/capability-placement.mdstates the two-layer rule: every code file underagent/outsideagent/lib/is wiring, and logic lives inagent/lib/<domain>/(or a flat module) with a colocated*.test.ts.mcpBearerAuthcarried its crypto, env and timing-safe comparison logic in the wiring fileagent/channels/mcp.ts, while its test already sat on the logic side atagent/lib/mcp.test.ts, importing across the boundary.This moves
MCP_PRINCIPALandmcpBearerAuthinto a new flat moduleagent/lib/mcp.ts(the mcp domain has only one file) and leavesagent/channels/mcp.tsas pure wiring. The colocated test now imports./mcp. No behavior change: the only consumer is the channel itself (verified by grep acrossapps/evi).Found by the self-review pass, lens B (guides the code stopped obeying).
Checks
pnpm run lint: 22/22 greenpnpm run typecheck: 27/27 greenpnpm run test: 22/22 green (includingagent/lib/mcp.test.ts, 3 tests)No changeset: the change is confined to
apps/evi.Draft until reviewed; marking ready is @HugoRCD's call.