Skip to content

ci: align coverage with Rocket.Chat house style (Codecov, no hard gate) - #3366

Merged
jeanfbrito merged 3 commits into
masterfrom
chore/coverage-align-rc-codecov
Jun 22, 2026
Merged

ci: align coverage with Rocket.Chat house style (Codecov, no hard gate)#3366
jeanfbrito merged 3 commits into
masterfrom
chore/coverage-align-rc-codecov

Conversation

@jeanfbrito

@jeanfbrito jeanfbrito commented Jun 22, 2026

Copy link
Copy Markdown
Member

What

Aligns this repo's coverage reporting with the main Rocket.Chat monorepo's conventions, after comparing the two setups. Stacked on the Phase 3 PR.

Stacked on chore/coverage-phase3-rtl-infra (#3365). Merge after it.

Why

The monorepo tracks coverage informationally via Codecov — it does not hard-gate builds. Our earlier PRs added a hard coverageThreshold ratchet, which is stricter than the parent project. This PR matches the house style.

Changes

Area Before (ours) After (RC house style)
Gate hard coverageThreshold (fail CI below floor) dropped — informational only
Reporting coverage/ artifact upload Codecov (codecov-action@v6.0.1, same pinned SHA as monorepo) + artifact fallback
Config none codecov.yml mirroring monorepo: patch: off, project target: auto / threshold: 1%, unit flag carryforward, reach,diff,flags comment
Blocking gate could fail CI fail_ci_if_error: false — coverage never blocks merge

Action required

Add a CODECOV_TOKEN repo secret (the monorepo uses org-level Codecov). Until then, the Codecov step no-ops gracefully and the artifact fallback still publishes coverage/.

Comparison notes (what we did NOT adopt, with reasons)

  • coverageProvider: 'v8' — the monorepo uses @swc/jest + jsdom; our stack is ts-jest + @kayahr/jest-electron-runner (real renderer DOM). v8 under that combo needs separate validation before switching — deferred, not adopted blind.
  • @rocket.chat/mock-providers (mockAppRoot() builder) — monorepo-internal, not published to npm (404). Our renderWithStore helper stays.
  • jest-axe a11y matchers — the monorepo bakes these into its client preset; a cheap future add for the desktop component specs.

Effect on the coverage initiative

Coverage still measured + reported on every PR (now via Codecov PR comments + trend, like the monorepo). The 33% → 50% climb continues through component-test waves; without a hard gate, adding waves has less CI friction — matching how the parent project operates.

Summary by CodeRabbit

  • Chores
    • Integrated automated coverage reporting into continuous integration workflow
    • Added configuration for coverage metrics tracking and enforcement
    • Updated test coverage threshold management

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@jeanfbrito, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 38 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1a3da94-b90b-49e2-87c7-ed5bd5bbaf66

📥 Commits

Reviewing files that changed from the base of the PR and between 46ff5d4 and 4ae2223.

📒 Files selected for processing (3)
  • .github/workflows/validate-pr.yml
  • codecov.yml
  • jest.config.js

Walkthrough

The PR integrates Codecov into the CI workflow by adding a codecov/codecov-action@v6.0.1 upload step with a unit flag, introduces a codecov.yml configuration file, and removes the coverageThreshold block from jest.config.js.

Changes

Codecov Integration

Layer / File(s) Summary
Codecov configuration file
codecov.yml
Adds a new codecov.yml with max_report_age: off, patch status disabled, project default targeting auto at 1% threshold, unit flag with carryforward: true, and comment layout set to reach, diff, flags.
CI upload steps and Jest threshold removal
.github/workflows/validate-pr.yml, jest.config.js
Adds a Codecov upload step (codecov/codecov-action@v6.0.1) with fail_ci_if_error: false gated to ubuntu-latest, retains the artifact fallback upload step, and removes the coverageThreshold global minimums block from Jest config.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: aligning coverage configuration with Rocket.Chat house style by adopting Codecov with no hard coverage gates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@jeanfbrito
jeanfbrito force-pushed the chore/coverage-phase3-rtl-infra branch from 71b221c to 777936f Compare June 22, 2026 16:25
Base automatically changed from chore/coverage-phase3-rtl-infra to master June 22, 2026 16:25
Sets up component testing so the renderer layer can be covered.

- Add devDeps: @testing-library/react 14.3.1, jest-dom 6.9.1,
  user-event 14.6.1, dom 9.3.4 (React 18 compatible)
- Import @testing-library/jest-dom in src/.jest/setup.ts for DOM matchers
- src/jest-dom.d.ts: register jest-dom matcher types for tsc (the dotted
  .jest dir is excluded from the TS program, so the augmentation lives
  in an included path)
- src/ui/test-utils.tsx: renderWithStore() helper wrapping components in
  a redux Provider with preloaded state; re-exports RTL + userEvent;
  documents the react-i18next mock snippet for component specs
- Example spec: ServersView/ErrorView.spec.tsx proves the pattern

RTL works out-of-box under @kayahr/jest-electron-runner (real renderer
DOM, no jsdom, no jest.config change). 807 tests pass, lint clean.
Adds RTL behavior tests for 14 renderer components — dialogs (Update,
ScreenSharing, ClearCache, SupportedVersion, OutlookCredentials),
containers (DownloadsManagerView, AddServerView, SideBar, Shell), leaf
components (DownloadItem, ModalBackdrop, ServerButton) and the ui/utils
helpers (createAnchor, ReparentingContainer).

Also hardens 3 main-process specs (logging/index, ScreenSharingRequest-
Tracker, desktopCapturerCache) with fake timers + afterEach cleanup —
a real setInterval in logging/index.ts was leaking ref'd handles across
isolateModules reloads and hanging the suite past --forceExit.

Ratchets coverageThreshold to lines/statements 32, branches 28,
functions 26.

Coverage: lines 26.72% -> 33.29%, statements -> 33.65%, branches ->
29.33%, functions -> 27.31%. 912 tests pass, 2 skipped, 52 suites.

Three component specs (ErrorView, ServerInfoContent, AboutDialog) are
held back — they leak async/DOM teardown that the strict uncaught-
exception handler in src/.jest/setup.ts turns into a process.exit(1);
tracked in docs/KNOWN_ISSUES.md for a follow-up.
Match the main monorepo's coverage approach:
- Drop the hard coverageThreshold gate from jest.config.js — the main
  Rocket.Chat repo tracks coverage informationally (codecov project
  threshold 1%, patch off), not as a build-time gate.
- Add codecov.yml mirroring the monorepo: patch off, project target
  auto/threshold 1%, unit flag with carryforward, reach/diff/flags
  comment layout.
- validate-pr.yml: upload coverage via codecov/codecov-action@v6.0.1
  (same pinned action as the monorepo) with the unit flag and
  fail_ci_if_error:false so coverage never blocks merge. Artifact
  upload kept as a tokenless fallback.

Requires a CODECOV_TOKEN repo secret (the monorepo uses org-level
Codecov). Until it is added, the action no-ops gracefully and the
artifact fallback still publishes coverage/.

Not adopted: coverageProvider v8 (monorepo uses @swc/jest+jsdom; our
ts-jest + @kayahr/jest-electron-runner stack needs separate validation)
and @rocket.chat/mock-providers (monorepo-internal, not published to
npm — our renderWithStore helper stays).
@jeanfbrito
jeanfbrito force-pushed the chore/coverage-align-rc-codecov branch from 46ff5d4 to 4ae2223 Compare June 22, 2026 16:25
@jeanfbrito
jeanfbrito merged commit 5e42a18 into master Jun 22, 2026
8 of 9 checks passed
@jeanfbrito
jeanfbrito deleted the chore/coverage-align-rc-codecov branch June 22, 2026 16:26
jeanfbrito added a commit that referenced this pull request Jun 22, 2026
Append-only log of coverage milestones (date, PR, the four metric
percentages, test count, notes) plus how to measure + update it and
the testing gotchas learned while building the suite. Records the
17.15% -> 33.29% climb across PRs #3362-#3366.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant