Behind the build

How Ysra checks a code change before it says it's done

When you ask Code for a change, it runs your repository's own checks, has a reviewer that can't edit go through your acceptance criteria, and opens a real browser for anything people click. Every task ends "Your changes are ready" or "Didn't work", with one line that says what ran.

The Ysra team4 min read

Orange and dark waves with the words Behind the build and How Code checks a change

When you ask Ysra’s Code for a change, it checks the change before it tells you it’s done. It runs your repository’s own commands, has a separate reviewer go through what “done” means for this change, and opens a real browser for anything a person clicks.

Every task then ends one of two ways: Your changes are ready or Didn’t work. Both endings carry one plain line that says what ran, such as Ran: npm test (passed). This post explains what sits behind that line.

Starting a Code task in the Ysra web app, in a connected repository

Each result belongs to one version of the change

Every check is tied to the exact version of the change it looked at. If the code changes afterwards, the earlier result no longer counts. A build that rewrites source files, a repair, or going back to a saved point all mean the new version is checked again.

Checks run when the work needs them. If you ask for a small change “without tests”, none run, and the ending says Ran: nothing.

Your repository’s own checks

Before it edits anything, Code works out how your repository is checked: its install, lint, type-check, test and build commands. When the change needs checking, it runs the commands for the parts of the repository the change touches. A fix in the docs folder doesn’t run the whole backend test suite.

Some results get special handling:

  • A check that can’t run counts as a failure.
  • A test that was already failing before the change is reported as already failing. It isn’t blamed on the change, and it doesn’t block it.
  • A test that passes and fails on the same code is reported as flaky and never counted as proof.
  • Tests that Code writes itself count as evidence, but never as the only proof.

A review by something that didn’t write the code

A plan for a change has acceptance criteria: what “done” means for this task. After your checks, a separate reviewer reads the change, the criteria and the evidence so far, and marks each criterion proved, failed or unproved.

This reviewer can’t edit anything. A pass can’t override a failing check. Something a person clicks can’t pass on reading the source alone; it needs evidence from a real browser run. “We couldn’t test this” counts as unproved, never as a pass.

A real browser for what people click

When a criterion describes something a person does, Code turns it into concrete checks, such as “an invalid date shows an error”. It writes browser scenarios from your actual pages, runs the app, and carries each one out: typing, clicking, reloading, at desktop and phone widths. A written scenario isn’t proof. Only one that ran counts.

The checks a code change goes through, a repair when a defect is found, and the two endings

When a check fails

Only a concrete defect sends the work back. The repair is scoped to that defect, starts from the reviewed version, and re-runs only the checks the fix could affect. Code stops repairing when a fix no longer changes the result, so it doesn’t go round in circles.

A problem with the environment, like a port in use or a service that didn’t start, never triggers a code repair. It is reported as the environment’s problem.

Two endings

If the checks that ran passed, the task ends Your changes are ready. If your project’s checks still fail, it ends Didn’t work and says what failed in plain words. Either way the change is kept, and the Ran: line lists each command and how it went, plus the browser check if there was one.

When a repository has no tests

Plenty of repositories have none. Code then checks the change the way a person would: it runs the program with a sample input, opens the page, or calls the endpoint, and names each command it ran.

When a repository has no tests: what Code does when something ran and worked, when it failed, and when nothing could be run

If nothing could be run, it says so and asks you to try the change before relying on it. It never reports checks as passed when none ran.

You decide what ships

Ysra warns; it never blocks. A change that wasn’t fully checked can still be committed, pushed or deployed, and its Ran: line goes with it so everyone knows what they’re shipping. A pull request opens as a draft unless you ask otherwise, and you merge it.

The checks don’t replace your own review. Read the diff, look at which criteria are proved and which aren’t, and try the change yourself when it matters.

The details are in the docs: Review and verification.

  • Code
  • Verification
  • Pull requests

All posts