Skip to content

Conversation

@cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Jan 28, 2026

We need to permit this kind of style of commit messages:

tests: in_splunk: Add a remote_addr extraction case

Signed-off-by: ...

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

    • Enhanced commit prefix validation for test-related contributions with more specific naming conventions and umbrella handling
    • Expanded umbrella prefix policies to better organize changes across lib and tests categories
    • Improved validation to ensure changes align with declared prefixes, with clearer error messages for mismatches
  • Tests

    • Updated and added tests to validate the new prefix rules and error reporting

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

…bject

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

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Commit prefix inference now derives specific prefixes from test file names (stripping leading flb_ when present) and also adds a tests: umbrella when appropriate. Umbrella-prefix logic was expanded to include lib: and tests: and now validates path coverage for those umbrellas with detailed errors.

Changes

Cohort / File(s) Summary
Commit prefix inference and validation
/.github/scripts/commit_prefix_check.py
Infer concrete prefixes from tests/ file names (strip leading flb_), add both name: and tests: where applicable; broaden umbrella_prefixes to include lib: and tests:; add validation ensuring umbrella subject prefixes cover all changed paths with explicit error messages.
Test updates
/.github/scripts/tests/test_commit_lint.py
Update expected commit-prefix output to include derived test-name prefix (e.g., "tests: test_router: add unit test") and add a test asserting invalid combinations produce a detailed error listing expected prefixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • niedbalski
  • patrick-stephens
  • celalettin1286

Poem

🐰 I hopped through tests and found a name,

flb_ peeled off, no two files the same.
Umbrellas widen — lib: and tests: aligned,
Prefixes tidy, no surprises left behind. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: expanding the commit prefix check script to include 'tests' as an umbrella prefix category.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ 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

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b6eb37f9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/tests/test_commit_lint.py (1)

606-618: Docstring is now outdated.

The docstring states that "Test files (in tests/ directory) don't generate specific component prefixes" and "Generic prefixes like 'tests:' are acceptable." With the new logic, test files do generate specific prefixes (e.g., test_router: from test_router.c), and the test message was updated to reflect the nested prefix style.

📝 Suggested docstring update
 def test_valid_test_file_changes():
     """
-    Test that test file changes are allowed with generic prefixes.
+    Test that test file changes allow umbrella prefix with nested scope.
 
-    Test files (in tests/ directory) don't generate specific component prefixes.
-    Generic prefixes like 'tests:' are acceptable for test-related changes.
+    Test files (in tests/ directory) generate both specific prefixes (derived
+    from filename) and the umbrella 'tests:' prefix. Commits can use the
+    'tests:' umbrella prefix with a nested scope (e.g., 'tests: test_router:').
     """
🧹 Nitpick comments (1)
.github/scripts/commit_prefix_check.py (1)

252-268: Consider consolidating duplicate validation blocks.

The lib: and tests: umbrella validation blocks are nearly identical, differing only in the directory prefix check. This could be consolidated using a mapping.

♻️ Suggested refactor
     if len(non_build_prefixes) > 1:
         if subj_lower in umbrella_prefixes:
             norm_paths = [p.replace(os.sep, "/") for p in files]
 
-            if subj_lower == "lib:":
-                if not all(p.startswith("lib/") for p in norm_paths):
-                    expected_list = sorted(expected)
-                    expected_str = ", ".join(expected_list)
-                    return False, (
-                        f"Subject prefix '{subject_prefix}' does not match files changed.\n"
-                        f"Expected one of: {expected_str}"
-                    )
-
-            elif subj_lower == "tests:":
-                if not all(p.startswith("tests/") for p in norm_paths):
-                    expected_list = sorted(expected)
-                    expected_str = ", ".join(expected_list)
-                    return False, (
-                        f"Subject prefix '{subject_prefix}' does not match files changed.\n"
-                        f"Expected one of: {expected_str}"
-                    )
+            umbrella_to_dir = {"lib:": "lib/", "tests:": "tests/"}
+            required_dir = umbrella_to_dir[subj_lower]
+            if not all(p.startswith(required_dir) for p in norm_paths):
+                expected_list = sorted(expected)
+                expected_str = ", ".join(expected_list)
+                return False, (
+                    f"Subject prefix '{subject_prefix}' does not match files changed.\n"
+                    f"Expected one of: {expected_str}"
+                )

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

Apart from my hatred of python this looks fine :)

@patrick-stephens patrick-stephens merged commit 26a7ccd into master Jan 28, 2026
17 checks passed
@patrick-stephens patrick-stephens deleted the cosmo0920-add-tests-into-umbrella-rule branch January 28, 2026 11:35
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.

2 participants