Skip to content

Add test: New BAD_ARGUMENTS error path for simultaneous X-ClickHouse-Quota header and quota_key URL parameter is untested - #104092

Closed
clickgapai wants to merge 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr62842
Closed

clickgapai wants to merge 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr62842

Conversation

@clickgapai

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

Retrospective finding from a historical scan of PR #62842 (merged 2024-04-26). Confirmed on current codebase — close with a note if already fixed.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #62842.
That PR PR allows the quota_key to be sent via URL parameter together with credentials passed by a different scheme (e.g. X-ClickHouse-User header or HTTP Basic authorization). It removes quota_key from the has_auth_headers/has_credentials_in_query_params flags and extracts the value AFTER the a

1. New BAD_ARGUMENTS error path for simultaneous X-ClickHouse-Quota header and quota_key URL parameter is untested
src/Server/HTTP/authenticateUserByHTTP.cpp:244
Risk: Reaching the new branch requires params.has("quota_key") AND a non-empty quota_key previously read from the X-ClickHouse-Quota header. The PR's own test only hits the success path (URL param + **What's unique vs PR tests:** PR test at01399_http_request_headers.sh:18only covers the SUCCESS direction (URL-paramquota_key+X-ClickHouse-Userheader, noX-ClickHouse-Quota` header). My test covers the CONFLICT branch

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label May 6, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8e0674e]

Summary: ❌

job_name test_name status info comment
Config Workflow ERROR
Dockers Build (amd) DROPPED
Dockers Build (arm) DROPPED
Dockers Build (multiplatform manifest) DROPPED
Style check DROPPED
Code Review DROPPED
Docs check DROPPED
Docs check (Mintlify) DROPPED
Fast test DROPPED
CI Tests DROPPED

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 6, 2026
@clickgapai

Copy link
Copy Markdown
Contributor Author

CI check Stateless tests (amd_debug, distributed plan, s3 storage, parallel) failed, but the failure does not reference this PR's test (04203_http_quota_key_conflict).

This PR is test-only; the bot will not retrigger CI or modify the test to chase a failure that appears unrelated. If you believe a failure is related to this test, please comment with details and the bot will re-evaluate.

@clickgapai

Copy link
Copy Markdown
Contributor Author

CI check Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) failed, but the failure does not reference this PR's test (04203_http_quota_key_conflict).

This PR is test-only; the bot will not retrigger CI or modify the test to chase a failure that appears unrelated. If you believe a failure is related to this test, please comment with details and the bot will re-evaluate.

@clickgapai

Copy link
Copy Markdown
Contributor Author

The bot has tried to address CI failures on this PR 50 times without a successful push (logs unavailable / context insufficient / plan rejected). Stopping further auto-fix attempts on Stateless tests (amd_debug, distributed plan, s3 storage, parallel) — needs human review.

@clickgapai

Copy link
Copy Markdown
Contributor Author

CI failure in Stateless tests (amd_debug, distributed plan, s3 storage, parallel), Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) appears to be unrelated breakage and is not related to this change. Let me know if you'd like me to merge master and retrigger CI.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ alexey-milovidov
❌ ClickGap AI Bot


ClickGap AI Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@clickgapai

Copy link
Copy Markdown
Contributor Author

CI failure in Config Workflow appears to be unrelated breakage and is not related to this change. Let me know if you'd like me to merge master and retrigger CI.

@zlareb1

zlareb1 commented Aug 10, 2026

Copy link
Copy Markdown
Member

@groeneai can you take this up and open a new PR?

@groeneai

Copy link
Copy Markdown
Collaborator

Yes. Triaged as part of this batch of 20; the target code path still exists on master (2850e46) and the test passes there against its committed reference.

I am re-filing the batch grouped by area rather than as 18 separate test PRs, to keep reviewer load down. Before filing, I mutation-test each oracle — in your previous batch two tests passed both with and without the defect, so I will not re-file one that does not actually redden. If this one turns out to be vacuous or already covered, I will post the reason here instead of a PR.

Consolidated triage for the whole batch: #103950 (comment)

@groeneai

Copy link
Copy Markdown
Collaborator

Re-filed: #114234

The test is there as 04871_http_quota_key_conflict.sh (04203 is occupied by 12 tests on master now, so it needed a new number). Your coverage claim held up when I checked it independently: 01399_http_request_headers.sh passes quota_key as a header alone or as a URL parameter alone, never both, so the conflict branch is never reached.

Two changes from the original. I reduced it to one case: the params.has("quota_key") check in authenticateUserByHTTP.cpp sits after the auth-scheme if/else closes, so the header, Basic and query-parameter schemes all converge on the same throw and one case covers them. I also dropped the two sanity lines, since 01399 already covers each source alone. Deleting the throw removes the Code: 36 line and the test fails, so it is load-bearing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants