Skip to main content

Quality gate

Experimental
Experimental

qa gate and the gate: section of qaboard.yaml may change without notice: their names, defaults and output. Tell us how it works for you in GitHub issues.

qa gate fails your CI job when a commit's results regress against a reference: a metric's median gets worse than you allow, one test gets much worse, runs fail, or output files stop being bit-accurate. It decides on the numbers that the commit page's Summary and Metrics Diff show, and links to the Metrics Diff, so that whoever reviews the change sees why.

On the commit that added a shared cache, the p99 latency is far worse than on main: the gate fails and exits with 1.

Fail the CI when a metric regresses​

  1. Add rules to qaboard.yaml. The inference gateway's rules let its p99 latency get 10% worse at most, its throughput 5% worse, and no run fail:

    qaboard.yaml
    # Experimental: may change without notice
    gate:
    reference: main
    labels: [ci]
    rules:
    - {metric: latency_p99, max_regression: 10%}
    - {metric: throughput, max_regression: 5%}
    max_failed_runs: 0
  2. Try it on a commit that has CI results, from your clone:

    qa gate

    qa gate compares the current commit's CI batch with the reference, prints a table of the rules with the new and reference values, and the link to the Metrics Diff. It exits with 0 when every rule passes, 1 when one fails, 2 when it can't decide (see exit codes).

  3. Run it in the CI, after qa batch. Run it even when qa batch failed, so that it reports the failed runs too:

    .github/workflows/qaboard.yml
    # Runs your test set on every push, then fails the job when the results regress against the reference
    # (qa gate is experimental). qa saves results where the server reads them (e.g. /mnt/qaboard, an NFS
    # share), at the same path: use a self-hosted runner that mounts it. GitHub-hosted runners can't reach it yet.
    name: QA-Board
    on: push
    permissions:
    contents: read
    statuses: write # for qa batch's commit status, and qa gate --post-status
    pull-requests: write # for qa gate --post-comment

    jobs:
    qaboard:
    runs-on: self-hosted
    env:
    QABOARD_URL: http://<your-qaboard>
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
    with:
    python-version: "3.12"
    - run: pip install qaboard -r requirements.txt
    - run: qa batch ci
    # Also when runs failed, so that the gate reports them. Its table goes to the job's summary,
    # and to a comment on the commit's pull request, updated on each push.
    - run: qa gate --post-status github --post-comment github
    if: ${{ !cancelled() }}

    <your-qaboard> is your server's URL, like http://localhost:5151.

  4. Push a commit. When a rule breaks, the job fails. The gate's table is in the job's log, in GitHub Actions in the job's summary, and with --post-comment, in a comment on the pull request:

A CI job summary titled Quality gate: fail, with a table of checks: the p99 latency's median is much worse than the reference's, over its limit.
In the job's summary, the gate's table shows which rule failed, with a link to the Metrics Diff.

Write rules​

Each rule names a metric, and one or more limits:

LimitFails when
max_regression: 5%The metric's median over the runs is more than 5% worse than the reference's.
per_test_max_regression: 10%One run is more than 10% worse than its reference run.
min: 0.42The median is under 0.42.
max: 12The median is over 12.

The detector combines them: an absolute floor for its mAP, at most 10% less AP on small objects, and no slice much worse than in the reference.

qaboard.yaml
# Experimental: may change without notice
gate:
reference: main
labels: [ci]
rules:
- {metric: map, min: 0.15} # median over the batch's runs
- {metric: ap_small, max_regression: 10%}
- {metric: map, per_test_max_regression: 25%} # no slice and variant much worse than in the reference
max_failed_runs: 0
  • Worse comes from your metrics' definitions, in your code or your metrics file (see Declaring metrics): with smaller_is_better: false, a smaller value is worse. Regression rules need to know which way is better: they fail with an error for metrics that were not declared, declared in code without smaller_is_better, or with smaller_is_better: null. In a metrics file, metrics without smaller_is_better are "smaller is better". min and max work with any metric.
  • Give regressions as percentages (5%) or fractions (0.05), relative to the magnitude of the reference's value.
  • Give min and max in the unit the runs return, like target: before scale is applied.
  • Combine limits in one rule: {metric: psnr, max_regression: 1%, per_test_max_regression: 5%}.
  • A metric that none of the new runs return fails its rules. A metric that the reference's runs don't have yet, like a new one, skips its regression rules.

Medians and per-test limits keep noisy metrics from failing the gate: one slow run moves a mean, not a median. Use per_test_max_regression for regressions that only hurt a few inputs, which a median hides. The gate doesn't measure your metrics' noise: set limits above the run-to-run variation you see in Trends.

Pass/fail metrics​

The median of a metric that is 0 or 1 in each test says little: {metric: unsafe_actions, max: 0} passes as long as fewer than half of the tests are unsafe. Choose another aggregate: median (the default), mean, min or max. The fleet assistant's gate fails as soon as one task has an unsafe action, and lets its pass rate drop by 5% of itself at most:

qaboard.yaml
# Experimental: may change without notice
# Each run is one task, and `passed` and `unsafe_actions` are 0 or 1 per task (unsafe_actions counts): their median
# over the tasks says little. The rules aggregate them over the batch's tasks instead.
gate:
reference: main
labels: [ci]
rules:
- {metric: unsafe_actions, max: 0, aggregate: max} # no task may have an unsafe action
- {metric: passed, max_regression: 5%, aggregate: mean} # the pass rate
max_failed_runs: 0

With mean, min or max, the gate aggregates each test's values, as the Metrics Diff shows them: the new runs' values, and those of the reference runs they're compared with. Regressions are relative to the reference's aggregate: from a pass rate of 80%, max_regression: 5% allows 76%. When the reference's aggregate is 0, any change for the worse fails. aggregate applies to max_regression, min and max: it can't be used with per_test_max_regression, which checks each test, so give that one its own rule.

Rules for some batches or labels​

Two names select runs. A batch is the name after qa batch: the inputs and configurations listed under it in your batches file. A label is what qa --label sets: the name the web app's batch selector shows, default for the CI's results (shown as CI). Several batches can run under one label.

Your CI may run several batches of qaboard.yaml, like qa batch ci and qa batch perf, and their runs land in the same results. A latency rule only makes sense for the performance runs. Give a rule a batch, and it checks only the runs of that qa batch. Give it a label, and it applies only when the gate checks results with that label (qa --label nightly batch all):

qaboard.yaml
gate:
labels: [default, nightly] # the CI's results, and the nightly ones
expect_batches: [ci, perf] # undecidable until both have runs
rules:
- {metric: psnr, max_regression: 1%} # every run
- {metric: latency_p99, max_regression: 10%, batch: perf} # only the runs of `qa batch perf`
- {metric: coverage, min: 80, batch: [unit, integration]} # several batches, or patterns like "perf-*"
- {metric: accuracy, min: 0.9, label: nightly} # only when checking the label "nightly"
  • A rule with batch computes its median, mean, min or max over the runs of those batches, and the reference runs they're compared with. per_test_max_regression looks at those runs only. The table says so: latency_p99, median [perf].
  • No run of the batch yet: the check is unknown, "no runs from qa batch perf yet", and the gate is undecidable. With --wait, it waits for them.
  • A rule with label is left out when the gate checks another label.
  • batch and label take a name, a list, or shell patterns like perf-*. Without them, a rule applies to every run of every label checked.
  • max_failed_runs and require_bit_accuracy are about all the runs of a label. To limit the failures of one batch, write a rule on a metric your runs return, like failed, with a batch.

The runs say which batch they come from to servers from November 2026: with an older server, a rule with batch is unknown, with a message to upgrade it.

Rules a commit can't change​

The rules above are in the commit they check: a change can loosen a rule in the same commit that breaks it. A project's owners can set rules that hold whatever the commit says, from the web app: Admin → Quality gate, in the project's sidebar (see Set a project's gate rules).

  • Project rules use the same limits as qaboard.yaml's, and can be for some batches or labels too. qa gate checks them on every commit, after the commit's own rules, and marks them [project rule] in its table. A metric can have a rule in both: each is checked with its own limit.
  • Batches to wait for: the project's are added to those of the commit's expect_batches.
  • Failed runs and bit accuracy: the stricter of the commit's and the project's settings applies.
  • When a commit loosens its own rules, compared with the rules of the reference's qaboard.yaml, the gate says so. Owners can make it fail instead: the looser rules then reach the reference branch when people decide to merge them, not with the commit that needs them.

qa gate gets the project's settings from the server with the numbers it compares: there is nothing to add to the CI job. Versions of qa from before project rules ignore them.

note

qa gate runs in your CI, which a commit can change too. Project rules don't make the gate tamper-proof: they make loosening it a visible act, in a place commits don't reach, with the change in the server's audit log.

Choose the reference and the results to check​

The other keys of the gate: section:

KeyDefaultMeaning
referenceproject.reference_branch, else your repository's default branch, else mainWhat to compare with: the name of a shared milestone (or #12 for the milestone whose link is /<project>/milestone/12-...), a commit's sha, or a branch. A branch means its latest commit with runs with the same label, other than the commit you check. If that commit is on the same branch, the latest one before it.
labels[default]The labels of the results to check, as qa --label sets them. The CI's label is default, and the web app shows it as CI: ci names it too. Each label is compared with the reference's results that have the same label. batches is its older name, still accepted (not both).
expect_batchesnoneThe batches, as named after qa batch, that must have at least one run before the gate decides: e.g. [ci, perf], when a job runs the gate between qa batch ci and qa batch perf. Until then the gate is undecidable, and --wait waits. Per label: {default: [ci, perf], nightly: [all]}.
max_failed_runs0How many runs may fail in each label's results. null doesn't check.
require_bit_accuracyfalseFail when a run's output files differ from its reference run's, like qa check-bit-accuracy: files that match bit_accuracy.patterns, ignoring the logs. Runs without a manifest.outputs.json make the gate undecidable.
Which numbers the gate compares

The gate uses the numbers of the commit page, so that what it says is what reviewers see:

  • Medians, as in the Summary: over the commit's finished runs, including failed runs that returned the metric (its tuning iterations are left out), and over the reference's runs on the same inputs.
  • Means, minimums and maximums, and rules with batch: over the tests that have both a run and a reference run, so a scoped median can differ from the Summary's.
  • Each test, as in the Metrics Diff: each run is compared with the reference run that matches it best (the same input, then the closest configuration and tuning parameters, then the same platform).
  • The table shows each check's values, and how much worse or better they are.

Exit codes​

CodeVerdictWhen
0passEvery rule passes.
1failA rule fails, the gate: section has an error, or the project's rules need a newer qa.
2undecidableThe gate can't decide yet: see below.

With --wait, qa gate checks again every --interval seconds (30) while it's undecidable, until --timeout (1800). Use it when the reference's CI, or another of your jobs, may still be running. To let the CI pass when the gate can't decide, allow exit code 2 in your CI, as the GitLab CI example does.

From your machine​

Outside CI, qa batch labels its results with your name: qa --label w9 batch ci makes the batch @<you>| w9, and qa batch ci makes @<you>| default (<you> is your login on the machine, or QA_USER). When the commit has no results with the label you check, qa gate --label w9 checks yours, @<you>| w9, and says so. It compares them with the reference's results labelled the same, else with those labelled like you typed, e.g. the reference branch's CI results for qa gate. To compare with other results of the reference, give their label. When the reference has none to compare with but has your own, the gate says which --reference-label finds them:

qa --label w9 batch ci
qa gate --label w9 --reference-label default # against the CI's results on the reference branch
qa gate --label w9 --reference-label "@$(whoami)| default" # against your own `qa batch ci` on it ($QA_USER if set)

When the gate can't decide​

Undecidable means the results aren't there to compare yet, not that the commit is bad. The table, the job's summary and the comment say why:

qa gate saysWhat to do
No reference: "main" is no milestone or commit, and no commit on the branch "main" has runs in the batch "default".The reference has no results with this label yet: wait for the reference branch's CI (--wait), set another reference, or compare with results of the reference that have another label: --reference-label.
No runs in the batch "default" of this commit.Run qa batch before qa gate, with the same label: the gate checks gate.labels (default in CI), or --label.
Some runs are still running: the numbers may change.Wait for them: --wait.
no runs from `qa batch perf` yetA rule with batch, or expect_batches, needs qa batch perf's runs: run it before the gate, or --wait when another job runs it.
QA-Board's server doesn't say which batch each run comes fromRules with batch and expect_batches need a server from November 2026: ask your admins to upgrade it.
some runs have no manifest.outputs.json to comparerequire_bit_accuracy compares the runs' manifest.outputs.json: some runs, new or reference, don't have one. Run them again.
QA-Board doesn't have the reference's qaboard.yaml to compare the rules withThe project fails commits that loosen their rules, and the reference's results came without a qaboard.yaml, or with a gate: section qa gate can't read: run the reference's CI again.
could not reach QA-Board, or a sign-in errorCheck QABOARD_URL or --server, and the CI's token (see CI integration).
QA-Board's server doesn't have the comparisons qa gate needsThe gate needs a server from October 2026: ask your admins to upgrade it.

Report on pull requests​

--post-status github (or gitlab) posts a commit status that branch protection can require, and --post-comment github one comment on the commit's pull request, that every qa gate job updates, with a section per label. The comment also says when runs only passed after being done again, and when the commit loosens its rules. Set them up, and check them with qa --dryrun gate: see The gate on pull requests.

Options​

OptionMeaning
--reference <ref>Compare with this branch, milestone or commit instead of gate.reference.
--label <label>Check the results with this label instead of gate.labels. Repeat it for several labels. qa --label <label> gate does the same.
--batch <label>, -bThe older name of --label.
--reference-label <label>Compare with the reference's results that have this label, e.g. default (its CI's), instead of the same label.
--commit <sha>Check this commit instead of the current one.
--format text|markdown|json, --jsonThe output: a table (default), a Markdown table, or JSON for scripts and agents.
--wait, --timeout, --intervalCheck again while undecidable, see exit codes.
--post-status github|gitlabPost a commit status, see commit statuses.
--post-comment github|gitlabPost or update a comment on the commit's pull request, see the gate on pull requests.
--server <url>The QA-Board server, instead of QABOARD_URL or your site's settings.
qa --dryrun gate ...Print the comment and status instead of posting them, see try it without posting.

qa gate prints a reminder that it's experimental on stderr: stdout only has the result.

From scripts and agents​

qa gate --json prints the verdict, each check with its values, and the link to the Metrics Diff. labels lists the labels checked, and batches has each label's results (its name from before labels). It also has rules_changes, how the rules differ from the reference's (each with looser), and for each label reruns: how many runs were done again, how many passed after a failed attempt, and which. Checks that come from the project's rules have "source": "project", and project_rules lists them. Checks of rules for some batches have batch, and expect_batches checks list the missing batches.

The numbers come from the server's comparison, /api/v1/commit/<sha>/compare, that scripts can read too: see Compare with the reference.

Known limitations​

  • Tags can't be references yet: use the tagged commit's sha.
  • A branch's commits are those QA-Board first saw on that branch. A commit pushed to a feature branch, then fast-forwarded to main, stays on the feature branch.
  • Milestones must be shared to be found by name (#<id> finds any). The gate compares with the runs of the milestone's label, but doesn't apply the milestone's filter: all those runs are compared.