Skip to content

SONARJAVA-6592 Test ruling sync action#5762

Draft
romainbrenguier wants to merge 13 commits into
masterfrom
romain/test-ruling-sync-action
Draft

SONARJAVA-6592 Test ruling sync action#5762
romainbrenguier wants to merge 13 commits into
masterfrom
romain/test-ruling-sync-action

Conversation

@romainbrenguier

@romainbrenguier romainbrenguier commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Part of


Summary by Gitar

  • CI/CD workflows:
    • Added ruling-diff-comment.yml to post comments on PRs when ruling JSON files change.
    • Added test-ruling-update-notify.yml to automate ruling updates and notifications on test failures.
    • Integrated ruling-update-notify job into build.yml to support ruling synchronization.
  • Test optimizations:
    • Ignored several test cases in JavaRulingTest.java using @Ignore to accelerate CI cycles.
  • Ruling configuration:
    • Updated various JSON expectation files in its/ruling/src/test/resources/ including java-S1134.json, java-S1448.json, and added java-S1234.json.
    • Removed java-S1488.json from its/ruling/src/test/resources/commons-beanutils/.

This will update automatically on new commits.

romainbrenguier and others added 6 commits July 8, 2026 15:54
Based on action from core-languages-tooling.
- Exclude most ruling tests (guava, mall, jetty, etc.) using @ignore
- Keep only commons-beanutils test active for PR validation
- Add test changes to commons-beanutils S1134 to demonstrate diff comments

This is a temporary change to speed up CI for demonstrating the
ruling diff comment feature. Not intended for merge to master.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The submodules must be initialized to access source files for
generating code snippets in ruling diff comments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Test ruling sync action SONARJAVA-6592 Test ruling sync action Jul 9, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

SONARJAVA-6592

Comment thread its/ruling/src/test/resources/commons-beanutils/java-S1448.json Outdated
@gitar-bot

gitar-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Integrates automated ruling diff and notification workflows while optimizing test execution. The malformed JSON in java-S1448.json has been corrected, and no further issues were found.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

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

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Ruling Diff Summary

Detected changes in 3 rule files: 16 issues removed, 4 issues added.

S1134 (java) on commons-beanutils - 4 issues removed, 3 issues added

Added src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java (line 215)

       210 |      *  constructor is not accessible
       211 |      * @throws InstantiationException if this Class represents an abstract
       212 |      *  class, an array class, a primitive type, or void; or if instantiation
       213 |      *  fails for some other reason
       214 |      */
>>>    215 |     @Override
       216 |     public DynaBean newInstance()
       217 |             throws IllegalAccessException, InstantiationException {
       218 | 
       219 |         try {
       220 |             // Refind the constructor after a deserialization (if needed)

Removed src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java (line 213)

       208 |      *
       209 |      * <p>If you know that no type conversions are required, the
       210 |      * <code>copyProperties()</code> method in {@link PropertyUtils} will
       211 |      * execute faster than this method.</p>
       212 |      *
>>>    213 |      * <p><strong>FIXME</strong> - Indexed and mapped properties that do not
       214 |      * have getter and setter methods for the underlying array or Map are not
       215 |      * copied by this method.</p>
       216 |      *
       217 |      * @param dest Destination bean whose properties are modified
       218 |      * @param orig Origin bean whose properties are retrieved

Removed src/main/java/org/apache/commons/beanutils2/DynaClass.java (line 60)

        55 |     /**
        56 |      * <p>Returns an array of {@code ProperyDescriptors} for the properties
        57 |      * currently defined in this DynaClass.  If no properties are defined, a
        58 |      * zero-length array will be returned.</p>
        59 |      *
>>>     60 |      * <p><strong>FIXME</strong> - Should we really be implementing
        61 |      * {@code getBeanInfo()} instead, which returns property descriptors
        62 |      * and a bunch of other stuff?</p>
        63 |      *
        64 |      * @return the set of properties for this DynaClass
        65 |      */

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 722)

       717 | 
       718 | 
       719 |     /**
       720 |      * <p>Return the mapped property descriptors for this bean.</p>
       721 |      *
>>>    722 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
       723 |      *
       724 |      * @param bean Bean to be introspected
       725 |      * @return the mapped property descriptors
       726 |      */
       727 |     Map getMappedPropertyDescriptors(final Object bean) {

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1182)

      1177 | 
      1178 |     /**
      1179 |      * <p>Return an accessible property getter method for this property,
      1180 |      * if there is one; otherwise return <code>null</code>.</p>
      1181 |      *
>>>   1182 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
      1183 |      *
      1184 |      * @param clazz The class of the read method will be invoked on
      1185 |      * @param descriptor Property descriptor to return a getter for
      1186 |      * @return The read method
      1187 |      */

Added src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 719)

       714 |         return mappedDescriptorsCache.get(beanClass);
       715 | 
       716 |     }
       717 | 
       718 | 
>>>    719 |     /**
       720 |      * <p>Return the mapped property descriptors for this bean.</p>
       721 |      *
       722 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
       723 |      *
       724 |      * @param bean Bean to be introspected

Added src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1203)

      1198 |      * @param name Name of the property to be extracted
      1199 |      * @return The property value
      1200 |      *
      1201 |      * @throws IllegalAccessException if the caller does not have
      1202 |      *  access to the property accessor method
>>>   1203 |      * @throws IllegalArgumentException if <code>bean</code> or
      1204 |      *  <code>name</code> is null
      1205 |      * @throws IllegalArgumentException if the property name
      1206 |      *  is nested or indexed
      1207 |      * @throws InvocationTargetException if the property accessor method
      1208 |      *  throws an exception
S1488 (java) on commons-beanutils - 12 issues removed, 0 issues added - deleted ruling file

Removed src/main/java/org/apache/commons/beanutils2/BeanMap.java (line 766)

       761 |                     if ( ! paramType.isAssignableFrom( value.getClass() ) ) {
       762 |                         value = convertType( paramType, value );
       763 |                     }
       764 |                 }
       765 |             }
>>>    766 |             final Object[] answer = { value };
       767 |             return answer;
       768 |         }
       769 |         catch ( final InvocationTargetException e ) {
       770 |             final IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
       771 |             if (BeanUtils.initCause(iae, e) == false) {

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1265)

      1260 |             throw new NoSuchMethodException("Property '" + name +
      1261 |                     "' has no getter method in class '" + bean.getClass() + "'");
      1262 |         }
      1263 | 
      1264 |         // Call the property getter and return the value
>>>   1265 |         final Object value = invokeMethod(readMethod, bean, EMPTY_OBJECT_ARRAY);
      1266 |         return value;
      1267 | 
      1268 |     }
      1269 | 
      1270 | 

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 528)

       523 |     private Calendar parse(final Class<?> sourceType, final Class<?> targetType, final String value) throws Exception {
       524 |         Exception firstEx = null;
       525 |         for (final String pattern : patterns) {
       526 |             try {
       527 |                 final DateFormat format = getFormat(pattern);
>>>    528 |                 final Calendar calendar = parse(sourceType, targetType, value, format);
       529 |                 return calendar;
       530 |             } catch (final Exception ex) {
       531 |                 if (firstEx == null) {
       532 |                     firstEx = ex;
       533 |                 }

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 570)

       565 |             if (log().isDebugEnabled()) {
       566 |                 log().debug("    " + msg);
       567 |             }
       568 |             throw new ConversionException(msg);
       569 |         }
>>>    570 |         final Calendar calendar = format.getCalendar();
       571 |         return calendar;
       572 |     }
       573 | 
       574 |     /**
       575 |      * Provide a String representation of this date/time converter.

Removed src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTestCase.java (line 986)

       981 |     protected DynaClass createDynaClass() {
       982 | 
       983 |         final int intArray[] = new int[0];
       984 |         final String stringArray[] = new String[0];
       985 | 
>>>    986 |         final DynaClass dynaClass = new BasicDynaClass
       987 |                 ("TestDynaClass", null,
       988 |                         new DynaProperty[]{
       989 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
       990 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
       991 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 181)

       176 |     //
       177 |     // Then, I manually added the "class" key, which is a property that exists for
       178 |     // all beans (and all objects for that matter.
       179 |     @Override
       180 |     public Object[] getSampleKeys() {
>>>    181 |         final Object[] keys = new Object[] {
       182 |             "someIntValue",
       183 |             "someLongValue",
       184 |             "someDoubleValue",
       185 |             "someFloatValue",
       186 |             "someShortValue",

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 208)

       203 |     private final Object objectInFullMap = new Object();
       204 | 
       205 |     // note to self: the sample values were created manually
       206 |     @Override
       207 |     public Object[] getSampleValues() {
>>>    208 |         final Object[] values = new Object[] {
       209 |             new Integer(1234),
       210 |             new Long(1298341928234L),
       211 |             new Double(123423.34),
       212 |             new Float(1213332.12f),
       213 |             new Short((short)134),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 226)

       221 |         return values;
       222 |     }
       223 | 
       224 |     @Override
       225 |     public Object[] getNewSampleValues() {
>>>    226 |         final Object[] values = new Object[] {
       227 |             new Integer(223),
       228 |             new Long(23341928234L),
       229 |             new Double(23423.34),
       230 |             new Float(213332.12f),
       231 |             new Short((short)234),

Removed src/test/java/org/apache/commons/beanutils2/DynaBeanUtilsTestCase.java (line 1237)

      1232 |     protected static DynaClass createDynaClass() {
      1233 | 
      1234 |         final int intArray[] = new int[0];
      1235 |         final String stringArray[] = new String[0];
      1236 | 
>>>   1237 |         final DynaClass dynaClass = new BasicDynaClass
      1238 |                 ("TestDynaClass", null,
      1239 |                         new DynaProperty[]{
      1240 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      1241 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      1242 |                             new DynaProperty("byteProperty", Byte.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/DynaPropertyUtilsTestCase.java (line 2614)

      2609 |     protected DynaClass createDynaClass() {
      2610 | 
      2611 |         final int intArray[] = new int[0];
      2612 |         final String stringArray[] = new String[0];
      2613 | 
>>>   2614 |         final DynaClass dynaClass = new BasicDynaClass
      2615 |                 ("TestDynaClass", null,
      2616 |                         new DynaProperty[]{
      2617 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      2618 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      2619 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java (line 150)

       145 |             }
       146 |         }
       147 |         final String classLocation = newString.toString();
       148 |         //System.out.println("classlocation: " + classLocation);
       149 | 
>>>    150 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       151 |         return theLoader;
       152 |     }
       153 | }

Removed src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java (line 528)

       523 |             }
       524 |         }
       525 |         final String classLocation = newString.toString();
       526 |         //System.out.println("classlocation: " + classLocation);
       527 | 
>>>    528 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       529 |         return theLoader;
       530 |     }
       531 | 
       532 |     /**
       533 |      * Produces a profiler report about where the leaks are.
S1234 (java) on test-project - 0 issues removed, 1 issues added - new ruling file

Added test.java (line 42)

(source file not found at this revision: test.java)

The file was missing the opening brace '{', causing JSON parse errors.

Fixed format:
- Before: "key": [values]...
- After: {"key": [values]...}
@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch from 2ecd11c to 1c3e3bf Compare July 9, 2026 11:28
Integrates the ruling-update-and-notify action to respond to Ruling QA
failures. This job:
- Runs after all ruling-qa matrix jobs complete
- Only runs on pull requests
- Posts ruling diff comments to PRs
- Prepares for future fix PR creation (currently disabled)

The sync-command needs to be implemented to download actual results from
the ruling-qa job artifacts before enabling fix PR creation.
Changed from checking contains(needs.ruling-qa.result, 'failure') to checking
if needs.ruling-qa.result != 'success'. For matrix jobs, the result is only
'success' if ALL matrix jobs succeeded, otherwise it's 'failure'.
Removed complex sync-command - the action now handles artifact download
automatically. The workflow just needs to specify the basic parameters.

This makes integration much cleaner and easier to maintain.
Temporarily keep only one matrix item (without-sonarqube-project on
sonar-m-public) to make testing of the ruling-update-notify action
faster and simpler.
@gitar-bot

gitar-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
CI failed: The CI build failed due to a combination of malformed JSON in a test resource file and an incorrectly configured build step that prevents ruling diff generation.

Overview

The build failed primarily due to invalid ruling data in the repository and a broken workflow path for generating ruling comparison reports. Across multiple test jobs, the build failed to reach completion because of JSON parsing errors and missing directories.

Failures

Malformed JSON in Ruling Data (confidence: high)

  • Type: tooling
  • Affected jobs: 86107563864, 86116592594
  • Related to change: yes
  • Root cause: The ruling JSON file its/ruling/src/test/resources/commons-beanutils/java-S1448.json contains invalid formatting (extra data on line 2), triggering a JSONDecodeError during the ruling-update-notify process.
  • Suggested fix: Inspect and sanitize the JSON structure in its/ruling/src/test/resources/commons-beanutils/java-S1448.json to ensure it conforms strictly to JSON standards.

Missing Diff Directory in Ruling QA (confidence: high)

  • Type: build
  • Affected jobs: 86117073605
  • Related to change: yes
  • Root cause: The ruling-diff-comment.yml workflow fails because it attempts to process a target/actual directory that does not exist. The build configuration either skips the generation step or points to an incorrect path.
  • Suggested fix: Ensure the preceding test suite effectively populates the expected target/actual directory before the diff generation command is invoked.

Out-of-Sync Ruling Baseline (confidence: high)

  • Type: test
  • Affected jobs: 86099386444
  • Related to change: yes
  • Root cause: The current analysis output generates new test cases that do not match the expected baseline in its/ruling/src/test/resources/commons-beanutils.
  • Suggested fix: Validate the generated HTML reports and update the baseline files in the its/ruling directory to match the new analysis results.

Summary

  • Change-related failures: 3 failures identified (JSON parsing, directory path configuration, and baseline synchronization).
  • Infrastructure/flaky failures: 0
  • Recommended action: First, fix the malformed JSON in java-S1448.json. Then, verify the workflow dependency chain for the ruling-diff-comment job to ensure the target/actual directory is correctly provisioned. Finally, update the test baselines to match the new engine output.
Code Review ✅ Approved 1 resolved / 1 findings

Introduces automated ruling synchronization and diff commenting workflows while optimizing CI test cycles. The malformed JSON in java-S1448.json has been corrected.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

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

@sonarqube-next

sonarqube-next Bot commented Jul 9, 2026

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
2 New issues

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

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