From f0a643952f02018f4357c3bfff23636fe1981a4e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 25 Sep 2025 13:12:07 -0300 Subject: [PATCH] chore: Update .coderabbit.yaml configuration to add pre-merge checks (#9980) * chore: Update .coderabbit.yaml configuration for review processes - Added pre-merge checks for test coverage, quality, and file naming to enhance testing standards. * chore: Refine .coderabbit.yaml review instructions for testing standards - Updated test coverage checks to emphasize the inclusion of corresponding tests for new components and improved clarity on test quality evaluation. - Adjusted modes for warnings and errors to enhance the review process, ensuring better adherence to testing best practices. - Introduced a new check for excessive mock usage to promote better test design and reliability. --- .coderabbit.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/.coderabbit.yaml b/.coderabbit.yaml index b679ac675..af47f905a 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,14 +1,14 @@ language: en-US -tone_instructions: '' +tone_instructions: "" early_access: true enable_free_tier: true reviews: profile: chill request_changes_workflow: false high_level_summary: true - high_level_summary_placeholder: '@coderabbitai summary' + high_level_summary_placeholder: "@coderabbitai summary" high_level_summary_in_walkthrough: false - auto_title_placeholder: '@coderabbitai' + auto_title_placeholder: "@coderabbitai" auto_title_instructions: Use conventional commits structure review_status: true commit_status: true @@ -26,7 +26,7 @@ reviews: poem: false labeling_instructions: [] path_filters: - - '!src/backend/base/langflow/initial_setup/starter_projects' + - "!src/backend/base/langflow/initial_setup/starter_projects" path_instructions: [] abort_on_close: true disable_cache: false @@ -42,6 +42,46 @@ reviews: enabled: true unit_tests: enabled: true + pre_merge_checks: + custom_checks: + - name: "Test Coverage for New Implementations" + instructions: | + Check if the PR includes new or updated test files that correspond to the code changes: + 1. For new components or functionality, ensure corresponding tests are included in the PR + 2. For bug fixes, verify that regression tests are included + 3. For new features, ensure both unit and integration tests are present where appropriate + 4. Check that test files follow the project's naming conventions (test_*.py for backend, *.test.ts for frontend) + 5. Verify that tests actually test the new functionality, not just placeholder tests + mode: "error" + - name: "Test Quality and Coverage" + instructions: | + Evaluate the quality and comprehensiveness of tests for new implementations: + 1. Tests should cover the main functionality being implemented + 2. For async functions, ensure proper async testing patterns are used (pytest for backend) + 3. Check that tests are not just smoke tests but actually validate behavior + 4. Ensure tests follow the project's testing patterns (pytest for backend, Playwright for frontend) + 5. For API endpoints, verify both success and error response testing + mode: "warning" + - name: "Test File Naming and Structure" + instructions: | + Verify that test files follow the correct patterns and structure: + 1. Backend tests: test_*.py with proper pytest structure + 2. Frontend tests: *.test.ts or *.test.tsx using Playwright + 3. Integration tests should be clearly marked and in appropriate directories + 4. Test files should have descriptive test function names that explain what is being tested + 5. Tests should be organized logically with proper setup and teardown + 6. Consider including edge cases and error conditions for comprehensive coverage + 7. Verify tests cover both positive and negative scenarios where appropriate + mode: "warning" + - name: "Excessive Mock Usage Warning" + instructions: | + Review test files for excessive use of mocks that may indicate poor test design: + 1. Check if tests have too many mock objects that obscure what's actually being tested + 2. Warn when mocks are used instead of testing real behavior and interactions + 3. Suggest using real objects or test doubles when mocks become excessive + 4. Ensure mocks are used appropriately for external dependencies, not core logic + 5. Recommend integration tests when unit tests become overly mocked + mode: "warning" tools: ast-grep: rule_dirs: []