payload_snapshot: fix JUnit XML discovery timeout for large artifact trees - #641
redhat-chai-bot wants to merge 1 commit into
Conversation
Hypershift e2e jobs produce 10,000+ artifacts (cluster resource dumps per test case), causing the recursive `**` glob in `gcloud storage ls` to time out at the previous 30-second limit. When the timeout fires, `_run_gcloud` silently returns None, and `_list_junit_files` returns [], so `collect()` writes an empty results.json — the downstream analysis agent sees zero test failures and confabulates results. Changes: - Increase glob timeout from 30s to 120s (matching _run_gcloud default) - Add targeted fallback when the glob returns no results: list top-level step directories under artifacts/ and probe each for junit files at known locations, avoiding the expensive recursive enumeration - Log a warning when the glob returns empty so the silent failure is visible in stderr output - Bump ci plugin version to 0.0.72 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: redhat-chai-bot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughChangesCI plugin update
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant JUnitCollector
participant gcloud_storage
participant GCS_bucket
JUnitCollector->>gcloud_storage: Run recursive JUnit glob
gcloud_storage->>GCS_bucket: Search for junit XML files
GCS_bucket-->>gcloud_storage: Return matching paths or no results
gcloud_storage-->>JUnitCollector: Return normalized paths
JUnitCollector->>gcloud_storage: List artifact step directories when empty
gcloud_storage->>GCS_bucket: Probe candidate JUnit paths
GCS_bucket-->>JUnitCollector: Return aggregated fallback matches
Suggested reviewers: 🚥 Pre-merge checks | ✅ 10✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).claude-plugin/marketplace.jsonTraceback (most recent call last): plugins/ci/.claude-plugin/plugin.jsonTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/ci/skills/payload-snapshot/scripts/payload_snapshot.py`:
- Around line 771-772: Rename the ambiguous loop variable l to line at all four
affected sites: plugins/ci/skills/payload-snapshot/scripts/payload_snapshot.py
lines 771-772, 841-843, 852-854, and 863-865. Update each corresponding
reference while preserving the existing filtering and processing behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6f292107-9fca-4e95-9e98-fb714828d19d
📒 Files selected for processing (4)
.claude-plugin/marketplace.jsondocs/index.htmlplugins/ci/.claude-plugin/plugin.jsonplugins/ci/skills/payload-snapshot/scripts/payload_snapshot.py
|
/test ? |
|
/test payload-agent |
…ounded-depth fallback Incorporates the JUnit discovery hardening from openshift-eng#641 (closed in favour of this PR), with two fixes and one interaction resolved: - Primary recursive glob timeout raised 30s -> 120s. - Bounded-depth fallback when the recursive glob yields nothing. - Fix: openshift-eng#641's probes checked {step}/, {step}/artifacts/ and {step}/*/artifacts/ only. Aggregated jobs keep junit-aggregated.xml about six levels below artifacts/, so those probes could never find it. The aggregator subtree now gets its own scoped ** probe, which stays fast because it covers one small directory. - Fix: junit_operator.xml lives directly in artifacts/, not inside a step directory, so the fallback missed it. Added a top-level probe. The fallback now recovers the same file set as the glob. - Interaction: a recovered failure must not mark the snapshot incomplete. Errors resolved by a fallback are flagged `recovered: true`, reported separately, and excluded from `data_complete`. Verified against the same payload three ways: - glob fails, fallback recovers: 73 failing tests, data_complete true, 4 errors all recovered, exit 0 — identical results to the glob path - all reads fail: 20 unrecovered errors, no results.json written, junit_collection_failed set, exit 1 - real gcloud: no fallback needed, 73 failing tests, 0 errors, exit 0
|
Closing in favour of #644, which absorbs the changes here. #644 keeps both of this PR's improvements — the 30s→120s glob timeout raise and the bounded-depth fallback — and fixes two problems found while incorporating them:
#644 also addresses the underlying defect this PR's description identifies but does not fix: Worth noting on the premise: in the snapshot that motivated #644, the glob was not actually slow — 0.73s for the aggregated AWS job, 8s for Thanks — the diagnosis in this PR's description is what pointed at the right area. |
|
Hi @not-stbenjam -- I can only respond automatically to comments from verified Red Hat associates. Your GitHub account could not be confirmed. If you are a Red Hat employee and believe this is an error, please ask for help in the |
payload-snapshot: fix silent data loss on unauthenticated gcloud (supersedes #641)
Problem
The
JUnitCollector._list_junit_files()method usesgcloud storage lswith a recursive**glob and a 30-second timeout to discover JUnit XML files in CI job artifacts. For hypershift e2e jobs that produce 10,000+ artifacts (cluster resource dumps, node YAMLs, deployment YAMLs per test case), this glob times out before finding thejunit.xmlfile.When the timeout occurs,
_run_gcloud()silently returnsNone, and_list_junit_files()returns an empty list. Thecollect()method then writes an empty[]toresults.json, causing the downstream payload analysis agent to see zero test failures. This data gap led to a confabulation where the agent fabricated test failure output from PR diffs instead of reporting insufficient data.Fix
_run_gclouddefault)artifacts/and probes each one forjunit*.xmlfiles using non-recursive patterns — avoiding the expensive**glob entirely@stbenjam requested in Slack thread
Summary by CodeRabbit
New Features
Bug Fixes
Chores