Skip to content

Add test: table_readonly alterPartition gate default: break; allow-path (FREEZE/UNFREEZE) untested - #109007

Closed
clickgapai wants to merge 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr95079
Closed

clickgapai wants to merge 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr95079

Conversation

@clickgapai

Copy link
Copy Markdown
Contributor

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

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 #95079.
That PR The PR adds a table_readonly MergeTree setting that (1) rejects foreground modifications on StorageMergeTree (assertNotReadonly for INSERT/mutation/OPTIMIZE), (2) rejects data-mutating partition commands in MergeTreeData::alterPartition (ATTACH/MOVE/DROP/DROP DETACHED/FETCH/REPLACE PARTITION

1. table_readonly alterPartition gate default: break; allow-path (FREEZE/UNFREEZE) untested
src/Storages/MergeTree/MergeTreeData.cpp:7026
Risk: The readonly gate switch at MergeTreeData.cpp:7017-7028 only throws for the six mutating PartitionCommand types and falls through default: break; for everything else. PR tests only cover the throwing cases (04490) — the allow path is uncovered (LLVM: 7025-7026 marked >>). Risk: if the switch is ever refactored into a reject-by-default whitelist (or the default case dropped), FREEZE/UNFREEZE (backup) of a read-only table — e.g. a rotated system log table an operator wants to archive — …
What's unique vs PR tests: PR test 04490 covers only the REJECTED partition commands (DROP/DETACH/ATTACH) on a read-only table. This test covers the complementary ALLOW path — FREEZE/UNFREEZE succeed on a read-only table — which is the default: break; branch the PR's own tests never reach.

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)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
MergeTreeData.cpp:7026-7027 default: break; — the allow path for non-mutating partition commands on a read-only table is correct but has zero test coverage.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04492_table_readonly_freeze_forget_allowed.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

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

clickhouse-gh Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0bb0a07]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_binary, parallel) FAIL
03360_bool_remote FAIL cidb

AI Review

Summary
  • This test-only PR adds stateless coverage for the table_readonly MergeTree setting around ALTER ... PARTITION: mutating partition commands stay rejected, while FREEZE PARTITION and UNFREEZE PARTITION still pass through the MergeTreeData::alterPartition allow path. I did not find an actionable correctness or test-quality issue in the changed files.
Missing context / blind spots
  • ⚠️ I did not run the new stateless test locally because this checkout has no build directory or ClickHouse binaries; the fetched PR CI report shows no failed checks.
Final Verdict
  • Status: ✅ Approve

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

clickhouse-gh Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.73% 85.75% +0.02%
Functions 91.46% 91.46% +0.00%
Branches 78.35% 78.39% +0.04%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 143 line(s), 4 function(s) across 48 file(s) · Details

Top files
  • src/Functions/catboostEvaluate.cpp: 14 line(s), 1 function(s)
  • src/Storages/StorageReplicatedMergeTree.cpp: 14 line(s)
  • src/Functions/FunctionCustomWeekToDateOrDate32.h: 6 line(s)
  • src/AggregateFunctions/AggregateFunctionSparkbar.cpp: 5 line(s)
  • src/Functions/array/arrayShiftRotate.cpp: 5 line(s)

Full report

@Michicosun Michicosun closed this Jul 8, 2026
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.

3 participants