Skip to content

Conversation

@cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Jan 21, 2026

This change does not relax commit message validation rules.
It only prevents false positives caused by fenced code blocks
commonly used to include logs, YAML configs, or command output
in Fluent Bit commit messages.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Chores

    • Commit validation now ignores fenced code blocks in message bodies.
    • Multi-prefix handling improved: umbrella prefixes may cover multiple components; otherwise validation returns clearer expected-prefix errors.
  • Tests

    • Added tests ensuring commit messages containing fenced code blocks pass validation.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

The pull request adds support for stripping fenced code blocks from commit messages before validation. A new regex pattern and strip_fenced_code_blocks() function is introduced and applied to commit body parsing in squash detection and commit validation. Additionally, multi-prefix handling logic is refined to allow umbrella prefixes to cover multiple components when needed.

Changes

Cohort / File(s) Summary
Fenced code block stripping & prefix validation
​.github/scripts/commit_prefix_check.py
Added FENCED_BLOCK_RE regex and strip_fenced_code_blocks() function to remove code fences from commit bodies. Applied sanitization in detect_bad_squash() and validate_commit(). Refined multi-prefix handling to allow umbrella prefixes (e.g., lib:) when multiple non-build prefixes are inferred.
Test coverage for fenced code blocks
​.github/scripts/tests/test_commit_lint.py
Added test case validating that commits with fenced code blocks (YAML examples) in the body pass validation without errors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • niedbalski
  • patrick-stephens
  • celalettin1286

Poem

A rabbit hops through code fences tall, 🐰
Strips them away, ignoring them all!
Squash detection runs clean and bright,
Prefixes validated just right! ✨
No blocked code shall cause dismay,
Commit linting saves the day!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding functionality to skip commit linter validations for code blocks in commit messages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/scripts/commit_prefix_check.py:
- Around line 238-246: The current branch allows umbrella prefixes (checked via
subj_lower in umbrella_prefixes) even when the commit touches mixed components;
modify the block inside the len(non_build_prefixes) > 1 check to only accept
umbrella prefixes when all changed file paths belong to the umbrella domain(s)
(e.g., all paths start with the umbrella directory like "lib/"); specifically,
when evaluating subj_lower against umbrella_prefixes, add a predicate that
verifies every changed path in the commit is within the umbrella directories
before returning success, otherwise treat it as a mismatch and return the
existing False with expected_str (using subject_prefix, non_build_prefixes,
umbrella_prefixes, and expected to locate and adjust the logic).

In @.github/scripts/tests/test_commit_lint.py:
- Around line 207-208: The test assigns a second return value to msg from
validate_commit(commit) but never uses it; rename msg to _ or _msg to satisfy
RUF059. Update the line "ok, msg = validate_commit(commit)" to "ok, _ =
validate_commit(commit)" or "ok, _msg = validate_commit(commit)" so the unused
variable is clearly ignored while keeping validate_commit and commit references
intact.

…de blocks

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@cosmo0920 cosmo0920 force-pushed the cosmo0920-skip-validations-for-code-blocks branch from 2ee617d to 96f9299 Compare January 22, 2026 04:56
@cosmo0920 cosmo0920 added this to the Fluent Bit v5.0 milestone Jan 22, 2026
@patrick-stephens patrick-stephens merged commit c22185e into master Jan 22, 2026
28 checks passed
@patrick-stephens patrick-stephens deleted the cosmo0920-skip-validations-for-code-blocks branch January 22, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants