RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

Investigate why the order for parsing for blurb is inconsistent

Open JoanneHing opened this issue 8 months ago • 2 comments

Please include the steps to reproduce the bug.

When running test cases for the author and chart blurb, you can find out that when multiple blurb is in the markdown, the order of the blurb is parsed is not as how it is expected.

What was expected to happen?

We will expect the blurb to be parse following the order in the summary.json (blurb 1 -> blurb 2 -> blurb 3) But now repo blurb are parsing in order of (2 -> 1 -> 3) and chart in (3 -> 2 -> 1) which is unexpected. This does not actually affecting the project as the order of the blurb is parsed is not important, but it would be nice if the reason that affect the parsing order.

What actually happened? Please include a screenshot of the output.

May refer to the summary.json files in the system test and look for the field of author blurb and chart blurb to see the orders.

JoanneHing avatar Apr 21 '25 03:04 JoanneHing

hi @JoanneHing i have investigated this issue.

it seems that AuthorBlurbMap and ChartBlurbMap both extend from AbstractBlurbMap which uses HashMap for its blurbMap attribute which is why insertion order is not preserved.

also, in SystemTestUtil.java, the function assertSummaryJson(...) only checks for Assertions.assertEquals(jsonExpected, jsonActual); but JSON objects are unordered.

hence the test was passing as order inconsistency was not detected. let me know if you think this could be the root cause!

feliciahmq avatar Jun 24 '25 09:06 feliciahmq

@feliciahmq Thank you for the investigation!

@JoanneHing Is it necessary to fix the display order in the unit testing? If it is, we may need to add some changes to the testing modules.

CYX22222003 avatar Jul 19 '25 09:07 CYX22222003