Skip to content

Guides

Running in CI

Running Oloproof inside a CI job, and comparing a pull request against the branch it targets. This page covers how to install Oloproof there, where the evidence lives while the job runs, and how to read a result without parsing a table. Gating CI covers the release policy and what each exit code means.

A gate from the first pull request

oloproof init --ci github writes .github/workflows/oloproof.yml (and scaffolds a project first if the directory has no oloproof.yaml). Run it at the root of the repository. The workflow gates one run of the pull request's own code against release.yaml, so it needs no baseline on the base branch and works on the pull request that introduces Oloproof. It:

  • installs the Oloproof that wrote it, pinned (oloproof==VERSION), and requirements.txt if there is one;
  • warns when the OLOPROOF_EXPORT_KEY secret is missing, with the line that sets it, and fails (exit 2) instead once oloproof.yaml names the project's export key;
  • fails as a broken build (exit 5) when no case produced an output, so a system that raised on every case never reads as a warning;
  • writes the gate's markdown summary into the job summary and into one pull request comment, edited on each push rather than added again; its last line says it was written by Oloproof, with a link, and OLOPROOF_FOOTER: "off" in the job's environment leaves it out;
  • reads the base branch's release.yaml and passes it to the gate as --base-policy, so the summary names, under a heading of its own, every way the pull request relaxes it (a lower bar, a removed rule, warn_on, validation turned off), and its oloproof.yaml as --base-config, so the summary also names every check swapped or loosened, every case removed from the suite or edited, and any judge validated after the run it decides;
  • exits on the gate's own code.

The same gate as one step

The gate job is also published as a GitHub Action, etobicoke/oloproof-gate, generated from the same workflow so the two run the same script. A job that checks out the repository and adds one step gets the gate, the job summary, the pull request comment and the HTML report:

on: pull_request
permissions:
  contents: read
  pull-requests: write
jobs:
  gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: etobicoke/oloproof-gate@v1
        with:
          export-key: ${{ secrets.OLOPROOF_EXPORT_KEY }}

@v1 follows the action's compatible releases; pin @v1.0.0 to hold it still. Its inputs are export-key, advisory ("true" warns instead of blocking while a rule cannot decide yet), version (the pinned Oloproof release), python-version and github-token; its output run is the run it decided.

The workflow has a second job, compare, that runs the base branch and the pull request into one store and compares them, as the section on comparing a pull request against its base shows below. It decides on compare.yaml when the pull request has one and exits on the comparison's code; without compare.yaml the comparison is reported and blocks nothing. Its summary goes into the job summary and a second pull request comment, and lists the cases the pull request fixed and broke. It is skipped on a fork's pull request, when the base branch has no oloproof.yaml yet, and when the pull request changed the suite, since a comparison pairs cases over one suite.

--advisory writes the same workflow with OLOPROOF_ADVISORY: "true": a rule the suite cannot decide yet (exit 3) warns instead of blocking, and the comment adds oloproof plan's count of the cases that would decide it. Set it to "false" once the suite is large enough. A crashed system still blocks: a rule whose metric observed no case, or more missing cases than its max_missing_fraction allows, exits 3 under every policy, and the gate says so in words.

A pull request from a fork gets no secrets and no permission to comment, so the workflow decides it under a throwaway key: oloproof run --throwaway-key keys the run under a key held in memory only, writes its store to a private temporary folder deleted when the run ends, writes the gate's summary into the job summary and the HTML report as an artifact, and posts no comment. The summary says the run is not kept and cannot be pushed, and it is not compared with any other run. Do not switch the workflow to pull_request_target: that runs the fork's code with this repository's secrets.

GitLab, Azure Pipelines and Jenkins

The gate needs no GitHub. In a project with oloproof.yaml:

# or azure, or jenkins; add --advisory to warn on exit 3
oloproof init --ci gitlab

It writes oloproof-gate.sh, the gate as one POSIX script, and the system's own pipeline file (.gitlab-ci.yml, azure-pipelines.yml or Jenkinsfile) that runs it on each merge or pull request in a plain python:3.12 image. The script installs the Oloproof it was written with, runs the suite, fails as a broken build when no case produced an output, keeps the gate's markdown summary (oloproof-summary.md) and the offline report (oloproof-report.html) as the pipeline's artifacts, and exits on the gate's code below. Give the job the export key the way the command prints: a masked CI/CD variable in GitLab, a secret pipeline variable in Azure, a Secret text credential named oloproof-export-key in Jenkins.

What stays GitHub-only for now: the comparison with the base branch, the fork handling and the comment on the pull request. Post oloproof-summary.md with your system's own tooling if you want it on the merge request. Any other CI system runs the script as it is.

The exit code is the gate

oloproof run exits on its gate. A CI step that runs it fails when the gate blocks, which is usually what you want and needs no extra wiring:

CodeA CI step should
0pass
1fail: a rule failed
2fail as a broken build: the configuration was wrong and nothing was measured
3fail, or warn: the suite could not decide
4fail and route to a person
5fail as a broken build: the run did not complete
6wait for approval: every rule passed and the policy requires two approvals

Code 3 is the one teams argue about. The default policy blocks on it, because a suite too small to decide has not shown the change is safe. A team that wants the job to go green while it grows its suite can say so in the policy, rather than by ignoring the exit code:

version: 1
block_on: [FAIL, MANUAL_REVIEW]
warn_on: [INSUFFICIENT_EVIDENCE]
rules:
  - id: exact-label-floor
    metric: exact_label
    min: 0.70

The same stored run of the support_bot example (oloproof init --example support_bot), which blocks with 3 under its own policy, under this one:

oloproof gate latest --policy advisory.yaml
exact-label-floor: INSUFFICIENT_EVIDENCE (interval_overlaps_threshold)
  72.2%, range 46.5% to 90.4% (exact binomial interval); 18 of 18 cases
  a suite of about 1702 cases (1684 more) would decide it, if the next cases go like these; at that size it is settled about half the time
Gate: WARN (exit 0)

It exits 0. The decision is unchanged. Only the release action moved, and it moved because a file under review says so. It would not have moved had the system crashed: a rule whose metric observed no case blocks with 3 whatever warn_on says.

Reading the result as data

--json writes one JSON event per line to standard output and the human tables to standard error, so a CI log keeps the tables and a script reads the events. Saved to run.ndjson, the run's id is on every line, and the last line carries the exit code:

jq -r 'select(.type == "run_started") | .run_id' run.ndjson
jq -c 'select(.type == "run_finished")' run.ndjson
run_01M3C3WS0SBTFAG55M7ECM1EZ4
{"run_id":"run_01M3C3WS0SBTFAG55M7ECM1EZ4","timestamp":"2026-09-25T11:06:03.646415Z","type":"run_finished","status":"DECIDED","completeness":"COMPLETE","exit_code":3}

When a policy decides the run, the line before the last is a run_decided event with the decisions: per rule the state, the state in words, the estimate, the range, the bar and the release action. oloproof gate RUN --json prints the same decisions as one document:

jq -r 'select(.type == "run_decided") | .verdict.decisions[] | "\(.rule_id): \(.state)"' run.ndjson

Progress and concurrency lists every event type, and the CLI reference every command with a JSON form.

Where the evidence lives

A run is stored in .oloproof/store.sqlite beside the oloproof.yaml it was run from, and oloproof init puts .oloproof/ in .gitignore. A CI job starts with an empty store, so every job re-executes every case, and nothing from one job is visible to the next.

That matters most for a comparison, which needs both runs in one store. Two checkouts of a project each get their own store, so a baseline run from one cannot be found from the other:

Configuration error: unknown run 'run_01M3C3XSX9KY5T8VFZXA1CVBES'

OLOPROOF_HOME points every command at one store, wherever its oloproof.yaml is. The directory it names holds .oloproof/store.sqlite.

Installing Oloproof in a job

A job installs Oloproof the way a developer does, from PyPI:

python -m pip install oloproof

Pin the version your suite was written against (oloproof==0.1.0a22) so a release of Oloproof never changes a gate's result without a change in your repository. The package provides the oloproof command; nothing else is needed, and no checkout of Oloproof's own repository.

The export key

A project that keeps any content on its own machines (every project whose egress: does not export everything, the default included) keys the digests of that content with its export key, so a workspace holding them cannot find a short withheld value by hashing guesses. A developer's machine makes the key on its first run. A job never does: with CI set and no key, a run stops with a configuration error rather than start a second, incompatible set of ids. Give the job the key the project already has, as a secret:

oloproof keys export --to - | gh secret set OLOPROOF_EXPORT_KEY

and set OLOPROOF_EXPORT_KEY: ${{ secrets.OLOPROOF_EXPORT_KEY }} in the job's env:, as below. oloproof keys show prints the key's fingerprint, never the key.

The first keyed run writes that fingerprint into oloproof.yaml, under export_key:, and asks you to commit it. Once it is committed, a machine or job without the key it names is refused (exit 2) instead of making a second key: a teammate imports the key with oloproof keys import --from FILE (a file oloproof keys export --to FILE wrote on a machine that holds it). An Oloproof older than the one that wrote the block refuses a file carrying it, so bump the pinned oloproof==VERSION in the workflow in the same commit. Keys live under ~/.oloproof/keys whatever OLOPROOF_HOME says. Adopt the key once and share it before branching: two branches that each make a key show a conflict on the fingerprint: line.

To decide without the key, keeping nothing, run oloproof run --throwaway-key (or set OLOPROOF_THROWAWAY_KEY=1 in a step). It is refused when the key is here, and with --cloud; a step that pushes must not set it, since push, export and record export refuse it, and the workspace refuses a run made under a throwaway key. The first keyed run a workspace receives registers the project's fingerprint, and it must be pushed by an Owner, who can also reset the registration.

Comparing a pull request against its base

Check out the base branch and the pull request side by side, run each into the same store, and compare:

name: oloproof
on: pull_request
jobs:
  evaluate:
    runs-on: ubuntu-latest
    env:
      OLOPROOF_HOME: ${{ github.workspace }}/evidence
      OLOPROOF_EXPORT_KEY: ${{ secrets.OLOPROOF_EXPORT_KEY }}
    steps:
      - uses: actions/checkout@v4
        with:
          path: pr
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.base_ref }}
          path: main
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: python -m pip install "oloproof==0.1.0a22"
      - run: if [ -f pr/requirements.txt ]; then python -m pip install -r pr/requirements.txt; fi
      - run: mkdir -p "$OLOPROOF_HOME"
      - name: baseline
        run: |
          if [ ! -f main/oloproof.yaml ]; then
            echo "main has no oloproof.yaml yet: nothing to compare against, so the comparison is skipped"
            exit 0
          fi
          oloproof run --config main/oloproof.yaml --json > base.ndjson || true
      - run: oloproof run --config pr/oloproof.yaml --json > cand.ndjson || true
      - name: compare
        if: hashFiles('main/oloproof.yaml') != ''
        run: |
          candidate=$(jq -r 'select(.type == "run_started") | .run_id' cand.ndjson)
          baseline=$(jq -r 'select(.type == "run_started") | .run_id' base.ndjson)
          oloproof compare "$candidate" "$baseline" --config pr/oloproof.yaml --policy pr/compare.yaml

The two runs carry || true because their own gates are not the question here; the comparison's exit code is.

The same steps on a laptop, with the scaffolded project checked out twice:

Comparison sha256:31ac104779bda1726ba55b661107cbe256fae5f1d831c79b1283a07651b58cbf of run_01M3C3XX4TM0WSZW8K81PHRGAW against run_01M3C3XW7X64B0Z0ACZV27WSW6 · 30 paired cases
exact_label: +0.0 points [-16.5, +16.5] · 30 paired · 0 missing · 0 excluded
Decisions
  no-regression  exact_label  non-inferiority, margin 5.0 points  INSUFFICIENT_EVIDENCE  interval_overlaps_margin
    a suite of about 107 paired cases (77 more) would decide it, if the next pairs go like these; at that size it is settled about half the time
Gate: BLOCK (exit 3)

Both runs must be over the same suite. A pull request that edits a case changes the suite's digest, and the comparison refuses rather than pair cases that are no longer the same case:

Configuration error: runs 'run_01M3C3XXVZ1X0J2PR1ZW1WVGVZ' and 'run_01M3C3XW7X64B0Z0ACZV27WSW6' used different suites (sha256:baff4f101901d9a37cd440f99b9a70032f9488891b4f590f18a81017c26ba794 and sha256:2011286a7ec00c8c31560bb6d037b54a501a15f6251ac7c2d578d0c40e226d72); comparisons pair scenario by scenario over one suite

A comparison of a run that did not finish exits 5, the same as a gate over one: there is no paired result to decide on.

A summary on the pull request

oloproof gate and oloproof compare take --summary markdown. It writes one markdown block to standard output in place of the text: the release action and exit code, then the answer in plain words, a table with each rule's decision, estimate (for a comparison, the paired difference), interval, what the rule requires and its denominator with the missing cases, what stopped early and why, and any further action. Every number in it is the one the text output prints.

The answer comes first, under "Is it good enough?" for a gate and "Is it real?" for a comparison: one line per rule with its decision in one word, its estimate and interval, and, where the evidence could not settle it, how many more cases would. The word is the decision's and nothing more: PASS reads established, FAIL ruled out, INSUFFICIENT_EVIDENCE not established yet and MANUAL_REVIEW for a person to decide. The exit code is the same with the flag as without it, so one step both writes the summary and gates the job. It cannot be combined with --json, which writes to standard output too.

Appended to $GITHUB_STEP_SUMMARY, the block appears on the job's summary page. In the comparison job above, the last step becomes:

      - name: compare
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          candidate=$(jq -r 'select(.type == "run_started") | .run_id' cand.ndjson)
          baseline=$(jq -r 'select(.type == "run_started") | .run_id' base.ndjson)
          code=0
          summary=$(oloproof compare "$candidate" "$baseline" --config pr/oloproof.yaml --policy pr/compare.yaml --summary markdown) || code=$?
          printf '%s\n' "$summary" | tee summary.md >> "$GITHUB_STEP_SUMMARY"
          gh pr comment ${{ github.event.pull_request.number }} --body-file summary.md
          exit $code

The gh pr comment line is optional; it needs permissions: pull-requests: write on the job. The step exits on the comparison's own code, after the summary has been written.

A comparison's summary ends with the cases that changed: for each pass rate, how many cases the candidate fixed and broke against the baseline, and the ids of the first ten in each direction with a count of the rest. That list is reported only. The cases are picked by their outcome, so they are not a slice and no rule reads them; the rules above it decide.

The gate over the stored run of the support_bot example:

oloproof gate latest --summary markdown
### Oloproof gate: BLOCK (exit 3)

**Is it good enough?**

- exact-label-floor, at least 70.0%: **not established yet**. 72.2%, interval [46.5%, 90.4%]. Exact binomial interval; 18 of 18 cases. A suite of about 1702 cases (1684 more) would decide it, if the next cases go like these; at that size it is settled about half the time.
- valid-format, at most 0 failures: **established**. 100.0%, interval [81.4%, 100.0%]. 0 failures observed, at most 0 allowed; 18 of 18 cases.
- pii-free, at most 0 failures: **established**. 100.0%, interval [81.4%, 100.0%]. 0 failures observed, at most 0 allowed; 18 of 18 cases.

Run `run_01M4ET49JQRZ4HK4VN4MCMG2VJ`, complete.

**Reach**: inputs like these: the population this suite stands for, as far as it is a fair sample.

| Rule | Decision | Estimate | Interval | Requires | Denominator |
|---|---|---|---|---|---|
| exact-label-floor | INSUFFICIENT_EVIDENCE (interval_overlaps_threshold) | 72.2% | [46.5%, 90.4%] | at least 70.0% | 13 / 18 observed · 0 missing · 0 excluded |
| valid-format | PASS (observed_failures_within_limit) | 100.0% | [81.4%, 100.0%] | at most 0 failures | 18 / 18 observed · 0 missing · 0 excluded |
| pii-free | PASS (observed_failures_within_limit) | 100.0% | [81.4%, 100.0%] | at most 0 failures | 18 / 18 observed · 0 missing · 0 excluded |

A run that stopped early adds a section saying after how many cases it stopped and that every rule was decided at that look, or, when the policy asked for early stopping and it was not applied, why not. A Next section lists anything else to do, such as a judge to validate or a sign-off waiting for an approver; with nothing else, there is none.

A run or comparison pushed from the same machine is linked: oloproof push prints the page it landed on (Open it: and the address) and remembers it beside the store, and the summary then ends its run line with a link to that page, so a reviewer of the pull request opens the evidence in one click. For a comparison, the link is to the comparison when it was pushed (oloproof push --comparison), and otherwise to its candidate run. Push before writing the summary for the link to be there; without a push the summary is the same, with no link.

A report anyone can open

oloproof report RUN --html report.html writes the run as one HTML file: the release action, each rule's answer with what decided it and its interval drawn against its bar, the metrics, and every case's verdicts. It needs no account and makes no request, so a job can keep it as an artifact:

      - run: oloproof report latest --html oloproof-report.html
        if: always()
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: oloproof-report
          path: oloproof-report.html

Case inputs, expected values, outputs and judge text are left out unless you pass --include-content; leave it off wherever the artifact reaches more people than the data does. In a notebook, the result oloproof.evaluate returns shows the same report as its rich view, and result.to_html("report.html") writes the file.

Where to go next

  • Gating CI covers the policy and the order exit codes are reported in.
  • Comparison rules covers what a comparison policy can ask.