Skip to content

chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources - #184

Merged
ideoma merged 8 commits into
mainfrom
fix/clang-format-gate
Aug 12, 2026
Merged

ideoma merged 8 commits into
mainfrom
fix/clang-format-gate

Conversation

@jerrinot

@jerrinot jerrinot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

The C/C++ format check never failed: clang-format --dry-run without -Werror always exits 0, and CI's apt install clang-format failed silently, so an unpinned version checked a stale file list.

  • ci/format_cpp.py: add --Werror in check mode; cover the QWP headers, tests and examples (vendored doctest.h excluded).
  • CI: pipx install clang-format==21.1.8, version asserted — comment reflow differs across clang-format versions.
  • Reformat the 949 accumulated violations (whitespace and comment reflow only).

Summary by CodeRabbit

  • Documentation

    • Clarified C/C++ formatting requirements and sender completion, retry, queue, and symbol-dictionary behavior.
    • Documented the required formatting-tool version and known comment reflow limitations.
  • Chores

    • Standardized automated formatting checks on clang-format 21.1.8.
    • Reformatted project headers, tests, and examples without changing behavior or public APIs.
  • Tests

    • Improved durable acknowledgment and WebSocket integration coverage.
    • Made asynchronous sender and connection-lifecycle tests more reliable.

…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>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jerrinot, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 479ac8b4-d06c-4833-b07e-d274978455a6

📥 Commits

Reviewing files that changed from the base of the PR and between 757d265 and f202290.

📒 Files selected for processing (1)
  • questdb-rs/src/tests/qwp_ws.rs
📝 Walkthrough

Walkthrough

The 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.

Changes

Formatting standardization

Layer / File(s) Summary
Formatter tooling and CI
CONTRIBUTING.md, ci/format_cpp.py, ci/run_tests_pipeline.yaml
The formatter uses clang-format 21.1.8, discovers source files recursively, excludes vendored files, and supports check and write modes. CI installs and validates the pinned version.
C/C++ source and test formatting
cpp_test/*, examples/*, include/questdb/*
C/C++ mocks, tests, examples, and public headers receive formatting and documentation reflow. APIs, assertions, control flow, output, and runtime behavior remain unchanged.
Rust WebSocket and sender tests
questdb-rs/src/ingress/sender/qwp_ws_driver.rs, questdb-rs/src/tests/qwp_sender_pool.rs, questdb-rs/src/tests/qwp_ws.rs
WebSocket tests validate frame masking, binary opcodes, durable-ACK negotiation, keepalive PING behavior, connection pacing, and asynchronous error handling. Sender-pool tests improve timeout and reaper coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: documentation, enhancement

Suggested reviewers: bluestreak01

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: stronger clang-format enforcement, pinning version 21.1.8, and expanded QWP source coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/clang-format-gate

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jerrinot

Copy link
Copy Markdown
Contributor Author

Verified. The only file the glob excludes is cpp_test/doctest.h — exactly the intended VENDORED exclusion. Coverage is complete (81/82 sources, doctest.h deliberately skipped). Everything checks out; here's the review.


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 ci/format_cpp.py (44 lines), ci/run_tests_pipeline.yaml (7 lines), and CONTRIBUTING.md (docs). I verified all three claims in the PR body against source, and — most importantly — proved the bulk reformatting changes no code.

Verification performed

  • Reformatting is provably pure tool output. I have the exact pinned clang-format 21.1.8 locally. Running it on the main version of every file my token-diff flagged reproduces the branch version byte-for-byte (11/11 match, 0 mismatches). My own tokenizer's "differences" were false positives from // inside string literals (URLs). Zero semantic changes in the diff.
  • Repo is clean at HEAD. python3 ci/format_cpp.py --check passes — the newly-toothed check is green against the reformatted tree, so this PR won't self-fail.
  • The core premise holds. clang-format --dry-run on misformatted code exits 0; adding --Werror exits 1. The old check was genuinely a no-op; the fix is real.
  • Glob coverage is complete and strictly broader than the old hardcoded list. All 82 C/C++ sources under include/questdb, cpp_test, examples are covered except cpp_test/doctest.h (the intended vendored exclusion). The old list even referenced files while missing all the qwp_*, test_arrow_*, test_reader_*, and compile_fail_* sources — those are now covered. No subdirs or other extensions (.cc/.inl) are missed.
  • CI pin is asserted correctly. set -e + pipx install clang-format==21.1.8 + clang-format --version | grep -F 21.1.8. -F correctly treats the dots as literal, and set -e makes the version mismatch fail the job.

Critical

None.

Moderate

None.

Minor

  1. ci/format_cpp.py doesn't assert the clang-format version; CI does — asymmetric. CONTRIBUTING tells contributors to run python3 ci/format_cpp.py, but the script runs whatever clang-format resolves first on PATH. A contributor on clang-format 20 or 22 (or whose system binary shadows the pipx shim) silently reformats differently, passes locally, and only discovers the mismatch when CI fails on comment reflow. Since the exact-version dependency is the whole point of this PR, add the same --version guard inside the script (skippable via env for flexibility) so local and CI are symmetric. ci/format_cpp.py:35.
  2. PATH-across-steps is load-bearing but implicit. pipx installs to ~/.local/bin; the version-assert runs in the install step, while format_cpp.py --check runs in a later step (ci/run_tests_pipeline.yaml:233). This works because ~/.local/bin is on the Azure ubuntu-latest agent's base PATH (inherited by all steps), and the install-step assertion de-risks it — but it's not a bug, just the one thing that would break if the hosted image ever dropped ~/.local/bin from the default PATH. No action needed; noting for awareness.

Downgraded (false positives)

  • "11 files have token differences beyond whitespace/comments" (my initial tokenizer pass) — false positive: authoritative clang-format 21.1.8 reproduces each byte-for-byte; the tokenizer mishandled // inside string-literal URLs.
  • "glob misses ~80 sources" — false positive: a namespace-package import quirk left my comparison file empty on the first run; corrected run shows only doctest.h excluded, as intended.

Summary

Approve. Clean, well-scoped, correctly-motivated tooling fix; the three PR claims (--Werror teeth, version pin, wider file coverage) are all verified true, and the large reformatting diff is proven to be pure clang-format output with no token changes. Out-of-diff findings: 0, which is correct here — this PR changes no public symbol, ABI, or wire format, so there is no cross-context blast radius; I verified that by proving the reformatting is semantically inert rather than by assuming it. Draft findings: 4 raised, 2 confirmed (both Minor), 2 dropped as false positives.

Only actionable suggestion: mirror CI's version assertion inside format_cpp.py so contributors can't silently drift.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9bbb00a and 20a1b55.

📒 Files selected for processing (64)
  • CONTRIBUTING.md
  • ci/format_cpp.py
  • ci/run_tests_pipeline.yaml
  • cpp_test/qwp_mock_c.cpp
  • cpp_test/qwp_mock_c.h
  • cpp_test/qwp_mock_server.cpp
  • cpp_test/qwp_mock_server.hpp
  • cpp_test/smoke_reader.c
  • cpp_test/test_arrow_c.c
  • cpp_test/test_arrow_egress.cpp
  • cpp_test/test_arrow_ingress.cpp
  • cpp_test/test_column_sender.cpp
  • cpp_test/test_line_sender.cpp
  • cpp_test/test_reader.cpp
  • cpp_test/test_reader_mock.cpp
  • cpp_test/test_reader_offline.cpp
  • examples/bench_http_c.c
  • examples/bench_http_c.h
  • examples/bench_ingest_c.c
  • examples/bench_ingest_c.h
  • examples/bench_json_c.c
  • examples/bench_json_c.h
  • examples/bench_schema_c.c
  • examples/bench_schema_c.h
  • examples/line_sender_c_example.c
  • examples/line_sender_c_example_auth.c
  • examples/line_sender_c_example_auth_tls.c
  • examples/line_sender_c_example_decimal_binary.c
  • examples/line_sender_c_example_from_conf.c
  • examples/line_sender_c_example_from_env.c
  • examples/line_sender_c_example_http.c
  • examples/line_sender_c_example_tls_ca.c
  • examples/line_sender_c_example_udp.c
  • examples/line_sender_c_example_udp_batch.c
  • examples/line_sender_cpp_example.cpp
  • examples/line_sender_cpp_example_arrow.cpp
  • examples/line_sender_cpp_example_auth.cpp
  • examples/line_sender_cpp_example_decimal_binary.cpp
  • examples/line_sender_cpp_example_decimal_custom.cpp
  • examples/line_sender_cpp_example_from_conf.cpp
  • examples/line_sender_cpp_example_from_env.cpp
  • examples/line_sender_cpp_example_http.cpp
  • examples/line_sender_cpp_example_tls_ca.cpp
  • examples/line_sender_cpp_example_udp.cpp
  • examples/line_sender_cpp_example_udp_batch.cpp
  • examples/qwp_bench_selftest.c
  • examples/qwp_egress_c.c
  • examples/qwp_ingress_c.c
  • examples/reader_c_example_arrow.c
  • examples/reader_c_example_columns.c
  • examples/reader_c_example_from_conf.c
  • examples/reader_cpp_example_arrow.cpp
  • examples/reader_cpp_example_from_conf.cpp
  • examples/reader_cpp_example_with_binds.cpp
  • include/questdb/client.h
  • include/questdb/client.hpp
  • include/questdb/egress/qwp_reader.h
  • include/questdb/egress/qwp_reader.hpp
  • include/questdb/ingress/line_sender.h
  • include/questdb/ingress/line_sender.hpp
  • include/questdb/ingress/line_sender_core.hpp
  • include/questdb/ingress/line_sender_decimal.hpp
  • include/questdb/ingress/qwp_sender.h
  • include/questdb/ingress/qwp_sender.hpp

Comment thread ci/run_tests_pipeline.yaml Resolved
Comment thread examples/bench_http_c.c Resolved
Comment thread examples/bench_ingest_c.c Resolved
jerrinot and others added 4 commits August 11, 2026 14:15
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>
@jerrinot

Copy link
Copy Markdown
Contributor Author

Everything checks out. The full chain is intact: CI installs pinned clang-format 21.1.8 → asserts the version → runs python3 ci/format_cpp.py --check (line 233) which now uses --Werror. Review complete.


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 verified

The 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 line_sender_core.hpp, whose only hand edits are the 7-line clang-format off/on guard comment. There are no hidden logic edits, and — contrary to CodeRabbit's walkthrough — no doc-comment wording changed anywhere (clang-format(old)==new rules that out); what it called "clarified" is pure reflow.

The clang-format off guard is correct, necessary, and works today. I initially suspected the directive was a no-op because it carries trailing text (// clang-format off: the Rust test...) and older clang-format required an exact-match comment. I disproved that empirically: v21.1.8 honors the directive with trailing text. It's load-bearing now, not hypothetically — without it, clang-format wants to wrap arrow_unsupported_column_kind across two lines, which would break mirrors_of_the_c_error_code_enum_are_complete. Both that test and c_header_line_sender_enum_matches_rust pass, and the full format_cpp.py --check passes over all 81 files under the pin.

The CI fix is real and complete. --dry-run without --Werror always exits 0, so the old check never failed — the --Werror addition fixes that. The version is installed, asserted (clang-format --version | grep -F 21.1.8 under set -e), and the check is invoked (line 233). The new recursive glob is a clean superset of the old file list; only vendored doctest.h is excluded, correctly.

The bundled Rust test changes are sound and pass. New driver tests (blocking_transport_emits_durable_keepalive_ping, blocking_transport_reconnect_registers_replacement_with_traffic_gate) touch no production code and pass. The qwp_sender_pool.rs retry loop correctly tolerates the expected SFA append-timeout backpressure while asserting the chunk stays retryable and rolled back — consistent with the store-and-forward durability invariant. fmt and clippy are clean.

Critical

None.

Moderate

None.

Minor

  1. Coverage shifted, not lost, for reconnect drop-interruption (questdb-rs/src/tests/qwp_ws.rs, removed qwp_ws_drop_interrupts_blocked_send_after_reconnect). The deleted test asserted an end-to-end property: drop(sender) returns in <1s when a send is blocked on the replacement socket after reconnect. Its replacement (blocking_transport_reconnect_registers_replacement_with_traffic_gate) proves the mechanism — the replacement socket is registered with the traffic gate — at unit level, and the drop→gate wiring is still covered end-to-end for the non-reconnect case by qwp_ws_drop_interrupts_blocked_background_send. Net coverage is equivalent and far more deterministic (the old test was the source of the Windows races these commits chased), so this is an acceptable trade — just noting the integration-level "drop is bounded after reconnect" assertion is no longer stated directly.

  2. Pool retry loop has no backoff (qwp_sender_pool.rs:3434). The loop { match sender.flush(&mut third) … } retries with no sleep. It's not a hot spin — each flush blocks internally for the SFA append timeout — and it's test-only, so negligible. Mentioned only for completeness.

Downgraded (false positives)

  • "The clang-format off: guard is a no-op because clang-format only matches the exact comment." — Dismissed: empirically, clang-format 21.1.8 honors the directive with trailing text (verified with a control: the guarded enum keeps its spacing while int y = 3; after clang-format on collapses), and the guard demonstrably keeps arrow_unsupported_column_kind on one line.

Summary

  • 1-line verdict: Approve — provably formatting-only C/C++ plus well-tested, invariant-respecting Rust test changes.
  • Findings: 3 draft findings verified (2 Minor kept, 1 downgraded); no Critical/Moderate. In-diff: 2 Minor. Out-of-diff: 0 — justified here, since the C/C++ change was proven semantically inert by the clang-format-idempotence check (no changed contract for callsites to violate) and the Rust changes are test-only.
  • No regressions. The one real behavioral lever in the PR — CI now actually enforces formatting — is verified working end-to-end.

jerrinot and others added 2 commits August 11, 2026 16:56
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>
@jerrinot

Copy link
Copy Markdown
Contributor Author

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
questdb-rs/src/tests/qwp_ws.rs (2)

4723-4736: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Use 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 lift

Restore direct reconnect coverage for blocked sends.

The deletion removes the reconnect-specific blocked-send scenario. qwp_ws_drop_interrupts_blocked_background_send at Lines 2730-2784 covers explicit sender drop, not reconnect. The cancellation path in questdb-rs/src/ingress/sender/qwp_ws.rs Lines 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7d9ffc6 and 757d265.

📒 Files selected for processing (3)
  • questdb-rs/src/ingress/sender/qwp_ws_driver.rs
  • questdb-rs/src/tests/qwp_sender_pool.rs
  • questdb-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

Comment thread questdb-rs/src/tests/qwp_ws.rs Resolved
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>
@jerrinot

Copy link
Copy Markdown
Contributor Author

Review complete. The FormatAndLinting job (ubuntu-latest, so pipx is present) installs pinned clang-format 21.1.8 and runs python3 ci/format_cpp.py --check at line 233 — and that job already passed on the branch, validating the entire CI change end-to-end. I've verified every substantive change against source and run 388 tests locally (0 failures).


Review: PR #184 — "chore(ci): give the clang-format check teeth, pin 21.1.8, cover QWP sources" — level 3

Scope reality. Of ~2,560 changed lines, this PR contains zero production-code changes. The surface is: CI tooling (ci/format_cpp.py, ci/run_tests_pipeline.yaml), docs (CONTRIBUTING.md), mechanical clang-format output (60 C/C++ files), one documented clang-format off whitespace guard, and test-only Rust (3 files, all under #[cfg(test)]). No FFI/ABI, wire-format, public-API, unsafe, or sender/buffer state-machine change exists — so most level-3 machinery (Agents 3–6, 9) has an empty target set by construction, not by underrun.

Independent verification performed.

  • Formatting is provably pure. Applied clang-format 21.1.8 to each C/C++ file's main version and compared byte-for-byte to HEAD: 60/61 identical. The lone mismatch (line_sender_core.hpp) is an intentional // clang-format off guard I confirmed is required — the mirrors_of_the_c_error_code_enum_are_complete test in questdb-rs-ffi/src/lib.rs parses that enum one-entry-per-line, and a two-line reflow would yield a bogus empty-value entry and fail the mirror check.
  • Glob coverage complete. No missed extensions (.cc/.cxx/.inl/…) or subdirs; --check passes at HEAD.
  • Load-bearing test claims confirmed. qwp_ws_terminal_error is documented non-consuming (poll loop leaves later poll_qwp_ws_error intact); removed integration test and new driver tests share the identical sync-sender-qwp-ws gate (no config loses coverage).
  • 388 tests pass locally, 0 failed — including every test consuming the changed shared server helpers.

Critical

None.

Moderate

None.

Minor

  1. ci/format_cpp.py — inconsistent glob depth (in-diff). include/questdb/**/*.h is recursive but cpp_test/*.c / examples/*.c are flat. A future cpp_test/subdir/foo.cpp would silently escape the newly-toothed check. Low risk (both dirs are conventionally flat), but making all three use ** closes the gap for free.
  2. qwp_ws.rs durable-ack test drops the keepalive dimension (in-diff). Removing durable_ack_keepalive_interval_millis=1 deletes the interaction coverage of aggressive keepalive × durable completion across progress modes. Keepalive is now covered in isolation by the new blocking_transport_emits_durable_keepalive_ping, so the pieces are tested — just no longer together. Acceptable, worth noting.
  3. Removed qwp_ws_drop_interrupts_blocked_send_after_reconnect (in-diff). Replaced by the lower-level, deterministic blocking_transport_reconnect_registers_replacement_with_traffic_gate. Good trade (the integration test was flaky), but the full end-to-end sender drop → reconnect → interrupt path now has only unit-level coverage of the mechanism.

Downgraded (false positives)

  • "SFA retry loop is an unbounded busy-spin" — dismissed: bounded by a 30s trim_deadline whose assert! panics on expiry, and each iteration is a blocking network flush, not a hot spin.
  • "hold-until-close drain loops (while ...read()...) can hang forever" — dismissed: each has a read-timeout backstop (5–10s) and exits on client close via Ok(0).
  • "line_sender_core.hpp edit is a manual change smuggled into the formatting bucket" — dismissed: it's a documented clang-format off guard the enum-mirror parser genuinely requires.
  • "reap pre-timeout coverage lost" — dismissed: relocated to new deterministic manual_reap_ignores_*_below_idle_timeout tests using the default 60s idle timeout; assertions preserved.

Summary

Verdict: approve. Clean, unusually well-reasoned PR — the --Werror fix closes a real no-op (--dry-run alone always exits 0), the pin is asserted correctly, and every test change is a determinism/strengthening fix, not a weakening. 7 candidate findings evaluated: 3 verified (all Minor), 4 dropped as false positives. All 3 findings are in-diff; out-of-diff is zero and correctly so — no production symbol changed, so the cross-context caller surface is genuinely empty, not under-searched. No regressions or data-loss/store-and-forward concerns.

@ideoma
ideoma merged commit 752d240 into main Aug 12, 2026
24 checks passed
@jerrinot
jerrinot deleted the fix/clang-format-gate branch August 12, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants