From 921b33caeb1f10b54c50584c9828727f2a54002b Mon Sep 17 00:00:00 2001 From: Polyglot AI <293096396+polyglotAI-bot@users.noreply.github.com> Date: Thu, 26 Nov 2026 13:58:07 +0000 Subject: [PATCH] docs: issue classification and priority rules for issue triage Add the shared issue-classification skill with a section for this repository, and the issue-priority skill: the rule for legacy (v1) issues, the reach tiers of client-v2 and jdbc-v2, the severity rows, the modifiers, and the confidence. AGENTS.md points to both files. docs/source-map.md: ClickHouseDriver and ClickHouseDataSource are proxies that run jdbc-v2 by default, not v1 classes. Co-Authored-By: Claude Opus 5.5 --- .claude/skills/issue-classification/SKILL.md | 275 +++++++++++++++++++ .claude/skills/issue-priority/SKILL.md | 256 +++++++++++++++++ AGENTS.md | 8 + docs/source-map.md | 15 +- 4 files changed, 549 insertions(+), 5 deletions(-) create mode 100644 .claude/skills/issue-classification/SKILL.md create mode 100644 .claude/skills/issue-priority/SKILL.md diff --git a/.claude/skills/issue-classification/SKILL.md b/.claude/skills/issue-classification/SKILL.md new file mode 100644 index 000000000..8f90e663a --- /dev/null +++ b/.claude/skills/issue-classification/SKILL.md @@ -0,0 +1,275 @@ +--- +name: issue-classification +description: > + The classes of an issue in this ClickHouse client repository: the impacts + (Security, Data integrity, Stability, Performance) and the area (Connectivity, + Data types & formats, Queries, Configuration, API & diagnostics, Environment, + Docs & project, Other), and the native classes (format, protocol) of an issue + that needs a change in the client's code for the Native format or the native + TCP protocol. Use this skill when the task is to "classify an + issue" or "give the classes of an issue", and when you triage, file, or + prioritize an issue: the issue-priority skill uses the impacts. +--- + +# Issue classification + +The classes name **what kind of problem an issue is about**, with the same words in every +ClickHouse client repo. They are an input to the priority, and they make issue counts +comparable across clients. + +An issue has: + +- **Impacts** — what goes wrong: none, one, or more of the four impact classes. +- **One area** — the part of the client whose behavior is wrong or missing. +- **Native classes** — none, one, or both of format and protocol: the issue needs a change in + the client's code for the Native format or for the native TCP protocol. + +The classes do not replace the kind of request (bug, feature, question) or the reach tier of +a repo's priority rules. + +Every ClickHouse client repository has a copy of this file, so that any agent can classify an +issue in the repository. Keep the copies the same where you can, so that the classes mean the +same in every client. Put a change that applies only to this repository in the section "This +repository" at the end. + +## Rules + +1. Give each impact that applies, one area, and each native class that applies. +2. Use only what the issue, a reproduction, or code inspection of the current code + **shows**. Do not give a class for an effect + that is only possible. Classes can raise the priority, so each class needs evidence. +3. Classify by the **observed effect**, not by the location of the code. Example: a + connection-string defect that makes the client drop rows with no error has the impact + Data integrity. The native classes are the exception: they follow the code (section + "Native classes"). +4. Data integrity and Stability are for defects only. Security and Performance are also for + feature requests: a new authentication method, a request to make an operation faster. + The priority rules rate such requests as feature requests. +5. An issue with no harm has no impact. This is the normal case. + +## Impact classes + +| Impact | Use when | +|---|---| +| **Security** | Two parts. A **vulnerability**: a defect makes the protection weaker: it exposes credentials or data (also a secret that leaks to a log, an error message, a URL, or another host), lets a value change the meaning of a query (injection), skips or weakens a TLS or identity check, corrupts memory (an out-of-bounds write, a use after free), or lets input that the application takes from its users stop the client; also a vulnerability in a dependency. The boundaries "Hostile server or network" and "Dependencies" below say when these count. **Authentication**: an authentication method that does not work or is missing, or how the client takes credentials (for example a token provider or a credentials file); a secret that leaks is a vulnerability, not authentication. Say which part applies: the priority rules of a repo rate the two parts differently. | +| **Data integrity** | Data that the caller wrote, or a result that the caller reads, is missing, incomplete, or different from the value given or stored, and the client reports no error. This includes a failed operation that the client reports as a success, a server error that the client ignores, overflow, lost precision, a time zone shift, a wrong decode, a stream that loses synchronization, a duplicate write, and a write to the wrong table. | +| **Stability** | The process stops in a way that the caller cannot handle as a normal error (abort, segmentation fault, unrecovered panic, stack overflow), a call does not return (deadlock, hang), or a resource leaks until none is left (connections, sockets, memory). Also a thread-safety defect. | +| **Performance** | The result is correct, but the operation is too slow, or uses too much memory or CPU. Also a request to make an operation faster. | + +Boundaries: + +- **Data integrity needs "no error".** When the client rejects a value with an error, the + issue has no Data integrity impact. When the caller gets an error, but the error is wrong + or not clear, the issue has no Data integrity impact either: it has the area API & + diagnostics. +- **Security and values that are not quoted.** A value or an identifier that the client + does not quote or escape gets Security only when the issue shows a path from untrusted + input. A string value that leaves its literal because the client does not escape it is + such a path. An identifier that the client does not quote, with no such path, is the area + Queries with no impact. +- **TLS.** A TLS check that the client skips or weakens is Security. A connection with TLS + that fails has no impact; its area is Connectivity. +- **Memory.** High memory use without a failure is Performance, not Stability. +- **Hostile server or network.** A hang, or a crash with no memory corruption, that only a + hostile server or network causes is Stability, not Security. Memory corruption is a + vulnerability also when only a hostile server or network causes it. A crash while the + client reads data from the server (for example an access violation or `SIGSEGV`) can be + memory corruption: rule that out by code inspection before you classify it as Stability. +- **Dependencies.** A vulnerability in a dependency is Security (vulnerability) when the + client calls the vulnerable code, and also when it is not published yet. A published one + (CVE or GHSA) in code that the client does not call has no impact: the issue asks for a + dependency update (area Environment). Report one that is not published yet also to the + maintainers of that dependency, in private, through their security policy, never in a + public issue. +- **An error is not Stability.** A normal exception or error value is not a crash. In Go + and Rust, a panic that the library does not recover is Stability. In Java, a + `StackOverflowError`, `OutOfMemoryError`, or `VerifyError` is Stability. + +## A vulnerability that is not public yet + +A security issue must not stay public with a description of how to reproduce it. An issue +is a **confirmed vulnerability** when a run or code inspection shows one of these: + +- credentials or data are exposed to a party that must not get them (also a secret that leaks); +- a value changes the meaning of a query (injection); +- a TLS or identity check is skipped or weakened; +- memory corruption (see "Hostile server or network" in the boundaries above); +- a vulnerability in a dependency that is not published yet (see "Dependencies" above); +- input that the application takes from its users stops the client. + +Never put a confirmed vulnerability into a public comment, issue, pull request, or +Classification line. Report it in a private GitHub vulnerability report for this repository +(**Security** → **Report a vulnerability**). The issue-priority skill of this repository says +how to handle the public issue and how to rate the vulnerability. When you can neither confirm +nor rule out a vulnerability, do not discuss it in public either: ask a maintainer in private, +or send a private report that says what is not confirmed. + +These are not affected: a vulnerability that is already public (a published CVE or GHSA, for +example in a dependency), and the part authentication (a method that does not work or is +missing). Classify them as usual. + +## Area classes + +| Area | Scope | +|---|---| +| **Connectivity** | Connect and handshake, a connection with TLS, proxies and redirects, the connection pool, keep-alive, reconnect and failover, retries, timeouts, cancellation, the transport (HTTP, native TCP), compression on the wire. | +| **Data types & formats** | Parsing of type names, encoding and decoding of values, the mapping to language types and to rows or objects (POJO, serde, struct), data formats (Native, RowBinary, JSON, Parquet, Arrow), support for a new type or format. | +| **Queries** | How the client builds a statement: parameters and placeholders, quoting and escaping, SQL parsing in the client, size limits of the statement and its parameters. How the client runs a statement: batches and streaming inserts, sessions and roles, external data, totals, asynchronous inserts, the queries that the client sends on its own (`DESCRIBE`, server information), caches of table structure. | +| **Configuration** | Reading and passing options: connection strings, DSNs, URLs, and option objects (parsing, validation, defaults); ClickHouse settings for a connection or a query; settings that the client sends on its own. | +| **API & diagnostics** | The shape of the public API (a missing method or overload, a wrong type signature), and conformance to a standard interface that the client implements (JDBC, ODBC, ADO.NET, `database/sql`, DB-API, SQLAlchemy, R2DBC), including metadata and catalog functions. Errors that are wrong, incomplete, or not clear. Logging, metrics, tracing, progress, the query ID. | +| **Environment** | A build from sources, support for a compiler, runtime, operating system, or architecture, package managers, released artifacts, installers, dependencies. Also a failure with one ClickHouse server version only, or with one third-party tool only (Power BI, Tableau, Spark, DBeaver). | +| **Docs & project** | Documentation, examples, or the changelog are wrong or missing. Tests, CI, the release process, refactoring. | +| **Other** | No area fits. | + +Boundaries: + +- **Configuration or the area that an option controls.** If the client reads an option + correctly but the behavior that the option controls is wrong, use the area of that + behavior. Example: a keep-alive option that has no effect is Connectivity. +- **Authentication.** An authentication issue has the impact Security and the area + Connectivity. +- **Environment or the area of the failure.** Use Environment when the same call works in + general, and fails only with one server version, one platform, or one third-party tool. + A failure with all server versions and without the tool has the area of the failure. +- **API & diagnostics or the area of the failure.** When the problem is the quality of an + error, use API & diagnostics. When the problem is that the operation fails at all, use + the area of the operation. + +Rules for **Other**: + +- Other is the last choice. Say why no area fits. +- Other does not raise the priority. +- A subject that repeats in Other is a sign that a class is missing: report it. + +## Native classes + +The native classes mark an issue that needs a change in the client's **native code**: its +codec for the ClickHouse `Native` format, or its implementation of the native TCP protocol. A +shared core for this code is planned (`ClickHouse/ch-core-rs`). The native classes count how +much maintenance this code needs in each client. + +| Native class | Code | +|---|---| +| **format** | Reading and writing data in the `Native` format, over HTTP (`FORMAT Native`) and in the Data packets of the native protocol: the block structure (column and row counts, column names, type names), the parsing of the type names of a block, and the bytes of each column type: fixed widths, null maps, offsets, LowCardinality dictionaries and keys, serialization versions and kinds (also sparse columns), Variant and Dynamic discriminators, JSON paths. | +| **protocol** | The native TCP protocol: the packets and their fields (Hello and its addendum, Query with the client information, the settings, and the parameters, Data, Exception, Progress, ProfileInfo, ProfileEvents, Totals, Extremes, Log, TableColumns, Ping, Cancel, EndOfStream), the negotiation of the protocol revision and the features that the revision controls, the order of the packets, the framing of compressed blocks (checksum, method, sizes), and external tables in the protocol. | + +Rules: + +1. Classify by the **code**, not by the observed effect (an exception to rule 3 of "Rules"). + Give a native class when a run, code inspection, or the fix shows that the cause is in that + code. A feature request gets a native class when the feature changes that code, for + example support for the native protocol, for a new type in the Native format, or for a new + packet. +2. The code around the native code gets no native class: the conversion between a decoded + value and a language type (a scan into a struct or an object, a time type of the + language), the connection pool, TLS, the socket, timeouts and retries, the public API, and + the other formats (RowBinary, JSON, Arrow, Parquet, ODBCDriver2). A failure that occurs + only with the native protocol, but that has its cause in this code, gets no native class. +3. Code that the client uses for the Native format and for another format (for example one + parser of type names) gets the class format when the defect also occurs on the Native + path. +4. When the evidence does not show where the cause is, give no native class. +5. The native classes do not change the impacts, the area, or the priority. A format issue + usually has the area Data types & formats. A protocol issue usually has the area + Connectivity, Queries, or API & diagnostics. A failure with one server version only has + the area Environment. +6. A client that has no native code gets a native class only for a request to add it. + +On GitHub, the label `native-format` shows the class format, and the label `native-protocol` +shows the class protocol. + +| Issue | Classification | +|---|---| +| A `LowCardinality(String)` column is written with wrong dictionary keys | `impact: Data integrity · area: Data types & formats (LowCardinality(String)) · native: format` | +| The client cannot read a new serialization version of `JSON` that one new server version sends | `impact: none · area: Environment (JSON, ClickHouse 26.x) · native: format` | +| The client sends the client version 0.0.0 in the Hello packet, and one server version rejects it | `impact: none · area: Environment (client version, ClickHouse 26.10) · native: protocol` | +| The client allocates a new buffer for each compressed block | `impact: Performance · area: Connectivity (compression) · native: protocol` | +| A request to support the native TCP protocol | `impact: none · area: Connectivity (native protocol) · native: protocol` | +| A scan of a `DateTime64` column into a time type of the language loses the time zone | `impact: Data integrity · area: Data types & formats (DateTime64)`: the conversion to a language type is not native code | +| The connection pool leaks connections that use the native protocol | `impact: Stability · area: Connectivity (connection pool)` | + +## Examples + +| Issue | Impacts | Area | +|---|---|---| +| A bare `Enum(...)` type hint is written as `Enum8`, which corrupts the data | Data integrity | Data types & formats | +| A flush returns no error when the server rejects the INSERT | Data integrity | Queries | +| The connection pool leaks connections until none is left | Stability | Connectivity | +| String parameters are not escaped | Security (vulnerability) | Queries | +| `LowCardinality(Nullable(String))` cannot be read: the client returns an error | none | Data types & formats | +| A server error loses its code when the response arrives in two chunks | none | API & diagnostics | +| A request for Kerberos authentication | Security (authentication) | Connectivity | +| Each compressed read fails on one new server version | none | Environment | +| Parameter binding takes quadratic time | Performance | Queries | + +## How to write the classification + +One line, in this form. In a triage comment, the line has the name **Classification**: + +`impact: · area: ()` + +When a native class applies, add it at the end of the line: ` · native: format`, +` · native: protocol`, or ` · native: format, protocol`. When none applies, add nothing. + +For Security, add the part in parentheses: `Security (vulnerability)` or +`Security (authentication)`. + +The **subject** names what the issue is about inside the area, in one to four words. Use the +names that ClickHouse or the client API uses: + +- **Data types & formats:** always the ClickHouse types or the data format, for example + `(Enum8, Enum16)`, `(Map)`, `(DateTime64)`, `(RowBinary)`, `(Parquet)`. "Data types & + formats" alone does not say which type. +- **Other areas:** the feature, for example `(cancellation)`, `(TLS)`, `(connection pool)`, + `(query parameters)`, `(sessions)`, `(mid-stream errors)`, `(logging)`, `(release process)`. +- With two areas, give a subject after each one. + +Examples: `impact: Data integrity · area: Data types & formats (Map)`, +`impact: none · area: Configuration (URL parameters)`, +`impact: Security (vulnerability), Stability · area: Connectivity (TLS)`, +`impact: none · area: Connectivity (ZSTD compression) · native: protocol`. + +## This repository + +In this repository, "the client" is any of the published modules: `client-v2`, `jdbc-v2` +(also as the artifacts `clickhouse-jdbc` and `clickhouse-jdbc-all`), `clickhouse-data`, the v1 +stack (`clickhouse-client`, `clickhouse-http-client`, and the v1 driver `DriverV1` in +`clickhouse-jdbc`), and `clickhouse-r2dbc`. The standard interfaces of the area API & +diagnostics are JDBC and R2DBC. + +[`docs/source-map.md`](../../../docs/source-map.md) maps packages, classes, and stack traces to +the modules and to the code areas, and gives the module labels. Use it to find the code, not +the area: the area comes from the observed effect (rule 3 of "Rules"). Example: a +`ResultSetImpl.getTimestamp()` that shifts the time zone is in the code area "JDBC read" of the +map, and has the area Data types & formats (`DateTime64`). + +Boundaries for this repository: + +- **JDBC metadata.** A wrong or missing result of `DatabaseMetaData`, `ResultSetMetaData`, or + `ParameterMetaData` (the detail label `jdbc-metadata`) has the area API & diagnostics, also a + wrong `java.sql.Types` value or Java class name for a ClickHouse type. A value that a + `ResultSet` getter returns wrong has the area Data types & formats. +- **SQL parser.** A defect of the SQL parser of the JDBC driver (the detail label `sql-parser`: + `SqlParserFacade`, `internal/parser/`, and the grammars in `src/main/javacc/` and + `src/main/antlr4/` in jdbc-v2; `jdbc/parser/` and `src/main/javacc/` in v1) has the area + Queries. +- **Parameters.** A parameter value that the client converts wrongly (its type, precision, or + time zone) has the area Data types & formats: the `?` values that `PreparedStatementImpl` + writes into the SQL text, and the server-side parameters of `Client.query(sql, params)` + (`param_`). Quoting and escaping, and how the client puts the parameters into the + statement, have the area Queries. + +**Native code.** No module has the native TCP protocol: all modules use HTTP. Format: the +reader of `FORMAT Native` results in client-v2 (`NativeFormatReader`, and the Native methods +of `BinaryStreamReader`, for example `readQBitNative` and `readGeoNative`). There is no Native +writer. `NativeFormatReader` also uses the readers of single values of `BinaryStreamReader` +(`readValue`), which the RowBinary readers use too: a defect there gets the class format only +when it also occurs on the Native path (rule 3 of "Native classes"). The same applies to the +type-name parser (`ClickHouseColumn` in `clickhouse-data`). Protocol: the compressed blocks of +the HTTP parameters `compress=1` and `decompress=1` (client-v2 `CompressedBlockInputStream` and +`CompressedBlockOutputStream`; v1: `Lz4InputStream` and `Lz4OutputStream` of `clickhouse-data`). +client-v2 asks for compressed responses by default (`compress` is `true`). Not native code: the +RowBinary readers and writers, the JSONEachRow reader, the conversion of values to Java types +(`GenericRecord`, `ResultSetImpl`, POJO serde), the HTTP compression of +`client.use_http_compression` (`Content-Encoding`), parameter values as text, the connection +pool, and TLS. diff --git a/.claude/skills/issue-priority/SKILL.md b/.claude/skills/issue-priority/SKILL.md new file mode 100644 index 000000000..2c2d165b6 --- /dev/null +++ b/.claude/skills/issue-priority/SKILL.md @@ -0,0 +1,256 @@ +--- +name: issue-priority +description: > + Decide the priority of a `ClickHouse/clickhouse-java` issue: `Urgent`, + `High`, `Medium`, or `Low`, for the org issue field **Priority**. Use this + skill when the task is to "prioritize", "set the priority of", "rate", or + "triage" an issue, or to explain why an issue has a given priority. It + defines the rule for legacy issues, the reach tiers of the public API, the + severity rows, the base-level matrix, the modifiers, and the confidence. +--- + +# Issue priority + +This skill is the single source of truth for the **Priority** of +`ClickHouse/clickhouse-java` issues. People and automated triage use the same +rules. + +The value goes into the org issue field **Priority** (`Urgent`, `High`, +`Medium`, `Low`). The field is visible to org members only. An automated tool +sets the value once, never changes a value that is already set, and keeps the +level and its reason out of public comments. + +## When to set no priority + +Set no priority when one of these is true: + +- A maintainer can close the issue with no further action: it is already fixed + on `main`, a duplicate, works as intended, already supported, answered, or + obsolete. +- Only a deprecated public API of client-v2 or jdbc-v2 reaches the defect: an + API with a `@Deprecated` annotation, or an API that the docs call + deprecated. Examples: `Client.getEndpoints()`, the client-v2 property + `product_name`, and the jdbc-v2 properties `custom_http_params`, + `custom_settings`, and `typeMappings`. The rule looks at the API that reaches + the defect: a deprecated class that a v2 path calls (for example + `ClickHouseCityHash` in `CompressedBlockInputStream`) does not count. The v1 + stack is not deprecated code for this rule: see "Legacy issues". +- The issue is a question, or it is about CI, the release process, or a + discussion. + +## Vulnerabilities that are not public yet + +A security issue must not stay public with a description of how to reproduce +it. This section applies when a reproduction or code inspection confirms a +vulnerability that is not public yet, as the classification skill of this +repository defines it +([`../issue-classification/SKILL.md`](../issue-classification/SKILL.md), "A +vulnerability that is not public yet"). It applies to every module, also to +the v1 stack. + +- Report it in a private GitHub vulnerability report for this repository + (**Security** → **Report a vulnerability**), never in a public issue, + comment, or pull request. If a public issue reports it, copy the title, the + text, and the comments of the issue into the report first. +- Set no Priority on the public issue. Close it with a comment that gives no + details, and ask a repository administrator to delete it: closing does not + hide the text of the issue. +- Rate the vulnerability with the rules below, and put the level and its reason + into the private report as the proposed severity. + +A vulnerability that is already public (a published CVE or GHSA, for example in +a dependency such as Apache HttpClient, Jackson, or `lz4-java`), and an +authentication method that does not work or is missing, get a Priority on the +issue as usual. + +## Legacy issues (the v1 stack) + +An issue is **legacy** when only the v1 stack has the problem: the v1 client +(`clickhouse-client`, `clickhouse-http-client`: `ClickHouseClient`, +`ClickHouseHttpClient`) or the v1 JDBC driver in `clickhouse-jdbc` +(`DriverV1`, `DataSourceV1`, `ClickHouseConnection`, `ClickHouseStatement`, +`ClickHousePreparedStatement`, `ClickHouseResultSet`). The v1 driver runs only +when the application asks for it (`clickhouse.jdbc.v1=true` or +`clickhouse.jdbc.v2=false`). The artifact `com.clickhouse:clickhouse-jdbc` and +its classes `ClickHouseDriver` and `ClickHouseDataSource` run jdbc-v2 by +default, so these names do not make an issue legacy. A `clickhouse-data` +defect that only the v1 stack reaches is legacy. The label `legacy` shows the +class. When the label and the code that runs do not agree, use the code. + +A legacy issue gets `Low`, with one exception: a legacy issue that is +**critical for customers** gets `Urgent`. It is critical for customers when +both conditions are true: + +1. The severity (section 2) is "Wrong data or security" or "Broken, no + workaround". +2. The issue shows that customers are affected: it links a Linear customer + request (`linear.app`), or a maintainer or a ClickHouse employee says that + customers are affected. + +The reach tiers, the base level, and the modifiers (sections 1, 3, and 4) do +not apply to a legacy issue. This includes modifier 1: a v1 vulnerability gets +`Urgent` only when it is critical for customers. + +An issue that the v1 stack and client-v2 or jdbc-v2 both have is not legacy: +rate it by the client-v2 or jdbc-v2 path. `clickhouse-r2dbc` is built on the +v1 client, but an r2dbc issue (label `r2dbc`) is not legacy, also when the +cause is in the v1 code that r2dbc calls, unless a maintainer says so. Rate it +with the sections below, by its own reach. + +## 1. Reach + +**Reach** tells how many applications can hit the defect. It comes from the +public API that leads to the code with the defect: an API that almost every +application calls has a high reach, an API that few applications use has a low +reach. There are four tiers, highest first: + +- **Core:** almost every application calls this API. +- **Common:** many applications use it, but not all. +- **Narrow:** few applications use it (rare types, experimental APIs, special + setups). +- **Satellite:** applications do not import it (examples, tests, docs, tools). + +To find the tier, find the most-used public API that reaches the defect, and +look it up in the table below. Use the API, not the file that contains the +defect: a defect in a `BinaryStreamReader` method that only +`NativeFormatReader` calls (`readGeoNative`) is Narrow, and a defect in a +method that the reader of `RowBinaryWithNamesAndTypes` also calls +(`readValue`) is Core. A method or a property that the table puts into Common +or Narrow has that tier, also when its class is in Core. +[`docs/source-map.md`](../../../docs/source-map.md) maps classes and stack +traces to the modules. + +jdbc-v2 is built on client-v2: both use the same HTTP transport, connection +pool, readers, and type-name parser (`client-v2` `api/internal/`, +`api/data_formats/`, and `clickhouse-data`). A defect in that code has the +tier of the most-used path that reaches it, through either module. These +defaults put a path into Core: the result format `RowBinaryWithNamesAndTypes` +(`format`), compressed responses (`compress` is `true`), the connection pool +(`connection_pool_enabled`), retries (`retry`), HTTP Basic authentication +(`http_use_basic_auth`), the server time zone (`use_server_time_zone`), JDBC +escape processing, and the JavaCC SQL parser (`jdbc_sql_parser`). A defect of +the shaded jar (`packages/clickhouse-jdbc-all`) has the tier of the API that +fails with it. + +| Tier | Public paths | +| --------- | ------------ | +| Core | client-v2: `Client.Builder` and `build()`, `Client.query`, `queryAll`, `queryRecords`, `execute`, `ping`, and `insert` with an `InputStream` and a `ClickHouseFormat`; `QueryResponse`, `Records`, `GenericRecord`, and `ClickHouseBinaryFormatReader` for `RowBinaryWithNamesAndTypes`. jdbc-v2: `ClickHouseDriver` and `ClickHouseDataSource` of the `clickhouse-jdbc` artifact (they select jdbc-v2), `Driver`, `DataSourceImpl`, `ConnectionImpl`, `StatementImpl`, JDBC escape processing (`StatementImpl.escapedSQLToNative`), `PreparedStatementImpl` with the `?` values that it writes into the SQL text (`encodeObject`), batches (`addBatch`, `executeBatch`), the getters of `ResultSetImpl`, and these `ResultSetMetaData` methods: `getColumnCount`, `getColumnName`, `getColumnLabel`, `getColumnType`, `getColumnClassName`; the JavaCC SQL parser (`SqlParserFacade`), which reads each statement. Both: the HTTP transport (`HttpAPIClientHelper`), the connection pool (`max_open_connections`, `connection_request_timeout`), timeouts (`connection_timeout`, `socket_timeout`, `max_execution_time`), retries (`retry`, `client_retry_on_failures`), TLS (`ssl_mode`, `trust_store`, `sslrootcert`), user name and password authentication, the `User-Agent` header (`client_name`, `WorkloadIdentitySupport`); the parsing and validation of `ClientConfigProperties`, `DriverProperties`, and the JDBC URL; `QuerySettings` and `InsertSettings`, which each request uses; compressed responses (`CompressedBlockInputStream`), errors (`ClientException`, `ServerException`, `SQLException`), the reader of `RowBinaryWithNamesAndTypes` (`BinaryStreamReader`), the type-name parser (`ClickHouseColumn`), the server time zone for date and time values (`use_server_time_zone`), and these column types: integers up to 64 bits, `Float32`, `Float64`, `Bool`, `String`, `FixedString`, `Date`, `Date32`, `DateTime`, `DateTime64`, `Decimal`, `UUID`, `Enum8`, `Enum16`, `Nullable`, `LowCardinality`, `Array`, `Map`, `Tuple` | +| Common | compressed requests (`decompress`, `compression.method` LZ4 and ZSTD, `CompressedBlockOutputStream`), HTTP compression (`client.use_http_compression`), `app_compressed_data`, the Java LZ4 implementation (`disable_native_compression`); POJO serialization (`Client.register`, `insert` with a `List` of POJOs, `queryAll` with a `Class`, `POJOSerDe`, `ColumnToMethodMatchingStrategy`), `RowBinaryFormatWriter`, `DataStreamWriter`, the readers of `RowBinary` and `RowBinaryWithNames`, `getTableSchema`; sessions (`Session`, `session_id`, `session_check`) and roles (`session_db_roles`, `setDBRoles`, `SET ROLE` with `remember_last_set_roles`); server-side query parameters (`Client.query(sql, params)`, `param_`); server settings that the application sets (`serverSetting`, `clickhouse_setting_*`, `default_query_settings`), custom HTTP headers (`httpHeader`, `http_header_*`), the query ID (`query_id`, `jdbc_query_id_generator`); a time zone that the application sets (`use_time_zone`); asynchronous operations (`async`); `Statement.setQueryTimeout`, `cancel`, and `setMaxRows`; the other methods of `ResultSetMetaData`, `DatabaseMetaData` (also `ShowStatementsMetaData`), and `ParameterMetaData`; the JDBC `Array` and `Struct` (`createArrayOf`, `createStruct`); authentication with HTTP headers (`http_use_basic_auth` is `false`); more than one endpoint (a second `addEndpoint`, `ClientNodeSelector`); logging (SLF4J); the column types `JSON`, `Dynamic`, `IPv4`, `IPv6`, `Int128`, `Int256`, `UInt128`, `UInt256`, `Nested`, `SimpleAggregateFunction` | +| Narrow | the other column types: `Variant`, Geo (`Point`, `Ring`, `LineString`, `MultiPoint`, `MultiLineString`, `Polygon`, `MultiPolygon`, `Geometry`), `QBit`, `Time`, `Time64`, `BFloat16`, `AggregateFunction`, `Interval*`, `Nothing`; the other result formats: `Native` (`NativeFormatReader`), `JSONEachRow` (`JSONEachRowFormatReader`, `jdbc_json_parser_factory`); `binary_string_support`, a `type_hint_mapping` that the application sets (the default `Array` to `List` hint of jdbc-v2 has the tier of `Array`), `jdbc_type_mappings`, `ResultSet.getObject` with a type map; the RowBinary writer of jdbc-v2 (`beta.row_binary_for_simple_insert`, `WriterStatementImpl`); the ANTLR4 SQL parsers (`jdbc_sql_parser` `ANTLR4`, `ANTLR4_PARAMS_PARSER`); the other authentication methods (`bearer_token`, `access_token`, `ssl_authentication` with `sslcert` and `ssl_key`) and credential updates at run time (`updateUserAndPassword`, `updateBearerToken`, `updateAccessToken`); the proxy (`proxy_type`, `addProxy`); HTTP cookies (`client.http.cookies_enabled`), form data for queries (`client.http.use_form_request_for_query`), the socket options (`socket_rcvbuf`, `socket_sndbuf`, `socket_linger`, `socket_tcp_nodelay`), `ssl_socket_sni`, `ssl_cipher_suites`, `connection_reuse_strategy`, `connection_ttl`, `http_keep_alive_timeout`; `jdbc_cluster_name`; OpenTelemetry (`SpanRecorder`, `OpenTelemetrySpanRecorder`) and Micrometer (`MetricsRecorder`, `MicrometerMetricsRecorder`, `registerClientMetrics`, `jdbc_metrics_recorder`); the GraalVM native-image files (`META-INF/native-image`); `clickhouse-r2dbc` | +| Satellite | `examples/`, `performance/` (benchmarks), the test code (`src/test/` of each module, `tests/`), `docs/`, `README.md`, `CHANGELOG.md`, `history/`, `migration-helpers/`, the build tools (`clickhouse-annotation-processor`, `release.sh`, `build_examples.sh`), the agent files in `.claude/` and `.cursor/` | + +## 2. Severity + +First name the **impacts** of the issue with the classification skill of this +repository +([`../issue-classification/SKILL.md`](../issue-classification/SKILL.md)): none, +one, or more of Security (part vulnerability or part authentication), Data +integrity, Stability, and Performance. Most issues have none. + +Then use the first severity row that fits. With more than one impact, the +highest row applies: + +| Severity | Use when | +| ----------------------- | -------- | +| Wrong data or security | impact **Data integrity**: the client returns or stores wrong or incomplete data with no error, or reports success for a query that failed; or impact **Security** with a vulnerability (for a vulnerability in a dependency: only when the client calls the vulnerable code) | +| Broken, no workaround | the feature fails (an exception, a hang, a leak that ends in an `OutOfMemoryError` or in exhausted connections), and the caller has no reasonable workaround; also a wrong or incomplete error with no workaround: the failure is reported, but its type, code, or message is wrong or lost. The impact **Stability** (a hang, a `StackOverflowError` or `OutOfMemoryError`, such a leak) uses this row when the caller has no reasonable workaround | +| Workaround exists | the feature fails, but the caller can avoid the failure with a small change in their own code (name the workaround in the reason); also impact **Performance** of a defect: a result that is correct but slow or uses too much memory (a request to make an operation faster is a feature request: last row) | +| Cosmetic, docs, feature | wrong log or message text, documentation, a feature request; also a request to make an operation faster, and a dependency update (also one for a vulnerability in a dependency, in code that the client does not call) | + +**An exception of a type that the API does not declare.** The JDBC methods of +jdbc-v2 must throw `SQLException`, and client-v2 throws the subclasses of +`ClickHouseException` (`ClientException`, `ServerException`, and others). +Sometimes the code of the driver or the client throws a different unchecked +exception, for example a `NullPointerException`, `ClassCastException`, +`IllegalStateException`, or `ArrayIndexOutOfBoundsException`. A caller that +catches the declared type does not catch it. To catch all +`RuntimeException`s is not a reasonable workaround, so such a failure uses the +row "Broken, no workaround". When the caller can prevent the failure with a +different small change, use "Workaround exists". These are not this case: an +exception that the Javadoc or `docs/features.md` documents for the call (for +example the `IllegalArgumentException` for an endpoint that is not a valid +URL), and an exception from the caller's own code (for example from a POJO +setter). + +An issue that has the impact Security with no vulnerability (an authentication +method that does not work or is missing) does not use the first row. Rate an +authentication method that does not work by its failure ("Broken, no +workaround" or "Workaround exists"), and a request for a missing method as a +feature request. + +## 3. Base level + +| Severity ↓ / Reach → | Core | Common | Narrow | Satellite | +| ----------------------- | ------ | ------ | ------ | --------- | +| Wrong data or security | Urgent | Urgent | High | Medium | +| Broken, no workaround | High | High | Medium | Low | +| Workaround exists | Medium | Medium | Low | Low | +| Cosmetic, docs, feature | Low | Low | Low | Low | + +## 4. Modifiers + +Apply them in this order: + +1. **Security with a shown path from untrusted input.** The issue or a + reproduction shows how a value that an application takes from its users + reaches the defect: `Urgent` at any reach. Skip the other modifiers. A + defect that puts a caller-supplied value into SQL without quoting or + escaping is a candidate: look for such a path. Examples: the `?` values + that `PreparedStatementImpl` writes into the SQL text (`encodeObject`), the + helpers `SQLUtils.enquoteLiteral`, `enquoteIdentifier`, and + `escapeSingleQuotes` (also through `Statement.enquoteLiteral` and + `enquoteIdentifier`), and the SQL that `DatabaseMetaDataImpl` and + `ShowStatementsMetaData` (`quoteIdentifier`) make from the names and + patterns of the caller. If none is shown, rate the defect by the failure + that it shows. A vulnerability that is not public yet goes to a private + vulnerability report, not to a public issue (see "Vulnerabilities that are + not public yet"). +2. **Ingestion.** The defect is on the insert path (`Client.insert` with + POJOs, with an `InputStream`, or with a `DataStreamWriter`; + `RowBinaryFormatWriter`; `Client.execute` with an `INSERT`; `INSERT` + through `PreparedStatement` or `Statement` in jdbc-v2, with any `execute*` + method; `WriterStatementImpl`), and the client stores data that is lost, + corrupted, or different from the given value, with no error. This includes + a missing field, and a column that gets a default value in place of the + given value, or does not get its `DEFAULT` when the value is not given: up + one level. This can give `Urgent`. Wrong data in a table stays wrong after + the fix; a defect on the read path does not change the stored data. +3. **Regression in the latest published release:** up one level. This can give + `Urgent`. It is a regression only when the latest release shows the problem + and the release before it does not. The tags are `vX.Y.Z` (for example + `v0.11.2`). The latest release is the highest version that is not a + pre-release (`vX.Y.Z-rcN`); a patch release of an older line (for example + `v0.9.9`, published after `v0.10.0`) is not the latest release. The release + before it is the next lower version that is not a pre-release. +4. **Customer request in Linear.** The issue links (`linear.app`) a Linear + issue for a customer request: up one level, but never to `Urgent` (`High` + stays `High`). + +A defect on the query path (`Client.query`, `queryAll`, `queryRecords`, +`Statement.executeQuery`, the getters of `ResultSet`) gets no ingestion +modifier. So at the same reach and severity, a query defect ranks below an +ingestion defect. + +## 5. Confidence + +A missing reproduction lowers the confidence, not the level. Record the +confidence with the value when the tool that sets it supports it: + +| Confidence | Use when | +| ---------- | -------- | +| `HIGH` | a run shows the problem (or, for a feature, code inspection confirms its absence on `main`) | +| `MEDIUM` | code inspection shows a defect, but no reproduction was run (for example, it needs ClickHouse Cloud) | +| `LOW` | the report lacks what a reproduction needs, or a run did not show the problem | + +## 6. Reason + +Write one line with the value: + +` () · · · → .` + +For a legacy issue, the line is: + +`Legacy () · · · <"critical for customers: ", or "not critical for customers"> → .` + +Name the workaround when the severity is "Workaround exists". When the +confidence is `LOW`, say what is missing. diff --git a/AGENTS.md b/AGENTS.md index b495b6171..b0c4c6c01 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -124,6 +124,14 @@ For review requests, follow `docs/ai-review.md` as the shared review standard ac Before treating implementation work as done, self-review your own diff against `docs/ai-review.md` — not only when a review is explicitly requested. +## Issue triage + +To set, check, or explain the Priority of an issue, follow [`.claude/skills/issue-priority/SKILL.md`](.claude/skills/issue-priority/SKILL.md). It is the single source of truth for the priority rules. + +To classify an issue (its impacts, its area, and its native classes), follow [`.claude/skills/issue-classification/SKILL.md`](.claude/skills/issue-classification/SKILL.md). + +A vulnerability that is not public yet goes into a private security report (**Security** → **Report a vulnerability**), never into an issue or a pull request. The classification skill defines such a vulnerability, and the priority skill says how to handle the public issue. + ## Optional nested AGENTS.md If a module develops its own conventions, add a nested `AGENTS.md` inside that module. diff --git a/docs/source-map.md b/docs/source-map.md index 4e024dcd4..39ac30945 100644 --- a/docs/source-map.md +++ b/docs/source-map.md @@ -16,7 +16,7 @@ mapping below is wrong because the code moved, fix the boundary here. | `client` + `legacy` | `clickhouse-client/`, `clickhouse-http-client/` | `com.clickhouse.client` (no `.api`) | Legacy v1 client stack. | | label of the calling module | `clickhouse-data/` | `com.clickhouse.data` | Shared data types, codecs, formats, streams. Used by v1 and by client-v2. | | `jdbc` | `jdbc-v2/` | `com.clickhouse.jdbc` | Current JDBC driver (built on client-v2). | -| `jdbc` + `legacy` | `clickhouse-jdbc/` | `com.clickhouse.jdbc` | Legacy JDBC driver (built on client-v1). | +| `jdbc` + `legacy` | `clickhouse-jdbc/` | `com.clickhouse.jdbc` | Legacy JDBC driver (built on client-v1). The module also holds the proxies `ClickHouseDriver` and `ClickHouseDataSource`, which run jdbc-v2 by default: the artifact `com.clickhouse:clickhouse-jdbc` is jdbc-v2. | | `r2dbc` | `clickhouse-r2dbc/` | `com.clickhouse.r2dbc` | R2DBC integration (built on client-v1). | Add `legacy` only when only the v1 stack has the problem. An issue in v1 and v2 @@ -35,7 +35,11 @@ Package prefixes overlap between versions, so use class-name cues: (`ConnectionImpl`, `StatementImpl`, `PreparedStatementImpl`, `ResultSetImpl`, `DatabaseMetaDataImpl`, `Driver`, `DataSourceImpl`) under `jdbc-v2/`. v1 uses `ClickHouse*` classes (`ClickHouseConnection`, `ClickHouseStatement`, - `ClickHouseDriver`, `ClickHouseDataSource`) under `clickhouse-jdbc/`. + `ClickHousePreparedStatement`, `ClickHouseResultSet`) and `DriverV1`, + `DataSourceV1` under `clickhouse-jdbc/`. `ClickHouseDriver` and + `ClickHouseDataSource` in the same module are proxies: they run jdbc-v2 unless + the application selects v1 (`clickhouse.jdbc.v1=true` or + `clickhouse.jdbc.v2=false`), so they do not show the version. - If the issue does not say which version, note it as a question for the user, but make a best guess from the class names / JDBC URL / Maven coordinates in the report. @@ -95,7 +99,7 @@ parser areas (v1 and v2) also have a detail label: `jdbc-metadata` and `sql-pars - **client-v1**: `clickhouse-client/.../client/` and `clickhouse-http-client/.../client/http/`. - **jdbc-v1**: `clickhouse-jdbc/.../jdbc/ClickHouseConnection.java`, - `ClickHouseDriver`. + `DriverV1`. - **data**: `clickhouse-data/.../data/ClickHouseDataProcessor`, `ClickHouseColumn`, `format/`. @@ -110,8 +114,9 @@ Map the top app-owned frames (ignore JDK/third-party frames) by package: **client-v1**. - `com.clickhouse.jdbc.*Impl` or `com.clickhouse.jdbc.internal.parser.*` → **jdbc-v2**. -- `com.clickhouse.jdbc.ClickHouse*` or `com.clickhouse.jdbc.parser.*` → - **jdbc-v1**. +- `com.clickhouse.jdbc.ClickHouse*` (not the proxies `ClickHouseDriver` and + `ClickHouseDataSource`), `DriverV1`, `DataSourceV1`, or + `com.clickhouse.jdbc.parser.*` → **jdbc-v1**. - `com.clickhouse.data.*` → **clickhouse-data** (shared); then the code area (data types, data formats, compression) by sub-package. Identify the *caller* module to set the module label.