Skip to content

devops: upload test results to Flakiness.io#7359

Merged
PavelVanecek merged 2 commits into
recharts:mainfrom
aslushnikov:upload-to-flakiness-io
May 24, 2026
Merged

devops: upload test results to Flakiness.io#7359
PavelVanecek merged 2 commits into
recharts:mainfrom
aslushnikov:upload-to-flakiness-io

Conversation

@aslushnikov

@aslushnikov aslushnikov commented May 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #7358

Summary by CodeRabbit

  • Chores
    • CI now captures and publishes test flakiness reports, including conditional uploads for fork pull requests.
    • A new workflow forwards flakiness report artifacts from completed runs and uploads discovered report files to the flakiness service.
    • Testing configuration now emits additional flakiness reporting output in CI.
    • Added a dev dependency to support the flakiness reporter.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4268a0dd-baa1-46fb-ae72-c5cade54745c

📥 Commits

Reviewing files that changed from the base of the PR and between 8eb37fb and 84ac252.

📒 Files selected for processing (1)
  • test-vr/playwright-ct.config.ts

Walkthrough

Adds flakiness reporting for Playwright visual-regression tests: installs the flakiness reporter, configures CI to emit flakiness artifacts per matrix entry, and adds a workflow that uploads those reports to Flakiness.io for fork PRs.

Changes

Flakiness tracking integration for visual regression tests

Layer / File(s) Summary
Flakiness reporter setup
package.json, test-vr/playwright-ct.config.ts
@flakiness/playwright@^1.9.0 added to devDependencies and configured as a CI-only Playwright reporter with flakinessProject: "recharts/recharts".
VR test artifact export in CI
.github/workflows/ci.yml
vr_tests job granted id-token: write and a conditional artifact upload step added to publish flakiness-report/ artifacts named by job+matrix index, retained 1 day for fork PRs.
Fork PR flakiness upload workflow
.github/workflows/flakiness-upload-fork-prs.yml
New workflow triggers on Build and test completion for fork PRs (success or failure), downloads flakiness-report-* artifacts from the triggering run, and uploads each report.json via npx flakiness upload.

Sequence Diagram

sequenceDiagram
  participant VRTests as Playwright VR Tests
  participant CIJob as CI (vr_tests)
  participant Artifact as GitHub Artifacts
  participant UploadWF as Flakiness Upload Workflow
  participant FlakinessIO as Flakiness.io

  VRTests->>VRTests: Emit flakiness report (via `@flakiness/playwright`)
  VRTests->>CIJob: Report files produced
  CIJob->>Artifact: Upload flakiness-report-* artifacts (1d retention)
  UploadWF->>Artifact: Download flakiness-report-* from triggering run
  UploadWF->>FlakinessIO: Run `npx flakiness upload` with report.json files
  FlakinessIO->>FlakinessIO: Store/track flakiness data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • recharts/recharts#7135: Modifies the CI vr_tests visual-regression reporting and artifact handling, related to this PR's flakiness-report artifact publishing.

Suggested reviewers

  • PavelVanecek
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal, containing only a issue reference without explanation of changes, motivation, testing approach, or other template sections. Expand the description to include motivation (why Flakiness.io integration is needed), summary of changes made (workflow updates, reporter configuration), and how the changes were tested.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: integrating test result uploads to Flakiness.io, which matches the core objective of the PR.
Linked Issues check ✅ Passed The PR addresses the core objective of integrating Flakiness.io with Playwright test reporting: adding a reporter to capture test results and uploading them to the Flakiness.io service.
Out of Scope Changes check ✅ Passed All changes are directly related to Flakiness.io integration: CI workflow updates, a new fork PR workflow, test reporter configuration, and the required dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PavelVanecek PavelVanecek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do credentials work? Will this upload report even for PRs of first contributors?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 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 @.github/workflows/ci.yml:
- Around line 480-483: Replace the mutable tag uses of
actions/upload-artifact@v4 with the corresponding full commit SHAs to hard-pin
the action; locate every occurrence of "uses: actions/upload-artifact@v4" in the
workflow and update each to the verified commit SHA for the specific v4 release
you want to lock to, ensuring consistency across all upload-artifact steps and
committing the updated workflow.

In @.github/workflows/flakiness-upload-fork-prs.yml:
- Around line 26-27: Replace the unpinned `npx flakiness upload` invocation with
a pinned CLI version (e.g. `npx flakiness@<VERSION> upload`) so the workflow
uses a deterministic, auditable flakiness CLI; update the command in the step
that currently runs `find . -path '*/flakiness-report-*/report.json' -exec npx
flakiness upload {} \;` to call `npx flakiness@<VERSION> upload` (or use an
equivalent pinned install like `npm exec --package=flakiness@<VERSION> --
flakiness upload`) and choose a specific version string to freeze in CI.

In `@test-vr/playwright-ct.config.ts`:
- Around line 50-53: The reporter configuration contains an invalid comma before
a ternary operator causing a parse error; locate the reporter array in
test-vr/playwright-ct.config.ts (the reporters/CI branch conditional block) and
remove the extra trailing comma after the CI branch array so the ternary
expression is syntactically valid (ensure the conditional uses arrayA : arrayB
with no stray comma before the colon and that the two branch arrays remain
intact).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c677ab21-ea91-4f93-bd43-1845608489a3

📥 Commits

Reviewing files that changed from the base of the PR and between ae92422 and 8eb37fb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/flakiness-upload-fork-prs.yml
  • package.json
  • test-vr/playwright-ct.config.ts

Comment thread .github/workflows/ci.yml
Comment on lines +480 to +483
- name: Upload Flakiness report artifact (fork PRs only)
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork
uses: actions/upload-artifact@v4
with:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the referenced section in the workflow
sed -n '450,520p' .github/workflows/ci.yml

# Find all uses of actions/upload-artifact in the repository
rg -n "uses:\s*actions/upload-artifact@" .github/workflows -S || true

Repository: recharts/recharts

Length of output: 3088


Pin actions/upload-artifact to a full commit SHA (workflow security)

Line 482 uses actions/upload-artifact@v4 (mutable tag). The same @v4 usage appears elsewhere in this workflow as well (lines 74, 178, 334, 380, 490, 533), so pin all upload-artifact steps to full commit SHAs.

Suggested fix
-        uses: actions/upload-artifact@v4
+        uses: actions/upload-artifact@<full-length-commit-sha>
🧰 Tools
🪛 zizmor (1.25.2)

[error] 482-482: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for 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.

In @.github/workflows/ci.yml around lines 480 - 483, Replace the mutable tag
uses of actions/upload-artifact@v4 with the corresponding full commit SHAs to
hard-pin the action; locate every occurrence of "uses:
actions/upload-artifact@v4" in the workflow and update each to the verified
commit SHA for the specific v4 release you want to lock to, ensuring consistency
across all upload-artifact steps and committing the updated workflow.

Comment on lines +26 to +27
- name: Upload to Flakiness.io
run: find . -path '*/flakiness-report-*/report.json' -exec npx flakiness upload {} \; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate and display the workflow file around the referenced lines
FILE=".github/workflows/flakiness-upload-fork-prs.yml"
echo "=== File exists? ==="
ls -l "$FILE" || true

echo "=== Snippet around lines 15-60 ==="
nl -ba "$FILE" | sed -n '15,60p'

echo
echo "=== Search for flakiness usage in repo ==="
rg -n "flakiness" .github/workflows . -S --hidden || true

Repository: recharts/recharts

Length of output: 276


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE=".github/workflows/flakiness-upload-fork-prs.yml"
ls -l "$FILE" || true
echo "=== Snippet around lines 15-60 ==="
nl -ba "$FILE" | sed -n '15,60p'

echo
echo "=== Search for flakiness usage in repo ==="
rg -n "flakiness" .github/workflows . -S --hidden || true

Repository: recharts/recharts

Length of output: 254


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=".github/workflows/flakiness-upload-fork-prs.yml"
ls -l "$FILE"
nl -ba "$FILE" | sed -n '1,120p'

Repository: recharts/recharts

Length of output: 219


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=".github/workflows/flakiness-upload-fork-prs.yml"
ls -l "$FILE"
nl -ba "$FILE" | sed -n '1,120p'

Repository: recharts/recharts

Length of output: 219


🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "npx flakiness" .github/workflows -S || true
rg -n "flakiness" package*.json -S || true
ls -la

Repository: recharts/recharts

Length of output: 4208


🏁 Script executed:

ls .github/workflows | head

Repository: recharts/recharts

Length of output: 210


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=".github/workflows/flakiness-upload-fork-prs.yml"
echo "=== WORKFLOW FILE ==="
nl -ba "$FILE" | sed -n '1,120p'

echo
echo "=== SEARCH: npx flakiness ==="
rg -n "npx[[:space:]]+flakiness" .github/workflows -S || true

echo
echo "=== SEARCH: flakiness package.json ==="
rg -n "\"flakiness\"" package*.json -S || true
rg -n "flakiness" package*.json -S || true

Repository: recharts/recharts

Length of output: 144


🏁 Script executed:

pwd && ls

Repository: recharts/recharts

Length of output: 508


Pin the Flakiness CLI version in CI.

The workflow .github/workflows/flakiness-upload-fork-prs.yml runs npx flakiness upload without a fixed version, so the CLI can change between runs (determinism + supply-chain risk).

Suggested fix
-        run: find . -path '*/flakiness-report-*/report.json' -exec npx flakiness upload {} \;
+        run: find . -path '*/flakiness-report-*/report.json' -exec npx flakiness@<exact-version> upload {} \;
🤖 Prompt for 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.

In @.github/workflows/flakiness-upload-fork-prs.yml around lines 26 - 27,
Replace the unpinned `npx flakiness upload` invocation with a pinned CLI version
(e.g. `npx flakiness@<VERSION> upload`) so the workflow uses a deterministic,
auditable flakiness CLI; update the command in the step that currently runs
`find . -path '*/flakiness-report-*/report.json' -exec npx flakiness upload {}
\;` to call `npx flakiness@<VERSION> upload` (or use an equivalent pinned
install like `npm exec --package=flakiness@<VERSION> -- flakiness upload`) and
choose a specific version string to freeze in CI.

Comment thread test-vr/playwright-ct.config.ts Outdated
@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.04%. Comparing base (ae92422) to head (84ac252).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7359   +/-   ##
=======================================
  Coverage   89.04%   89.04%           
=======================================
  Files         548      548           
  Lines       40546    40546           
  Branches     5570     5570           
=======================================
  Hits        36105    36105           
  Misses       4432     4432           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aslushnikov

aslushnikov commented May 24, 2026

Copy link
Copy Markdown
Contributor Author

How do credentials work?

@PavelVanecek there are 2 different paths.

  1. For the workflows that run on this repository, authentication happens using Github OIDC (that's the id-token: write permission in this PR). That's a neat modern way of secretless authentication.
  2. For the PRs-from-forks, the Github OIDC is not available. So for this we employ a neat trick: the pr workflow will upload flakiness report as an artifact, and a second, trusted workflow, triggered by workflow_run, uploads the reports to the dashboard, using the Flakiness CLI and Github OIDC.

Will this upload report even for PRs of first contributors?

Is there anything special about first contributors?

@PavelVanecek

Copy link
Copy Markdown
Collaborator

Is there anything special about first contributors?

It's rather "PRs originating from this repository" which just me and @ckifer have access and "PRs originating from forks" which is everyone else. You explained it all I think, thank you, nothing special about "first".

@PavelVanecek
PavelVanecek merged commit 3ef1f19 into recharts:main May 24, 2026
53 checks passed
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.

Playwright Tests Dashboard

2 participants