Docs/Proofs
#

Proofs

Prove pull request changes with passing Cofactor tests, see the verdict in GitHub, and promote proven tests into your regression suite.

Prove my changes with Cofactor tests

A proof ties a pull request to passing Cofactor tests. Your agent writes a short list of acceptance criteria, such as "A shopper can apply a discount code", and attaches a passing test run to each one. Reviewers get the evidence in the pull request: a video of each run, a verdict from the cofactor / proofs check in GitHub, and a proof page in Cofactor. When the pull request merges, the tests it proved join your regression suite.

Prove a pull request

  1. Connect GitHub. An organization admin installs the Cofactor GitHub App once and links each repository to its application. The App posts the cofactor / proofs check. Proofs need an application that builds from GitHub, so an application delivered as an uploaded image cannot supply them. See Connect GitHub.

  2. Let your agent prove the change. Install the proof skill in your coding agent:

    bash
    cofactor skill install cofactor-prove-with-tests
    

    For every user-visible change, the agent runs cofactor proofs guide and follows it. In short, the agent:

    • looks for an existing test that covers the behavior, and forks it instead of editing the original. It creates a new draft test only when nothing fits;
    • sets the test's promotion with cofactor workflow set-promotion;
    • pushes its commit, claims a sandbox at that commit and runs the test until it passes;
    • opens a draft pull request and attaches the passing run to each criterion;
    • pastes the output of cofactor proofs render into the pull request description.

    Each attach names the criterion, the test, the run and what the run checked:

    bash
    cofactor proofs attach --pr 42 --application <application> --criterion 1 \
      --text "A shopper can apply a discount code" \
      --test <wf_...> --run <wrun_...> \
      --asserted "The cart total drops by the code's amount." --org <organization>
    cofactor proofs render --pr 42 --org <organization>
    

    The rendered block sits between <!-- cofactor:proof --> markers. Your agent pastes it unedited and renders again after every push, attach or detach. A criterion can also be proved by a performance run, an agent eval run or a Playwright test from your own suite. The guide covers each one.

  3. Read the check and the proof page. Once the description has a proof block, the cofactor / proofs check appears on the pull request. It fails when a criterion failed, and passes in every other case. Open View all proofs in Cofactor in the description, or find the pull request on the PRs page, to see the proof page. It lists each acceptance criterion with its state. Expand a criterion to see what the run checked and the key moments from its video, and select Watch full video to play the whole run. The filters at the top (All, Failed, Not proved, Proved) narrow the list.

  4. Block merges on the check. Add cofactor / proofs as a required status check in GitHub.

    1. Open a pull request with a proof block, so the check runs once. GitHub lists a check only after it has run.
    2. In your repository, open Settings, then Branches, and add or edit the rule for your main branch.
    3. Turn on Require status checks to pass before merging, then add cofactor / proofs.

    The check is posted only when the description has a proof block, so a required check waits forever on a pull request without one. Tell your agent to always paste a block. When a change has nothing a user can observe, such as a dependency bump, the agent prints a neutral block with cofactor proofs render --none "<why>".

  5. Promote proven tests into a suite. Each test has a Promote on setting. Set it in the test's settings under Promotion, or with the CLI:

    bash
    cofactor workflow set-promotion <wf_...> --promote-on merge --org <organization>
    
    • Merge (add to Regression) adds a new test to your Regression suite when the pull request merges. A fork merges into the test it came from.
    • Never (archive at merge) archives the test at merge. Use it when the proof is about the change itself, such as a one-time migration or a flag rollout step.

    A test that already runs in Regression is cited as an existing test and is never promoted again. A person approves by merging the pull request. The agent does not approve tests.

Check it worked

  1. Open a pull request that carries a proof block. The cofactor / proofs check appears in its checks list. Its title reads "Proof criteria passed", or "Proof criteria failed" when a criterion has no passing evidence.
  2. Select the check's details link, or open the proof page from the description. Each criterion shows its state, and expanding one shows the run's video.
  3. If you made the check required, a pull request with a failed check cannot merge until the evidence passes.
  4. Merge a pull request whose new test is set to Merge. The test appears in your Regression suite.

Go deeper

Advanced

Criterion states, stale evidence, turning the check off, and pull requests with nothing to prove.

Criterion states and the check

Every criterion is in exactly one state. The proof page, the pull request description and cofactor proofs status all show the same one.

StateMeaningEffect on the check
Proved by CofactorEvery attached test, performance run or eval run passed.Passes.
Checked another wayOnly the agent's own account backs the criterion, for something Cofactor cannot exercise, such as a desktop client.Passes.
Not provedThe agent says why it did not prove the criterion and attached no evidence.Passes, and the check title counts the unproved criteria.
FailedAn attached run did not pass, or the criterion has no evidence and no stated reason.Fails.

The check itself ends in one of three results.

ResultWhen
SuccessNo criterion failed.
FailureA criterion failed, or the proof has no criteria.
NeutralThe description carries a --none block.

A pull request with no proof block gets no check. The check is a snapshot of the description as it is now. It runs again when the description changes, when the pull request is opened, reopened or pushed to, and when you use GitHub's Re-run all checks.

Stale evidence and re-runs

Pushing a new commit makes evidence from an earlier commit stale. The proof page marks it Out of date, with the commit it last passed on. Stale evidence still passes the check. It never blocks a merge, and Cofactor does not re-run it for you.

To refresh it:

  • Tests. On the proof page, select Re-run out-of-date checks. Cofactor re-runs the stale tests on a fresh sandbox at the pull request head and updates the check when they finish. The button is hidden once the pull request is merged or abandoned, and running tests on a pull request needs the Scale plan.
  • Performance runs. Your agent runs the test again at the new head, attaches the new run and detaches the old one.
  • Checked another way. Your agent attaches its account again at the new head.

A failed refresh records a failure and does not keep the old green result.

Turn the check off

The switch covers your whole organization. It cannot be set per repository. An organization admin turns it off:

  1. Open the PRs page and select Configure.
  2. In the Proofs card, turn off Post the proofs check.

With the switch off, Cofactor stops posting cofactor / proofs to GitHub. If branch protection requires the check, remove it there first, or pull requests wait on a check that never arrives. Proof pages and cofactor proofs keep working, and promotion on merge still runs.

A pull request with nothing to prove

For a dependency bump, a docs-only change or another change no user can observe, the agent prints a neutral block and pastes it in place of the proof block:

bash
cofactor proofs render --none "Docs-only change, no behavior to test"

The check reports neutral. The reason is shown to reviewers, so a change that does alter what a user sees should carry a real proof instead.