Repository navigation
ci: gate the PR title check, report coverage - #518
Conversation
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]>
Reviewer's GuideThe 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 CIsequenceDiagram
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
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 ☂️ |
There was a problem hiding this comment.
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
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]>
Documentation build overview
|
Summary
pr-title.yml(deleted) intoci.ymlas jobtitle("PR title"), using the shared actionelixir-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 gateCI passedneeds it (allow-skipped: title). The check name staysPR title, so the current ruleset keeps working; afterwards onlyCI passedneeds to be required.editedpull requests, so that the title check follows the title. All jobs run then (a run that skipped the tests would reportCI passedfor 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.npm run test -- -- --coverage; web-test-runnercoverageConfig, 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 secretCODECOV_TOKEN; upload errors fail CI only in the upstream repository). Newcodecov.yml(project: no drop by more than 1 %; patch: informational until all packages have tests), coverage badge in the README,coverage/**as turbo output oftest.CONTRIBUTING.md(title rules, CI job, coverage).Closes #515
Verification
actionlint(with shellcheck) on all workflows: no findings.prettier --checkon the changed files: clean.ecc-utils-designbuilt and tested with--coveragein Chromium →coverage/lcov.infowithSF:src/...paths (one test failed only because the sandbox blocks cdn.jsdelivr.net). The collection step, run on sample reports, rewrites the paths topackages/<pkg>/src/...and fails when there is no report.turbo run test --parallel --dry=json -- --coveragepasses--coverageto thetestscripts ofdesignandwes.PR titleandCI passedfrom the new job, andcodecov/projectandcodecov/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): keptgithub.repository_owner == 'elixir-cloud-aai'as in FOCA, which is the org standard (fork-safe CI);CODECOV_TOKENis an org secret for Actions and Dependabot, and fork pull requests to the public repository upload without a token.allow-skipped: title(low): documented at the gate; the job'sif:limits skips to pushes and Dependabot.inputs: []means all package files).For the maintainer
After this is merged and
CI passedhas reported, dropPR titlefrom thedevruleset, so that onlyCI passedis required (the new job still reports a check namedPR 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:
Enhancements:
CI:
Documentation:
Tests:
Chores: