Surface overridden environment credentials - #352
Open
sdairs wants to merge 2 commits into
Open
Conversation
sdairs
temporarily deployed
to
cloud-integration
August 1, 2026 10:51 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves credential-source transparency in clickhousectl cloud by surfacing when environment API credentials are present but outranked by higher-precedence sources, without changing the underlying precedence rules.
Changes:
- Emit a one-line stderr notice when env API credentials are configured but ignored due to CLI flag or project-credentials-file precedence.
- Enhance
cloud auth statusandcloud --help/flag help text to document precedence and show inactive-but-configured env credentials. - Add unit and subprocess regression tests to verify the notice, help text, status output, and on-wire credentials behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents precedence order and the new stderr notice / auth status behavior. |
| crates/clickhousectl/tests/cli_request_shape_test.rs | Adds subprocess regression coverage for env-credential override notice and inactive env status. |
| crates/clickhousectl/src/main.rs | Implements the stderr notice and updates cloud auth status env-row status strings. |
| crates/clickhousectl/src/cloud/mod.rs | Re-exports EnvCredPresence for use by the CLI layer. |
| crates/clickhousectl/src/cloud/client.rs | Adds derives to EnvCredPresence to support comparisons/debugging/tests. |
| crates/clickhousectl/src/cloud/cli.rs | Clarifies --api-key/--api-secret as explicit overrides in help output. |
| crates/clickhousectl/src/cli.rs | Documents credential precedence in cloud --help and adds a help-text unit test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Aug 1, 2026
sdairs
force-pushed
the
codex/issue-336-env-credential-precedence
branch
from
August 3, 2026 18:42
7282589 to
3c295df
Compare
sdairs
temporarily deployed
to
cloud-integration
August 3, 2026 18:42 — with
GitHub Actions
Inactive
sdairs
temporarily deployed
to
cloud-integration
August 3, 2026 19:09 — with
GitHub Actions
Inactive
sdairs
force-pushed
the
codex/issue-336-env-credential-precedence
branch
from
August 3, 2026 19:34
3c295df to
1d9aa29
Compare
sdairs
temporarily deployed
to
cloud-integration
August 3, 2026 19:36 — with
GitHub Actions
Inactive
sdairs
marked this pull request as ready for review
August 3, 2026 19:43
sdairs
temporarily deployed
to
cloud-integration
August 3, 2026 20:02 — with
GitHub Actions
Inactive
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
cloud auth statuscloud --helpand clarify the global credential flagsWhy
Credential resolution deliberately prefers CLI flags, then
.clickhouse/credentials.json, then environment credentials, then OAuth. When a credentials file existed, a user could set environment credentials for another organization and unknowingly continue operating with the file credentials. The resolved source was visible only with--debug, while normal commands gave no indication that the environment pair had been ignored.Impact
Commands now warn on stderr without contaminating JSON stdout, and
cloud auth statusdistinguishes an inactive environment pair from an unconfigured one. The precedence itself is unchanged.Stack
This PR is stacked on #351 and should be reviewed as the delta from
codex/issue-335-delete-force-hint.Closes #336.
Validation
cargo fmt --all --checkcargo build -p clickhousectlcargo test -p clickhousectlcargo clippy -p clickhousectl --all-targets -- -D warnings