Expose project scope in managed local client errors - #518
Conversation
| let project = canonical_project_dir()?; | ||
| server::recover_current_project_servers() | ||
| .map_err(|error| error.with_managed_client_scope(project.clone()))?; | ||
| let lock = server::ServerLock::acquire(server_name)?; |
There was a problem hiding this comment.
🟡 Medium local/mod.rs:280
When ServerLock::acquire(server_name) cannot create or open the lock, run_client returns the raw metadata error, so managed-client JSON omits mode and project and human output omits the project-scope recovery guidance. Map this error through with_managed_client_scope(project.clone()) like load_info and is_running.
| let lock = server::ServerLock::acquire(server_name)?; | |
| let lock = server::ServerLock::acquire(server_name) | |
| .map_err(|error| error.with_managed_client_scope(project.clone()))?; |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @crates/clickhousectl/src/local/mod.rs around line 280:
When `ServerLock::acquire(server_name)` cannot create or open the lock, `run_client` returns the raw metadata error, so managed-client JSON omits `mode` and `project` and human output omits the project-scope recovery guidance. Map this error through `with_managed_client_scope(project.clone())` like `load_info` and `is_running`.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1eb8e3e. Configure here.
| .map_err(|error| error.with_managed_client_scope(project.clone()))?; | ||
| let lock = server::ServerLock::acquire(server_name)?; | ||
| let info = lock | ||
| .load_info()? |
There was a problem hiding this comment.
Managed scope skips lock acquire
Medium Severity
ServerLock::acquire in managed local client is not passed through with_managed_client_scope, unlike recover, load_info, ServerNotFound, is_running, and ServerNotRunning. Lock and permission failures that already produce whitelisted ServerMetadata* errors therefore omit mode, project, and the managed recovery text, even though those variants have dedicated recovery copy in with_managed_client_scope.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1eb8e3e. Configure here.


Summary
local clientmode and the canonical current project directory for missing, stopped, and missing-binary failuresmodeandprojectfields, concise human guidance, and fixed recovery commandsCloses #467
Tests
cargo fmt --all --checkcargo build -p clickhousectlcargo check -p clickhousectl --no-default-featurescargo test -p clickhousectl(636 unit tests plus all integration suites)cargo clippy -p clickhousectl --all-targets -- -D warningscargo clippy -p clickhousectl --no-default-features --all-targets -- -D warningsStack
issue-477-server-project-scope-errors)