Repository navigation
chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources - #184
Conversation
…rces The C/C++ format gate has been silently green since its introduction: clang-format --dry-run without -Werror prints warnings but exits 0, so check_call never failed. On top of that, the CI install step ran `apt install clang-format` without sudo, which failed silently (Azure only checks the last command of a script step), so the check ran with whatever clang-format the image happened to ship. - ci/format_cpp.py: pass --Werror in --check mode; build the file list from recursive globs so the QWP-era sources (questdb/client.h/.hpp, ingress/qwp_sender, egress/qwp_reader, new cpp_test and example files) are covered; exclude vendored doctest.h by basename so the filter also works with Windows path separators. - ci/run_tests_pipeline.yaml: install clang-format via `pipx install clang-format==21.1.8` under `set -e`, and assert the resolved binary is 21.1.8 so a PATH mix-up fails the install step rather than the format check. Comment reflow differs across clang-format major versions, hence the exact pin. - Reformat all covered C/C++ sources with clang-format 21.1.8 (949 accumulated violations, comment reflow and alignment only). - CONTRIBUTING.md: document the pinned version and the script. Verified: format check exits 0 (and non-zero on an injected violation), all public headers and examples pass C11/C++17 syntax checks with and without QUESTDB_CLIENT_ENABLE_ARROW, the two compile_fail_* tests still fail with their intended errors, and ci/check_docs.py passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 45 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR standardizes C/C++ formatting with clang-format 21.1.8. It updates formatter discovery and CI installation, reformats tests, examples, mocks, and public headers, and adjusts Rust WebSocket and sender-pool tests. ChangesFormatting standardization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Verified. The only file the glob excludes is Review: PR #184 — "chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources" (level 0)Scope. ~2500 of ~2560 changed lines are mechanical reformatting; the real logic is Verification performed
CriticalNone. ModerateNone. Minor
Downgraded (false positives)
SummaryApprove. Clean, well-scoped, correctly-motivated tooling fix; the three PR claims ( Only actionable suggestion: mirror CI's version assertion inside |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ci/run_tests_pipeline.yaml`:
- Around line 201-206: Add the pipx binary directory to PATH after installing
clang-format by emitting the Azure DevOps task.prependpath command using pipx
environment --value PIPX_BIN_DIR. Before the existing clang-format version
check, validate that command -v clang-format resolves within that directory so
the subsequent ci/format_cpp.py --check step uses the pinned formatter.
In `@examples/bench_http_c.c`:
- Line 90: Replace the broker-count conversion in the JSON parsing path with
checked strtoll parsing, tracking errno and endptr. Reject non-numeric or
out-of-range values, and validate that endptr points to the expected JSON
delimiter before returning the count.
In `@examples/bench_ingest_c.c`:
- Around line 146-148: Validate MAX_BATCH_ROWS after parsing the environment
value and before the benchmark calls ingest_pass, rejecting zero with the
existing error-handling path. Ensure the ingest loop always receives a positive
batch size while preserving current behavior for valid values.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2cab1161-4571-4545-9a42-331c0070bcf3
📒 Files selected for processing (64)
CONTRIBUTING.mdci/format_cpp.pyci/run_tests_pipeline.yamlcpp_test/qwp_mock_c.cppcpp_test/qwp_mock_c.hcpp_test/qwp_mock_server.cppcpp_test/qwp_mock_server.hppcpp_test/smoke_reader.ccpp_test/test_arrow_c.ccpp_test/test_arrow_egress.cppcpp_test/test_arrow_ingress.cppcpp_test/test_column_sender.cppcpp_test/test_line_sender.cppcpp_test/test_reader.cppcpp_test/test_reader_mock.cppcpp_test/test_reader_offline.cppexamples/bench_http_c.cexamples/bench_http_c.hexamples/bench_ingest_c.cexamples/bench_ingest_c.hexamples/bench_json_c.cexamples/bench_json_c.hexamples/bench_schema_c.cexamples/bench_schema_c.hexamples/line_sender_c_example.cexamples/line_sender_c_example_auth.cexamples/line_sender_c_example_auth_tls.cexamples/line_sender_c_example_decimal_binary.cexamples/line_sender_c_example_from_conf.cexamples/line_sender_c_example_from_env.cexamples/line_sender_c_example_http.cexamples/line_sender_c_example_tls_ca.cexamples/line_sender_c_example_udp.cexamples/line_sender_c_example_udp_batch.cexamples/line_sender_cpp_example.cppexamples/line_sender_cpp_example_arrow.cppexamples/line_sender_cpp_example_auth.cppexamples/line_sender_cpp_example_decimal_binary.cppexamples/line_sender_cpp_example_decimal_custom.cppexamples/line_sender_cpp_example_from_conf.cppexamples/line_sender_cpp_example_from_env.cppexamples/line_sender_cpp_example_http.cppexamples/line_sender_cpp_example_tls_ca.cppexamples/line_sender_cpp_example_udp.cppexamples/line_sender_cpp_example_udp_batch.cppexamples/qwp_bench_selftest.cexamples/qwp_egress_c.cexamples/qwp_ingress_c.cexamples/reader_c_example_arrow.cexamples/reader_c_example_columns.cexamples/reader_c_example_from_conf.cexamples/reader_cpp_example_arrow.cppexamples/reader_cpp_example_from_conf.cppexamples/reader_cpp_example_with_binds.cppinclude/questdb/client.hinclude/questdb/client.hppinclude/questdb/egress/qwp_reader.hinclude/questdb/egress/qwp_reader.hppinclude/questdb/ingress/line_sender.hinclude/questdb/ingress/line_sender.hppinclude/questdb/ingress/line_sender_core.hppinclude/questdb/ingress/line_sender_decimal.hppinclude/questdb/ingress/qwp_sender.hinclude/questdb/ingress/qwp_sender.hpp
The test failed on both Windows CI jobs, one per race: - msvc-2025: the gate's CancelIoEx interrupted the in-flight recv, but Windows reports that as WSAEINTR (10004), which maps to ErrorKind::Uncategorized and was rejected by the Unix-centric error-kind allowlist. - msvc-2022: the reader signalled "started" before entering recv, so CancelIoEx found nothing pending, and a recv entered after it is not woken by Winsock shutdown(). The read only returned at the transport's 10s request_timeout, past the test's 2s wait. Replace the single blocking read with a 100ms read timeout and a retry loop under a 10s deadline: any interleaving with the gate shutdown now resolves on the next read attempt, and WSAEINTR/WSAESHUTDOWN are accepted as interrupt outcomes. A missing reconnect registration still fails the test, since the gate never touches the replacement socket and every attempt times out until the deadline. Verified: 200 consecutive local runs pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 21.1.8 reformat wrapped `arrow_unsupported_column_kind = ...` (81 columns) across two lines, which broke `mirrors_of_the_c_error_code_enum_are_complete` on every platform: the test parses the C++ mirror expecting exactly one `<short> = ::line_sender_error_<short>,` per line, so the entry vanished from the parsed list. The mirror's layout is machine-checked, i.e. semantic, so exempt the enum from clang-format with an off/on guard and restore the one-line entry instead of teaching the parser to accept wrapped entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Everything checks out. The full chain is intact: CI installs pinned clang-format 21.1.8 → asserts the version → runs Review: PR #184 — "chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources" (level 3)Verdict: Approve. This is a genuinely clean PR. I ran the full level-3 pass and, unusually, can back the "formatting-only" claim with proof rather than inspection. What I verifiedThe C/C++ reformatting is provably code-neutral. I ran the pinned clang-format 21.1.8 over the old version of all 62 changed C/C++ files and diffed against the PR's new versions. Every file is byte-for-byte identical to clang-format's output except The The CI fix is real and complete. The bundled Rust test changes are sound and pass. New driver tests ( CriticalNone. ModerateNone. Minor
Downgraded (false positives)
Summary
|
qwp_ws_server_error_response_is_surfaced raced its second flush against the background runner: a 100ms sleep was the only thing giving the mock server time to write the QWP error response and the runner time to apply it. On a slow machine the flush arrived first, observed a healthy connection, and succeeded — unwrap_err then failed (seen on windows-msvc-2025; reproduced locally at ~50% under --features almost-all-features). Replace the sleep with a bounded pump on `qwp_ws_terminal_error`, which probes the terminal diagnostic without consuming it, so the flush only runs once the rejection is applied and every later assertion (handler callback, poll_qwp_ws_error) is left intact. The handler channel cannot serve as the barrier: notifications are drained only from user-side sender calls, so waiting on it before the flush deadlocks. The mock server now also holds its socket open until the client closes instead of sleeping 50ms, so a late flush cannot race server teardown. Verified: 300 consecutive runs under almost-all-features and 150 under default features, 0 failures (the sleep version failed ~50%). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A sweep of every thread::sleep in the QWP test code (prompted by the windows-msvc flakes on this branch) found seven fixed time budgets a stalled machine can flip, plus mock servers that drop their socket after a fixed sleep. Fixes, one test at a time: - manual_reap_closes_*: the pre-timeout `reap_idle() == 0` asserts had to run within the 50ms idle timeout. Moved that half of the contract into two new tests (senders, readers) using the default 60s timeout — deterministic with no sleeps — and left the post-timeout halves, where oversleeping is the safe direction. - at_cap_borrow_waits_for_a_return_within_acquire_timeout: take the wait-measurement start on the main thread before spawning the waiter, so a slow spawn can only inflate the measured wait, never shrink it under the asserted floor. - qwp_ws_close_flush_timeout_minus_one_skips_close_drain_wait: the server now stays silent-but-alive until the client closes (its 5s read timeout doubles as the unblock bound if close regresses into waiting), and the "returned promptly" budget widens from 250ms to 2s — far above any stall, far below the regressed path. - poison_dwell_driver_holds_terminal_until_window_elapses: widen the dwell window from 200ms to 2s (sleep 2.3s). The pre-sleep asserts need the window still open; 2s of stall between adjacent statements does not happen. - *_recycles_are_paced: the ≥2-connections lower bound could see a stalled client manage only its initial connect in the 900ms window. The recycling server now extends (bounded by 10s) until the second connection lands, and the scenario keeps the sender alive until then; the ≤8 pacing bound is unaffected since a longer quiet window only lowers the rate. - spawn_delayed_durable_ack_server, spawn_upgrade_only_server, spawn_max_batch_size_upgrade_only_server: hold the socket open until the client closes instead of sleeping 50-200ms and dropping, so a slow client cannot see an RST that discards a buffered response or reroutes the silent-server path under test. Full lib suite passes under almost-all-features (2129 tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
sigh: ##[error]We stopped hearing from agent dedi-incus-6-6. Verify the agent machine is running and has a healthy network connection. Anything that terminates an agent process, starves it for CPU, or blocks its network access can cause this error. For more information, see: https://go.microsoft.com/fwlink/?linkid=846610 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
questdb-rs/src/tests/qwp_ws.rs (2)
4723-4736: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winUse bounded backoff in the polling loop.
The loop calls
qwp_ws_terminal_error()every millisecond for up to five seconds. This can cause about 5,000 polling iterations in one test. Use bounded backoff and keep the five-second deadline.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@questdb-rs/src/tests/qwp_ws.rs` around lines 4723 - 4736, Update the polling loop around qwp_ws_terminal_error to use bounded backoff rather than sleeping a fixed 1ms on every iteration, while preserving the existing five-second deadline and terminal-error detection behavior. Start with a short delay and increase it up to a reasonable maximum before the next poll.
2785-2785: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy liftRestore direct reconnect coverage for blocked sends.
The deletion removes the reconnect-specific blocked-send scenario.
qwp_ws_drop_interrupts_blocked_background_sendat Lines 2730-2784 covers explicit sender drop, not reconnect. The cancellation path inquestdb-rs/src/ingress/sender/qwp_ws.rsLines 216-239 therefore loses direct reconnect coverage. Restore a bounded reconnect test or add equivalent coverage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@questdb-rs/src/tests/qwp_ws.rs` at line 2785, Restore direct reconnect coverage for blocked sends by adding a bounded test alongside qwp_ws_drop_interrupts_blocked_background_send that exercises the reconnect cancellation path in qwp_ws. Ensure the test blocks a background send, triggers reconnect rather than explicit sender drop, and verifies the blocked operation is interrupted and completes without hanging.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@questdb-rs/src/tests/qwp_ws.rs`:
- Line 688: In the connection-handling flow around the match action block, move
shared_count.store(connections, Ordering::Release) until after
write_qwp_error_response or write_server_close_frame has completed. Keep the
existing response writes and error handling unchanged, and ensure the count is
published only after the match action block finishes.
---
Nitpick comments:
In `@questdb-rs/src/tests/qwp_ws.rs`:
- Around line 4723-4736: Update the polling loop around qwp_ws_terminal_error to
use bounded backoff rather than sleeping a fixed 1ms on every iteration, while
preserving the existing five-second deadline and terminal-error detection
behavior. Start with a short delay and increase it up to a reasonable maximum
before the next poll.
- Line 2785: Restore direct reconnect coverage for blocked sends by adding a
bounded test alongside qwp_ws_drop_interrupts_blocked_background_send that
exercises the reconnect cancellation path in qwp_ws. Ensure the test blocks a
background send, triggers reconnect rather than explicit sender drop, and
verifies the blocked operation is interrupted and completes without hanging.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cb4788c8-7cac-47d2-a8aa-476a84e670d6
📒 Files selected for processing (3)
questdb-rs/src/ingress/sender/qwp_ws_driver.rsquestdb-rs/src/tests/qwp_sender_pool.rsquestdb-rs/src/tests/qwp_ws.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- questdb-rs/src/ingress/sender/qwp_ws_driver.rs
- questdb-rs/src/tests/qwp_sender_pool.rs
Review follow-up (CodeRabbit): the recycling server signalled the second connection before writing its error/close response, and the scenario drops the sender as soon as it observes that count — a server stall in between let the client teardown RST the socket and panic the response-write unwrap, which join() then propagated. Store the count after the match block, and tolerate response-write failures the same way the read side already tolerates reset/EOF: the client tearing down mid-response is a legitimate outcome in this scenario. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Review complete. The Review: PR #184 — "chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources" — level 3Scope reality. Of ~2,560 changed lines, this PR contains zero production-code changes. The surface is: CI tooling ( Independent verification performed.
CriticalNone. ModerateNone. Minor
Downgraded (false positives)
SummaryVerdict: approve. Clean, unusually well-reasoned PR — the |
The C/C++ format check never failed:
clang-format --dry-runwithout-Werroralways exits 0, and CI'sapt install clang-formatfailed silently, so an unpinned version checked a stale file list.ci/format_cpp.py: add--Werrorin check mode; cover the QWP headers, tests and examples (vendoreddoctest.hexcluded).pipx install clang-format==21.1.8, version asserted — comment reflow differs across clang-format versions.Summary by CodeRabbit
Documentation
Chores
Tests