Reading the report
A report lists what the new build did differently, most important first, and says plainly what it looked at and what it could not see.
On this page
This page walks through one report, then covers each part in turn. For a report from a real run, see the sample report. Words in a report lists what each word means.
An example #
In this made-up example, a one-line change makes myapp load each order twice. Every response is the same as before, and what changed is underneath: 3 changes, all in the calls the app made while serving requests.
3 changes in responses and requests
learned from 8 runs: 312 values fixed, 9 varying, 0 sometimes present, 0 links
checked 4 runs of the new build
driver made 10 requests: 200 x6, 201 x3, 204 x1
requests exercised 7 of 24 endpoints the app declares (/openapi.json)
cost per request, calls the app made to other services while serving each request:
0005 GET /api/orders/7: 6 calls to postgres:5432, was 3
"SELECT id, customer, total_cents FROM orders WHERE id = $1" ran 2 times, was 1
0002 GET /api/orders/7: 6 calls to postgres:5432, was 3
"SELECT id, customer, total_cents FROM orders WHERE id = $1" ran 2 times, was 1
COUNT /calls/app -> postgres:5432/"BEGIN" 1 -> 2, added {"params":[],"rows":[],"outcome":"BEGIN"}
2 scenarios: 0002 GET /api/orders/7, 0005 GET /api/orders/7
COUNT /calls/app -> postgres:5432/"SELECT id, customer, total_cents..." 1 -> 2, added {"params":["7"],...}
2 scenarios: 0002 GET /api/orders/7, 0005 GET /api/orders/7
COUNT /calls/app -> postgres:5432/"COMMIT" 1 -> 2, added {"params":[],"rows":[],"outcome":"COMMIT"}
2 scenarios: 0002 GET /api/orders/7, 0005 GET /api/orders/7Read it from the top:
| Part | What it tells you |
|---|---|
| The first line | Counts the changes. responses and requests means changes in responses and in the calls made while serving requests. |
learned from |
What the old runs taught Nikasa. It gives how many values were the same in every old run, how many differed from run to run, how many places were there in only some old runs, and how many pairs of values matched each other, such as an id one call returned and the next one sent. |
| The next lines | How much was compared: how many new runs were checked, what the driver got back, and how many endpoints the requests reached. |
| Cost per request | In numbers, what moved. Here this request made twice the calls to Postgres. |
| The changes | Each difference, and the requests that show it. |
The first line #
The first line counts the changes in responses and in calls during requests. It gives the total when other areas hold any:
2 changes in responses and requests; 3 in allWith none in responses or requests, it leads with the total and its areas:
3 changes: 2 at startup, 1 in the background; none in responses or requestsA report of more than 12 changes breaks that line down by area and lists the changes in responses first. An in short block follows, summing up the rest in a line each, and then the other changes in full.
--fail-on-change counts a change in any area.
Two other openings mean something special:
| The report opens with | What it means |
|---|---|
stopped early |
The report was written from the runs made before the disk ran short, so what it lists was not confirmed by every run Nikasa wanted. See When a compare stops early. |
Your tests drove this compare or Your tests did not drive this compare |
It comes from a CI job that records your tests. See Your tests drive the compare. |
The kinds of change #
Each change starts with one of five words:
| Kind | Means |
|---|---|
NEW, GONE |
Something appeared or disappeared |
VALUE |
A value changed |
COUNT |
Something happened more or fewer times |
SHAPE |
A value's structure changed |
LINK |
Two values that matched each other no longer do |
Each change names where it happened, which the report calls its place, and the scenarios that show it. A place looks like /response/body/total or /calls/app -> postgres:5432/"SELECT ...".
A change no request caused says where it was seen instead:
in the run's logsin the run's filesin the run's startupin the run's databasesin the run's containers
The order is most important first: responses, calls made while serving a request, the state the run ended with, name lookups, logs, telemetry, then startup and background work.
Startup and background work is grouped to one line per service and place unless you pass --all. It still counts:
app -> postgres:5432 at startup: 18 new, 2 gone, 34 changed (schema: 6 ALTER TABLE, 3 CREATE INDEX)Changes that show only sometimes #
What happens depends on how many runs show the bug:
| Case | What Nikasa does |
|---|---|
| Every run so far shows it | A compare makes 2 runs of the new build. When something shows in both, it makes 2 more, 4 in all, and the change counts when all 4 show it. |
| Some of those runs show it | It is listed under a line such as 2 unstable differences, seen in some but not all of 4 new runs, and it is not counted. |
| None of those runs show it | A rare, intermittent bug may not show in any of them, and then the report has nothing to say about it. |
To list the unstable differences, run:
nk report list <out-dir> --stability unstableNo option makes an unstable difference count. --new-runs <n> starts with more new runs, which gives a rare one more chances to show on the list.
Coverage: what a quiet report means #
Nikasa only sees what your requests make the app do. A quiet report means "no behaviour changes in what the requests exercised", and every report says how much that was.
| Part | What it says |
|---|---|
| Exercised | Each endpoint a request reached. |
| Not exercised | Each endpoint the app declares that no request reached, when Nikasa has the app's API description. A change there would not show until a request reaches it. |
How Nikasa finds the description #
Nikasa asks the app for its OpenAPI or Swagger description where frameworks serve one by default. It asks after each run's capture stops, so the asking stays out of the comparison.
| Flag | What it does |
|---|---|
--openapi <file> |
Gives the description as a file. |
--openapi / |
Names where the app serves it. |
gRPC methods in a run's schemas count as declared too.
What the last block says #
Every report ends with a block saying what the compare looked at:
- the starting state;
- what decided each service had started;
- which services no traffic reached;
- the protocols read and not read;
- what drove the runs;
- whose filesystems were compared;
- which programs gave TLS keys;
- how many values were masked.
Coverage never counts for --fail-on-change.
Cost per request #
When the calls the app made to one service while serving a request moved, a line says so:
0003 GET /api/orders: 5 calls to postgres:5432, was 1The statements that ran more often sit under it. Here is how to read it:
- Old runs that differed give their range (
was 58 to 62), and a new total inside that range is no cost. - Calls made by another service, such as a worker, name it.
- This line sums changes the report already lists, so it adds nothing to the count.
The report files #
Every compare writes these to its output folder:
| File | For |
|---|---|
report. |
Every change |
report. |
A pull request, with a ticket link beside each change |
report. |
Scripts. Its schema_version is 1.1 |
information. |
Every fact shown for information, one per line |
--format picks which one is printed.
To write the reports again without new runs, use --replay. It reads the runs an earlier compare left in that folder:
nk compare <old> <new> <out-dir> --replayReading it from a script or a coding agent #
nk report reads a report and writes nothing, so it is safe to hand to a coding agent:
nk report check out/nk # looks for a secret the masking on write missed
nk report list out/nk # counted changes, 25 a page; add --format json for an agent
nk report show out/nk nk-6f7cf426 # one change, with the lines that accept and mask itlist and show run the check first and refuse a report it flags, and nk report exits 1 when it does. Security and your data says exactly what these commands print.
One cause, one change #
A report groups lines that tell one change more than once, and marks them folded:. Everything grouped this way still counts, and report.txt lists each one.
| Situation | What the report does |
|---|---|
| A status changes | The other changes that follow from it in the same answer are grouped under it, and one line names every place: folded: 1 field gone from the old answer (body/ |
| The same response change shows at several places | It is grouped under the first line telling it: also told at / |
| Whole numbers all moved by one difference | They are one line: VALUE <path> 24 values, each moved by +3 |
| Stack frames of one runtime | They are one line per service: NEW / |
| A statement got back what a response above already showed | It is grouped under that response line. |
| Numbers renumbered one to one within one field | They are one VALUE: order_items. |
| A statement is replaced by one that differs only in its columns | It is one SHAPE: columns added: "o"."currency"; removed: "o"."curr" |
Lists are matched item by item, by what each item is and not where it stands. So an item added at the top is one COUNT and not a change to every item after it.
Pages sent as a component stream #
Some pages are sent as a component stream, with the type text/x-component, as Next.js sends them. Nikasa reads them as what their elements carry:
- the text of each element;
links,images,metaanderrors;- the props a server component hands a client one.
It does not read row numbers, chunk and module lists, build ids, class names or the router's tree, as they differ between builds of the same page. So a change only to those does not show.
A stream that cannot be read stays one string.
Shown but never counted #
These appear in the report for information, marked never counted as a change or told, never counted, and never count for --fail-on-change.
| What | How it shows |
|---|---|
| The build's own version | Values that only tell the version, by the two image tags, are one line: VALUE the build's version 1.4.0 -> 1.5.0, as the image tags give it (not counted). An upgrade whose only change is its version reports no change. |
A last-modified header |
An answer whose only change is its last-modified header, with or without its etag, joins the version line, as that tells only when its file was built. With a tag that holds no version, those stay counted. |
| Times | A time under a second, such as 4ms, is listed under times responses took. |
| Order | The same items in another order are listed under list order. |
| A console log line with a word or two changed | Such as a thread name or an id, it is printed as one line at the end. A changed severity of warn or worse still counts. |
| Unstable differences | Differences that only some new runs showed. |
| Places that came and went | Across identical old runs, and statements whose calls come and go between identical runs, such as those behind a cache. |
| Background workers | Those whose total work stayed within the old runs' range. A job a worker newly runs or no longer runs still counts. |
| Transport and image size | The HTTP and TLS versions each peer used, and an image that grew or shrank by at least 5% and 1 MB. |
| Calls a timer makes | A call that runs on a clock lands in a request one time more or less from run to run, so how often it ran is not compared. A changed value in it, or a clock call that is new or gone, still counts. |
| Outside calls seen in the background | With a pack that has cassettes, a call that nothing in the build's requests asked for, and that looks like a timer or comes from a service that does not run the build, is listed as seen in the background, not counted. What a recording keeps says when. |
When Nikasa cannot read something, it says so rather than staying silent. See Warnings that do not stop a compare.
Provenance #
The last block says exactly what was compared, so a verdict can be trusted and run again:
- Nikasa's version;
- when the runs started;
- every service's image by id;
- the compose files' hashes;
- the driver, the pack and the starting state.
It holds nothing from your services' environment.
What it reads on the wire #
| Kind | Protocols |
|---|---|
| Web | HTTP/1.1, HTTP/2, WebSocket, DNS, gRPC |
| Databases | Postgres, MySQL, SQL Server, Oracle, MongoDB, Cassandra, ClickHouse, Neo4j |
| Caches and queues | Redis, Memcached, Kafka, RabbitMQ, NATS, MQTT, STOMP, Pulsar, RocketMQ, AMQP 1.0, ZooKeeper |
| Other services | SMTP, LDAP, FTP, Thrift |
| Telemetry and logs | OTLP, Prometheus, Loki, Fluent, StatsD, syslog, GELF |
It also reads the rows of a SQLite file a service leaves. A connection in any other protocol is compared by its exchanges, with sizes shown, and the report says so.
Next steps #
- The sample report: a real report, and how its count adds up.
- Words in a report: every word the report uses.
- Accept expected changes: keep an agreed change out of the next report.
- Tickets from a report: link each change to a ticket.
- When something goes wrong: what to do when a compare stops or the report is noisy.
Written for nk 0.3.14. Something wrong or unclear? Write to hello@nikasa.dev.