Repository navigation
Add coverage for two untested branches in ATTACH and JSONColumns - #114293
Conversation
Re-files three of five closed clickgapai coverage PRs (103925, 103930, 103914) that zlareb1 asked to be re-filed via ClickHouse#101781. Two of the five are declined with the reason posted on their own threads: 101743 (its reference would freeze an unresolved CREATE-time-vs-runtime MV validation semantic, an owner-level call) and 103923 (its only site beyond 04338 is the cache-hit copy, which leaves the cached query tree unrewritten, so it is not observable from SQL). Each shipped test was falsified rather than taken on trust: the exact line it claims to cover was mutated, the binary rebuilt with the Build ID asserted to move, and the test required to fail while neighbouring tests stayed green. - 04201_attach_table_missing_database pins the UNKNOWN_DATABASE throw in the stub-ATTACH block of InterpreterCreateQuery.cpp. No file under tests/ asserts UNKNOWN_DATABASE for an ATTACH, and the qualified bare-ATTACH tests on master all attach into a database that exists first. The sibling throw on the createTable path is uncovered too and stays out of scope here. Because the mutation is injected at that throw, only a statement resolving there can redden, which is what pins the site. One statement: ATTACH DICTIONARY reaches the identical throw before any is_dictionary discrimination. - 04201_force_null_for_omitted_jsoncolumns pins the force-null check in JSONColumnsBlockInputFormatBase. That setting has six independent copies in src/ and 03004 covers five, not this one. Two rows rather than eight: JSONColumns, JSONCompactColumns and JSONColumnsWithMetadata were measured to emit a byte-identical exception from the same base class, so they are one dispatch. Negating the type predicate reddens this test while 03004 stays green, so the sibling copies are untouched. - 02884_create_view_with_sql_security_option gains one assertion instead of a new file. It already performs the definer-to-invoker transition and reads SHOW CREATE TABLE; only the negative check that the definer is gone was missing. The pattern needs the equals sign, since a bare DEFINER also matches SQL SECURITY DEFINER. Leaving the definer uncleared flips that assertion from 0 to 1 and changes nothing else in the file, while its existing SQL SECURITY INVOKER row stays 1 and so serves as the did-the-ALTER-run control. The ATTACH reference is empty, which is correct for a serverError-only test, and was verified on stderr: a stray newline or a wrong error code both fail. The 02884 reference line was placed by running the test and rebuilding the file from its output, not by hand. The ATTACH test is scoped to CLICKHOUSE_DATABASE_1 rather than a server-global database name so it is safe to run against itself. Both new tests passed 50 runs with randomized settings and 50 with --no-random-settings, plus four concurrent copies of themselves and a joint run with 03004, 04126, 04010, 04141 and 02884, so neither needs no-parallel.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex, 2 rounds) plus my own cold review
Severity: ❌ blocker / The fix round came from my own review, not from the gate. The description, the notes and the What I checked that could have failed, rather than what passed: each new test's liveness against Session id: cron:clickhouse-review-slot-11:20260811-082600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-11:20260811-082600 |
|
cc @pufit, could you review this? It is test-only: it pins the UNKNOWN_DATABASE throw in the stub-ATTACH block of InterpreterCreateQuery, the force-null check in JSONColumnsBlockInputFormatBase (the one copy of that setting 03004 does not reach), and adds one assertion to 02884 that the definer is actually cleared by MODIFY SQL SECURITY INVOKER. |
|
Workflow [PR], commit [4a5ef5d] Summary: ❌
AI ReviewSummaryThis PR is test-only. It adds focused coverage for the short Final Verdict✅ No findings. |
CI finish ledger - 4a5ef5dEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Notes on the single failure:
Session id: cron:our-pr-ci-monitor:20260811-130000 |
31372e9
Related: #101781
Related: #103925
Related: #103930
Related: #103914
Related: #101743
Related: #103923
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Test-only, 6 files, 19 insertions. @ zlareb1 asked me to re-file five closed
clickgapaicoverage PRs (linked above); this is the analyzer/views group.I did not take them on trust: for each one I mutated the line it claims to cover and required that test to fail, with neighbouring tests staying green. Three survived, two did not.
04201_attach_table_missing_database: shortATTACH TABLEinto a missing database. Nothing undertests/assertsUNKNOWN_DATABASEfor anATTACH, and master's qualified bare-ATTACHtests all attach into a database that exists. The sibling throw on thecreateTablepath is uncovered too, and out of scope here. One statement, sinceATTACH DICTIONARYreaches the identical throw before anyis_dictionarycheck.04201_force_null_for_omitted_jsoncolumns.input_format_force_null_for_omitted_fieldshas six copies insrc/;03004covers five, not theJSONColumnsone. Two rows, not eight:JSONColumns,JSONCompactColumnsandJSONColumnsWithMetadataemit a byte-identical exception from one base class, so they are one dispatch.02884_create_view_with_sql_security_option, not a new file. Everything it needs is already set up; only the negative check thatDEFINER =is gone afterMODIFY SQL SECURITY INVOKERwas missing. The equals sign matters, since a bareDEFINERalso matchesSQL SECURITY DEFINER..referencewould freeze an unresolved semantic: CREATE-time validation readsgetSampleBlockInsertable()(MATERIALIZED excluded) while the runtime sink readsgetSampleBlock()(included), so the runtime path accepts what CREATE rejects. Owner-level call.04338is the cache-hit copy, which leaves the cached query tree unrewritten, and_tablecomes fromgetStorageID(), not the alias, so what it predicted is not SQL-observable.Already covered elsewhere, so the gaps are not oversights:
MODIFY DEFINERby04126and02884, the materialized-view form by04201_alter_materialized_view_modify_sql_security_invoker_error.Validation
Debug build,
clickhouse-test, randomization on (the CI default). Every mutation changes the branch's output rather than deleting it, so a fall-through to an equivalent path cannot be mistaken for a vacuous test. Each arm was reverted and rebuilt before the next, with the Build ID asserted to move both ways.04201_attach_table_missing_databaseInterpreterCreateQuery.cpp:1758thrown code swappedUNKNOWN_DATABASEtests stayed OK as non-interference checks02884_create_view_with_sql_security_optionStorageInMemoryMetadata.cpp:126definer not clearedSQL SECURITY INVOKERrow stays 1, so a 0 cannot mean the ALTER no-opped04201_force_null_for_omitted_jsoncolumnsJSONColumnsBlockInputFormatBase.cpp:206type predicate negated03004stayed OK, so the sibling copies are untouchedThe
ATTACHreference is 0 bytes, correct for aserverError-only test: verified on stderr, and a stray newline or wrong code both fail. Both new tests passed 50/50 runs with randomization and 50/50 with--no-random-settings, plus 4x concurrently with themselves and alongside03004,04126,04010,04141and02884, so neither needsno-parallel.