Skip reporting synthetic failures#11259
Skip reporting synthetic failures#11259gh-worker-dd-mergequeue-cf854d[bot] merged 9 commits intomasterfrom
Conversation
18e0884 to
b93d638
Compare
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
| var name = e.getAttribute("name"); | ||
| if ("initializationError".equals(name)) { | ||
| byClassname.computeIfAbsent(e.getAttribute("classname"), k -> new ArrayList<>()).add(e); | ||
| } else if ("executionError".equals(name) || "test exception".equals(name)) { |
There was a problem hiding this comment.
I had codex take a look, and it pointed out that we have a real test case with the name of "test exception": https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy#L1251. The test is marked as Flaky, so the output is skipped anyway IIUC, but worth noting... We could consider changing the test case name to keep this logic simpler?
There was a problem hiding this comment.
good idea, will make an update here
| return null; | ||
| } | ||
|
|
||
| static boolean tagSkip(org.w3c.dom.Document doc, Element testcase) { |
There was a problem hiding this comment.
Can import org.w3c.dom.Document and set this to just Document
sarahchen6
left a comment
There was a problem hiding this comment.
A couple small comments, but otherwise looks good!
PerfectSlayer
left a comment
There was a problem hiding this comment.
Updating labels and minor comments
| var children = parent.getChildNodes(); | ||
| for (int i = 0; i < children.getLength(); i++) { | ||
| var child = children.item(i); | ||
| if (child instanceof Element e && tagName.equals(e.getTagName())) return e; |
There was a problem hiding this comment.
🔍 nitpick: Please avoid one-line for readability / uniformity (this is usually enforced using spotless on the project)
| if (child instanceof Element e && tagName.equals(e.getTagName())) return e; | |
| if (child instanceof Element e && tagName.equals(e.getTagName())) { | |
| return e; | |
| } |
There was a problem hiding this comment.
I ran ./gradlew spotlessApply and it doesn't seem to apply to .gitlab/*. When I changed the spotless.gradle config file to consider them and ran it, it wasn't applying the check here but did in other places 🤔
Claude analyzed the following:
The issue is that google-java-format does not add missing braces — it only handles whitespace, indentation, and line
wrapping. Line 111:
if (child instanceof Element e && tagName.equals(e.getTagName())) return e;
is syntactically valid, fits within the 100-character column limit (81 chars), so the formatter has nothing to change.
This is a known gap: the Google Java Style Guide §4.1.1 requires braces on all if/for/while bodies, but
google-java-format deliberately does not restructure code to enforce that.
You need to add the braces manually:
if (child instanceof Element e && tagName.equals(e.getTagName())) {
return e;
}The check to enable spotless checks on that directory was:
project.pluginManager.withPlugin('java') {
java {
toggleOffOn()
// set explicit target to workaround https://github.com/diffplug/spotless/issues/1163
target 'src/**/*.java'
// ignore embedded test projects and everything in build dir, e.g. generated sources
targetExclude('src/test/resources/**', buildDirectoryFiles)
tableTestFormatter('1.1.1')
googleJavaFormat('1.35.0')
}
}
// Root project doesn't apply the java plugin, so withPlugin('java') never fires for it.
// Configure a separate java block to cover .gitlab/*.java scripts.
if (project == project.rootProject && !project.plugins.hasPlugin('java')) {
java {
toggleOffOn()
target '.gitlab/*.java'
targetExclude(buildDirectoryFiles)
tableTestFormatter('1.1.1')
googleJavaFormat('1.35.0')
}
}
I will fix them manually for now, but wonder what your thoughts are here
| } | ||
| boolean modified = false; | ||
| for (var group : byClassname.values()) { | ||
| if (group.size() <= 1) continue; |
There was a problem hiding this comment.
💭 thought: Not sure what this guard is for? 🤔 The next loop should not trigger in size <= 1
There was a problem hiding this comment.
heh, took me multiple attempts to convince Claude that your comment made more sense. Great catch
49ef484 to
9cb3b43
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
Extends
TagInitializationErrors.javato also tagexecutionErrorandtest exceptionsynthetic testcaseswith
dd_tags[test.final_status]=skip, unconditionally. Previously, only intermediateinitializationErrorretries were tagged.The tagging logic is refactored into a shared
tagSkiphelper that uses direct child element lookups(instead of
getElementsByTagName, which searches all descendants) and is idempotent - testcases alreadycarrying the property are left unchanged.
Detected in CI:

Which should stop such tests from being labelled as failures (

master)Motivation
executionErrorandtest exceptionare framework-level synthetic entries that never represent a realtest result. Without this change, Test Optimization treats them as genuine failures, producing noise in
the test results dashboard. Like
initializationErrorintermediates, they should be skipped so onlyreal test outcomes are surfaced.
Additional Notes
TagInitializationErrors.javatoTagSyntheticFailures.javaContributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: APMLP-1296
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.