Repository navigation
fix request-scoped client overrides - #221
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes request-scoped ClickHouse client configuration overrides getting lost when run_query hands work off to QUERY_EXECUTOR, while tightening override validation and preserving configured base roles unless explicitly overridden.
Changes:
- Capture and validate per-request client overrides before the thread-pool handoff, and pass them into the worker execution path.
- Merge nested override mappings (
settings,generic_args) with the base config while rejecting role aliases and failing closed on invalid state. - Expand unit and MCP-boundary tests for override propagation, concurrency isolation, and safe error behavior; document override constraints in the README.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mcp_clickhouse/mcp_server.py | Captures request overrides pre-executor, validates/snapshots them, and merges them safely into the base ClickHouse client config. |
| tests/test_context_config_override.py | Adds thorough unit + MCP-boundary coverage for override validation, propagation into worker threads, and concurrency isolation. |
| tests/test_mcp_server.py | Updates the execute_query patch stub signature to match the new worker call shape. |
| README.md | Documents override shape requirements, merge semantics, and role/authorization constraints for middleware-provided overrides. |
| CHANGELOG.md | Adds an Unreleased “Fixed” entry describing the override propagation fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
# Conflicts: # CHANGELOG.md # mcp_clickhouse/mcp_server.py
slabko
approved these changes
Aug 21, 2026
This was referenced Sep 1, 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.
Summary
Supersedes #191
Builds on the original fix by @andrei-katkov, thanks!