Nikasa, home Request an invite
DocsYour first compare

Your first compare

Give Nikasa some requests, an old image and a new image, and read what changed. Requests are what make the report worth reading, so they come first.

On this page

This page takes you from an app that starts in Nikasa to your first compare, and shows how to read its result.

You will:

  1. Choose the requests that drive your app.
  2. Build your change as a second image and compare the two.
  3. Compare a build with itself, to see that the report is quiet when it should be.

First, give it requests #

What a compare can see depends on what drives your app. Take the first of these that fits:

  1. Your app serves an OpenAPI or Swagger description. A healthy nk try has already written safe GET requests to nk/specs. Read that file, then go on.
  2. You have an end-to-end suite, in Playwright, Cypress, Postman, Bruno or anything else. Record it once, and Nikasa sends what it sent on every run.
  3. Neither. Write a few requests in a small text file. Each is a line or two, with no expected answers.

Run it #

The old image is the one nk try just started, from your main branch. Build your change as a second image, then compare the two:

shell
git checkout my-branch
docker build -t myapp:new .
nk compare myapp:old myapp:new

With nk/app.yaml in place, that is the whole command. Nikasa says what it picked up, one line each:

What Where it comes from
The app file nk/app.yaml, unless --app names another.
The requests Request files in nk/specs, or else a recorded session in nk/packs/main, unless --specs or --pack names others.
Where it writes The output folder out/nk, unless you give a folder after the two images.

CI scripts use the full form, which says all of it:

shell
nk compare myapp:old myapp:new out --app nk/app.yaml --specs nk/specs

Flags you give win over what is in nk/. With no app file, the command stops with exit 2 and names nk init.

What it does #

A compare makes its runs in three stages:

Stage What happens
Old runs The old build runs 3 times, each from nothing. What differs between those identical runs is learned as varying.
New runs The new build runs twice. A difference every new run shows is a candidate change. One only some new runs show is listed as unstable.
Confirming If there is a candidate, the old build runs until there are 8 old runs and the new build until there are 4 new runs. Only what all 8 old runs agree on and all 4 new runs show differently is counted.

A compare that finds nothing stops at the first 5 runs.

A compare takes about 5 to 15 minutes on a 4-core machine. Saved baselines roughly halve that by reusing the old build's runs.

What you get #

The report prints to your terminal and is written to the output folder. Its first line counts the changes, and the changes follow, most important first.

The sample showed you the short form. Reading the report explains every part.

Check that the report can be trusted #

Compare a build with itself:

shell
nk compare myapp:old myapp:old out/self

The two sides are the same image, so there is nothing real to find. A quiet app says:

output
no behaviour changes in what the requests exercised

If it lists something, that came from how your app behaves from run to run and not from your change. The report is noisy on your app says what to do about it.

Exit status #

Exit Meaning
0 The compare ran. The report lists any changes. A new build is expected to change things, so this is not a failure.
1 Only with --fail-on-change, and only when the report lists a change in every new run. An unstable change does not count, nor does one you accepted.
2 Nikasa could not compare, and the log says why. An old build that does not start is one such case, and so is a disk too short for a run before any new run was made.

A new build that never starts, when the old build started in every run, is a change like any other. The exit is 0, or 1 with --fail-on-change.

Nikasa stops trying the new build after its first run and writes a report headed the new build did not start. The report gives the reason, the first error line in the build's logs and where the logs are.

Options worth knowing #

Flag What it does
--fail-on-change Exits 1 when the report lists a change in every new run, for a merge gate or an upgrade check.
--ignore <place> Leaves out changes at a place, for this run only; * and ? match. To remember the choice, use nk accept.
--all Lists changes at startup and in the background instead of grouping them to one line per service.
--format text|json|markdown Picks what is printed. All the report files are written either way.
--jobs <n> Sets how many runs go at once, each on a sandbox network of its own.
--old-runs <n> Sets how many old runs to start with.
--new-runs <n> Sets how many new runs to start with.

Commands lists them all.

Next steps #

Written for nk 0.3.14. Something wrong or unclear? Write to hello@nikasa.dev.