# Use tests as proof

## Use an external test as proof

Attach a stored external test and its real settled result to a pull request
criterion. The run must target the pushed Application commit and include a
complete result for that test. A passed or flaky result is accepted; disclose
flaky results clearly. Skipped, absent, incomplete, canceled, running and
failed results cannot be attached. A different test failing in the same settled
suite does not cancel the selected test's evidence.

From the clean, pushed Application checkout at the proven head, attach the
selected test and run. Use customer-facing acceptance language in the
criterion and assertion. State what the user can now do or see, not what was
removed: "Settings shows one Save button", not "the old Apply button is gone".
A removal is a property of the change, not lasting behaviour, so do not make
it a criterion; show it with a screenshot in the pull request body instead.
`--steps` is optional plain-language context, one step per line:

```bash
cofactor proofs attach --pr <pull-request-number> --application Example \
  --criterion 1 --text "A member can sign in and see their account" \
  --test <extest_test-id> --run <extrun_run-id> \
  --asserted "the member can sign in and sees the account." \
  --steps "Opened the sign-in page
Entered the QA persona credentials
Saw the account page" --org Acme
```

An external proof uses only the test and run IDs plus the asserted product
behavior.

External attachments reject Workflow-only `--node`, `--base` and `--tree`
options; visual checkpoint comparison is not part of this route.

The source repository owns test review, merges and suite membership: a merge and
later discovery update which tests belong to the suite. Cofactor does not
archive or promote external tests. Native Workflow evidence in the same proof
keeps its existing lifecycle.

After attaching, render the proof block and copy the complete output into the
pull request description:

```bash
cofactor proofs render --pr <pull-request-number> --org Acme
```

Render again after every push, attach or detach; the block is a snapshot. A
successful result at an older Application head stays a stale success. The
proof page's **Re-run** is the explicit way to evaluate stale evidence at the
current head. There is no automatic pull request rerun. If a refresh completes
with a failed test, the evidence shows that failure rather than keeping a green
fallback. A rerun of evidence from an independent test repository retains the
test revision already cited; run and attach a new revision to prove changed
tests.

Only supported Playwright v2 runs with authoritative Application and test
source provenance can prove a pull request. Legacy and ingest-only runs cannot
be attached as this evidence. External tests do not use visual checkpoint
comparisons. For the full criterion, rendering, stale-status
and rerun process, see `cofactor proofs guide`; for run diagnostics, see
`cofactor external-run guide`.

```bash
cofactor test-suite guide
```
