Repository navigation
refactor(api): route MCP PromQL connection lookups through the MCP helper - #3777
brandon-pereira wants to merge 2 commits into
Conversation
…lper resolvePromqlTarget and getPromqlLabelCatalog take an optional getConnection lookup that defaults to the team-scoped controller lookup, so the REST /prometheus router is unchanged. The MCP PromQL tile and describe_source paths pass getMcpConnection, so every MCP connection lookup now goes through mcp/utils/connections.ts.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewScope: PR #3777 — routes MCP PromQL connection lookups through Intent: Follow-up to #3776. Give ✅ No critical issues found. Security and correctness independently traced both the REST and MCP paths and confirmed equivalence: 🔵 P3 nitpicks (3)
Reviewers (7): correctness, testing, maintainability, project-standards, kieran-typescript, security, api-contract. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 476 passed • 1 skipped • 1104s
Tests ran across 4 shards in parallel. |
|
Re the review's P3 findings:
|
Summary
Follow-up to #3776.
#3776 routed MCP connection lookups through
mcp/utils/connections.ts. Two PromQL paths still skipped it, because they get their connection inside the sharedcontrollers/promql.ts:runPromqlTile, viaresolvePromqlTarget)describe_source(describePromqlSource, viagetPromqlLabelCatalog)This PR gives both controller functions an optional
getConnectionlookup. It defaults to the existing team-scopedgetConnectionById, so the REST/prometheusrouter is unchanged. The MCP paths now take the fullMcpContextand passgetMcpConnection, so every MCP connection lookup goes through the helper. The comment inconnections.tsdrops the PromQL exception that #3776 added.No behavior change: the same connection is found, the password is selected the same way, and the "Connection not found" errors are unchanged.
No changeset: internal refactor with no user-facing change.
How to reproduce
Starting point: N/A, internal refactor with no user-visible change.
Testing:
cd packages/api && yarn ci:unitruns the newcontrollers/__tests__/promqlConnectionLookup.test.ts(default lookup, custom lookup, and not-found handling) and a newdescribeSourceTimeout.test.tscase that checks PromQLdescribe_sourcelooks up connections through the MCP helper.make dev-int FILE="promql prometheus"covers the MCP PromQL tools and tiles plus the REST/prometheusrouter: 5 suites, 189 tests pass. The full MCP integration suite (make dev-int FILE=src/mcp/__tests__) also passes: 23 suites, 636 tests.How to test on Vercel preview
N/A, non-UI change.
References