Repository navigation
fix(mcp): propagate semantic metric discovery refusals - #45905
Draft
mikebridge wants to merge 2 commits into
Draft
mikebridge wants to merge 2 commits into
mikebridge wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #45905 +/- ##
=======================================
Coverage 84.73% 84.73%
=======================================
Files 3069 3069
Lines 205771 205792 +21
Branches 48396 48399 +3
=======================================
+ Hits 174354 174378 +24
+ Misses 28123 28122 -1
+ Partials 3294 3292 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
SUMMARY
TL;DR: Metric discovery reports an access refusal instead of showing a misleading empty or incomplete catalog.
Background. MCP clients use
list_metricsto find metrics across datasets and semantic views.Problem. If a semantic view refused discovery while loading metrics or compatible dimensions, the per-view fallback swallowed that refusal and reported a successful result. Clients could mistake missing metrics for an empty catalog.
What changes. Typed security refusals reach the existing
AccessDeniedhandler. If any visible view refuses discovery, an unscopedlist_metricscall fails as a whole, including built-in dataset metrics; usedataset_idorview_idto scope the call to a source that does not refuse. Unexpected provider failures keep their warning and partial-result behavior. Tests cover scoped and unscoped discovery through streamable HTTP, plus refusal responses on both async chart-data HTTP paths. No SDK or/compatiblebehavior changes.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable: MCP and HTTP response behavior.
TESTING INSTRUCTIONS
Run
pytest tests/unit_tests/mcp_service/semantic_layer/tool/test_list_metrics.py tests/unit_tests/semantic_layers/query_errors_test.py -q.143 tests passed. Six discovery cases fail on the old code and pass with the fix. Both async HTTP cases fail when refusals are deliberately converted to 202 responses; the production async implementation is unchanged. Changed-file hooks pass.
HTTP tests use in-process transports and injected refusal exceptions. They do not require or validate a live provider, broker or worker.
ADDITIONAL INFORMATION
SEMANTIC_LAYERSfor semantic-view discovery