8000 fix request-scoped client overrides by joe-clickhouse · Pull Request #221 · ClickHouse/mcp-clickhouse · GitHub
[go: up one dir, main page]

Skip to content

fix request-scoped client overrides - #221

Merged
joe-clickhouse merged 3 commits into
mainfrom
joe/pr-191-finish
Aug 21, 2026
Merged

joe-clickhouse merged 3 commits into
mainfrom
joe/pr-191-finish

Conversation

@joe-clickhouse
Copy link
Copy Markdown
Collaborator

Summary

  • preserve request-scoped ClickHouse client overrides across the query executor handoff
  • fail closed on invalid state and preserve configured roles when merging settings
  • support opaque client objects and isolate concurrent requests
  • document middleware trust and role-selection constraints

Supersedes #191

Builds on the original fix by @andrei-katkov, thanks!

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread CHANGELOG.md Resolved
# Conflicts:
#	CHANGELOG.md
#	mcp_clickhouse/mcp_server.py
@joe-clickhouse
joe-clickhouse merged commit 18a6364 into main Aug 21, 2026
2 checks passed
@joe-clickhouse
joe-clickhouse deleted the joe/pr-191-finish branch August 21, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0