Skip to content
START WITH THE BIG PICTUREKnow which pull requests to read first, and exactly why.

For qa engineers · reviewers · leads

STEP 01

Run lupin diff-guard in CI to report changes that weaken the tests.

What should I remember?

The score is a sum of stated factors. Missing test results or coverage make a change unknown, never low.

New to the terminology? See the words explained

Change risk ​

AI agents now open pull requests faster than anyone can read them. Change risk is how Lupin tells you which ones to read first, and why, in a form you can check by hand.

Every pull request the gate sees gets a level (low, medium, unknown, high, critical) and a score. The score is the sum of stated factors, each with its own sentence and its points. Nothing in it is a judgement call: the points table is versioned (change-risk/1), and an assessment made with another version is never compared with this one.

What counts ​

FactorPointsWhen
Test tampering40lupin diff-guard found a change that weakens the tests
New critical findings40The branch adds a critical finding over the default branch
Failed tests30A test fails on the head commit and quarantine does not excuse it
New high findings20The branch adds a high finding
Diff coverage10, 20Below 80%, below 50% of the changed lines covered
Size10, 20400 or more lines, 1,000 or more
Eval regression20An eval suite regressed against the default branch
Blast radius10 each, at most 20The change touches a sensitive area
Skipped phases10 each, at most 20The change went past an SDLC phase without doing it
Agent-authored15Attributed as written by an agent (5 for AI-assisted)
No human approval15AI-written and no person approved it (5 for any other change)
No test file touched1050 or more lines changed and no test file among them
Unexcused flaky10A test passed only on retry and is not quarantined

Below 20 points is low, below 40 medium, below 70 high, and 70 or more critical. Two floors no sum can undercut: a new critical finding is at least high, and an AI-written change that weakens its own tests is critical.

Missing evidence is never safety ​

A change whose test results or diff coverage were not measured is unknown at best, never low. A change already measured high or critical keeps that level: a missing reading never hides a known risk. Every missing reading is listed with the step that would supply it.

To require more than tests and diff coverage, set it in lupin.config.json:

json
{ "health": { "risk": { "require": ["tests", "diff-coverage", "tampering"] } } }

Report first, block when you are ready ​

Installing this changes nobody's pull requests on day one: the risk is reported in the comment, the check run and the dashboard, and the verdict is the gate's own. To fail the gate at a level:

json
{ "health": { "risk": { "blockAt": "high", "blockOnUnknown": false } } }

Catch tests weakened to pass ​

When an agent cannot make a test pass, it sometimes changes the test. lupin diff-guard reads the job's own git diff and reports deleted tests, added .skip/.only/xit/@Disabled, removed or loosened assertions, empty catches in tests, bulk snapshot updates, lowered coverage thresholds, CI steps made unable to fail (continue-on-error, || true) and added retries.

It sends kinds, paths and line numbers, never a line of source. Run it before the gate:

yaml
- uses: actions/checkout@v4
  with: { fetch-depth: 0 } # the guard diffs against the base branch
- run: npx --yes -p https://github.com/Sergey-Bar/Lupin/releases/download/v5.1.0/lupin-cli-5.1.0.tgz lupin diff-guard --pr ${{ github.event.pull_request.number }}
  env:
    LUPIN_URL: ${{ vars.LUPIN_URL }}
    LUPIN_PROJECT: ${{ vars.LUPIN_PROJECT }}
    LUPIN_TOKEN: ${{ secrets.LUPIN_TOKEN }}
    LUPIN_COMMIT: ${{ github.event.pull_request.head.sha }}

lupin diff-guard --dry-run prints the findings and sends nothing, which needs no Lupin install.

On the pull request ​

With a GitHub token of its own, the server posts the lupin/health status as it always has, a lupin/change-risk check run beside it with the factors and line annotations, and leads the sticky comment with the risk. A personal token cannot write check runs: the status and the comment still post, and the check reads as unavailable.

A GitHub App is the better token. Create an app with read and write access to checks, commit statuses and pull requests, install it on your repositories, and paste its App ID and a private key under Settings → Integrations → GitHub App (admin). The server then posts as the app, with an installation token for each repository that lasts an hour and reaches only where the app is installed, so check runs work and no comment is signed by a person. A project with its own token keeps using it. The key is sealed in the vault and never shown again.

A LAN install, or one with no token, has the job post instead, with its own token:

yaml
permissions:
  checks: write
  pull-requests: write
  statuses: write
steps:
  - run: npx --yes -p https://github.com/Sergey-Bar/Lupin/releases/download/v5.1.0/lupin-cli-5.1.0.tgz lupin gate --pr ${{ github.event.pull_request.number }} --post
    env:
      LUPIN_URL: ${{ vars.LUPIN_URL }}
      LUPIN_PROJECT: ${{ vars.LUPIN_PROJECT }}
      LUPIN_TOKEN: ${{ secrets.LUPIN_TOKEN }}
      LUPIN_COMMIT: ${{ github.event.pull_request.head.sha }}
      GITHUB_TOKEN: ${{ github.token }}

GITHUB_TOKEN goes only to GitHub and LUPIN_TOKEN only to Lupin. A refusal from GitHub is printed, and the job exits with the gate's verdict either way.

In the dashboard ​

Pull requests shows each assessed row's level and a High and above filter. A level assessed at an older head says so: the commits since have not been assessed. Each level links to the pull request's own page: the band, every factor with its points, what was not measured, the reach (sensitive areas, owning teams, tests that failed with these files), and the assessments across its heads. Home lists an open pull request whose current head is high or critical.

What it does not do yet ​

  • A skipped SDLC phase adds points only for the phases the phase model can read; whether the gate passed at merge is not stored, so it never counts.
  • diff-guard reads the diff it is given. A shallow clone without the base branch fails with the step to fix it, and a diff over 64 MiB is read in part and says so.
  • The composite action shows the risk in the job summary; diff-guard and --post are CLI steps.