Repository navigation
Add fatal JSON summaries and make lifecycle notices debug-only - #25
Conversation
…and tracking (#435) * fix(resp3): accept push frames; count nil _ as miss in arbitrary command tracking Two RESP3 correctness bugs surfaced by the 2.4 readiness review. #27: aggregate_type() lacked '>'. A server-pushed message (pubsub, keyspace notifications, client tracking invalidation) on a RESP3 connection hit the "unsupported response" path and dropped the connection. Now accepts and drains push frames inline. #25: SingleNullBulk and ArrayPerElementNulls miss sentinels only recognised RESP2 nil shapes ($-1/*-1/*0). RESP3 nil (_\r\n) was miscounted as a hit, silently understating miss rate and suppressing --miss-rate-threshold warnings. Refs: 2.4 review findings #25 + #27 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(resp3): flag RESP3 null at construction; distinguish from literal "_" Bugbot flagged that the ArrayPerElementNulls walker used a content heuristic (value_len==1 && value[0]=='_') that couldn't tell a RESP3 null parsed via single_type from a real bulk value of literal "_" parsed via blob_type. Both produce identical bulk_el. Added bulk_el::is_resp3_null flag, set only when single_type constructs the element for type byte '_'. Walker now reads the flag directly instead of inferring from content. Test added that stores "_" values and asserts they are NOT counted as misses. Refs: bugbot LOW on PR #435 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(resp3): drain server-pushed frames without delivering as reply Reviewer caught that the prior commit accepted RESP3 push (>) into aggregate_type() but didn't suppress its effect on m_last_response. The push frame fully parsed AS a reply, response_ended() returned 1, and memtier dequeued the push as the reply to the next in-flight command -- corrupting latency attribution + hit/miss accounting. Adds an m_push drain-mode flag: - Set when a push aggregate is encountered at top level - Suppresses every mutation to m_last_response while true - Cleared in response_ended(), which returns false so the parser continues to read the actual reply - Reset on rs_initial transition Refs: 2.4 review of PR #435 (R1 CRITICAL). * fix(resp3): reset m_response_len when draining push frame Bugbot caught that response_ended()'s m_push drain returned false without resetting m_response_len. The accumulated push frame bytes stayed in the counter and contaminated set_total_len() for the actual reply, skewing bandwidth and per-op size statistics. Resetting m_response_len to 0 at the push-drain-complete site matches the behaviour at rs_initial (the only other site where m_response_len is reset). Refs: bugbot LOW on PR #435 (follow-up). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(resp3): clear both m_push and m_attribute together in response_ended() Bugbot caught that if an attribute (|) appears nested inside a push frame (>), and both complete at the same response_ended() call, the m_attribute branch fired first and returned false, leaving m_push set. The parser then consumed the actual command reply as push-drain data, desynchronizing the connection. response_ended() now clears whichever flags are set in a single call and returns false if either was set. Refs: bugbot LOW on PR #435 (follow-up). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. Thanks for bringing this old one up to date against current master. I went through the writer, the finalization reordering and the tests, and left a few comments below.
The core change looks sound to me. I'd mainly like an answer on the early-exit category question and a release-note mention of the quieter stderr before this merges. (would file this as a comment, not a formal block) |
…on verifier failure
|
Thanks. The output decisions are explicit now:
Published followup: |
|
Follow-up on the07:53:15 edit:
|
|
Replying to the07:59:44 revision: The early-exit category is deliberately generic in this change. The README explicitly limits specialized categories to normal finalization. Adding category assignment to every historical exit site would broaden this patch; it can be a follow-up without weakening the existing exit status or detailed stderr. The documented priority is intentional, and verification's existing result object is retained when emitted. The writer is an internal executable component. Its debug logging dependency is acceptable here; BUILD independently compiled and linked a direct writer consumer with the normal logging callback stub, alongside the full no-TLS VPATH build/install and14 unit programs. A new public logging hook is unnecessary for the current use. The early-exit failed-key-logger lifetime explanation remains at There is no tracked release-notes/changelog file in this repository. I have added an explicit release-note paragraph to the PR body for the next release: “JSON creation, saving and close notices now require --debug. Error diagnostics and exit statuses are unchanged; failed JSON results may include the optional FATAL_ERROR summary.” This makes the stderr change reviewable as a release-facing compatibility note. The unittest adapter intentionally keeps the same cases runnable directly against an installed binary and in RLTest; failures propagate full test details. All six early-exit cases pass with the debug close check. The final merge will be a squash. Body counts and review status are being refreshed; no further runtime change is needed for these points. |
Problem
With
--json-out-file, a failed run can leave configuration or partial results without a structured indication of failure. JSON creation/finalization notices also clutter ordinary stderr.Root cause
The current writer preserves and closes partial JSON, but does not record the failure category. The original PR predates the current output and shutdown handling and cannot safely replace those paths wholesale.
Fix
Add an optional top-level
FATAL_ERRORstring after JSON initialization, retaining configuration and results already emitted. Fixed summaries distinguish connection setup, worker, verification, other output, and early termination failures; detailed diagnostics remain on stderr and existing exit codes remain authoritative. Close the failed-key log before finalizing JSON so its late failures are included. Move JSON lifecycle notices behind--debug.Successful runs, recovered errors and graceful interrupts do not gain the field unless another failure occurs. Pre-initialization validation leaves existing JSON untouched. JSON write failure, crashes and forced termination cannot guarantee a complete artifact. The writer escapes error text, closes existing nesting and records only the first summary.
Tests
/dev/full.Affected versions
This adds a new JSON failure-summary field; no released version provides this contract. The comparison baseline is current master
21a7879802a6a901a2f4079868e67c70e4da9a0b. Consumers should continue checking the process exit status and accept the optional top-level field.Note
Low Risk
Adds optional JSON metadata and stderr noise reduction on shutdown paths; behavior for successful runs is unchanged aside from quieter stderr.
Overview
Failed runs with
--json-out-filenow get a top-levelFATAL_ERRORstring in the JSON artifact while keeping configuration and any results already written.json_handler::write_error()records one escaped summary (connection setup, worker stop, output write failure, verification failure, or generic early termination); stderr and exit codes stay the source of detail.Shutdown in
main()picks the category in fixed priority and closes the failed-keys log before finalizing JSON so late log failures count as output errors. TheatexitJSON closer writes the generic early-termination message when the process exits without normal finalization.JSON create/close/save notices move behind
--debugviabenchmark_debug_log. README documents the contract; tests cover success (no field), each failure class with retained stats, and updated early-exit expectations.Reviewed by Cursor Bugbot for commit 17e65dd. Bugbot is set up for automated code reviews on this repo. Configure here.
Release note
JSON creation, saving and close notices now require
--debug. Error diagnostics and exit statuses are unchanged; failed JSON results may include the optionalFATAL_ERRORsummary.🤖 Generated with Claude Code