Skip to content

fix(ci): correct ElementTree truthiness bug in e2e summary script#1050

Merged
nthmost-orkes merged 3 commits into
mainfrom
fix/ci-summary-xml-truthiness
Apr 28, 2026
Merged

fix(ci): correct ElementTree truthiness bug in e2e summary script#1050
nthmost-orkes merged 3 commits into
mainfrom
fix/ci-summary-xml-truthiness

Conversation

@nthmost-orkes
Copy link
Copy Markdown
Contributor

Summary

  • Fixes a crash in the e2e JUnit XML summary step introduced in Improve task retry policy #1031
  • Python's xml.etree.ElementTree evaluates an element as falsy when it has no child elements, regardless of its attributes or text content
  • tc.find("failure") or tc.find("error") therefore returned None whenever a test had a <failure message="..."/> node with no child elements, causing node.get("message") to crash with AttributeError
  • Replace the or with an explicit is not None guard

Root cause

This only triggers when an e2e test actually fails. Previous CI runs since #1031 landed all had clean e2e suites, so the bug path was never reached until now (surfaced by a flaky test in one of the #1025 parallel runners).

Python also emits a DeprecationWarning for this pattern: "Testing an element's truth value will raise an exception in future versions. Use specific len(elem) or elem is not None test instead." — the fix aligns with that guidance.

User impact

Without this fix, any e2e run with a failing test causes the summary step to crash and the CI job to report failure even if the actual test results were fine.

Python's xml.etree.ElementTree evaluates elements as falsy when they
have no child elements, regardless of attributes or text. The expression
`tc.find("failure") or tc.find("error")` returned None for any
`<failure message="..."/>` node (no children), crashing the summary
step with AttributeError.

Replace with explicit `is not None` guards.
@nthmost-orkes nthmost-orkes merged commit d64927b into main Apr 28, 2026
11 checks passed
@nthmost-orkes nthmost-orkes deleted the fix/ci-summary-xml-truthiness branch April 28, 2026 05:20
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.

2 participants