Your First Enforcement
nolapse run is the enforcement command. It measures coverage in the current working tree, compares it against the baseline, classifies the result as pass, warn, or fail, and exits with a code that CI can act on.
Running the check
Section titled “Running the check”nolapse run --repo .For a Python project, add --lang python if it is not already set in nolapse.yaml:
nolapse run --repo . --lang pythonHow the check works
Section titled “How the check works”At a conceptual level, nolapse run performs these steps:
- Reads
nolapse.yamlfrom the repo root forlang,warn_threshold,fail_threshold, andstrict_mode. - Applies any flags passed on the command line, which override
nolapse.yamlvalues. - Locates
.audit/coverage/baseline.mdand reads thecoverage:field from the header block. - Runs the test suite with coverage instrumentation (Go:
go test -cover ./...; Python:pytest --covvia the runner subprocess). - Parses the total coverage percentage from the tool output.
- Calculates
delta = current_coverage - baseline_coverage. - Classifies the outcome using the threshold logic (see below).
- Prints the results table and summary line to stdout.
- Exits with code
0(pass or warn) or1(fail), modified by--strict-mode.
Understanding the output
Section titled “Understanding the output”file baseline coverage PR coverage delta outcome. 80.00% 82.30% +2.30% pass
outcome: pass delta: +2.30 coverage: 82.30% baseline: 80.00% outcome: passwarn_threshold: 0.5 fail_threshold: 1.0Coverage delta: +2.30% (threshold: 0.5%) pass| Column / Field | Meaning |
|---|---|
file | Repository path checked (. means root). |
baseline coverage | Coverage recorded in .audit/coverage/baseline.md. |
PR coverage | Coverage measured in the current working tree. |
delta | Difference in percentage points (current − baseline). Positive means improved. |
outcome | pass, warn, or fail (see logic below). |
warn_threshold | Active warn threshold (from config or flag). |
fail_threshold | Active fail threshold (from config or flag). |
Pass, warn, and fail
Section titled “Pass, warn, and fail”nolapse uses two thresholds expressed as negative percentage-point drops. The defaults are warn_threshold = 0.5 and fail_threshold = 1.0.
| Condition | Outcome | Exit code |
|---|---|---|
delta > -warn_threshold | pass | 0 |
delta > -fail_threshold (and not pass) | warn | 0 (or 1 with strict mode) |
delta ≤ -fail_threshold | fail | 1 |
Examples with default thresholds (warn=0.5, fail=1.0)
Section titled “Examples with default thresholds (warn=0.5, fail=1.0)”| Delta | Outcome | Why |
|---|---|---|
+2.30% | pass | Improved; above warn threshold |
0.00% | pass | No change; above warn threshold |
-0.30% | pass | Small drop, still above -0.5 |
-0.70% | warn | Below -0.5 but above -1.0 |
-1.00% | fail | At the fail threshold |
-3.50% | fail | Well below fail threshold |
Strict mode
Section titled “Strict mode”When strict_mode: true is set in nolapse.yaml (or --strict-mode is passed on the command line), a warn outcome exits with code 1 instead of 0. This is useful when you want zero tolerance for any regression, even small ones, without tightening the thresholds permanently.
nolapse run --repo . --strict-modeOverriding thresholds at runtime
Section titled “Overriding thresholds at runtime”All threshold values can be overridden per invocation without editing nolapse.yaml:
# Tighter thresholds for a release branchnolapse run --repo . --warn-threshold 0.1 --fail-threshold 0.5
# Looser thresholds for an experimental branchnolapse run --repo . --warn-threshold 2.0 --fail-threshold 5.0Command-line flags always take precedence over nolapse.yaml.
How CI uses exit codes
Section titled “How CI uses exit codes”The exit code is the mechanism by which CI systems enforce the gate:
- Exit
0— the check step succeeds. The pipeline continues. A warn outcome still exits0unless--strict-modeis active. - Exit
1— the check step fails. Most CI systems (GitHub Actions, GitLab CI, CircleCI) mark the job as failed and, if the branch protection requires the check to pass, block the merge. - Non-zero (other) — a configuration or runtime error occurred (missing baseline, git not available, test runner crash). The step also fails.
In a GitHub Actions workflow the step looks like:
- name: Enforce coverage run: nolapse run --repo . # No 'continue-on-error' — let the non-zero exit block the PRFor a softer gate that reports but never blocks, use continue-on-error: true and rely on the PR comment for visibility.
Next step
Section titled “Next step”- Set permanent thresholds in nolapse.yaml instead of passing flags every time.
- See the full CLI Reference for every flag accepted by
nolapse run. - Read Exit Codes for a complete table of all possible exit codes.