Skip to content

Commit 24cccd2

Browse files
mhdatieclaude
andcommitted
Apply retry markers in ResultCollector before name normalization
Adds applyRetryMarkers() which scans the same directory as the source XML for TEST-retried-*.xml files and calls tagRetriedTests() for each, patching prior retry attempts as skip before tagFinalStatuses() runs. Called before normalizeStableTestNames() so that display names in the marker files match the XML before normalization rewrites them, preventing false positives from unrelated tests collapsing to the same normalized name. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 316024b commit 24cccd2

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

.gitlab/collect-result/ResultCollector.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,18 @@ void collect() throws Exception {
3939
}
4040

4141
private void collect(Path sourceXml) throws Exception {
42+
if (fileName(sourceXml).startsWith("TEST-retried-")) return;
43+
4244
var aggregatedName = aggregatedFileName(sourceXml);
4345
var targetXml = resultsDir.resolve(aggregatedName);
4446
System.out.print("- " + toUnixString(sourceXml) + " as " + aggregatedName);
4547

4648
var sourceFile = sourceFileResolver.resolve(sourceXml);
4749
var report = JUnitReport.parse(sourceXml);
4850
var reportChangedBeforeFinalStatus = report.addFileAttribute(sourceFile);
51+
applyRetryMarkers(sourceXml.getParent(), report); // before normalizeStableTestNames
4952
reportChangedBeforeFinalStatus |= report.normalizeStableTestNames();
5053
report.tagSyntheticFailures();
51-
report.tagRetriedTests();
5254
report.tagFinalStatuses();
5355
report.write(targetXml);
5456

@@ -58,6 +60,26 @@ private void collect(Path sourceXml) throws Exception {
5860
System.out.println();
5961
}
6062

63+
private static void applyRetryMarkers(Path dir, JUnitReport report) {
64+
if (dir == null) return;
65+
try (var paths = Files.list(dir)) {
66+
paths
67+
.filter(p -> fileName(p).startsWith("TEST-retried-") && fileName(p).endsWith(".xml"))
68+
.forEach(markerFile -> {
69+
try {
70+
report.tagRetriedTests(JUnitReport.parse(markerFile).testcaseKeys());
71+
} catch (Exception e) {
72+
System.err.println(
73+
"[ResultCollector] Failed to apply retry markers from "
74+
+ markerFile.getFileName() + ": " + e.getMessage());
75+
}
76+
});
77+
} catch (IOException e) {
78+
System.err.println(
79+
"[ResultCollector] Failed to scan for retry markers in " + dir + ": " + e.getMessage());
80+
}
81+
}
82+
6183
private List<Path> findTestResultDirs() throws IOException {
6284
var found = new ArrayList<Path>();
6385
for (var searchDir : searchDirs) {

0 commit comments

Comments
 (0)