In CI

judy is built to fail a build for the right reason. A gate names a number that must hold. --max-regression names a drop you will not accept. Exit codes say which kind of failure happened.

Code Meaning
0 ok
1 a gate was breached, or the candidate regressed by more than --max-regression
2 usage error or an invalid file (for example an unknown target)
3 an IO error or failed searches

A failed search is its own exit code, not a bad score: a cluster that is down never looks like a relevance regression.

Text
$ judy run fruit.judgements.yaml --target nope
error: No target 'nope'. Defined: baseline, candidate.
$ echo $?
2

Put the numbers a target must hold in the judgement set, per target:

YAML
gates:
  candidate: {ndcg@5: 0.9, success@1: 0.5}
Text
gates
  FAIL ndcg@5 0.638 < 0.800
  FAIL success@1 0.333 < 0.500

judy run exits 1 when any gate fails. Set gates a little under what you measure today. A gate at the current score fails on noise. A gate far below it never fires.

A gate protects an absolute level. --max-regression protects against going backwards, whatever the level:

Shell
judy compare main.results.yaml pr.results.yaml --max-regression 0.01

It exits 1 when the candidate's mean is lower than the baseline's by more than 0.01.

YAML
- name: Score the pull request
  run: judy run search.judgements.yaml --target candidate --format md
  env:
    ES_URL: ${{ secrets.ES_URL }}
    ES_API_KEY: ${{ secrets.ES_API_KEY }}

- name: Compare with main
  run: judy compare search.main.results.yaml search.candidate.results.yaml --max-regression 0.01

judy run appends its markdown to $GITHUB_STEP_SUMMARY when that variable is set. The scorecard then shows on the run page without a step of its own. --format md prints the same table for a pull request comment:

Text
### fruit on baseline

3 queries, 3 scorable, labels: human

| metric | all | `words:2` | `words:1` |
|---|---|---|---|
| success@1 | 0.333 | 0.000 | 1.000 |
| success@3 | 1.000 | 1.000 | 1.000 |
| mrr@5 | 0.667 | 0.500 | 1.000 |
| ndcg@5 | 0.638 | 0.650 | 0.613 |

--format json gives the same data for your own tooling.

judy compare needs no cluster when both sides are results files. Store the main branch's results as a CI artifact (or commit them) and compare each pull request with them. Results files hold each query's metrics and ranked ids, so they are small and diff well.

  • Run the same judgement set everywhere. A set is a file: commit it next to the code that changes the search.
  • Mind judged@k. A new query that returns many unjudged documents can lower a score without being worse. Look at the judged@k line, and fill the gaps with judy judge when it drops.
  • Cap spend in CI. judy judge has --max-calls; leave the LLM commands out of the pull request job and run them on a schedule.