DEV Community

Cover image for I Built a Jury for Pull Requests: What Fly.io Sprites Taught Me About "Tests Pass"
Amandeep Singh
Amandeep Singh Subscriber

Posted on

I Built a Jury for Pull Requests: What Fly.io Sprites Taught Me About "Tests Pass"

Uses Fly VMs to verify PR claims

"Fixed weak password hashing. Unit and API tests pass. There is no performance impact."

Would you merge that? The unit tests did pass. So did the API tests. And login had become far too slow for its own performance budget.

For Fly.io's Hacksgiving I built Perjury: comment /perjury on a pull request and a jury checks every claim in its description, then replies on the same PR.

What's a Sprite?

A Sprite is a hardware-isolated Linux VM with a persistent disk. It sleeps when idle and has its own URL. Two features matter here:

  • Checkpoint and restore: snapshot the whole filesystem, run something risky, rewind.
  • Connectors: Fly stores your GitHub credential and adds it at a gateway, so the machine never holds a token.

The Starting Point

My first idea was a lie detector for coding agents. The surprise was that, in my trials, the agent didn't lie.

What it did instead was more interesting. Two runs fixed the same tax bug in opposite ways. Each wrote its own fake pricing service to match its own assumption, watched the test pass, and reported that a 100 order now came to 118. At most one could be right.

Nobody lied, and nothing was proven. That became the idea: check what a description says against what a clean machine shows. Pull requests are where those descriptions matter, so I moved the court there.

How the Jury Works

How one trial works

Two Sprites. The court judges. The defendant runs the PR's code.

  1. A /perjury comment wakes the court through a webhook
  2. The court reads the PR through the GitHub connector
  3. It takes a checkpoint of the defendant, runs the repo's checks there, then restores it
  4. Claude, with no tools, splits the description into claims, and a frontend and a backend "juror" explain the results
  5. Code decides each verdict, and the court comments on the PR

For the security PR above, the reply looks like this:

Verdict Claim
PROVEN Unit tests pass.
PROVEN API tests pass.
FALSE There is no performance impact.

With the evidence attached: 5 logins took 839ms, budget is 250ms.

The model does not get a vote

The model only says which check a claim is about. The verdict is plain code:

if (!result) return ["unproven", "No check covers this."];
if (result.status === "skip") {
  return claim.holds
    ? ["hearsay", `Some tests in "${result.title}" do not run on a clean machine...`]
    : ["proven", `Some tests in "${result.title}" do not run on a clean machine.`];
}
const passed = result.status === "pass";
return [passed === claim.holds ? "proven" : "false", /* reason */];
Enter fullscreen mode Exit fullscreen mode

Hearsay is my favourite. "I tested the payment flow end to end" is not false when that test is skipped on a clean machine. It just rests on a setup only the author had.

Four Things Worth Stealing

1. A PR must not write its own exam

Each repo lists its checks in perjury.json. The court takes that file, and the ci/ scripts, from the base branch:

const COURT_OWNED = (path: string) => path === CONFIG || path.startsWith("ci/");
const kept = Object.entries(head).filter(([path]) => !COURT_OWNED(path));
const owned = Object.entries(base).filter(([path]) => COURT_OWNED(path));
Enter fullscreen mode Exit fullscreen mode

2. The webhook is only a hint

The court's URL is public, so it trusts nothing in the request body. It re-reads the comment from GitHub and acts only if the repository owner really wrote it:

const real = await getComment(repo, id).catch(() => null);
if (!real) return "ignored";
const matches = COMMAND.test(real.body.trim())
  && real.author_association === "OWNER"
  && real.issue_url.endsWith(`/issues/${number}`);
Enter fullscreen mode Exit fullscreen mode

Each comment ID is used once, so old comments cannot be replayed.

3. A sleeping VM does not finish your job

This one cost me. The webhook answered "The jury is out" and then nothing happened for four minutes, until something else woke the machine.

A Sprite with no open request can pause almost immediately, taking your background job with it. The fix is to hold it awake before you answer the request, using the Sprite's tasks API:

sprite-env curl -X PUT /v1/tasks/trial -d '{"expire":"30m"}'
Enter fullscreen mode Exit fullscreen mode

Then delete the task when the queue is empty. A trial now takes under a minute.

4. You can't point a connector at the platform itself

I wanted the court to control the defendant with no token at all, through a custom connector aimed at the Sprites API. Fly refuses: blocked: base URL targets the Sprites API itself. Fair. The court now holds a Sprites token restricted to the defendant's name, so it cannot even run a command on itself with it.

How to Use It

Add a perjury.json to your default branch. Each check is one shell command, and area picks the juror:

{
  "checks": [
    { "id": "unit", "area": "backend", "title": "Backend unit tests", "run": "go test -v ./..." },
    { "id": "ui", "area": "frontend", "title": "Frontend unit tests", "run": "node --test" }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Open a PR, describe it honestly (or not), and comment /perjury. Setup takes two Sprites, one connector and one webhook; the steps are in the README.

You can read four real verdicts on the sample eshop PRs.

What It Doesn't Do Yet

  • The Docker and Jenkins check only compares Go versions in the files. Nothing is built.
  • The end-to-end test calls a running backend without a browser.
  • The jury can map a claim to the wrong check, so the comment shows which check each verdict used.
  • A PR's own tests could try to fake their results.

TL;DR

  1. Green CI is not the same as a true description. Check the claims.
  2. Let the model read, let code decide. And give it no tools when it reads untrusted text.
  3. Run checks on a machine you can rewind.
  4. Read the check config from the base branch.
  5. Treat a webhook as a hint and re-fetch from the source.
  6. Hold your Sprite awake before you answer a request that starts background work.

The full source:

GitHub logo singhAmandeep007 / perjury

A jury for pull requests: comment /perjury and every claim in the description is checked. Built on Fly.io Sprites.

Perjury

A jury for pull requests. "Tests pass, no performance impact." Would you merge it?

Comment /perjury on a pull request A court on a Fly.io Sprite runs the repository's checks on a second Sprite that is rewound afterwards, rules on every claim in the description, and replies on the same pull request.

Built for Fly.io Hacksgiving 2026.

See it judge: Go upgrade · security fix · payment status · price separators

What it solves

A pull request arrives with a confident description, often written by a coding agent. Reviewers read it and trust it. Green CI says what passed, not whether the description matches it, and not that a test was skipped. Perjury checks the claims, one by one, against what a clean machine shows.

How it works

How one trial works

  1. You comment /perjury on a pull request.
  2. GitHub's webhook wakes the court Sprite. The court re-reads the comment through the…

PRs welcome. The jury will be waiting.

Top comments (8)

Collapse
 
kursatyz profile image
Kürşat Yılmaz •

Green unit tests on a password-hashing diff only validate single-request correctness under zero contention, completely hiding how memory-hard KDFs like Argon2id trigger OOM kills or event-loop starvation in TypeScript workers under concurrent login bursts. Evaluating PRs in isolated microVMs with adversarial checks exposes that tail-latency and memory-pressure cliff before a "no performance impact" merge saturates auth. Green suites still OOM production.

Collapse
 
visionwei profile image
Wei Bin •

What sticks with me is that the model never gets a vote — it only maps a claim to a check, and code decides the verdict. That separation is what makes it trustworthy to me, because otherwise I would just be trading one summary for another. I like the 'hearsay' verdict for skipped tests, since I have seen green runs skip the one check that mattered. How do you handle claims that are partly true, like a performance claim that passes in a single-user test but fails under concurrency — does the jury split the claim, or mark it false?

Collapse
 
aiframe profile image
AI Frame •

This is a really neat framing — green CI tells you the tests ran, not that the description is true. I especially liked "hearsay" as a verdict: a skipped test isn't a lie, it's just no evidence at all, and most review tools treat those the same. Reading perjury.json from the base branch is the detail I'd steal first; otherwise the PR really does get to write its own exam.

Collapse
 
sherotree profile image
Sherotree •

I keep thinking about the two agent runs that "fixed" the same tax bug in opposite ways, each inventing a fake pricing service so the test would go green. That's worse than a lie, because both descriptions can sound true until you rerun them on a clean machine. Checkpoint-and-restore on the defendant Sprite is what actually makes the court honest — otherwise a leftover fixture from one claim can prop up the next.

Collapse
 
prachitparikh profile image
Prachit Parikh •

The FALSE on "no performance impact" only exists because someone had already written the budget down: 250ms for login. Without that line it would have landed in UNPROVEN, and most PR descriptions are full of claims like it. So I'd treat the UNPROVEN count as a report of its own. Each one is a claim with no requirement behind it, and before merge it goes back to the author as one question: which check would show this? Sometimes the answer is a new test. Sometimes it's that the sentence shouldn't be in the description.

Collapse
 
humanonmute401 profile image
Human On Mute 401 •

Does it flag claims that aren't in the description at all? The PR that says nothing about performance worries me more than the one that says "no impact" and gets caught.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

treating the webhook as only a hint is the part worth stealing. the court re-reads the comment from GitHub and acts only if the owner really wrote it.

Collapse
 
the_daily_flare profile image
The daily flare •

Your 5 logins taking 839ms against a 250ms budget made me rethink how often my own green tests hide a real slowdown.