Nikasa, home Request an invite
DocsAccept expected changes

Accept expected changes

Nikasa takes out the noise every app has. A change only your app has, such as a header that carries a build hash, you mark once and Nikasa remembers.

On this page

Some changes in a report are expected, such as a header that carries a build hash. Accept them once, and later compares leave them out of the count.

Accept a change #

  1. Run a compare:

    shell
    nk compare myapp:1.4 myapp:1.5 out
  2. Accept the changes you expect. To take the places matching a glob, give --only, and a --note to keep why:

    shell
    nk accept out --only '/response/headers/*' --note "etag is a build hash"
  3. Commit the file, so your team shares the decision:

    shell
    git add nk/accepted.yaml

--only <place> takes the places matching a glob, written the way the report writes them. In a glob, * is any run of characters. A place writes a list position as [*], as in /body/posts/[*]/id, so /body/posts/*/id matches it.

What the kinds mean #

The kind of a change says what changed:

Kind What changed
VALUE A value differs.
NEW A field or call appeared.
GONE A field or call disappeared.
COUNT Something happened more or fewer times.
SHAPE The structure of a value changed.

The kinds of change section of Reading the report has them all, and the Words in a report page defines the rest of the report's words.

Accept from a saved diff #

nk diff compares two saved sets of results without running anything, and nk accept can read its result too. Write the result to a file, and give that file instead of the folder:

shell
nk diff --format json > report.json

What it writes #

Entries go in nk/accepted.yaml in the folder you run from, or the file --file names. They are appended and never rewritten or deleted.

Each entry holds:

  • the kind, place and detail of one change;
  • the date you accepted it;
  • the nk version;
  • your --note.

In the examples on this page, the date stands in for the real one.

yaml
accepted:
  - kind: VALUE
    place: /response/headers/etag
    detail: '"a" -> "b"'
    date: YYYY-MM-DD
    nk: 0.3.14
    note: etag is a build hash

Commit the file. It is a record of what your team decided to live with.

What an entry matches #

An entry matches one exact change, by kind, place and detail. The same place with another value ("a" -> "c") is reported again.

Two kinds match more loosely, because their detail differs from run to run:

Kind It matches by
COUNT Its counts (3 -> 4), not the items named.
NEW Its place, since a new key's value can be made up each run. The value is never written to the file.

Accept a place at any value #

A value that is new in every build, such as an etag that carries a build hash, takes a new detail each upgrade. An exact entry then matches only once.

--any-value records each place --only names by its kind and place alone. --only is required.

shell
nk accept out --only '/response/headers/etag' --any-value

It writes this entry:

yaml
- kind: VALUE
  place: /response/headers/etag
  value: any
  date: YYYY-MM-DD
  nk: 0.3.14
  note: etag is a build hash

Such an entry leaves out every change of its kind at its place, whatever the value, and never another kind there. A VALUE entry does not leave out a NEW or GONE at its place.

Every form of the report still lists each change it leaves out, with its values and the requests it showed in. When an exact entry and one at any value both match a change, the exact one takes it.

What later runs do #

nk compare and nk diff read nk/accepted.yaml when it is there.

Flag What it does
--accepted <file> Reads another file, and fails if it is missing.
--no-accepted Reads none.

Matching changes are left out of the change count (the one in the report's first line: Words in a report) and of --fail-on-change. The report always says so:

output
accepted: 3 changes in nk/accepted.yaml (not counted)

Entries no run shows any more #

An entry no new run shows any more is listed once as no longer seen. Nikasa deletes nothing, so delete the entry when you like.

When a value moved, the new change is reported and the old entry shows as no longer seen beside it.

Leave a change out for one run #

--ignore <place> leaves out changes at a place for that run only, and the report says how many it left out. * and ? match.

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