OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Rules library

Open harshach opened this issue 3 weeks ago • 5 comments

Describe your changes:

Fixes

I worked on ... because ...

Type of change:

  • [ ] Bug fix
  • [ ] Improvement
  • [ ] New feature
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation

Checklist:

  • [x] I have read the CONTRIBUTING document.
  • [ ] My PR title is Fixes <issue-number>: <short explanation>
  • [ ] I have commented on my code, particularly in hard-to-understand areas.
  • [ ] For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

Summary by Gitar

  • Database schema enhancement:
    • Added enabled boolean field to test_definition table with generated columns and indexing for both MySQL and PostgreSQL
  • Backend API extension:
    • TestDefinitionResource now supports filtering by enabled status with ?enabled=true/false query parameter defaulting to enabled definitions
  • Test case validation:
    • New validation in TestCaseRepository prevents creating test cases with disabled definitions while allowing updates to existing cases
  • Frontend UI implementation:
    • New RulesLibraryPage at /rules-library with admin-protected route for managing test definitions
    • TestDefinitionList component displays definitions in a table with toggle switches, edit, and delete actions
    • TestDefinitionForm drawer component handles create/edit operations with dynamic parameter fields
  • Comprehensive testing:
    • Backend tests in TestDefinitionResourceTest and TestCaseResourceTest cover enable/disable functionality and validation
    • Frontend unit tests for all new components plus E2E Playwright test for complete user flows
  • System data updates:
    • All 29 existing test definition JSON files updated to include "enabled": true

This will update automatically on new commits.


harshach avatar Dec 09 '25 07:12 harshach

TypeScript types have been updated based on the JSON schema changes in the PR

github-actions[bot] avatar Dec 09 '25 07:12 github-actions[bot]

The Java checkstyle failed.

Please run mvn spotless:apply in the root of your repository and commit the changes to this PR. You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

github-actions[bot] avatar Dec 09 '25 07:12 github-actions[bot]

TypeScript types have been updated based on the JSON schema changes in the PR

github-actions[bot] avatar Dec 09 '25 23:12 github-actions[bot]

TypeScript types have been updated based on the JSON schema changes in the PR

github-actions[bot] avatar Dec 11 '25 18:12 github-actions[bot]

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.04% (50670/79122) 41.48% (24511/59096) 45.07% (7770/17240)

github-actions[bot] avatar Dec 11 '25 18:12 github-actions[bot]

🔍 CI failure analysis for bdc7de6: Maven MySQL CI failure (AppsResourceTest.post_trigger_app_200) is unrelated to PR changes - it's a timing/flakiness issue in app execution. Playwright selector issues remain the primary PR-related fix needed.

Maven MySQL CI Failure Analysis

Issue

The maven-mysql-ci job failed with 1 test out of 7687:

  • Test: AppsResourceTest.post_trigger_app_200
  • Error: Max retries exceeded polling for eventual assert (32.80s timeout)
  • Location: AppsResourceTest.java:369 → assertAppRanAfterTriggerWithStatus:452

Root Cause

Infrastructure/Timing Issue - Unrelated to PR Changes

The test expects an application to run and reach a certain status after being triggered, but the app didn't complete within the timeout period. This is a flaky test failure caused by:

  1. Resource pressure: Build took 3h 45m (significantly longer than typical)
  2. Thread pool timing: Multiple RejectedExecutionException errors during test teardown indicate thread pool shutdown race conditions
  3. Asynchronous execution: App execution didn't complete within expected timeframe

Details

Why this is unrelated to the PR:

The PR changes are completely isolated to the Rules Library feature:

  • Database schema: Added enabled field to test_definition table
  • Backend: TestDefinitionRepository validation for the enabled field
  • Backend: CollectionDAO filtering support for enabled field
  • UI: Rules Library components

No changes were made to:

  • Apps/Applications functionality
  • AppsResourceTest or related code
  • Application execution or scheduling logic

Evidence of infrastructure issues:

ERROR o.o.s.s.a.UserActivityTracker - Error during final batch update
java.util.concurrent.RejectedExecutionException: Task rejected from 
  java.util.concurrent.ScheduledThreadPoolExecutor@20c9ee0
  [Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

Other CI Issues Summary

✅ Fixed: Jest Tests

  • 7310/7310 tests passing (100%)
  • Label mismatch issues in TestDefinitionForm and TestDefinitionList resolved

❌ Primary PR-Related Issue: Playwright Selectors

  • File: playwright/e2e/Features/RulesLibrary.spec.ts
  • Issue: page.getByRole('switch') matches 16+ elements
  • Affected shards: 2/6, 3/6, 4/6
  • Fix: Should add test IDs to Switch components:
    <Switch data-testid="enabled-switch" ... />
    // In test: page.getByTestId('enabled-switch')
    

❌ Unrelated Infrastructure Issues

  • Python DBT Cloud test failures (likely from main branch merge)
  • SonarCloud scanner failures
  • Maven timing/environment issues

Recommended Actions

  1. Re-run maven-mysql-ci: The AppsResourceTest failure should be retried to confirm it's transient
  2. Fix Playwright selectors: Add data-testid attributes to resolve the primary PR-related issue
  3. Monitor infrastructure: The 3h 45m build time and thread pool errors suggest CI environment issues
Rules 🎸 1 action taken

Gitar Rules

🎸 Flaky Test Retry: Retried maven-mysql-ci (run 20171094787) - AppsResourceTest failure shows flakiness patterns

2 rule(s) not applicable. Show all rules by commenting gitar display:verbose.

[!TIP] Comment Gitar fix CI or enable auto apply.

Auto-apply is off - Gitar will not commit updates to this branch. Enable by commenting gitar auto-apply:on. Was this helpful? React with 👍 / 👎 | This comment will update automatically (Docs)

gitar-bot[bot] avatar Dec 12 '25 15:12 gitar-bot[bot]