|
| 1 | +# Real-project regression testing with liveness_primer |
| 2 | + |
| 3 | +[liveness_primer](https://github.com/mcdigman/liveness_primer), created and |
| 4 | +maintained by [Matthew Digman](https://github.com/mcdigman), is Skylos's official |
| 5 | +real-project regression testing tool. Its source, adapters, and pinned project |
| 6 | +corpus live in Matthew's repository. Skylos keeps the CI integration here. |
| 7 | + |
| 8 | +It answers a specific question: **what changes for real projects if we merge |
| 9 | +this PR?** It does not decide whether every finding is correct. |
| 10 | + |
| 11 | +## What CI runs |
| 12 | + |
| 13 | +The [Analyzer Blast Radius workflow](../.github/workflows/liveness-primer.yml) |
| 14 | +runs when a PR is opened, updated with new commits, reopened, or marked ready |
| 15 | +for review. There are no changed-path or draft filters: docs-only and draft |
| 16 | +PRs get the same comparison. Fork PRs may need maintainer approval to run, and |
| 17 | +GitHub cannot run this `pull_request` workflow while merge conflicts remain. |
| 18 | +See [GitHub's event documentation](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request). |
| 19 | + |
| 20 | +The primer builds two Skylos revisions in separate managed environments: |
| 21 | + |
| 22 | +- Base: the PR's exact base commit (`pull_request.base.sha`). |
| 23 | +- Head: GitHub's synthetic merge commit (`github.sha`), so the comparison |
| 24 | + includes the result of merging the PR into its base branch, including forks. |
| 25 | + |
| 26 | +Both revisions scan the same commit-pinned corpus projects. The workflow uses |
| 27 | +the primer's packaged corpus, `--all`, two concurrent detector processes, and |
| 28 | +a 300-second default timeout per invocation. The job has a 45-minute limit. |
| 29 | +The primer and Actions are pinned to full commits; uv is pinned to `0.12.5`, |
| 30 | +Python to the `3.13` series, and the primer's dependencies use its lockfile. |
| 31 | + |
| 32 | +The current primer pin is |
| 33 | +[`d6f3118a2cfc465426500eab449005fe56845c58`](https://github.com/mcdigman/liveness_primer/tree/d6f3118a2cfc465426500eab449005fe56845c58). |
| 34 | +It selects 15 Python projects for Skylos. Its adapter compares unused |
| 35 | +functions, imports, classes, variables, and parameters. **File-level findings |
| 36 | +(`SKY-E002` / `SKY-E003`) are not included at this pin.** This job does not |
| 37 | +opt into security, secrets, quality, or AI-defect analyses, and is not a |
| 38 | +cross-language benchmark. |
| 39 | + |
| 40 | +## Read a PR report |
| 41 | + |
| 42 | +1. Open the PR's **Analyzer Blast Radius** run and read its summary. |
| 43 | +2. Check that both revisions completed. A crash, timeout, or unusable detector |
| 44 | + output fails the job; it is not a clean comparison. |
| 45 | +3. Review added, dropped, and changed findings against the intent of the PR. |
| 46 | + Added findings can be useful coverage or false positives. Dropped findings |
| 47 | + can be fixed false positives or missed detections. Neither direction is |
| 48 | + automatically an improvement. |
| 49 | +4. Download the `liveness-primer-report` artifact for |
| 50 | + `liveness-primer-report.md` and the complete `liveness-primer-report.json`. |
| 51 | + The Markdown display can be truncated; use JSON for the full comparison. |
| 52 | + Artifacts are retained for 14 days, so save evidence needed for later work. |
| 53 | + |
| 54 | +Finding changes are advisory: the workflow does not use `--fail-on` gates. |
| 55 | +It preserves the primer's nonzero exit status and requires a nonempty JSON |
| 56 | +report. Available evidence is uploaded even if the comparison fails. A green |
| 57 | +check means the comparison completed, not that someone has approved its |
| 58 | +findings or proved the PR regression-free. |
| 59 | + |
| 60 | +If a change looks wrong, inspect the pinned source and turn the confirmed bug |
| 61 | +into a regression test or [Corpus Guard fixture](../corpus/README.md). Do not |
| 62 | +accept or reject a PR solely because its total finding count went down or up. |
| 63 | + |
| 64 | +## Reproduce a comparison |
| 65 | + |
| 66 | +Use a disposable Linux environment without credentials, with Git, Python 3.13, |
| 67 | +and uv 0.12.5 available. Managed runs build and execute the detector revisions; |
| 68 | +do not run an unfamiliar PR on your everyday development machine. Corpus |
| 69 | +projects are static-analysis inputs, not projects whose tests should be run. |
| 70 | + |
| 71 | +Clone the same primer revision: |
| 72 | + |
| 73 | +```bash |
| 74 | +git clone https://github.com/mcdigman/liveness_primer.git liveness-primer-check |
| 75 | +git -C liveness-primer-check checkout --detach d6f3118a2cfc465426500eab449005fe56845c58 |
| 76 | +``` |
| 77 | + |
| 78 | +Replace the two revision placeholders below with the full base and head SHAs |
| 79 | +from the report, not mutable branch names. The head is the reported merge SHA, |
| 80 | +not necessarily the PR branch tip. |
| 81 | + |
| 82 | +```bash |
| 83 | +uv run --project liveness-primer-check --python 3.13 --locked liveness-primer run \ |
| 84 | + --tool skylos \ |
| 85 | + --repo https://github.com/duriantaco/skylos \ |
| 86 | + --old BASE_SHA_FROM_REPORT \ |
| 87 | + --new MERGE_SHA_FROM_REPORT \ |
| 88 | + --all \ |
| 89 | + --output github \ |
| 90 | + --json-out liveness-primer-report.json \ |
| 91 | + --jobs 2 \ |
| 92 | + --timeout 300 |
| 93 | +``` |
| 94 | + |
| 95 | +The pinned primer requires enforced network isolation for managed runs on |
| 96 | +Linux and fails if it cannot establish it. CI uses a fresh GitHub-hosted |
| 97 | +runner, read-only repository permission, no passed secrets, no persisted |
| 98 | +checkout credentials, and no shared uv cache. Network isolation is not a |
| 99 | +complete filesystem sandbox; do not add credentials or use a persistent |
| 100 | +self-hosted runner for this job. |
| 101 | + |
| 102 | +The report records dependency versions and environment differences. A later |
| 103 | +run may resolve different detector dependencies even with the same source |
| 104 | +commits, so retain the original JSON when investigating a discrepancy. |
| 105 | + |
| 106 | +## Benchmarks and maintenance |
| 107 | + |
| 108 | +Primer reports can support change reviews and supply cases for the public |
| 109 | +[skylos-demo](https://github.com/duriantaco/skylos-demo) benchmarks. They do not |
| 110 | +supply ground-truth labels or precision/recall scores. Public accuracy claims |
| 111 | +still need labeled cases, pinned inputs, and the methodology in |
| 112 | +[BENCHMARK.md](../BENCHMARK.md). Corpus Guard and the existing benchmark gates |
| 113 | +remain in place. |
| 114 | + |
| 115 | +Keep corpus and adapter improvements upstream with Matthew, rather than |
| 116 | +copying the primer into Skylos. Propose threshold changes with examples and |
| 117 | +review them together; this integration does not impose new finding-count |
| 118 | +thresholds or transfer repository ownership. |
| 119 | + |
| 120 | +Update the primer pin in a separate reviewed change, run a fresh comparison, |
| 121 | +and inspect corpus, adapter, and report-schema changes before accepting it. |
| 122 | +Do not replace the pin with `main`. For example, upstream v0.1.1 adds file-level |
| 123 | +findings, so adopting it changes what this CI report covers. |
0 commit comments