Skip to content

ci: gate the PR title check, report coverage - #518

Merged
uniqueg merged 5 commits into
devfrom
ci/gate-pr-title-coverage
Oct 31, 2026
Merged

uniqueg merged 5 commits into
devfrom
ci/gate-pr-title-coverage

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • PR title in CI: the check moves from pr-title.yml (deleted) into ci.yml as job title ("PR title"), using the shared action elixir-cloud-aai/.github/actions/pr-title (v1.0.0, pinned by SHA). It is skipped on pushes and for Dependabot (unless someone else edits a Dependabot title), and the gate CI passed needs it (allow-skipped: title). The check name stays PR title, so the current ruleset keeps working; afterwards only CI passed needs to be required.
  • Edits: CI now also runs on edited pull requests, so that the title check follows the title. All jobs run then (a run that skipped the tests would report CI passed for the commit). Runs for edits that leave the title unchanged (e.g. bots writing the description) share a group of their own per pull request, so they don't cancel the commit's run.
  • Rule change: the shared action limits the whole title to 50 characters (the old check limited the subject only) and rejects a capitalised first word and a trailing period, as in the org's other repositories.
  • Coverage: the tests run with coverage on Node.js 24 (npm run test -- -- --coverage; web-test-runner coverageConfig, Chromium only), the packages' lcov reports are merged with paths from the repository root (awk, paths as data) and uploaded to Codecov as in FOCA (org secret CODECOV_TOKEN; upload errors fail CI only in the upstream repository). New codecov.yml (project: no drop by more than 1 %; patch: informational until all packages have tests), coverage badge in the README, coverage/** as turbo output of test.
  • Docs: CONTRIBUTING.md (title rules, CI job, coverage).

Closes #515

Verification

  • actionlint (with shellcheck) on all workflows: no findings.
  • prettier --check on the changed files: clean.
  • Coverage locally: ecc-utils-design built and tested with --coverage in Chromium → coverage/lcov.info with SF:src/... paths (one test failed only because the sandbox blocks cdn.jsdelivr.net). The collection step, run on sample reports, rewrites the paths to packages/<pkg>/src/... and fails when there is no report.
  • Turbo passthrough checked by a reviewer: turbo run test --parallel --dry=json -- --coverage passes --coverage to the test scripts of design and wes.
  • CI: all checks green, including PR title and CI passed from the new job, and codecov/project and codecov/patch (the upload from Node.js 24 worked).

Declined review findings

  • fail_ci_if_error: github.event_name == 'push' as in cloud-registry (both reviewers): kept github.repository_owner == 'elixir-cloud-aai' as in FOCA, which is the org standard (fork-safe CI); CODECOV_TOKEN is an org secret for Actions and Dependabot, and fork pull requests to the public repository upload without a token.
  • Unconditional allow-skipped: title (low): documented at the gate; the job's if: limits skips to pushes and Dependabot.
  • A single variable for the coverage Node.js version (low): a comment in the matrix names the steps instead.
  • Sourcery: upload in a separate job without the code (token exposure), coverage of packages without tests, checking Dependabot titles on every event, turbo caching of coverage: answered in the threads (the org's pattern; packages without tests aren't uploaded, now documented; Dependabot's titles can't pass; inputs: [] means all package files).

For the maintainer

After this is merged and CI passed has reported, drop PR title from the dev ruleset, so that only CI passed is required (the new job still reports a check named PR title, so nothing breaks before the switch).

🤖 Generated with Claude Code

Summary by Sourcery

Integrate pull request title validation and coverage reporting into the main CI workflow while documenting the updated contribution requirements.

New Features:

  • Add CI coverage collection and Codecov reporting for package tests running on Node.js 24.
  • Add a repository coverage badge and enforce a one-percent project coverage threshold.

Enhancements:

  • Move pull request title validation into the main CI workflow and run it when pull requests are edited.
  • Update title requirements to enforce a 50-character total limit, lowercase descriptions, and no trailing period.
  • Make the CI gate include the pull request title check while allowing it to be skipped for pushes and eligible Dependabot events.

CI:

  • Run CI for edited pull requests and refine concurrency handling so edit runs do not cancel commit runs.

Documentation:

  • Document the updated pull request title rules, CI checks, and coverage reporting process.

Tests:

  • Configure the web test runner to generate Chromium LCOV coverage reports.

Chores:

  • Remove the standalone pull request title workflow.

uniqueg and others added 3 commits October 30, 2026 19:17
Move the PR title check from its own workflow into ci.yml, using the
shared pr-title action of elixir-cloud-aai/.github (v1.0.0): the job
`title` ("PR title") is skipped on pushes and for Dependabot, and the
gate `CI passed` needs it, so that the ruleset needs to require only the
gate. CI now also runs on edited pull requests, so that the check
follows title changes.

Run the tests with coverage (Chromium), merge the packages' lcov
reports with paths from the repository root and upload them to Codecov
(org secret CODECOV_TOKEN; upload errors fail CI only upstream). Add
codecov.yml, the coverage badge and the docs in CONTRIBUTING.md.

Closes #515

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Runs for edits that leave the PR title unchanged (e.g. bots writing
the description) get a concurrency group of their own, so that they no
longer cancel the run for the commit. Check Dependabot titles that
someone else edited, collect coverage only on Node.js 24, and clarify
the Codecov and coverage comments and docs.

Refs #515

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run the title check on Dependabot pull requests only for title edits
by someone else, not for any edit. Runs for edits that leave the title
unchanged now share one group per pull request, so that they cancel
each other instead of piling up.

Refs #515

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR consolidates PR-title validation into the required CI workflow, ensures edited pull requests and conditional skips are gated correctly, and adds Node.js 24 Chromium coverage collection with Codecov reporting, configuration, and documentation.

Sequence diagram for gated pull request CI

sequenceDiagram
    actor Author
    participant GitHub
    participant CI
    participant PRTitle as PR title
    participant CIGate as CI passed

    Author->>GitHub: Open, synchronize, reopen, or edit pull request
    GitHub->>CI: Trigger workflow
    CI->>PRTitle: Check PR title
    CI->>CI: Run conflicts, lint, and tests
    CI->>CIGate: Check results of all jobs
    CIGate-->>GitHub: Report CI passed

    alt Push or Dependabot pull request
        CI-->>PRTitle: Skip job
        CIGate->>CIGate: allow-skipped: title
    end
Loading

File-Level Changes

Change Details Files
Integrated pull-request title validation into the main CI workflow and made the CI gate account for its conditional execution.
  • Added a pinned shared PR-title action with Dependabot and push handling.
  • Triggered CI on pull-request edits and added concurrency separation for title-unchanged edits.
  • Included the title job in the aggregate gate while allowing its documented skips.
  • Removed the standalone PR-title workflow.
.github/workflows/ci.yml
.github/workflows/pr-title.yml
Added Chromium coverage collection and Codecov reporting to the Node.js 24 test path.
  • Runs coverage only on the Node.js 24 matrix entry while retaining regular tests on Node.js 22.
  • Merges package LCOV reports with repository-root source paths and fails when reports are absent.
  • Uploads coverage with repository-aware failure behavior and adds project/patch thresholds.
  • Configures the web test runner and Turbo to preserve coverage output.
.github/workflows/ci.yml
codecov.yml
web-test.runner-config.mjs
turbo.json
Updated contributor-facing documentation and project status indicators for the new title rules and coverage workflow.
  • Documented total title length, capitalization, punctuation, edit behavior, and CI coverage expectations.
  • Added the Codecov badge to the README.
CONTRIBUTING.md
README.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@uniqueg
uniqueg marked this pull request as ready for review October 30, 2026 22:32
@uniqueg
uniqueg requested a review from anuragxxd as a code owner October 30, 2026 22:32

@sourcery-ai sourcery-ai 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.

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="182" />
<code_context>
+          fi
+          for report in "${reports[@]}"; do
+            dir="${report%/coverage/lcov.info}"
+            sed "s|^SF:|SF:${dir}/|" "${report}"
+          done > lcov.info
+
</code_context>
<issue_to_address>
**PR paths execute sed commands**

When a PR adds a package directory with sed metacharacters and a crafted coverage report, the directory name is interpolated into sed’s program, so a crafted path can close the substitution and add GNU sed’s `e` command; coverage collection then executes the attacker’s command in the test job before the token-bearing upload step.

Avoid interpolating the directory into sed code; use a method that treats it strictly as data, escaping all sed replacement metacharacters and newlines.
</issue_to_address>

### Comment 2
<location path=".github/workflows/ci.yml" line_range="194" />
<code_context>
+        if: matrix.node == '24'
+        uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
+        with:
+          token: ${{ secrets.CODECOV_TOKEN }}
+          files: ./lcov.info
+          disable_search: true
</code_context>
<issue_to_address>
**Dependabot jobs expose Codecov token**

When a Dependabot PR installs a compromised dependency with code that persists in the runner, the dependency’s install or test code can leave a background process running in this same job; when the Codecov action receives `CODECOV_TOKEN`, that process can read it from the runner and send it to the attacker, exposing the upload credential.

Do not expose `CODECOV_TOKEN` to jobs that execute Dependabot-controlled dependencies; use a tokenless upload or isolate the upload in a clean job that does not run PR code.
</issue_to_address>

### Comment 3
<location path=".github/workflows/ci.yml" line_range="175" />
<code_context>
+        if: matrix.node == '24'
+        run: |
+          shopt -s nullglob
+          reports=(packages/*/coverage/lcov.info)
+          if [[ "${#reports[@]}" -eq 0 ]]; then
+            echo "::error::No coverage reports found"
</code_context>
<issue_to_address>
**Whole-code threshold misses packages**

When a change reduces coverage in a package that produces no lcov report, `Collect coverage` merges only reports that already exist, so Codecov evaluates uploaded files without the package’s source and the stated whole-code threshold misses the coverage drop.

Generate and upload coverage data that includes packages without existing lcov reports, and keep the documentation aligned with the coverage actually checked.

Also at `CONTRIBUTING.md:38`.
</issue_to_address>

### Comment 4
<location path=".github/workflows/ci.yml" line_range="50-51" />
<code_context>
+    if: >-
+      github.event_name == 'pull_request' && (
+        github.event.pull_request.user.login != 'dependabot[bot]' ||
+        github.event.changes.title &&
+        github.event.sender.login != 'dependabot[bot]')
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
</code_context>
<issue_to_address>
**Edited Dependabot title goes unchecked**

When a person gives a Dependabot PR an invalid title and a later event, such as a description edit or synchronize, arrives without changing the title, the `title` job skips when `changes.title` is absent, and the gate allows that skip; a synchronize event can cancel the edited-title run and let the skipped run pass, so the invalid title remains unchecked before merge.

Run the title validation for every relevant Dependabot PR event, or make the gate fail when title validation was skipped after a manual title edit.

Also at `.github/workflows/ci.yml:32-35`, `.github/workflows/ci.yml:217`.
</issue_to_address>

### Comment 5
<location path="CONTRIBUTING.md" line_range="33-35" />
<code_context>
+   `npm run build` and `npm test` (and
+   `node --test scripts/release.test.js` after changes to
+   `scripts/release.js`) locally before you push. CI runs the tests with
+   coverage (`npm run test -- -- --coverage`, which passes `--coverage`
+   through npm and turbo to the test runner; Chromium only; each package's
+   report is in its `coverage/` folder) and reports it to
+   [Codecov](https://app.codecov.io/gh/elixir-cloud-aai/cloud-components);
+   coverage of the whole code must not drop by more than 1 %
</code_context>
<issue_to_address>
**Cached coverage can be stale**

When a contributor has a cached test run and changes package source or test files before running the documented coverage command again, turbo can reuse a cached test task after package source or test files change because `turbo.json:14` sets `inputs: []`; with the new coverage output, that cache hit restores the previous `coverage/lcov.info` instead of producing a report for the current code. A contributor following this command can therefore inspect outdated coverage.

Include the package source and test files in the test task's Turbo inputs, or disable caching for the test task so coverage is regenerated for the current code.
</issue_to_address>

Linked issues

#515 ci: gate the PR title check, report coverage · 3 of 4 met · 1 to check by hand

# Requirement Status Notes
1 Move the PR title check into ci.yml, skip it on pushes, and add it to the CI gate. ✅ Met The title job is conditional on pull request events, and passed needs it while allowing it to be skipped.
2 Drop PR title from the dev ruleset after the new check has reported once. 👀 Check by hand (manual process) A maintainer must remove the separate PR title check from the dev ruleset after the new CI check has reported.
3 Run tests with coverage and upload coverage to Codecov using CODECOV_TOKEN. ✅ Met Tests collect coverage on Node.js 24, the package reports are merged with repository-root paths, and the Codecov action receives CODECOV_TOKEN.
4 Add codecov.yml and a coverage badge in the README. ✅ Met Both the Codecov configuration and README badge are added.

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and the CI now passes CODECOV_TOKEN to a third-party Codecov action on upstream runs; if that integration exposes the token, reverting stops future uploads but cannot undo access already exposed. The title gate and coverage threshold changes are otherwise reversible CI behavior.

Blocking findings: .github/workflows/ci.yml:182, .github/workflows/ci.yml:194, .github/workflows/ci.yml:175, .github/workflows/ci.yml:51, CONTRIBUTING.md:35


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread CONTRIBUTING.md Resolved
uniqueg and others added 2 commits October 30, 2026 23:43
Rewrite the paths of the coverage reports with awk, which reads the
package directory from the environment, instead of interpolating it
into a sed program. Say in the docs that only packages with tests
count for the coverage threshold.

Refs #515

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the README conflict: keep the streamlined README from dev and
add the coverage badge from this branch; drop the chat badge (no open
Slack).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cloud-components | 🛠️ Build #35546673 | 📁 Comparing 918b05d against latest (abf6fff)

  🔍 Preview build  

2 files changed
± docs/cloud-registry/providers/index.html
± docs/cloud-registry/components/service-create/index.html

@uniqueg
uniqueg merged commit 6b15bb0 into dev Oct 31, 2026
19 checks passed
@uniqueg
uniqueg deleted the ci/gate-pr-title-coverage branch October 31, 2026 15:35
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.

ci: gate the PR title check, report coverage

1 participant