Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ Update manifests and regenerate the corresponding lockfile on Linux with
or `npm install --package-lock-only --ignore-scripts --prefix .github/ci/pi`.
Check `npm audit` and run the isolated load checks before changing the pins.

Pi's Undici override excludes the vulnerable 8.0.0 through 8.12.1 range. Remove
the override once Pi itself requires a patched version, after repeating those checks.
Pi's Undici override excludes the vulnerable 8.0.0 through 8.12.1 range, and its
minimatch override excludes versions before 11.0.1 (GHSA-g3hv-75wg-m249). Pi pins
minimatch 10.2.6 but calls only `minimatch()`, which 11 keeps. Remove each override
once Pi itself requires a patched version, after repeating those checks.
15 changes: 11 additions & 4 deletions .github/ci/pi/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .github/ci/pi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"overrides": {
"@earendil-works/pi-coding-agent": {
"undici": "8.12.2"
"undici": "8.12.2",
"minimatch": "11.0.3"
}
}
}
63 changes: 63 additions & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Snyk

# Tests the npm locks that pin the load checks' CLIs. laconic-check has no
# third-party crates, so there is no Cargo graph to test. It runs weekly and
# when a dependency file changes, which keeps it inside the free plan's monthly
# test allowance.
on:
schedule:
- cron: "23 4 * * 1"
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/ci/*/package-lock.json"
- ".github/workflows/snyk.yml"
pull_request:
paths:
- ".github/ci/*/package-lock.json"
Comment on lines +14 to +18

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Add the dependency manifests to both the push and pull-request path filters, such as .github/ci/*/package.json, so manifest changes trigger Snyk scanning.

TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.

- ".github/workflows/snyk.yml"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Snyk open source test
# Pull requests from forks, and Dependabot's (which get Dependabot secrets
# only), receive no SNYK_TOKEN; the weekly run on main scans their changes.
if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.login != 'dependabot[bot]')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

This workflow does not scan Dependabot pull requests, so dependency updates can merge without Snyk validating the proposed lockfiles. Provide a trusted-token path for these pull requests or revise the documented scanning coverage.

TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.

runs-on: ubuntu-latest
timeout-minutes: 30
env:
# One dependency set per line: npm:<package-lock.json>.
SNYK_TARGETS: |
npm:.github/ci/claude-code/package-lock.json
npm:.github/ci/pi/package-lock.json
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: snyk/actions/setup@9adf32b1121593767fc3c057af55b55db032dc04 # v1.0.0
- name: Test each dependency set
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
set -uo pipefail
if [ -z "$SNYK_TOKEN" ]; then
echo "::error::The SNYK_TOKEN repository secret is not set, so nothing was scanned."
exit 1
fi
status=0
while IFS=: read -r kind target; do
[ -n "$kind" ] || continue
case "$kind" in
npm) snyk test --file="$target" --project-name="$target" || status=1 ;;
*) echo "::error::Unknown dependency set $kind:$target"; status=1 ;;
esac
done <<< "$SNYK_TARGETS"
exit "$status"
40 changes: 39 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,45 @@ jobs:
# Without the binary, tests/test_mcp_server.py would skip.
- name: Build laconic-check
run: cargo build --locked --manifest-path tools/laconic-check/Cargo.toml
# Coverage only records the run for the Codecov badge; no threshold.
- name: Install coverage
run: python -m pip install --only-binary=":all:" coverage==7.17.0
- name: Unit tests
run: python -m unittest discover -s tests -v
run: python -m coverage run --source=scripts,tools/laconic-check -m unittest discover -s tests -v
- name: Write coverage for Codecov
run: python -m coverage xml -o coverage-codecov.xml
- name: Keep the coverage report for the Codecov upload
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage-codecov
path: coverage-codecov.xml
retention-days: 1
- name: Validate evaluation cases
run: python scripts/run_evals.py validate

# The upload runs apart from the tests so the OIDC token is never available
# whilst test code runs.
codecov:
name: upload coverage to Codecov
needs: [unittest]
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 10
# A Codecov outage must not turn the tests badge red.
continue-on-error: true
permissions:
contents: read
id-token: write # Authenticate the Codecov upload with OIDC; no stored token.
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: coverage-codecov
- uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
use_oidc: true
files: coverage-codecov.xml
disable_search: true
fail_ci_if_error: true
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Keep `.opencode/command/laconic.md` frontmatter as a JSON object between the `--

## Verification

New functionality and bug fixes come with automated tests: Python in `tests/`, run by `python -m unittest discover -s tests -v` in the `tests` workflow, and `laconic-check` in its Rust test modules and `tools/laconic-check/tests/`, run by `cargo test` in the `laconic-check` workflow.

Run relevant checks and include the commands and results in the PR. For Python and evaluation-harness changes:

```sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div align="center">

[![tests](https://github.com/EquityBot/Laconic/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/tests.yml) [![laconic-check](https://github.com/EquityBot/Laconic/actions/workflows/laconic-check.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/laconic-check.yml) [![CodeQL](https://github.com/EquityBot/Laconic/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/codeql.yml) [![SonarCloud](https://sonarcloud.io/api/project_badges/measure?project=EquityBot_Laconic&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=EquityBot_Laconic)<br>
[![tests](https://github.com/EquityBot/Laconic/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/tests.yml) [![laconic-check](https://github.com/EquityBot/Laconic/actions/workflows/laconic-check.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/laconic-check.yml) [![Codecov](https://codecov.io/gh/EquityBot/Laconic/graph/badge.svg)](https://codecov.io/gh/EquityBot/Laconic) [![CodeQL](https://github.com/EquityBot/Laconic/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/codeql.yml) [![Snyk](https://github.com/EquityBot/Laconic/actions/workflows/snyk.yml/badge.svg?branch=main)](https://github.com/EquityBot/Laconic/actions/workflows/snyk.yml) [![SonarCloud](https://sonarcloud.io/api/project_badges/measure?project=EquityBot_Laconic&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=EquityBot_Laconic) [![Codacy code quality](https://app.codacy.com/project/badge/Grade/623f5ab312d4497c9e8161e547c95f44)](https://app.codacy.com/gh/EquityBot/Laconic/dashboard)<br>
[![release](https://img.shields.io/github/v/release/EquityBot/Laconic?filter=laconic-check-v*&color=66023C&labelColor=000000&style=flat)](https://github.com/EquityBot/Laconic/releases?q=laconic-check-v&expanded=true) [![licence: FSL-1.1-ALv2](.github/assets/badges/licence.svg)](LICENSE) [![fork of: i-have-adhd](.github/assets/badges/fork-of.svg)](https://github.com/ayghri/i-have-adhd)

[Install](#install) · [What changes](#what-changes) · [Evaluation](#evaluation) · [Checker](#checker) · [Always on](#always-on)
Expand Down
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Codecov reports coverage for the README badge. CI sets no coverage gate, so
# Codecov's own statuses are informational and it posts no comments.
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
comment: false
10 changes: 10 additions & 0 deletions tests/test_ci_installs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ def test_pi_transport_excludes_the_known_vulnerable_range(self):
version = tuple(int(part) for part in package["version"].split("."))
self.assertFalse((8, 0, 0) <= version < (8, 12, 2), package["version"])

def test_pi_glob_matcher_excludes_the_known_vulnerable_range(self):
# GHSA-g3hv-75wg-m249: minimatch before 11.0.1.
lock = json.loads((ROOT / ".github/ci/pi/package-lock.json").read_text())
matchers = [package for path, package in lock["packages"].items()
if path.endswith("node_modules/minimatch")]
self.assertTrue(matchers)
for package in matchers:
version = tuple(int(part) for part in package["version"].split("."))
self.assertGreaterEqual(version, (11, 0, 1), package["version"])

def test_load_checks_do_not_retain_checkout_credentials(self):
for name in WORKFLOWS:
text = (ROOT / ".github/workflows" / name).read_text(encoding="utf8")
Expand Down
Loading