Skip to content

test: make omitted cluster comments optional - #6022

Merged
renecannao merged 2 commits into
v3.0from
fix/cluster-simulator-optional-comment
Aug 10, 2026
Merged

test: make omitted cluster comments optional#6022
renecannao merged 2 commits into
v3.0from
fix/cluster-simulator-optional-comment

Conversation

@renecannao

@renecannao renecannao commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • treat an omitted comment in expected cluster-simulator states as a wildcard
  • preserve exact comparison when comment is explicitly present, including an empty string
  • include specified comments in projected diagnostic JSON
  • add a focused TAP regression and run it in the cluster-simulator CI build

Root cause

The Galera simulator payloads intentionally omit optional server comments. Runtime rows can retain generated comments such as node_127.1.1.x, but the parser previously converted an omitted expected comment to an empty string and the matcher compared it unconditionally. This made the first Galera payload depend on startup state and produced a checksum mismatch even though every asserted field matched.

This failure was observed while investigating PR #6017, but that PR does not modify the simulator. This fix is intentionally isolated.

Semantics

  • omitted optional fields remain unconstrained
  • explicit comments are compared exactly
  • explicit empty comments remain distinct from omission
  • checksum behavior is unchanged

Validation

  • clean containerized cluster-simulator build with -j32
  • focused common_utils_unit-t: 9/9
  • cluster_sim_galera-g1: 5/5, repeated in two fresh isolated environments
  • cluster_sim_read_only-g1: 9/9
  • simulation runtime verification for both groups
  • shellcheck test/infra/control/cluster-simulator-ci.bash
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Cluster simulator status checks now support optional comments: omitted comments act as wildcards, while supplied comments—including empty values—must match exactly.
    • Status diagnostics include the comment field only when it was explicitly provided.
  • Documentation

    • Documented optional status fields and their matching behavior.
  • Tests

    • Added regression coverage for omitted, matching, differing, and empty comments.
    • Integrated simulator checks into the build and validation workflow.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The cluster simulator now tracks whether comment was supplied, treats omitted comments as wildcards, preserves exact matching for supplied comments including empty strings, and conditionally serializes comments. Focused TAP tests and CI wiring validate the behavior.

Changes

Optional cluster-simulator comments

Layer / File(s) Summary
Comment contract and status shape
docs/superpowers/..., test/deps/cluster_simulator/lib/common_utils.h, test/deps/cluster_simulator/README.md
The design, plan, API documentation, and server_status representation define presence-aware comment matching.
Presence-aware parsing and projection
test/deps/cluster_simulator/lib/common_utils.cpp
Parsing records comment presence. Matching skips omitted expected comments. JSON includes comment only when supplied.
Focused regression validation and CI wiring
test/deps/cluster_simulator/tests/common_utils_unit-t.cpp, test/deps/cluster_simulator/Makefile, test/infra/control/cluster-simulator-ci.bash
TAP assertions cover comment extraction, matching, and serialization. The Makefile and CI run the test binary.

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

Possibly related PRs

  • sysown/proxysql#5760: Introduced the cluster simulator status extraction, matching, and JSON serialization extended here.

Suggested reviewers: wazir-ahmed

Poem

A rabbit checks each comment bright,
Empty or filled, it matches right.
Omitted fields can softly roam,
JSON leaves them safely home.
TAP hops green through CI’s run.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: omitted cluster comments now act as optional constraints.
✨ 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/cluster-simulator-optional-comment

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.

@gitar-bot

gitar-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Makes omitted cluster-simulator comments optional by treating them as wildcards while preserving exact comparison for explicitly provided comments. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@renecannao
renecannao marked this pull request as ready for review August 10, 2026 09:10
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.04%. Comparing base (b4c7514) to head (778db5f).
⚠️ Report is 76 commits behind head on v3.0.

Additional details and impacted files
@@            Coverage Diff             @@
##             v3.0    #6022      +/-   ##
==========================================
- Coverage   53.06%   53.04%   -0.02%     
==========================================
  Files         478      478              
  Lines      143736   143736              
  Branches    36348    36348              
==========================================
- Hits        76267    76244      -23     
- Misses      50559    50584      +25     
+ Partials    16910    16908       -2     
Flag Coverage Δ
integration-tests 49.25% <ø> (-0.02%) ⬇️
unit-tests 14.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@renecannao
renecannao merged commit 96ec0a0 into v3.0 Aug 10, 2026
82 of 83 checks passed
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.

1 participant