Repository navigation
ci: add Codecov, Snyk, SonarCloud and Codacy badges - #25
Conversation
The Linux test leg writes an lcov report and a separate codecov job uploads it with OIDC. publish.yml grants the called test.yml id-token so it can start; the codecov job skips publish runs and the test job keeps contents: read, which the workflow contract test now checks. Snyk tests the Rust tools' Cargo graph as a CycloneDX SBOM weekly and when tools/Cargo.toml or Cargo.lock changes.
SonarQube Cloud flagged 4 regexes with super-linear backtracking. The Ruby and JVM map patterns let a leading \s* cross blank lines, so a 64 KiB file of them took seconds; the deactivation check stripped trailing punctuation with an unanchored pattern; the benchmark's numbered-list check rescanned digit runs. Each now runs in linear time, with a regression test that fails on the old pattern. The CI install of pandas and pyyaml now takes wheels only, so no setup script runs.
pandas, pyyaml and their dependencies are pinned in .github/ci/requirements.txt, installed as wheels only. Snyk tests the set through its pip support and Dependabot keeps the pins current.
test.yml's test job now declares contents: read itself, so the id-token publish.yml grants the called workflow reaches only the codecov job. The workflow contract test checks each job's permissions in both files. The codecov job continues on error, so a Codecov outage cannot turn the tests badge red; the upload still fails its own job. The statusline path regex starts its unquoted form only at a word start, so a long statusLine command no longer takes quadratic time.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 4 critical 1 high |
🟢 Metrics 0 complexity · 0 duplication
Metric Results Complexity 0 Duplication 0
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
👀 Worth a closer look
The review found no high-confidence blocking defect. The Ubuntu workflow now exercises a narrower test command than the other matrix jobs, so the coverage-producing path may omit repository-level checks. The modified workflows and OIDC/Snyk behavior also lack automated validation.
The map regex has a potential backtracking risk on adversarial input; this warrants review, particularly before processing large untrusted files.
Test suggestions
- Verify each workflow job has the intended permissions and that only Codecov requests id-token access.
- Verify the Codecov job is gated appropriately, downloads the coverage artifact, and invokes the OIDC upload.
- Verify Snyk workflow target parsing, missing-token failure, Python installation, and Rust SBOM scanning behavior.
- Verify deactivation-command matching rejects embedded commands and remains fast on long punctuation input.
- Verify status-line detection remains fast on long commands and preserves safe, absolute-path behavior.
- Verify behavior and codebase-map regexes remain linear on long inputs and still detect indented declarations.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify the Codecov job is gated appropriately, downloads the coverage artifact, and invokes the OIDC upload.
2. Verify Snyk workflow target parsing, missing-token failure, Python installation, and Rust SBOM scanning behavior.
Low confidence findings
- The external analysis badges should be backed by verified repository integrations or documented as dependent on configuration outside this change; their working status is not demonstrated here.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| - name: Run tests with line coverage | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: >- | ||
| node --test --experimental-test-coverage | ||
| --test-coverage-exclude='tests/**' --test-coverage-exclude='pi-extension/test/**' | ||
| --test-reporter=spec --test-reporter-destination=stdout | ||
| --test-reporter=lcov --test-reporter-destination=coverage.lcov | ||
| tests/*.test.js pi-extension/test/*.test.js |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Run the full test suite on Ubuntu as well, while separately collecting Node coverage, or explicitly add the omitted correctness checks so the coverage runner does not exercise a reduced suite.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
| // [ \t]* rather than \s*: \s also matches newlines, so a run of blank lines cost | ||
| // quadratic time. | ||
| rb: [/^[ \t]*(?:def|class|module)\s+([A-Za-z][\w.]*)/gm], | ||
| jvm: [/^[ \t]*(?:public\s+)?(?:static\s+)?(?:final\s+)?(?:class|interface|enum|record)\s+(\w+)/gm], |
There was a problem hiding this comment.
🔴 HIGH RISK
Suggestion: Refactor this declaration matcher to avoid chained optional groups and unbounded backtracking while preserving indented declaration detection. Add regression coverage for long adversarial non-matching input.
TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.
pip now installs .github/ci/requirements.txt with --require-hashes, with every wheel's hash for Linux, macOS and Windows (SonarCloud S8544).
|



Summary
Brings this repository's badges up to the maintainer's other account: Codecov coverage, a Snyk scan, SonarCloud and Codacy, and fixes static-analysis findings.
tests/package-scripts.test.jschecks each job's permissions separately. 5 regexes that could take quadratic time are now linear, with regression tests. CI's Python packages are pinned, installed wheels-only and scanned by Snyk and Dependabot.Evidence
npm testpasses on Linux Node 22; the coverage run and contract test pass.Merge danger
Door: two-way. Blast radius: CI
The OIDC token is granted only to the separate
codecovjob, which continues on error, so a Codecov outage cannot turn the tests badge red.Unverified