nukadoko 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +153 -0
- data/README.ja.md +6 -3
- data/README.md +6 -3
- data/lib/nukadoko/aria_snapshot.rb +4 -4
- data/lib/nukadoko/base.rb +49 -29
- data/lib/nukadoko/check.rb +62 -5
- data/lib/nukadoko/claim_check.rb +2 -2
- data/lib/nukadoko/claim_rules.rb +1 -1
- data/lib/nukadoko/claim_sides.rb +481 -0
- data/lib/nukadoko/claims.rb +182 -20
- data/lib/nukadoko/cli.rb +24 -7
- data/lib/nukadoko/codes.json +20 -15
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/env_check.rb +1 -3
- data/lib/nukadoko/fixtures.rb +53 -21
- data/lib/nukadoko/init.rb +0 -1
- data/lib/nukadoko/js_json.rb +274 -0
- data/lib/nukadoko/js_pattern.rb +531 -0
- data/lib/nukadoko/parameter_types.rb +54 -0
- data/lib/nukadoko/parts.rb +1 -1
- data/lib/nukadoko/pattern.rb +112 -2
- data/lib/nukadoko/poll.rb +5 -3
- data/lib/nukadoko/program.rb +5 -5
- data/lib/nukadoko/project_files.rb +17 -0
- data/lib/nukadoko/project_program.rb +119 -0
- data/lib/nukadoko/run.rb +62 -17
- data/lib/nukadoko/run_record.rb +25 -22
- data/lib/nukadoko/scaffold.rb +2 -2
- data/lib/nukadoko/schema.rb +60 -18
- data/lib/nukadoko/secrets.rb +20 -4
- data/lib/nukadoko/spaces.rb +28 -0
- data/lib/nukadoko/step.rb +7 -1
- data/lib/nukadoko/text_fit.rb +1 -1
- data/lib/nukadoko/trace_actions.rb +4 -2
- data/lib/nukadoko/tree_passes.rb +6 -3
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko.rb +26 -2
- data/llms.txt +20 -18
- data/sig/generated/nukadoko/aria_snapshot.rbs +2 -2
- data/sig/generated/nukadoko/base.rbs +24 -18
- data/sig/generated/nukadoko/check.rbs +11 -1
- data/sig/generated/nukadoko/claim_sides.rbs +216 -0
- data/sig/generated/nukadoko/claims.rbs +46 -3
- data/sig/generated/nukadoko/cli.rbs +1 -1
- data/sig/generated/nukadoko/env_check.rbs +0 -4
- data/sig/generated/nukadoko/fixtures.rbs +25 -2
- data/sig/generated/nukadoko/init.rbs +0 -2
- data/sig/generated/nukadoko/js_json.rbs +109 -0
- data/sig/generated/nukadoko/js_pattern.rbs +194 -0
- data/sig/generated/nukadoko/parameter_types.rbs +27 -0
- data/sig/generated/nukadoko/pattern.rbs +59 -1
- data/sig/generated/nukadoko/poll.rbs +3 -2
- data/sig/generated/nukadoko/program.rbs +1 -1
- data/sig/generated/nukadoko/project_files.rbs +19 -0
- data/sig/generated/nukadoko/project_program.rbs +55 -0
- data/sig/generated/nukadoko/run.rbs +17 -3
- data/sig/generated/nukadoko/run_record.rbs +5 -4
- data/sig/generated/nukadoko/schema.rbs +22 -4
- data/sig/generated/nukadoko/secrets.rbs +17 -2
- data/sig/generated/nukadoko/spaces.rbs +31 -0
- data/sig/generated/nukadoko/trace_actions.rbs +3 -1
- data/sig/generated/nukadoko/tree_passes.rbs +2 -2
- data/sig/generated/nukadoko.rbs +11 -0
- data/skills/nukadoko/SKILL.md +2 -2
- data/skills/nukadoko/references/diagnosing.md +1 -1
- data/skills/nukadoko/references/examples/http-api.md +19 -16
- data/skills/nukadoko/references/fixtures.md +1 -1
- data/skills/nukadoko/references/perturbed-worlds.md +8 -6
- data/skills/nukadoko/references/program.md +20 -20
- data/skills/nukadoko/references/running.md +2 -2
- data/skills/nukadoko/references/scenario-rules.md +2 -2
- data/skills/nukadoko/references/verdicts.md +3 -3
- data/skills/nukadoko/references/writing-steps.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +6 -6
- metadata +19 -5
data/llms.txt
CHANGED
|
@@ -11,16 +11,16 @@ A step either runs (`run`) or claims (`claims`). Only a Then claims, and a Then
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
- `npm install -D nukadoko` installs the `nuka` CLI. It installs no browser. Playwright is an optional peer, needed only by a step whose fixtures build `page`, `context`, `pageAs`, or `request`; `nuka check` reports `playwright-missing` for such a step when Playwright does not resolve. README.md "Install" names the Node and Playwright versions.
|
|
14
|
-
- `npx nuka init` writes `nukadoko.config.ts` (`nukadoko.config.mts` in a project whose `package.json` has no `"type": "module"`, and step files are then `.mts` too, which it says on stderr), creates `features/steps/`, adds a `test:scenarios` script, adds `.nukadoko/`, `.env`, `.env.*`, and `!.env.example` to `.gitignore`, and, when `tsconfig.json` exists, adds the steps and the config to its `include` and `rewriteRelativeImportExtensions` to its `compilerOptions`. stdout lists each path it wrote; a failed self-check exits 1. `nuka init --allure` writes `allurerc.mjs` and creates `.nukadoko/export/allure-results/` for `nuka report --format allure`. Set another `featuresDir` in the config afterwards when the features live elsewhere. `nuka init` writes no program
|
|
14
|
+
- `npx nuka init` writes `nukadoko.config.ts` (`nukadoko.config.mts` in a project whose `package.json` has no `"type": "module"`, and step files are then `.mts` too, which it says on stderr), creates `features/steps/`, adds a `test:scenarios` script, adds `.nukadoko/`, `.env`, `.env.*`, and `!.env.example` to `.gitignore`, and, when `tsconfig.json` exists, adds the steps and the config to its `include` and `rewriteRelativeImportExtensions` to its `compilerOptions`. stdout lists each path it wrote; a failed self-check exits 1. `nuka init --allure` writes `allurerc.mjs` and creates `.nukadoko/export/allure-results/` for `nuka report --format allure`. Set another `featuresDir` in the config afterwards when the features live elsewhere. `nuka init` writes no program; `--server` and `--server-url` are removed and name the config's `program`.
|
|
15
15
|
- Run `nuka` from the directory that holds the config. Elsewhere every command says on stderr that no config was found, names one in a parent directory if there is one, and runs on the defaults; `nuka scaffold` refuses there.
|
|
16
|
-
- `nukadoko.program.ts`, beside the config, describes the program under test: `export default defineProgram({ build, prepare, serve: { command, port, ready, timeout_ms }, url, env, setup, lists, environments })`, with `defineProgram` imported from `nukadoko`. `build` commands run once per run in the tree's root; `prepare` runs once per world with the world's env; `serve` starts the program on a free port (`port: "auto"`, the default) and waits until `ready` (default `/`) answers 2xx within `timeout_ms` (default 60000; every `timeout_ms` is a whole number of milliseconds from 1 to 2147483647, the longest delay a Node.js timer keeps); `url`, a string or a function of `{ name, root, dir, signal }`, names a program nukadoko does not start, and is exclusive with `serve`; `setup(world)` runs after `ready`, before the first scenario. `lists: { routes, flags, tables }` names one command per kind of place the program has, each printing one JSON object per line in the words the execution events use: `{ method, route, handler? }` (the method uppercase, the route's template, and what it runs in the program's own words) or `{ name, sides }`, or `{ table, holds? }`, what the table holds in the program's own declaration (`state`, the default, `bookkeeping`, such as telemetry or an audit trail, or `infrastructure`, such as applied migrations, a job queue, or a cache), plus keys of the program's own that start `x_`; an entry printed twice is one, and a table printed with two holdings is refused. In a world nukadoko serves with `{events}`, of the tree the run started in (the `tables` command of every tree, and of `nuka do`'s world when its step counts execution events), each runs once after `setup`, in the root with the world's env and placeholders, within 60000 ms (`{ command, timeout_ms }`), its stderr in `program.log`; a world at a `url` and one with no events file read none, the base and old worlds and `nuka do` read no `routes` or `flags`, and an environment's `lists` replaces the top level's whole. A list is read whole or not at all: a command that cannot start, exits non-zero, passes its limit, prints more than 16 MiB, or prints one line that is not one entry of its kind (a key that is neither the kind's nor `x_`, a lowercase method) leaves that list unread, fails no world and no row, and raises the `program-list-unread` warning naming the command and the line (a base or old world's names its tree, and `nuka do` raises it for its tables list). What the work of `setup` or a `url` function prints goes to stderr and `program.log`, redacted; one past its `timeout_ms` is abandoned, and the `signal` in its argument is aborted then and when a signal stops the start, so it stops only if it honours that signal. A command is an argv array or a string split on whitespace, never through a shell. `env` values and command words fill `{port}` (the port `serve` got, or the `url`'s, as written or the scheme's), `{url}`, `{dir}` (the world's directory, `.nukadoko/runs/<run_id>/worlds/<env>/`), `{root}`, `{world}`, `{token}` (random per world, redacted as `{{secret.WORLD_TOKEN}}`), `{events}` (in a world nukadoko serves, the absolute path of an empty file for the program's execution events, made with mode 0600 in a 0700 directory of its own outside the run directory and removed when the world stops), and `{condition.<name>}` (the value the world's environment declares under `conditions`, as text); a placeholder with no value in that world (`{port}` or `{url}` with neither `serve` nor `url`, `{events}` without `serve`, a `{condition.<name>}` its environment does not declare, anything but `{root}` in `build`) is refused by name, by `nuka check` for the worlds a `nuka run` with the same `--env` flags would start and by `nuka run` and `nuka do` for the worlds they start. The program's processes and the steps' process both get `env`, except that a variable whose value names `{events}` reaches only the program, so no step's code and no process a step starts can append to the events file. `nuka run` starts one world per environment before its BeforeAll hooks and stops it after the scenarios; the world's URL is the base URL of `page`, `context`, `pageAs`, `request`, and the `baseURL` fixture. `nuka do` starts one for its execution. `program.log` in the world's directory holds what every command printed, redacted. run.json's `worlds` lists each world (`name`, `tree`, `url`, `commands`, `timings`, `log`, `error`, `program_log: { stamped, lines, late, tagged }`, counted when the world stops, `null` for a world at a `url`, and `events: { file, lines, owned, late, unowned, unreadable, undefined_kinds }` when the program file names `{events}`, `null` for a world at a `url`, and `lists: { <kind>: { entries, error } }` for each list it read, `entries` counting its places once and `null` with the `error` that says why it was not read, absent when it read none; a `lists` command is a `commands` entry with `phase: "lists"`, timed in `lists_ms`), and each step record names its world in `world_name`. Every request a step sends to the world's origin (through `fetch`, `node:http`, `node:https`, a Playwright request context, or a Chromium page's documents, fetches, XHRs, and EventSources; for a `localhost` world, a name below `localhost` at its port too) carries a W3C `traceparent` with one trace id per step or hook (a Before, AfterStep, or After hook's requests carry the hook's own, recorded in the scenario's directory; a BeforeAll or AfterAll hook's, and the `fetch`, `node:http`, and `node:https` requests of a fixture's setup or teardown, go without one), all of a world's starting with the same eight hexadecimal characters, and a span id per request; a request that sets its own, or whose request context's `extraHTTPHeaders` set one, keeps it, and a `node:http` request is stamped as its headers are sent, so one the step sets after creating it is kept. A redirect to another origin takes no header: `fetch` is stamped on each hop to the world as undici sends it (the `undici:request:create` channel), with the step's arguments untouched; the exception is a Playwright request context, which sends a call's headers on with a redirect. An http.jsonl line names the `traceparent` the request went out with, nukadoko's or the step's own (a page's line, as the browser sent it), and then always `traceparent_sent_to`, the origins that received it (a request context's first hop and final response; an origin between them is not known); a step's `stamped` counts only the requests that went out with nukadoko's value. When nukadoko serves the program, a line of `program.log` belongs to the step whose trace id it carries (the first place in the line where the world's eight characters begin 32 hexadecimal ones), wherever and whenever it appears, and redaction never changes a trace id of the world or a `traceparent` value holding one; each step record gets its lines so far in `program-log.txt` beside it, redacted, and `observed.program_log: { trace_id, lines, file, stamped, truncated? }` (`file` is `null` when `lines` is 0); a step that stamped a request waits up to 300 ms for its lines, until none carrying its trace id has arrived for 30 ms after the step ended. A line that arrives later goes to the step's `program-log-late.txt` when the world stops, run.json's step gets `program_log_late: { lines, file, truncated? }`, the run summary names it on the step's line, and `nuka do` prints a `program-log-late` note; the record is not rewritten. The program must write the id into its lines: for Rails, `config.log_tags = [ ->(request) { request.headers["traceparent"] } ]` with the test log sent to stdout. The run summary says once per world, decided from the whole log, when no line carries a trace id of the world, how many lines arrived after their step ended (and only when none came in time, that output buffered on a pipe looks like that: `STDOUT.sync = true` in Ruby, `PYTHONUNBUFFERED=1` for Python), and when it was not read because the world runs at a `url`; there `observed.program_log` is `null`. A program that names `{events}` (`env: { EXECUTION_EVENTS: "{events}" }`) can append one JSON line per operation it ends to that file, in the format of docs/execution-events.md (`request`, `db`, `tx`, `job`, `http`, `flag`, `error`, and a writer's own `x_` kinds), each carrying the request's `traceparent` or, for a job, the one that enqueued it, at most 4095 bytes in one write call; a line belongs to the step whose trace id its parsed `trace` field holds, a line that does not read belongs to none and counts in `unreadable` for the step whose trace id its text carries, and each step record gets its lines, parsed, redacted (trace ids kept), and written again as JSON, in `events.jsonl` beside it, with `observed.events: { trace_id, lines, file, kinds, stamped, stamped_spans, unreadable, unowned, process_spans, process_requests, whole, open }`, with `mcp_spans` when the step sent an MCP call (`stamped_spans` are the span ids of the stamped requests, at most 1000; `process_requests` counts the request lines that carry a span a `runCommand` process got in its TRACEPARENT; `mcp_spans` are the spans of the step's MCP calls, below), read with the same wait as the program's log. `whole` is `true` when every request the step stamped has its `request` line (by span id), every job enqueued in the trace performed, every `runCommand` process it ran closed with no process of its group left, and every MCP call it sent went out in a stamped request; otherwise `open` names why, one gap word each in this order: `no-requests` (no stamped request, no `runCommand` process, and no MCP call), `processes-unbounded` (a `runCommand` process may still send: it still ran when the record was built, left a process of its group running, or ran on Windows; one that leaves its group, as a daemon does with `setsid`, is not seen), `mcp-unbounded` (`calls`: MCP calls that reached their server over stdio or another origin, whose end no line reports), `no-lines`, `request-unreported` (`requests`), `jobs-pending` (`job_ids`), `unreadable` (`lines`), `truncated`, `file-replaced`. A line that arrives later goes to the step's `events-late.jsonl`, run.json's step gets `events_late: { lines, file, truncated? }`, and `nuka do` prints an `events-late` note; the world's stop also gives each step of a world with an events file `path: { requests, entries, maybe, open }`, its trace counted by what each line did over every line, late ones included: `requests` each `request` line's `method`, `route`, `status` in the order the step sent them, `entries` with `count` by kind in this order, `error` (`class`, `handled`), `db` writes (`table`, `op`, and `holds` on a table the tables list marks as `bookkeeping` or `infrastructure`, whose writes stay in the path; reads are left out for now, as are `tx` lines, ids, and actors), `http` (`method`, `origin`, `path`, `status`), `job` (`name`, `phase`), `flag` (`name`, `side`, with `gates`), `maybe` the lines that may be any line, and `open` the gap words over every line; the world's redacted copy is `worlds/<env>/events.jsonl`, and the run summary gives the world one line when the file was not read, got no line, or holds lines no step record holds. A world at a `url` refuses `{events}`, and its steps' `observed.events` is `null`. A claim step's `events: { <key>: { of, count } }` counts lines of an earlier step's trace: `of` is that step or a list of candidates of which one ran earlier (the latest run of it counts; none leaves the claim `unjudged` with `producer-not-run`, two leave it `unjudged`), and `count` is `{ kind, ...fields }` with the format's kinds and fields, each field one value or a list, a value `{ sentence: "<capture>" }` taken from the line (the capture then counts as read), a `db` selection whose `op` may be a write stating `committed`, a `db` selection that names no `table` leaving out each line on a table the tables list says holds `bookkeeping` or `infrastructure` (one that names a table counts it whatever it holds), and a writer's own `x_` kind, an undefined kind or field, or a bad value refused at import. A claim names the key alone as its `actual` (no `view`, `at`, `count`, `each`, or path), compares with `equal`, `not-equal`, `greater-than`, `at-least`, `less-than`, or `at-most` against a number the line states (a `{n:int}` capture, digits, a number word, `once`, `twice`, or `never`, `no`, `none`, `nothing` as 0 under `equal`), and an events key shares no name with a `from` or args key and is read by a claim. When the claims are judged, the step reads the trace's lines from where that step's slice began and waits while its events may still become whole (`no-lines`, `request-unreported`, `jobs-pending`), up to its `timeout`, else 10 s, or a shorter `stepTimeout`, never until a claim holds. The count is a range, `[yes, yes + maybe]` when whole and unbounded above when not (`maybe`: lines that did not read, of an undefined kind or version, missing a field the selection reads, `holds_unknown`, a `db` line on a table the count may leave out because the tables list was not read or the writer named its table `unknown` while the list marks one, a write of unknown commit state, or owned by no step), and the claim holds or breaks only when every count in it agrees, else it is `unjudged` with the gap word in its reason (`kind-unreported` while the world has reported no line of the kind; `world-unread` at a `url`; `inlet-unnamed` without `{events}`). The record holds the count as `actual` when it is one number, else `actual_range`, then `counted`, `actual_from` `events:<step>@<line> count <selection>`, `measured` `{ step_record_id: <own>, channel: "events_read.<key>" }`, and the step's `events_read.<key>`, `{ of, trace_id, count, range, counted, whole, open, maybe, lines, unreadable, unowned, file, waited_ms }`, with the lines it counted in `events-read.jsonl`; run.json's step carries `events_read` too. `counted` groups the lines the count counted, most first, as `{ kind, fields, lines }` by the kind's fields (`request` method, route, status; `db` op, table; `tx` phase; `job` name, phase; `http` method, origin, status; `flag` name, side; `error` class, handled), every group listed, and the claim's line names the first three under every outcome (`...; counted 1 line: db insert into events`, `counted 3 lines: 2 db insert into scores, 1 db update rankings`, then `and 4 more lines in 2 groups`); `left_out`, present when the count left a line out, groups those lines the same way with each group's `holds`, on the claim and in `events_read`, and the line adds `; left out 1 line: db insert into events (bookkeeping)` after what it counted. When the world stops, each reading is counted again over every line of the trace, and a claim the whole count judges otherwise gets `after_world_stop: { lines, range, outcome, reason }` in run.json, the reason naming the lines the whole count counted that the claim's did not (`and the stop counted 1 more line: db insert into scores`), and its cell is `broke` (`a claim at line <n> was judged before every execution event it counts had arrived`). `nuka run` also raises the note `undeclared-write` for a head step that declares `mutates: false` whose trace holds a write the program committed to a table that holds state (late lines included; not a write that rolled back, one of unknown commit state, or any when the tables list was not read), once per step line of a scenario and environment, naming the step, the table, and the op: `the step at line 6, get, declares mutates: false, and its trace holds writes the program committed to tables that hold state, 1 line: db insert into scores`; it changes no status and no exit code, and never reads a request's method as a write. A world that does not start is `program-start-failed`, with the end of `program.log`; no scenario runs in it. `environments` entries override any of those fields (`env` merges by key) and add `policy: "read-only"`, `envFiles` (after the config's), a `version` probe, and `conditions`, the switches of the program that environment runs, each `true`, `false`, or a string with no whitespace and no `@` (`{ banner: true, locale: "ja" }`; the strings `"true"` and `"false"` are refused, since a string reads as on), which a scenario's `@with:` and `@without:` tags read (see `nuka run`); they set nothing, which `env` and the env files do, and nukadoko trusts them without checking the program, so derive the switch from them (`env: { BANNER: "{condition.banner}" }`). The top-level `defaultEnvironments: [<names>]` names the environments a run without `--env` starts, each an environment of the file or `default`. A tree with no program file starts no world, which suits a command-line tool. `baseURL` and `environments` in the config are refused, naming this file.
|
|
16
|
+
- `program` in `nukadoko.config.ts` describes the program under test: `program: () => ({ build, prepare, serve: { command, port, ready, timeout_ms }, url, env, setup, lists, environments })`, a function the config calls once; a change to it is not a change to the mapping `nuka run --base` compares, while its environments' `conditions` and `defaultEnvironments` are. A `nukadoko.program.ts` of an earlier release is refused with `program-file-moved`. `build` commands run once per run in the tree's root; `prepare` runs once per world with the world's env; `serve` starts the program on a free port (`port: "auto"`, the default) and waits until `ready` (default `/`) answers 2xx within `timeout_ms` (default 60000; every `timeout_ms` is a whole number of milliseconds from 1 to 2147483647, the longest delay a Node.js timer keeps); `url`, a string or a function of `{ name, root, dir, signal }`, names a program nukadoko does not start, and is exclusive with `serve`; `setup(world)` runs after `ready`, before the first scenario. `lists: { routes, flags, tables }` names one command per kind of place the program has, each printing one JSON object per line in the words the execution events use: `{ method, route, handler? }` (the method uppercase, the route's template, and what it runs in the program's own words) or `{ name, sides }`, or `{ table, holds? }`, what the table holds in the program's own declaration (`state`, the default, `bookkeeping`, such as telemetry or an audit trail, or `infrastructure`, such as applied migrations, a job queue, or a cache), plus keys of the program's own that start `x_`; an entry printed twice is one, and a table printed with two holdings is refused. In a world nukadoko serves with `{events}`, of the tree the run started in (the `tables` command of every tree, and of `nuka do`'s world when its step counts execution events), each runs once after `setup`, in the root with the world's env and placeholders, within 60000 ms (`{ command, timeout_ms }`), its stderr in `program.log`; a world at a `url` and one with no events file read none, the base and old worlds and `nuka do` read no `routes` or `flags`, and an environment's `lists` replaces the top level's whole. A list is read whole or not at all: a command that cannot start, exits non-zero, passes its limit, prints more than 16 MiB, or prints one line that is not one entry of its kind (a key that is neither the kind's nor `x_`, a lowercase method) leaves that list unread, fails no world and no row, and raises the `program-list-unread` warning naming the command and the line (a base or old world's names its tree, and `nuka do` raises it for its tables list). What the work of `setup` or a `url` function prints goes to stderr and `program.log`, redacted; one past its `timeout_ms` is abandoned, and the `signal` in its argument is aborted then and when a signal stops the start, so it stops only if it honours that signal. A command is an argv array or a string split on whitespace, never through a shell. `env` values and command words fill `{port}` (the port `serve` got, or the `url`'s, as written or the scheme's), `{url}`, `{dir}` (the world's directory, `.nukadoko/runs/<run_id>/worlds/<env>/`), `{root}`, `{world}`, `{token}` (random per world, redacted as `{{secret.WORLD_TOKEN}}`), `{events}` (in a world nukadoko serves, the absolute path of an empty file for the program's execution events, made with mode 0600 in a 0700 directory of its own outside the run directory and removed when the world stops), and `{condition.<name>}` (the value the world's environment declares under `conditions`, as text); a placeholder with no value in that world (`{port}` or `{url}` with neither `serve` nor `url`, `{events}` without `serve`, a `{condition.<name>}` its environment does not declare, anything but `{root}` in `build`) is refused by name, by `nuka check` for the worlds a `nuka run` with the same `--env` flags would start and by `nuka run` and `nuka do` for the worlds they start. The program's processes and the steps' process both get `env`, except that a variable whose value names `{events}` reaches only the program, so no step's code and no process a step starts can append to the events file. `nuka run` starts one world per environment before its BeforeAll hooks and stops it after the scenarios; the world's URL is the base URL of `page`, `context`, `pageAs`, `request`, and the `baseURL` fixture. `nuka do` starts one for its execution. `program.log` in the world's directory holds what every command printed, redacted. run.json's `worlds` lists each world (`name`, `tree`, `url`, `commands`, `timings`, `log`, `error`, `program_log: { stamped, lines, late, tagged }`, counted when the world stops, `null` for a world at a `url`, and `events: { file, lines, owned, late, unowned, unreadable, undefined_kinds }` when the program names `{events}`, `null` for a world at a `url`, and `lists: { <kind>: { entries, error } }` for each list it read, `entries` counting its places once and `null` with the `error` that says why it was not read, absent when it read none; a `lists` command is a `commands` entry with `phase: "lists"`, timed in `lists_ms`), and each step record names its world in `world_name`. Every request a step sends to the world's origin (through `fetch`, `node:http`, `node:https`, a Playwright request context, or a Chromium page's documents, fetches, XHRs, and EventSources; for a `localhost` world, a name below `localhost` at its port too) carries a W3C `traceparent` with one trace id per step or hook (a Before, AfterStep, or After hook's requests carry the hook's own, recorded in the scenario's directory; a BeforeAll or AfterAll hook's, and the `fetch`, `node:http`, and `node:https` requests of a fixture's setup or teardown, go without one), all of a world's starting with the same eight hexadecimal characters, and a span id per request; a request that sets its own, or whose request context's `extraHTTPHeaders` set one, keeps it, and a `node:http` request is stamped as its headers are sent, so one the step sets after creating it is kept. A redirect to another origin takes no header: `fetch` is stamped on each hop to the world as undici sends it (the `undici:request:create` channel), with the step's arguments untouched; the exception is a Playwright request context, which sends a call's headers on with a redirect. An http.jsonl line names the `traceparent` the request went out with, nukadoko's or the step's own (a page's line, as the browser sent it), and then always `traceparent_sent_to`, the origins that received it (a request context's first hop and final response; an origin between them is not known); a step's `stamped` counts only the requests that went out with nukadoko's value. When nukadoko serves the program, a line of `program.log` belongs to the step whose trace id it carries (the first place in the line where the world's eight characters begin 32 hexadecimal ones), wherever and whenever it appears, and redaction never changes a trace id of the world or a `traceparent` value holding one; each step record gets its lines so far in `program-log.txt` beside it, redacted, and `observed.program_log: { trace_id, lines, file, stamped, truncated? }` (`file` is `null` when `lines` is 0); a step that stamped a request waits up to 300 ms for its lines, until none carrying its trace id has arrived for 30 ms after the step ended. A line that arrives later goes to the step's `program-log-late.txt` when the world stops, run.json's step gets `program_log_late: { lines, file, truncated? }`, the run summary names it on the step's line, and `nuka do` prints a `program-log-late` note; the record is not rewritten. The program must write the id into its lines: for Rails, `config.log_tags = [ ->(request) { request.headers["traceparent"] } ]` with the test log sent to stdout. The run summary says once per world, decided from the whole log, when no line carries a trace id of the world, how many lines arrived after their step ended (and only when none came in time, that output buffered on a pipe looks like that: `STDOUT.sync = true` in Ruby, `PYTHONUNBUFFERED=1` for Python), and when it was not read because the world runs at a `url`; there `observed.program_log` is `null`. A program that names `{events}` (`env: { EXECUTION_EVENTS: "{events}" }`) can append one JSON line per operation it ends to that file, in the format of docs/execution-events.md (`request`, `db`, `tx`, `job`, `http`, `flag`, `error`, and a writer's own `x_` kinds), each carrying the request's `traceparent` or, for a job, the one that enqueued it, at most 4095 bytes in one write call; a line belongs to the step whose trace id its parsed `trace` field holds, a line that does not read belongs to none and counts in `unreadable` for the step whose trace id its text carries, and each step record gets its lines, parsed, redacted (trace ids kept), and written again as JSON, in `events.jsonl` beside it, with `observed.events: { trace_id, lines, file, kinds, stamped, stamped_spans, unreadable, unowned, process_spans, process_requests, whole, open }`, with `mcp_spans` when the step sent an MCP call (`stamped_spans` are the span ids of the stamped requests, at most 1000; `process_requests` counts the request lines that carry a span a `runCommand` process got in its TRACEPARENT; `mcp_spans` are the spans of the step's MCP calls, below), read with the same wait as the program's log. `whole` is `true` when every request the step stamped has its `request` line (by span id), every job enqueued in the trace performed, every `runCommand` process it ran closed with no process of its group left, and every MCP call it sent went out in a stamped request; otherwise `open` names why, one gap word each in this order: `no-requests` (no stamped request, no `runCommand` process, and no MCP call), `processes-unbounded` (a `runCommand` process may still send: it still ran when the record was built, left a process of its group running, or ran on Windows; one that leaves its group, as a daemon does with `setsid`, is not seen), `mcp-unbounded` (`calls`: MCP calls that reached their server over stdio or another origin, whose end no line reports), `no-lines`, `request-unreported` (`requests`), `jobs-pending` (`job_ids`), `unreadable` (`lines`), `truncated`, `file-replaced`. A line that arrives later goes to the step's `events-late.jsonl`, run.json's step gets `events_late: { lines, file, truncated? }`, and `nuka do` prints an `events-late` note; the world's stop also gives each step of a world with an events file `path: { requests, entries, maybe, open }`, its trace counted by what each line did over every line, late ones included: `requests` each `request` line's `method`, `route`, `status` in the order the step sent them, `entries` with `count` by kind in this order, `error` (`class`, `handled`), `db` writes (`table`, `op`, and `holds` on a table the tables list marks as `bookkeeping` or `infrastructure`, whose writes stay in the path; reads are left out for now, as are `tx` lines, ids, and actors), `http` (`method`, `origin`, `path`, `status`), `job` (`name`, `phase`), `flag` (`name`, `side`, with `gates`), `maybe` the lines that may be any line, and `open` the gap words over every line; the world's redacted copy is `worlds/<env>/events.jsonl`, and the run summary gives the world one line when the file was not read, got no line, or holds lines no step record holds. A world at a `url` refuses `{events}`, and its steps' `observed.events` is `null`. A claim step's `events: { <key>: { of, count } }` counts lines of an earlier step's trace: `of` is that step or a list of candidates of which one ran earlier (the latest run of it counts; none leaves the claim `unjudged` with `producer-not-run`, two leave it `unjudged`), and `count` is `{ kind, ...fields }` with the format's kinds and fields, each field one value or a list, a value `{ sentence: "<capture>" }` taken from the line (the capture then counts as read), a `db` selection whose `op` may be a write stating `committed`, a `db` selection that names no `table` leaving out each line on a table the tables list says holds `bookkeeping` or `infrastructure` (one that names a table counts it whatever it holds), and a writer's own `x_` kind, an undefined kind or field, or a bad value refused at import. A claim names the key alone as its `actual` (no `view`, `at`, `count`, `each`, or path), compares with `equal`, `not-equal`, `greater-than`, `at-least`, `less-than`, or `at-most` against a number the line states (a `{n:int}` capture, digits, a number word, `once`, `twice`, or `never`, `no`, `none`, `nothing` as 0 under `equal`), and an events key shares no name with a `from` or args key and is read by a claim. When the claims are judged, the step reads the trace's lines from where that step's slice began and waits while its events may still become whole (`no-lines`, `request-unreported`, `jobs-pending`), up to its `timeout`, else 10 s, or a shorter `stepTimeout`, never until a claim holds. The count is a range, `[yes, yes + maybe]` when whole and unbounded above when not (`maybe`: lines that did not read, of an undefined kind or version, missing a field the selection reads, `holds_unknown`, a `db` line on a table the count may leave out because the tables list was not read or the writer named its table `unknown` while the list marks one, a write of unknown commit state, or owned by no step), and the claim holds or breaks only when every count in it agrees, else it is `unjudged` with the gap word in its reason (`kind-unreported` while the world has reported no line of the kind; `world-unread` at a `url`; `inlet-unnamed` without `{events}`). The record holds the count as `actual` when it is one number, else `actual_range`, then `counted`, `actual_from` `events:<step>@<line> count <selection>`, `measured` `{ step_record_id: <own>, channel: "events_read.<key>" }`, and the step's `events_read.<key>`, `{ of, trace_id, count, range, counted, whole, open, maybe, lines, unreadable, unowned, file, waited_ms }`, with the lines it counted in `events-read.jsonl`; run.json's step carries `events_read` too. `counted` groups the lines the count counted, most first, as `{ kind, fields, lines }` by the kind's fields (`request` method, route, status; `db` op, table; `tx` phase; `job` name, phase; `http` method, origin, status; `flag` name, side; `error` class, handled), every group listed, and the claim's line names the first three under every outcome (`...; counted 1 line: db insert into events`, `counted 3 lines: 2 db insert into scores, 1 db update rankings`, then `and 4 more lines in 2 groups`); `left_out`, present when the count left a line out, groups those lines the same way with each group's `holds`, on the claim and in `events_read`, and the line adds `; left out 1 line: db insert into events (bookkeeping)` after what it counted. When the world stops, each reading is counted again over every line of the trace, and a claim the whole count judges otherwise gets `after_world_stop: { lines, range, outcome, reason }` in run.json, the reason naming the lines the whole count counted that the claim's did not (`and the stop counted 1 more line: db insert into scores`), and its cell is `broke` (`a claim at line <n> was judged before every execution event it counts had arrived`). `nuka run` also raises the note `undeclared-write` for a head step that declares `mutates: false` whose trace holds a write the program committed to a table that holds state (late lines included; not a write that rolled back, one of unknown commit state, or any when the tables list was not read), once per step line of a scenario and environment, naming the step, the table, and the op: `the step at line 6, get, declares mutates: false, and its trace holds writes the program committed to tables that hold state, 1 line: db insert into scores`; it changes no status and no exit code, and never reads a request's method as a write. A world that does not start is `program-start-failed`, with the end of `program.log`; no scenario runs in it. `environments` entries override any of those fields (`env` merges by key) and add `policy: "read-only"`, `envFiles` (after the config's), a `version` probe, and `conditions`, the switches of the program that environment runs, each `true`, `false`, or a string with no whitespace and no `@` (`{ banner: true, locale: "ja" }`; the strings `"true"` and `"false"` are refused, since a string reads as on), which a scenario's `@with:` and `@without:` tags read (see `nuka run`); they set nothing, which `env` and the env files do, and nukadoko trusts them without checking the program, so derive the switch from them (`env: { BANNER: "{condition.banner}" }`). The top-level `defaultEnvironments: [<names>]` names the environments a run without `--env` starts, each an environment of the program or `default`. A tree with no program starts no world, which suits a command-line tool. `baseURL` and `environments` at the top of the config are refused, naming `program`.
|
|
17
17
|
- Commit `features/`, the config, and the program file. `.nukadoko/` is the state directory and stays out of git: `runs/<run_id>/` holds everything one `nuka run` measured (`run.json`, `summary.md`, `steps/<id>/` step records, `scenarios/<id>/` scenario evidence), and `do/<id>/` holds `nuka do` step records. Never edit a record by hand, and never delete one to get a cleaner run.
|
|
18
18
|
- A step is a file under `features/steps/` that starts with `import { defineStep, z } from "nukadoko"`. An existing cucumber-js suite comes in through `nukadoko/compat`.
|
|
19
19
|
- `returns` can be left out, and `run` then returns nothing: a step whose `returns` is `z.object({})` may drop it and its final `return {}`, but an early `return {}` inside an `if` becomes `return;`, or the step falls through.
|
|
20
20
|
- `scratch` is a builtin fixture: `scratch.dir(prefix)` and `scratch.copy(source)` give temporary directories removed when the scenario ends. A `scratch` entry in `config.fixtures` replaces it.
|
|
21
21
|
- `await runCommand(command, args, { cwd, env, input, timeout, redact, files })`, imported from `nukadoko`, runs a program and records it in the step record's `observed.processes`, with the files it `added`, `changed`, and `removed` under its working directory (`files`), and `stdout` and `stderr`, the files in the step record's directory (`process-<n>.stdout.txt`, `process-<n>.stderr.txt`) that hold what it printed, redacted, `stdin`, the file that holds the `input` it was given, and `env`, its environment as a difference from the runner's, or `{ "inherited": true }`, with every name and a value only when it is an absolute path that exists when the process ends, a decimal integer, or `true` or `false` (any other value is `{ "hidden_bytes": <n> }`, its UTF-8 length), `group` inside a step on POSIX (`ended` when no process of its group still ran as it closed, `running` when one did), and `traceparent`, the `TRACEPARENT` (OpenTelemetry's environment carrier) nukadoko put in its environment when the run has a world: the step's trace id and a span id of the process's own, set unless the step's `env` holds a TRACEPARENT other than the runner's own, so a tool that copies it into the `traceparent` header of its requests makes the program's lines for them the step's; the result carries the same `files` (outside a step only with `files: true`), and a Then that claims what the command wrote reads it through a claim step's `files: { <key>: { of: <step>, change?, under? } }`, never through a list the step returns. `redact: { NAME: value }` writes a secret the step holds as `{{secret.NAME}}` in the recorded command. On Windows it finds a bare name such as `npm` through `PATH` and `PATHEXT` and runs a `.cmd` file through `cmd.exe`. Inside a step on POSIX the process runs in a process group and a session of its own, with no controlling terminal: the process that runs the steps passes each SIGINT, SIGTERM, or SIGHUP on to every such group still running, and `timeout` sends SIGTERM to the whole group. It returns a Promise, and its `exitCode` is `number | null` (`null` after a signal).
|
|
22
22
|
- `measureMcp(transport)`, imported from `nukadoko`, wraps an MCP client's transport (any object with `start`, `send`, `close`, `onmessage`, `onclose`: the SDK's `StdioClientTransport` or `StreamableHTTPClientTransport`; nukadoko imports no SDK) and returns it with every other member its own: `await client.connect(measureMcp(new StreamableHTTPClientTransport(new URL("/mcp", baseURL))))`, usually in a scenario fixture. Like `runCommand` it is an import, not a `ctx` member: each `send` finds the step that runs then, and a message sent outside every step (the client's `initialize`) passes untouched and is recorded nowhere. Each request and notification a step sends is a line of the step record's `mcp.jsonl` (`evidence.mcp`; `observed.mcp` counts them): `method`, `id` (or `notification: true`), the `tool`, `prompt`, or `uri` it names, `params` and `result` as JSON text redacted and cut at 16 KiB like a body, `traceparent`, `header_sent_to`, `duration_ms`, `is_error: true` for a result with `isError` (the tool ran and reported an error), `error: { code, message }` for a JSON-RPC error, `unanswered` (`step`, `run`, or `closed`), or `send_error`. Each call carries the step's trace context in `params._meta.traceparent` (a caller's own is kept); over HTTP to the world's origin the transport's request carries the same value as its header, so it counts as a stamped request and the program's `request` line closes the call, and a count claim on its work can be exact. Over stdio, or to another origin, the value is in `_meta` only: the server's work is the step's when it sends the world a request with that value as its header, the step's events stay open with `mcp-unbounded`, and an exact count is `unjudged` while `at-least` can hold. A stdio server gets no `{events}` path, so it writes no events itself. `measureMcp` decides no verdict: an error answer is a result the step reads. A call started after the record goes to that step's `mcp.jsonl` with `after_step_end: true`, counted in run.json's `after_step_end.mcp`. Server-to-client requests and notifications are not recorded. `nuka check` notes `mcp-transport-unmeasured` for `client.connect(new XClientTransport(...))`, where nothing can wrap the transport.
|
|
23
|
-
- A step record's `observed` keeps one key per channel nukadoko measures: `processes` (through `runCommand`), `mcp` (the MCP calls sent through `measureMcp`, above; absent when none), `websocket` (the opens, closes, and frames of each socket made with the global `WebSocket`, each a line of the step record's `websocket.jsonl` with `event`, `socket` (a number per socket), `url`, `at`, and a text frame's `data` redacted and cut at 16 KiB like a body; a frame sent belongs to the step that sent it, and the rest to the step running when it arrived; absent when none),`http` (a count of the requests the step's process sent through `fetch`, `node:http`, `node:https`, or a Playwright request context; each is a line in the step record's `http.jsonl` with its `request_body` and `response_body`, redacted and cut at 16 KiB, and never its headers, except `traceparent` when nukadoko added one, with `traceparent_sent_to` when a request context's redirect took it to another origin), `program_log` (when the run has a world URL: the step's slice of the program's log, above), `events` (when the program
|
|
23
|
+
- A step record's `observed` keeps one key per channel nukadoko measures: `processes` (through `runCommand`), `mcp` (the MCP calls sent through `measureMcp`, above; absent when none), `websocket` (the opens, closes, and frames of each socket made with the global `WebSocket`, each a line of the step record's `websocket.jsonl` with `event`, `socket` (a number per socket), `url`, `at`, and a text frame's `data` redacted and cut at 16 KiB like a body; a frame sent belongs to the step that sent it, and the rest to the step running when it arrived; absent when none),`http` (a count of the requests the step's process sent through `fetch`, `node:http`, `node:https`, or a Playwright request context; each is a line in the step record's `http.jsonl` with its `request_body` and `response_body`, redacted and cut at 16 KiB, and never its headers, except `traceparent` when nukadoko added one, with `traceparent_sent_to` when a request context's redirect took it to another origin), `program_log` (when the run has a world URL: the step's slice of the program's log, above), `events` (when the program names `{events}`, or `null` for a world at a `url`: the step's execution events, above), `files` (the paths changed in a scratch directory or written through `node:fs` by the step's process, each with up to 8 KiB of its content; a file the step asked Playwright to write, such as `page.screenshot({ path })`, is listed, and what Playwright's server writes on its own, such as trace chunks, a HAR, or a video, is not, whoever launched the browser), and `unmeasured` (each action nukadoko saw but cannot measure, as `{ kind, detail }`: a process started without `runCommand`, however it ended, named by its program and argument count and never its arguments or a `NAME=value` word, a `Worker`, a connection the step opened or wrote to that carries no recorded request, what a `node:http` upgrade (a WebSocket from the `ws` package) or a CONNECT tunnel carried after its handshake, a UDP datagram sent through `node:dgram` (once per address), a Chromium page's request to the world that went without a `traceparent` because the page's DevTools session failed (`page_request`, once per reason), or a path the step wrote whose identity nukadoko could not read). A channel the step never reached is `null`, not `0`, and `unmeasured` is `[]` when nukadoko saw nothing it could not measure; a child process's own traffic, a Worker's, and a native addon's are never seen. A body nukadoko stopped reading has `bytes_read` instead of `bytes` (with `incomplete: true` when it stopped waiting at the step's or the run's end), a body that failed on its own (an abort, a destroy) has `bytes_read` and an `error`, a `node:http` response the step never read has `response_body: { unread }`, a stream or FormData body a step passes to `fetch` in its `init` is `request_body: { unread }`, since `fetch` gets exactly the step's arguments, and a request with no response by the step's end has `status: 0` and an `error` that says how long it had. A request or a `runCommand` process a step starts after its record was written is written beside that record with `after_step_end: true`, run.json's step names `after_step_end: { requests, processes, http, mcp }`, the run summary names it and its file, and a request still open when the run ends gets its line then. A page's own requests (`page`, `context`, `pageAs`) are lines in `http.jsonl` too, without bodies. The run summary gives each step with an unmeasured action, or an action started after it ended, one line. `args_origin` names where each `args` key came from: `capture`, `docstring`, `table`, `{ from: { step_record_id, step, key } }`, `command_line`, or `schema`. nukadoko never infers a write from an HTTP method.
|
|
24
24
|
- Skills, for any Agent Skills host: `gh skill install meganemura/nukadoko --all`. The copy that matches the installed version is in `node_modules/nukadoko/skills/`, and `nuka skill path` prints that directory. This file is `node_modules/nukadoko/llms.txt`, and in the Ruby gem it sits beside the `skills/` directory `nuka skill path` prints.
|
|
25
25
|
|
|
26
26
|
## Ruby
|
|
@@ -32,8 +32,9 @@ The `nukadoko` gem is a second engine that reads the same feature files and judg
|
|
|
32
32
|
- A Then step has `claims [{ actual: "body", compare: "equal", expected: { from: "created" } }]` and `def observe(...)` in place of `run`, with `poll timeout_ms: 3000` when it waits.
|
|
33
33
|
- The keyword arguments of `run` or `observe` name the fixtures, with `args:` only when the body reads them: `request`, `page`, `scratch` (`dir` and `copy`), `call`, and each `Nukadoko.fixture(:name) { |use| use.(value) }` in `nukadoko.config.rb`.
|
|
34
34
|
- `Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` runs a program and returns `{ exitCode:, signal:, stdout:, stderr: }`, kept in the step record. Its `env` is added to the runner's environment, and `timeout` is in seconds.
|
|
35
|
-
- `
|
|
35
|
+
- `Nukadoko.config(program: -> { { serve: { command: "... {port}", ready: "/up" }, environments: { ... } } })` holds the program under test, an environment's own env files under `envFiles:`. A `nukadoko.program.rb` of an earlier release is refused with `program-file-moved`.
|
|
36
36
|
- `Nukadoko.config(envFiles: [".env"], secrets: { public: [...], redact: [...] })` loads env files and classifies their secrets as above.
|
|
37
|
+
- `Nukadoko.config(parameterTypes: [{ name: "priority", regexp: /高|低/, transformer: ->(s) { s == "高" ? "high" : "low" } }])` registers a parameter type as `parameterTypes` does in the TypeScript config: a Ruby Regexp or a string, and a lambda given the groups the regexp captured.
|
|
37
38
|
- The gem has one command the npm package does not, `sig`: it writes `sig/nukadoko/steps.rbs`, the RBS of each step's args and returns, so Steep checks the step bodies.
|
|
38
39
|
- Not in the gem yet: `requires`, `gives`, and `ends`, `measureMcp`, the `nukadoko/compat` door, and `nuka init --allure`.
|
|
39
40
|
|
|
@@ -46,15 +47,15 @@ Run them in this order. Exit 0 is the only pass.
|
|
|
46
47
|
- Both exit 1 when a step file did not import (`step-file-import-failed`) or when part of a step's contract could not be read: its `needs`, a `from` entry, or (for `describe`) an args or returns schema JSON Schema cannot represent. Each such part is a `contract-unreadable` finding naming the step in the `--json` envelope; the rest is printed either way.
|
|
47
48
|
- `nuka scaffold <name> --pattern <text> [--then | --command [<entry point>] [--cwd <key>] [--argv <key>] | --request "<METHOD> <path>" [--body <key>]] [--from <step>.<key>] [--description <text>] [--replace]`: a step file that fails until implemented. `--then` writes a claim step: `claims` in place of `run`, and no `returns` or `mutates`. With one value the line states (a capture, the docstring, or the table) and one `--from`, its claim compares the two with `equal`, and a chained `stdout` or `stderr` against a stated string gets `view: "text"`, which trims the newline a program prints last. When the two are of two different JSON types (a `{string}` capture against a `z.number()`), `--then` refuses: a claim across them never holds, and a claim on a word of the line instead would leave the stated value read by nothing, which a step with no `observe` may not do. With any other mix of stated values and `--from`, it writes an `observe` stub that throws `not implemented: <name>` and one claim on what `observe` returns against the first stated value. A line that states its value with a word alone (`no`, `none`, `nothing`, `neither`, `never`, `empty`) needs exactly one `--from` whose `returns` schema is a bare `z.string()`, `z.number()`, or `z.array()`: its claim compares that value with the word's literal of the same JSON type (`""`, `0`, or `[]`), with `equal`, or with `not-equal` right after the word `not`, `neither`, or `nor`. A number word from `zero` to `twelve`, `once`, or `twice` works the same way with a `z.number()` `--from`, and its claim is written with `equal`, which a number word lets the step change to the compare the line says. Without such a `--from`, and for a line that states no value, `--then` refuses. When every feature line the pattern matches carries a docstring, `args` gets `docstring: z.string()`, and for a table `table: z.array(z.array(z.string()))`; a Then claims it like a capture. `--command` writes a When step that runs a program and returns `exitCode`, `stdout`, and `stderr`; its value must be an existing file that plain `node` can start, and without one the step throws `fill in the entry point: <file>:<line>` until that line is filled in. It runs the program in an empty `scratch.dir()` with the pattern's captures as argv, one capture per element; `--argv <key>` splits that string capture into elements on whitespace only, with no quoting rule, so one line such as `When I run greet with "Ada --shout"` carries every argument and flag. `--cwd <key>` runs it in the directory that args key holds instead, such as the `dir` a Given returned. The step writes `mutates: true`, the default, under a comment that says to set it to false when the program changes nothing outside a scratch directory. A `--from` key is never argv: until it is placed (an environment variable, a flag, or `--cwd`), the step throws `pass <keys> where the program reads them: <file>:<line>`. `--request "<METHOD> <path>"` writes a When step that sends one request through Playwright's own `request` (`request.fetch(path, { method })`, resolved against the world's URL) and returns `status` and `body` (the response text); each `{key}` in the path is that args key's value, put in as it is, `--body <key>` sends an args key (a capture, a `--from` key, or the line's `docstring`) as `data`, and any other value throws `pass <keys> where the request reads them: <file>:<line>` until it is placed. It writes `mutates: true`, because the method is only a proxy for write semantics. `--request` is refused with `--then` or `--command`, and so is `--body` without `--request`. `--from` chains a key of an earlier step's `returns` into `args`, and repeats; the same key given for two steps lists both as candidate producers, which must declare the same schema for it. Without `--description`, `--command` and `--request` write a description of the step they generate, and any other form writes `TODO: describe <name>`, which `nuka check` reports as the note `step-description-todo`.
|
|
48
49
|
- `nuka scaffold --feature <path>`: one stub for each line `nuka check <path>` reports as `undefined-step`, the pattern read from the line (`{value:string}`, `{value:int}`, `{value:float}`) and a claim step for a Then line; a Then line that states no value, or states it with a word alone, gets a `note:` line on stderr and no stub. A line with a docstring gets a `docstring` key, and a line with a table a `table` key. A line that reads more than one way keeps its text as the pattern, with no capture, and gets a `note:` line on stderr. The stubs declare no `returns` and no `from`: for a When that runs a program and the Thens that read its result, use single `nuka scaffold` calls with `--command` and `--then --from <step>.<key>`. After the written paths, stderr gives a `next:` line and, for each stub, the single `nuka scaffold <name> --pattern <pattern> [--then] --replace` that writes it again byte for byte (left out for a stub whose single scaffold would write it differently), to add `--command`, `--from`, or `--description` to. A step file that already exists is refused; while it is still, byte for byte, what scaffold writes under some set of options (a `--feature` stub, or a `--command`, `--from`, or `--description` step nobody edited), the refusal's `do:` line is the same command with `--replace`, which overwrites that file and refuses any other.
|
|
49
|
-
- `nuka check [feature..] [--json] [--fail-on <code>] [--env <name>]...`: static checks for the files `nuka run` would select (a file, several, a directory, or every feature with no target), and the program
|
|
50
|
-
- `nuka run [feature..] [--no-check] [--env <name>]... [--tag <expression>]... [--concurrency <n>] [--repeat <n>] [--order file|shuffled[:<seed>]] [--proof-runs <n>] [--base <git ref>] [--step] [--records] [--json]`: runs `check` first for the selected scenarios and refuses on an error (`--no-check` runs anyway). `<file>:<line>` runs one scenario. Progress, failures, and the paths it wrote go to stderr (none of them under `--json`); each step's line says `passed`, `failed`, or `skipped`, the word its step record uses. stdout stays empty unless asked: `--records` writes each scenario's `run.json` entry there as one JSON line when it finishes (a step's `program_log_late` is only in `run.json`, written when the world stops), and `--json` prints `run.json` itself, which is the envelope: `run_dir` (the run directory, relative to the project root, the argument `nuka report` takes), `commit` (`sha`, `dirty`, and `working_tree`, the working tree as one git tree id: tracked files as on disk and untracked files `.gitignore` does not leave out, the state directory left out; absent when git gives none), `environments` (each `name`, `target_version`, `base_url`, its world's URL or `null`, and `conditions` when it declares them), `worlds` (each world the run started, with `name`, `tree`, `url`, `commands`, `timings`, `log`, and `error`; empty with no program file), `selection` (`partial` when a `:line` target left out a scenario of its file), `order` (`{ kind: "file" }`, or `{ kind: "shuffled", seed }` under `--order shuffled`), `counts` (`scenarios`, `passed`, `failed`, and `stopped` (a walk stopped them, `--step`) of the executions of required cells, `not_run` required cells, `controls` of the executions of controls, and `controls_not_run` control cells), `table` (the verdict table: `base` (`{ ref, commit }` under `--base`, else `null`), `mapping_changed` and `mapping_changes` (`files`, `config`, `conditions`, `default_environments`, `unseen`; `null` without `--base`), `worlds`, its columns `{ world, environment }` with `world` of `head`, `base`, or `old`, `left_out`, the selected criteria `--env` left out, `proof_runs`, the `--proof-runs` a control's `runs` is measured against, and `rows`, one per selected criterion and then one per removed one, with `feature`, `line`, `name`, `change` (`null`, or under `--base` `unchanged`, `changed`, `new`, or `removed`), `renamed_from` (`{ feature, name }` at the base), `retagged` (`true` for an unchanged row whose tags differ from the base's), `conditions` (its condition tags and `@held`), `cells` (each `world`, `environment`, `role` of `required` or `control`, `conditions` (each condition its row's tags name, with the value its environment declares, `null` where none), `outcome` of `pass`, `fail`, `broke`, `stopped`, `flaky`, or `not-run`, the `line` of every one but `pass` and `not-run`, `runs`, for `fail` the `claim` every run broke and `actuals`, each run's actual value, and a `reason` for `not-run`, for a `broke` a hook caused, and for a control `broke` whose proof round could not finish), `verdict` of `held`, `proven`, `removed`, `failed`, `unproven`, or `moved`, `reason`, one sentence, and for a removed row `lines`, its sentences at the base), `flags` (only when a head step's execution events name a flag or a head world's `lists.flags` list declares one: one row per `name` and `side`, a declared side no criterion evaluated included with no `criteria`, each with `listed_in` (each environment whose list declares the side, empty for one no list declares) whenever a flags list was read, and `only_side_evaluated: true` on a flag's one side when the criteria evaluated no other, the side as its lines name it and never as an environment's conditions declare it, with `criteria`, each criterion that evaluated it there with its row's `verdict` and its `cells` on that side (`environment`, `role`, `outcome`, `line`, and `gates`, each gate its lines named or `null`), and `counts` by verdict, where a criterion seen on the side only in controls counts as `controls`; evidence to join with the program's own record of the flag by `name` and `side`, not a verdict on the flag; the summary gives each row one line under "Flags"), `routes` (only when a head world read a `lists.routes` list: one entry per `method` and `route` a list or a head step's `request` line names, `null` for the requests the program matched to no route, ordered by route and then method, with `handlers`, `listed_in` (each environment whose list holds it; empty for a route no list names), `requests` (every `request` line of a head step naming it, a late one included, each line in exactly one entry; 0 for one no step requested), `statuses`, and `criteria` and `counts` by the rules of `flags`, each cell with its `requests` and `statuses`; a request counts the same in a Given as in a Then and says the program matched the route, never that a claim read its answer; the summary's "Routes" names the listed routes no step requested, apart from those whose handler a request reached through another route (PUT and PATCH of one resource), the requests no list names, and each world whose list was not read), `paths` (only when a pair of sides read execution events: under `--base` each environment's base world against its head world, `between: { kind: "base" }`, base pairs first, for the rows the base ran there, which, when both program files name `{events}`, is every row whose head cell there is required and ran (head's `{events}` alone builds the base world for this even when no criterion is new or changed, so a refactor is compared), and two environments whose `conditions` differ in exactly one, `between: { kind: "condition", name, a, b }`; one entry per pair, with the sides `a` and `b` (`world`, `environment`), side `a` being the base world, or the environment where the condition is `false` or not declared, `unread` naming why nothing was compared or `null`, `counts` of `changed`, `open`, `same_so_far` (open, with every open count one range on both sides under the same gap words), `marked_only` (the only differences are on tables marked as bookkeeping or infrastructure; a criterion's `result` reads every other difference), `same`, and `not_compared`, `criteria` with each criterion's `result`, under a base pair `explained_by` on a `changed` one (`criterion_change` when it is new or changed, `null` when it is unchanged and nothing in the feature files asked for the difference), its side executions `a` and `b` (`scenario_record_id`, the cell's `outcome` and `line`), and `steps`, the steps with a difference aligned by line: `ran: "both"` with `changed` and `open` entries, each carrying the range of its count on side `a` and side `b`, and `holds` on a marked table, and `gaps`, or `ran: "a"` or `"b"` for a step only that side ran; a count a side's missing lines could still reach is `open`, never `changed`, a flag's side is the premise of a pair of environments and never compared there, while against the base a flag whose side changed is a difference, and `not_compared` names each criterion left out with a `reason`, such as `did not run at the base`; `unread` says when the base's program file names no `{events}`; evidence, not a verdict; the summary lists up to 20 criteria per heading under "Changed paths", every base pair under one `base → head` heading that lists a criterion with the same lines in several environments once, counts the unchanged criteria compared (`Each of the 2 unchanged criteria compared did the same at the base and at head.` when each did), and lists the unchanged criteria that changed first, then the new or changed ones, then those that may differ, each group under a line of its own, and then, under `Bookkeeping and infrastructure writes that differ, which no sentence is about, though another reader of those tables may be:`, the differences with `holds`, which never rank a criterion), `limits` (what the run does not show, computed from the other fields of run.json: `left-out`, `check-skipped`, `control-not-proving` for a held row where no control failed at a Then, `no-claim`, `unmeasured`, `after-record`, `unrecorded-log`, and `unrecorded-events`, each with a `detail` and, where one exists, a `do` or `fix`; the summary renders it under `What this run does not show` right after the table, and stderr ends with one line of counts by kind, `limits: <n> <kind>, ... (run.json limits)`), and per scenario execution its `environment`, `role`, under `--base` the `world` and `row` of a base or old execution, and `for_paths` (`outcome`, and `line` when it did not pass) on a base execution run for `paths` alone, which is no cell, gets no proof runs, never changes the table, and whose stderr line ends `(for paths)`, and steps (each with `line`, `text`, `step`, `status`, `step_record_id`, `record`, `record_unreadable` with a `step-record-unreadable` warning when its step record could not be read back, a claim step's `claims`, `observation`, and `attempts`, and for a failure `error` with `kind` and `message` and the `used` results it read, a result over 4096 bytes of JSON cut to a preview with `truncated` and `result_bytes`), a failed scenario's `do` (a control has none), and every finding the run raised. `run.json` is written to `.nukadoko/runs/<run_id>/run.json` either way, and every path inside it (`record`, `evidence.dir`) is relative to that run directory; there is no scenario record file. The Markdown run summary, rendered from `run.json` alone, is always written beside it and appended to `$GITHUB_STEP_SUMMARY` when that is set; the run writes no Allure results or messages stream. Each failed scenario is a `scenario-failed` finding on stderr whose ` do:` line is the `nuka run <file>:<line>` that reruns it (under `--order shuffled`, which runs the feature files and then each file's scenarios in the order a seed names, with the seed on stderr before the first scenario, in `order`, and in the summary, the line names the scenarios that ran before it in its pass, then it, with `--order shuffled:<seed>`, or is the run itself under `--repeat` or `--concurrency` above 1), and a scenario a walk stopped is a `walk-stopped` one. `--step` walks one scenario with a person: see `nuka step` below. `--env` repeats: `--env a --env b` is one run with one `run_id` that runs every selected scenario in `a`, then in `b`; each environment gets its own env files, secrets, version probe, world, BeforeAll and AfterAll, and process-scope fixtures. A run without `--env` runs the environments the program file's `defaultEnvironments` names, or else every environment that declares `conditions`, in the order the file lists them, and `default` when none does; any other, such as a deployment target, runs when `--env` names it. Under `--env`, a scenario no named environment meets is not run: its row is left out of the table, counted in `table.left_out`, in one line on stderr (`<n> criteria not run: their conditions hold in no selected environment`), and as the `left-out` entry of `limits`, and `nuka check` reports `condition-unmet` for the default selection only. `--env default` names the top-level environment (as run.json names it), whether or not `nukadoko.program.ts` defines it, so it combines with named ones. The tags `@with:<condition>`, `@with:<condition>=<value>` (exact text; `=true` and `=false` are malformed, write `@with:` or `@without:`), and `@without:<condition>` (off: `false` or not declared) on a Feature, Rule, Scenario, or Examples line make a scenario's cell `required` in an environment that meets them all and a `control` elsewhere; a scenario with none is required everywhere, and `@held` says the base already has the behaviour. `@expects:status=<500-599>`, `@expects:page-error=<name>`, and `@expects:error=<class>` on the same lines accept one failure underneath the scenario: a passed execution whose step got a 5xx response, whose page threw an error nothing caught, or whose trace holds an `error` with `handled: false`, is `broke@<that step's line>` unless a tag names that failure (`unexpected-failure` names it and spells the tag; `expects-unseen` notes a tag that matched nothing); only a pass moves, and like condition tags they are content under `--base`. A cell is `pass`, `fail@<line>` (each execution broke a claim at that line in Then position), `broke@<line>` (each stopped there before a claim was judged: a Given or When error, an undefined line, an unjudged claim; or, at the scenario's line, a hook, which the cell's `reason` names with when it ran), `flaky@<line>` (its executions disagree), `stopped@<line>` (a walk was stopped after the step at that line with `nuka step stop`), or `·` (none ran, with the `reason`). A required cell runs once, or `--repeat` times; a control that failed at a Then line runs again in the same world until it has broken the same claim there `--proof-runs` times (default 2) or a run disagrees (runs agree on the claim, by its position in the step, not on its value, which may differ), each a `proof run <k>/<n>` line on stderr; under `--concurrency` a proof round runs in a worker of its own, which runs BeforeAll and AfterAll again, and a hook that fails there, or a worker that records nothing, makes the round's control cells `broke` with the reason and a `proof-run-incomplete` warning, and the row reads as one no control proves (under `--base`, the base world runs for a new or changed row). A row is `failed` when a required cell is not `pass` or it has no required cell (only under `--no-check` without `--env`, with a `criterion-without-required-cell` finding whose `do:` runs the scenario where it is met, or `nuka check` on its file), `proven` when every required cell passed and a control failed in `--proof-runs` runs, and `held` otherwise. The exit code is 1 when a row is `failed`, `unproven`, or `moved`, or when the run failed outside every scenario: a BeforeAll or AfterAll of a pass failed (at any `--concurrency`), a head world did not start (`program-start-failed`), or a `--concurrency` worker exited before each of its scenarios had a record (`run-incomplete`); a control never makes it red. A `held` row whose control passed says the Then does not see what the switch changes, or the switch does not reach it: read it before calling the criterion covered. The stderr count line counts required cells alone, and a run with a control adds a `<n> control runs, <k> not run` line and a `criteria: <held> held, <proven> proven, <failed> failed` line under it, which every run under `--base` has, with `<unproven> unproven, <moved> moved, <removed> removed` after them. The summary opens with the table, one row per criterion and one `head <environment>` column per environment, headed with the conditions it declares (and `base <environment>` and `old <environment>` under `--base`), then one line per red row with its reason and where it stopped; a failure's `do:` names its environment. Naming one environment twice is refused. `--base <git ref>` compares each criterion with the commit the ref names: its identity is its feature file and name, and its content its steps with their effective keyword, docstrings, and tables, its Examples row, and its condition tags and `@held`, so a rename, a move, or another tag leaves it `unchanged` (with `renamed_from` when its name or file differs, and `retagged` when its tags differ) and an edit makes it `changed`; the rest are `new` or `removed`. The mapping (files under the features directory other than `.feature` files, the whole config but `stateDir` and `retention`, by its value and by the config file's own bytes, so a constant a config function closes over counts and an edit to those two fields alone does too, and each environment's `conditions` and `defaultEnvironments`) is compared as one unit. A `new` or `changed` row that passed at head also runs in the `base` world (the base's code under head's criteria and mapping, built from the base's program file in `trees/base` under the run directory), where a base cell proves like a control after `--proof-runs` failures at one Then line; it is `proven` then, `unproven` (red) when nothing proves it (a compat Then never can, and the reason says so), and a row tagged `@held` is `held` when the base passes it. An `unchanged` row that passed at head runs in the `old` world (head's code under the base's feature files and mapping, in `trees/old`) when the mapping changed or the row is retagged or renamed, and is `moved` (red) when it does not pass there, or else `proven` when a control proves it, as without `--base`, and `held` when none does. Each `unproven` or `moved` row is a `criterion-unproven` or `criterion-moved` finding whose `do:` is `nuka run <file>:<line> --base <commit>`, naming the full hash the ref resolved to, which judges it again against the same commit after the ref moves. `--base` does not support yet a symbolic link at, above, or under the features directory or at the config file, a feature file outside the features directory, a submodule or a nested repository, or, for the base world alone, a workspace package linked into `node_modules` from inside the repository: the world such a shape reaches is not built, its cells are `·` with the reason, and a red row's finding has a `do:` that runs the row without `--base` and a `fix:` when an edit lets `--base` build the world; a shape that hides part of the mapping is named in `mapping_changes.unseen` and makes `mapping_changed` true. A criterion only the base holds is a `removed` row, quoted under the summary's "Removed criteria". The trees install nothing and resolve packages from head's project; a `url` function receives `tree` (`"base"` or `"head"`) and may return nothing for the base, and one that returns head's URL for the base leaves the base world not run, so it has to branch on `tree`. A tree whose cells do not run says why on stderr, `<world> <environment> not run: <reason>`. The summary opens with a line naming the base and what changed. A project outside git is refused with `base-outside-git`, a ref that names no commit with `base-ref-unknown`, a shallow clone without it with `base-shallow` (its `do` is the `git fetch`), a git failure with `base-git-failed`, and a `featuresDir` at the project root with `base-features-at-root`; `--since` is refused with `removed-flag`.
|
|
50
|
+
- `nuka check [feature..] [--json] [--fail-on <code>] [--env <name>]...`: static checks for the files `nuka run` would select (a file, several, a directory, or every feature with no target), and the program's placeholders for the worlds a `nuka run` with the same `--env` flags would start. Findings are errors, warnings, and notes; a note is rot rather than breakage (an unbound pattern, an unused `from` or fixture, a field with no `.describe()`), and only a check with no target reports notes, because they are facts about every feature the project scans. Exit 1 on any error, or on a code `--fail-on` names (one value per flag, repeatable, or comma-separated; the finding keeps its severity, and `--json` lists the hits in `fail_on_hits`; a note code with targets, which compute no notes, is refused with `fail-on-note-with-targets`); warnings and notes alone exit 0. `nuka check --codes` prints every code `check`, `run`, and a refusal can carry; the table under "Findings" is that list. Condition tags are read against the environments `--env` names, as `nuka run --env` does, or without it the ones a run without `--env` selects: `condition-tag-malformed`, `condition-unknown` (a condition no environment declares), and `condition-unmet` (a scenario no selected environment meets) are errors.
|
|
51
|
+
- `nuka run [feature..] [--no-check] [--env <name>]... [--tag <expression>]... [--concurrency <n>] [--repeat <n>] [--order file|shuffled[:<seed>]] [--proof-runs <n>] [--base <git ref>] [--step] [--records] [--json]`: runs `check` first for the selected scenarios and refuses on an error (`--no-check` runs anyway). `<file>:<line>` runs one scenario. Progress, failures, and the paths it wrote go to stderr (none of them under `--json`); each step's line says `passed`, `failed`, or `skipped`, the word its step record uses. stdout stays empty unless asked: `--records` writes each scenario's `run.json` entry there as one JSON line when it finishes (a step's `program_log_late` is only in `run.json`, written when the world stops), and `--json` prints `run.json` itself, which is the envelope: `run_dir` (the run directory, relative to the project root, the argument `nuka report` takes), `commit` (`sha`, `dirty`, and `working_tree`, the working tree as one git tree id: tracked files as on disk and untracked files `.gitignore` does not leave out, the state directory left out; absent when git gives none), `environments` (each `name`, `target_version`, `base_url`, its world's URL or `null`, and `conditions` when it declares them), `worlds` (each world the run started, with `name`, `tree`, `url`, `commands`, `timings`, `log`, and `error`; empty with no program), `selection` (`partial` when a `:line` target left out a scenario of its file), `order` (`{ kind: "file" }`, or `{ kind: "shuffled", seed }` under `--order shuffled`), `counts` (`scenarios`, `passed`, `failed`, and `stopped` (a walk stopped them, `--step`) of the executions of required cells, `not_run` required cells, `controls` of the executions of controls, and `controls_not_run` control cells), `table` (the verdict table: `base` (`{ ref, commit }` under `--base`, else `null`), `mapping_changed` and `mapping_changes` (`files`, `config`, `conditions`, `default_environments`, `unseen`; `null` without `--base`), `worlds`, its columns `{ world, environment }` with `world` of `head`, `base`, or `old`, `left_out`, the selected criteria `--env` left out, `proof_runs`, the `--proof-runs` a control's `runs` is measured against, and `rows`, one per selected criterion and then one per removed one, with `feature`, `line`, `name`, `change` (`null`, or under `--base` `unchanged`, `changed`, `new`, or `removed`), `renamed_from` (`{ feature, name }` at the base), `retagged` (`true` for an unchanged row whose tags differ from the base's), `conditions` (its condition tags and `@held`), `cells` (each `world`, `environment`, `role` of `required` or `control`, `conditions` (each condition its row's tags name, with the value its environment declares, `null` where none), `outcome` of `pass`, `fail`, `broke`, `stopped`, `flaky`, or `not-run`, the `line` of every one but `pass` and `not-run`, `runs`, for `fail` the `claim` every run broke and `actuals`, each run's actual value, and a `reason` for `not-run`, for a `broke` a hook caused, and for a control `broke` whose proof round could not finish), `verdict` of `held`, `proven`, `removed`, `failed`, `unproven`, or `moved`, `reason`, one sentence, and for a removed row `lines`, its sentences at the base), `flags` (only when a head step's execution events name a flag or a head world's `lists.flags` list declares one: one row per `name` and `side`, a declared side no criterion evaluated included with no `criteria`, each with `listed_in` (each environment whose list declares the side, empty for one no list declares) whenever a flags list was read, and `only_side_evaluated: true` on a flag's one side when the criteria evaluated no other, the side as its lines name it and never as an environment's conditions declare it, with `criteria`, each criterion that evaluated it there with its row's `verdict` and its `cells` on that side (`environment`, `role`, `outcome`, `line`, and `gates`, each gate its lines named or `null`), and `counts` by verdict, where a criterion seen on the side only in controls counts as `controls`; evidence to join with the program's own record of the flag by `name` and `side`, not a verdict on the flag; the summary gives each row one line under "Flags"), `routes` (only when a head world read a `lists.routes` list: one entry per `method` and `route` a list or a head step's `request` line names, `null` for the requests the program matched to no route, ordered by route and then method, with `handlers`, `listed_in` (each environment whose list holds it; empty for a route no list names), `requests` (every `request` line of a head step naming it, a late one included, each line in exactly one entry; 0 for one no step requested), `statuses`, and `criteria` and `counts` by the rules of `flags`, each cell with its `requests` and `statuses`; a request counts the same in a Given as in a Then and says the program matched the route, never that a claim read its answer; the summary's "Routes" names the listed routes no step requested, apart from those whose handler a request reached through another route (PUT and PATCH of one resource), the requests no list names, and each world whose list was not read), `paths` (only when a pair of sides read execution events: under `--base` each environment's base world against its head world, `between: { kind: "base" }`, base pairs first, for the rows the base ran there, which, when both programs name `{events}`, is every row whose head cell there is required and ran (head's `{events}` alone builds the base world for this even when no criterion is new or changed, so a refactor is compared), and two environments whose `conditions` differ in exactly one, `between: { kind: "condition", name, a, b }`; one entry per pair, with the sides `a` and `b` (`world`, `environment`), side `a` being the base world, or the environment where the condition is `false` or not declared, `unread` naming why nothing was compared or `null`, `counts` of `changed`, `open`, `same_so_far` (open, with every open count one range on both sides under the same gap words), `marked_only` (the only differences are on tables marked as bookkeeping or infrastructure; a criterion's `result` reads every other difference), `same`, and `not_compared`, `criteria` with each criterion's `result`, under a base pair `explained_by` on a `changed` one (`criterion_change` when it is new or changed, `null` when it is unchanged and nothing in the feature files asked for the difference), its side executions `a` and `b` (`scenario_record_id`, the cell's `outcome` and `line`), and `steps`, the steps with a difference aligned by line: `ran: "both"` with `changed` and `open` entries, each carrying the range of its count on side `a` and side `b`, and `holds` on a marked table, and `gaps`, or `ran: "a"` or `"b"` for a step only that side ran; a count a side's missing lines could still reach is `open`, never `changed`, a flag's side is the premise of a pair of environments and never compared there, while against the base a flag whose side changed is a difference, and `not_compared` names each criterion left out with a `reason`, such as `did not run at the base`; `unread` says when the base's program names no `{events}`; evidence, not a verdict; the summary lists up to 20 criteria per heading under "Changed paths", every base pair under one `base → head` heading that lists a criterion with the same lines in several environments once, counts the unchanged criteria compared (`Each of the 2 unchanged criteria compared did the same at the base and at head.` when each did), and lists the unchanged criteria that changed first, then the new or changed ones, then those that may differ, each group under a line of its own, and then, under `Bookkeeping and infrastructure writes that differ, which no sentence is about, though another reader of those tables may be:`, the differences with `holds`, which never rank a criterion), `limits` (what the run does not show, computed from the other fields of run.json: `left-out`, `check-skipped`, `control-not-proving` for a held row where no control failed at a Then, `no-claim`, `unmeasured`, `after-record`, `unrecorded-log`, and `unrecorded-events`, each with a `detail` and, where one exists, a `do` or `fix`; the summary renders it under `What this run does not show` right after the table, and stderr ends with one line of counts by kind, `limits: <n> <kind>, ... (run.json limits)`), and per scenario execution its `environment`, `role`, under `--base` the `world` and `row` of a base or old execution, and `for_paths` (`outcome`, and `line` when it did not pass) on a base execution run for `paths` alone, which is no cell, gets no proof runs, never changes the table, and whose stderr line ends `(for paths)`, and steps (each with `line`, `text`, `step`, `status`, `step_record_id`, `record`, `record_unreadable` with a `step-record-unreadable` warning when its step record could not be read back, a claim step's `claims`, `observation`, and `attempts`, and for a failure `error` with `kind` and `message` and the `used` results it read, a result over 4096 bytes of JSON cut to a preview with `truncated` and `result_bytes`), a failed scenario's `do` (a control has none), and every finding the run raised. `run.json` is written to `.nukadoko/runs/<run_id>/run.json` either way, and every path inside it (`record`, `evidence.dir`) is relative to that run directory; there is no scenario record file. The Markdown run summary, rendered from `run.json` alone, is always written beside it and appended to `$GITHUB_STEP_SUMMARY` when that is set; the run writes no Allure results or messages stream. Each failed scenario is a `scenario-failed` finding on stderr whose ` do:` line is the `nuka run <file>:<line>` that reruns it (under `--order shuffled`, which runs the feature files and then each file's scenarios in the order a seed names, with the seed on stderr before the first scenario, in `order`, and in the summary, the line names the scenarios that ran before it in its pass, then it, with `--order shuffled:<seed>`, or is the run itself under `--repeat` or `--concurrency` above 1), and a scenario a walk stopped is a `walk-stopped` one. `--step` walks one scenario with a person: see `nuka step` below. `--env` repeats: `--env a --env b` is one run with one `run_id` that runs every selected scenario in `a`, then in `b`; each environment gets its own env files, secrets, version probe, world, BeforeAll and AfterAll, and process-scope fixtures. A run without `--env` runs the environments the program's `defaultEnvironments` names, or else every environment that declares `conditions`, in the order the file lists them, and `default` when none does; any other, such as a deployment target, runs when `--env` names it. Under `--env`, a scenario no named environment meets is not run: its row is left out of the table, counted in `table.left_out`, in one line on stderr (`<n> criteria not run: their conditions hold in no selected environment`), and as the `left-out` entry of `limits`, and `nuka check` reports `condition-unmet` for the default selection only. `--env default` names the top-level environment (as run.json names it), whether or not the program defines it, so it combines with named ones. The tags `@with:<condition>`, `@with:<condition>=<value>` (exact text; `=true` and `=false` are malformed, write `@with:` or `@without:`), and `@without:<condition>` (off: `false` or not declared) on a Feature, Rule, Scenario, or Examples line make a scenario's cell `required` in an environment that meets them all and a `control` elsewhere; a scenario with none is required everywhere, and `@held` says the base already has the behaviour. `@expects:status=<500-599>`, `@expects:page-error=<name>`, and `@expects:error=<class>` on the same lines accept one failure underneath the scenario: a passed execution whose step got a 5xx response, whose page threw an error nothing caught, or whose trace holds an `error` with `handled: false`, is `broke@<that step's line>` unless a tag names that failure (`unexpected-failure` names it and spells the tag; `expects-unseen` notes a tag that matched nothing); only a pass moves, and like condition tags they are content under `--base`. A cell is `pass`, `fail@<line>` (each execution broke a claim at that line in Then position), `broke@<line>` (each stopped there before a claim was judged: a Given or When error, an undefined line, an unjudged claim; or, at the scenario's line, a hook, which the cell's `reason` names with when it ran), `flaky@<line>` (its executions disagree), `stopped@<line>` (a walk was stopped after the step at that line with `nuka step stop`), or `·` (none ran, with the `reason`). A required cell runs once, or `--repeat` times; a control that failed at a Then line runs again in the same world until it has broken the same claim there `--proof-runs` times (default 2) or a run disagrees (runs agree on the claim, by its position in the step, not on its value, which may differ), each a `proof run <k>/<n>` line on stderr; under `--concurrency` a proof round runs in a worker of its own, which runs BeforeAll and AfterAll again, and a hook that fails there, or a worker that records nothing, makes the round's control cells `broke` with the reason and a `proof-run-incomplete` warning, and the row reads as one no control proves (under `--base`, the base world runs for a new or changed row). A row is `failed` when a required cell is not `pass` or it has no required cell (only under `--no-check` without `--env`, with a `criterion-without-required-cell` finding whose `do:` runs the scenario where it is met, or `nuka check` on its file), `proven` when every required cell passed and a control failed in `--proof-runs` runs, and `held` otherwise. The exit code is 1 when a row is `failed`, `unproven`, or `moved`, or when the run failed outside every scenario: a BeforeAll or AfterAll of a pass failed (at any `--concurrency`), a head world did not start (`program-start-failed`), or a `--concurrency` worker exited before each of its scenarios had a record (`run-incomplete`); a control never makes it red. A `held` row whose control passed says the Then does not see what the switch changes, or the switch does not reach it: read it before calling the criterion covered. The stderr count line counts required cells alone, and a run with a control adds a `<n> control runs, <k> not run` line and a `criteria: <held> held, <proven> proven, <failed> failed` line under it, which every run under `--base` has, with `<unproven> unproven, <moved> moved, <removed> removed` after them. The summary opens with the table, one row per criterion and one `head <environment>` column per environment, headed with the conditions it declares (and `base <environment>` and `old <environment>` under `--base`), then one line per red row with its reason and where it stopped; a failure's `do:` names its environment. Naming one environment twice is refused. `--base <git ref>` compares each criterion with the commit the ref names: its identity is its feature file and name, and its content its steps with their effective keyword, docstrings, and tables, its Examples row, and its condition tags and `@held`, so a rename, a move, or another tag leaves it `unchanged` (with `renamed_from` when its name or file differs, and `retagged` when its tags differ) and an edit makes it `changed`; the rest are `new` or `removed`. The mapping (files under the features directory other than `.feature` files, the whole config but `stateDir` and `retention`, by its value and by the config file's own bytes, so a constant a config function closes over counts and an edit to those two fields alone does too, and each environment's `conditions` and `defaultEnvironments`) is compared as one unit. A `new` or `changed` row that passed at head also runs in the `base` world (the base's code under head's criteria and mapping, built from the base's program in `trees/base` under the run directory), where a base cell proves like a control after `--proof-runs` failures at one Then line; it is `proven` then, `unproven` (red) when nothing proves it (a compat Then never can, and the reason says so), and a row tagged `@held` is `held` when the base passes it. An `unchanged` row that passed at head runs in the `old` world (head's code under the base's feature files and mapping, in `trees/old`) when the mapping changed or the row is retagged or renamed, and is `moved` (red) when it does not pass there, or else `proven` when a control proves it, as without `--base`, and `held` when none does. Each `unproven` or `moved` row is a `criterion-unproven` or `criterion-moved` finding whose `do:` is `nuka run <file>:<line> --base <commit>`, naming the full hash the ref resolved to, which judges it again against the same commit after the ref moves. `--base` does not support yet a symbolic link at, above, or under the features directory or at the config file, a feature file outside the features directory, a submodule or a nested repository, or, for the base world alone, a workspace package linked into `node_modules` from inside the repository: the world such a shape reaches is not built, its cells are `·` with the reason, and a red row's finding has a `do:` that runs the row without `--base` and a `fix:` when an edit lets `--base` build the world; a shape that hides part of the mapping is named in `mapping_changes.unseen` and makes `mapping_changed` true. A criterion only the base holds is a `removed` row, quoted under the summary's "Removed criteria". The trees install nothing and resolve packages from head's project; a `url` function receives `tree` (`"base"` or `"head"`) and may return nothing for the base, and one that returns head's URL for the base leaves the base world not run, so it has to branch on `tree`. A tree whose cells do not run says why on stderr, `<world> <environment> not run: <reason>`. The summary opens with a line naming the base and what changed. A project outside git is refused with `base-outside-git`, a ref that names no commit with `base-ref-unknown`, a shallow clone without it with `base-shallow` (its `do` is the `git fetch`), a git failure with `base-git-failed`, and a `featuresDir` at the project root with `base-features-at-root`; `--since` is refused with `removed-flag`.
|
|
51
52
|
- `nuka report [<run dir>] --format markdown|allure|messages [--out <path>] [--json]`: renders one finished run from its run directory alone, so a run directory copied off a CI machine renders too: `markdown` reads `run.json` alone, and `allure` and `messages` read `run.json`, the step records, and `sources.json`, the feature text the run parsed. With no run dir it renders the newest run. `markdown` is the run summary, on stdout or to `--out` (the file a CI step posts as a pull request comment); `allure` writes Allure 2 format results to `.nukadoko/export/allure-results/` or the directory `--out` names; `messages` is a cucumber-messages NDJSON stream on stdout or to `--out`, where a run over several environments gives each environment its own pickle, named `<scenario> (<environment>)`, and every execution of a control is left out, so a JUnit report of a green run is green; Allure keeps each control with the status it ran to, named `<scenario> (control)` with a `role` label, so a control that failed is a failed result there by design, and a CI gates on `nuka run`'s exit code. A file written under `.nukadoko/export/` is noted in the run's exports manifest, so retention removes it with the run, and rendering the same run there again replaces it; a file written anywhere else is not noted, and stays unless it sits inside a run directory that is removed. `--json` prints the envelope with `run_id`, `format`, and `written`, and needs `--out` for `markdown` and `messages`. A directory with no `run.json` is refused with `run-not-found`, and one whose `run.json` this release does not read with `run-invalid`; for `allure` and `messages`, one with no `sources.json` (a run from an earlier release) is refused with `run-sources-missing`, and one whose `sources.json` is corrupt or of another version with `run-sources-invalid`. A missing directory on the way to `--out` is created; anything else in the way (a directory where a file goes, a file where the Allure directory goes, a FIFO, a dangling symbolic link, a path under a regular file, or `allure-history.jsonl` in the export directory in any letter case) is refused with `report-out-invalid` before the run is read, and so is a markdown or messages file the file system refuses to write, with its error code; an Allure directory the file system refuses to write into ends as `report-incomplete`. A render that left out part of the run (a scenario, a step record, or an attachment it could not read) writes the rest and exits 1 with `report-incomplete`; a step whose step record is gone is never shown passed.
|
|
52
53
|
- `nuka verdict [--json]`: before you say a change is done. It reads the newest run that ended and never starts one, and exits 1 when no run ended (`run-missing`), the newest run judged another working tree (`run-stale`: a file git counts changed after it started), it ran part of its files or was a walk (`run-partial`), or it left something red (its own failed findings, relayed as it printed them). A pass says that run judged exactly this tree and left nothing red; it does not say the change has a criterion of its own. Notes: `run-without-base`, `criteria-unchanged` (under `--base`, no criterion is new or changed), `working-tree-unknown` (outside git or before the first commit, where the verdict is the run's own). `--json` adds `judged` (`missing`, `stale`, `judged`, `unknown`), `working_tree`, `run_id`, `run_dir`, `run_working_tree`, and `base`. `skills/nukadoko/scripts/claude-code-verdict-hook.mjs` is an opt-in Claude Code hook that asks for it at the end of a turn that changed the tree.
|
|
53
54
|
- `nuka judge <feature:line> [--run <run-id>] [--meets|--misses --by <name> --because <sentence>] [--json]`: when a run leaves a judgment `pending` or `stale`. A Then with a `judged-as` claim asks for a judgment no compare can give (whether a text reads as friendly); the run reads the value and judges nothing. Without a verdict flag it shows each value, the quality the sentence names, its digest, its step record, and the judged view. With `--meets` or `--misses`, `--by`, and `--because` it records one judgment per value in `judgments/<feature path>.json`, which you commit. The judge is not the agent that wrote the change. A row whose judgment is not `judged` fails the run (`judgment-pending`, `judgment-stale`, `judgment-misses`, `judgment-uncitable`); the verdict column is never changed by a judgment.
|
|
54
55
|
|
|
55
56
|
Exploring one step at a time, when the path is not known yet:
|
|
56
57
|
|
|
57
|
-
- `nuka do <name> --args <json> [--use <step record id>] [--env <name>]`: one typed step under its contract; the step record goes to stdout with its id. `--use` fills the step's `from` keys from an earlier record and repeats; `--args` may be left out only when `--use` supplies every key. Each call builds a fresh browser and starts clean, and with
|
|
58
|
+
- `nuka do <name> --args <json> [--use <step record id>] [--env <name>]`: one typed step under its contract; the step record goes to stdout with its id. `--use` fills the step's `from` keys from an earlier record and repeats; `--args` may be left out only when `--use` supplies every key. Each call builds a fresh browser and starts clean, and with a program starts the environment's world for this one execution and stops it after; a step that needs login state gets it from a fixture.
|
|
58
59
|
- `nuka run <file>:<line> --step [--env <name>]`, started in the background, then `nuka step wait [--walk <n>]`, `nuka step next <pause> --walk <n>`, and `nuka step stop <pause> --walk <n>`, each `[--timeout <s>] [--json]`: a walk of one scenario with a person. The run pauses after each step with the world, the browser, and the fixtures still open, writes a screenshot (`page.png`) and an ARIA snapshot (`page.aria.yml`) of each open page under `runs/<run_id>/pauses/<n>/` (`page-2.*` for a second page, `page.<name>.*` for a `pageAs` context; the URL, the title, and the snapshot, which holds field values, passwords included, are redacted with the loaded secrets, and the screenshot covers each element, in every frame, whose text or field value holds one, as the final screenshot does; a capture that takes longer than the page's 5 seconds is `null`, the title too), and waits until `nuka step` answers that pause; what a page sends while it waits goes to `pauses/<n>/http.jsonl`, not to the step's own files. `wait` prints where the walk stands: the step and its line, its status, its record, the views, the world's URL, and `do` with the answers; at a pause it answers nothing. `next <n>` runs the next step and prints the next pause or the end. `stop <n>` skips the steps after it (After hooks, which see `SKIPPED`, and teardown still run): the scenario is `stopped` with `stopped: { after_step, line }`, its steps after the stop `skipped`, its cell `stopped@<line>`, its row failed, and its finding `walk-stopped`. The pause number is the step number, and an answer names its walk with `--walk` (required for `next` and `stop`, the number each pause prints), so an answer moves only the pause the person saw: one for a walk that is not the walk in the project is refused with `walk-not-current`, which names that walk, the same answer again prints what followed it and writes nothing, another answer to that pause is refused with `pause-answered`, and a pause the walk is not at, or that an ended walk never reached, with `pause-not-current`; each refusal's `do` is `nuka step wait --walk <n>`, which reports that walk, its end included. After the last step or a failed one nothing is left to stop, and `do` names only `next`. `--timeout` (default 90 seconds) bounds the wait; on expiry `nuka step` prints the walk as `starting` (its run has not begun the scenario) or `running`, with the same command as `do`, safe to repeat. Without `--walk`, a wait reports the newest walk until a `nuka step` call has printed how it ended (kept as `walks-reported/<n>` in the state directory), so a walk that ended before the wait started is still reported once; after that it waits for the next walk, and is refused with `walk-not-found`, naming the last walk and how it ended, when none starts. `wait --walk <n>` reports walk n whatever was reported. The run refuses more than one scenario, environment, or execution, and `--base` (`step-needs-one-scenario`), and a second walk in the project (`walk-in-progress`). A signal ends the walk as `interrupted`; a run that was killed leaves it gone, which `nuka step` reports as `walk-gone`. Without `--json` the run writes each pause's lines on stderr (the step, a `failure:` line where the scenario failed, and `do`); with it, nothing. `run.json`'s `walk` lists each pause with its step record, its answer, and its views, and the run summary says the run was walked, so it is not the run a reviewer approves. A pause where the scenario failed (a failed step, or an AfterStep hook that failed after a step that passed) carries `failure` (`by`: `step` or `hook`, and `message`) and prints as `walk-failed`. `nuka step` exits 0 for a walk paused, starting, running, or ended green, 1 for one paused where its scenario failed, ended red, interrupted, or gone, and 2 for a refusal.
|
|
59
60
|
- A browser app whose state cannot be repeated (an account that opens once, an order that must not be placed twice) is explored through the host's Playwright MCP server, not `nuka do`. It is connected when its `browser_*` tools are listed; a Claude Code host adds it with `claude mcp add playwright npx @playwright/mcp@latest`. Then write what was found as a scenario and run `nuka check` on it.
|
|
60
61
|
|
|
@@ -121,8 +122,8 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
|
|
|
121
122
|
| `claim-sentence-unread` | error | A claim step with no observe is bound to a line whose docstring or table fills an args key, and no claim reads that key (as an actual, an expected value, or in where), so nothing checks the value the line states. defineStep refuses a pattern capture no claim reads; only the line says whether a docstring or a table fills a key, so this half is the check's, and nuka run breaks the step's claims for it too. | Compare a claim with the key (expected: "<key>"), or take the docstring or table off the line. |
|
|
122
123
|
| `claims-outside-then` | error | A claim step is bound in Given or When position, or on a * line, which Gherkin gives no position. Only a Then judges, so a broken claim there would read as a setup that broke instead of a criterion that failed. | Move the line to Then position, or bind a step that runs (defineStep with run) at this line. |
|
|
123
124
|
| `compat-step-not-runnable` | refused | nuka do names a compat step, which has no typed contract to run alone. | Promote the step to defineStep to run it with nuka do. |
|
|
124
|
-
| `condition-tag-malformed` | error | A tag starts with @with: or @without: but does not read as @with:<condition>, @with:<condition>=<value>, or @without:<condition>, so it names no condition. @with:<condition>=true and =false are malformed too: a value written as text is not the boolean the program
|
|
125
|
-
| `condition-unknown` | error | A condition tag names a condition that no environment in nukadoko.
|
|
125
|
+
| `condition-tag-malformed` | error | A tag starts with @with: or @without: but does not read as @with:<condition>, @with:<condition>=<value>, or @without:<condition>, so it names no condition. @with:<condition>=true and =false are malformed too: a value written as text is not the boolean the program declares. | Rewrite the tag as @with:<condition>, @with:<condition>=<value>, or @without:<condition>; a condition name holds letters, digits, "_", ".", or "-", a value holds no whitespace and no "@", and a boolean is @with:<condition> or @without:<condition>. |
|
|
126
|
+
| `condition-unknown` | error | A condition tag names a condition that no environment in the program in nukadoko.config.ts declares under conditions, so no environment sets it up. | Declare the condition under the conditions of the environments that set it up in the program in nukadoko.config.ts, or remove the tag. |
|
|
126
127
|
| `condition-unmet` | error | No environment the run selects meets every condition a scenario's tags name, so the scenario has no required cell and nothing shows that it holds. | Add an environment whose conditions meet the scenario's tags, name one with --env, or correct the tags. |
|
|
127
128
|
| `config-exists` | refused | nuka init found a config file, and writes nothing over it. | Edit the config file that exists, or delete it to start again. |
|
|
128
129
|
| `config-in-parent` | refused | There is no config file here, and one exists in a parent directory, so a file written here is not one that config reads. | Run the command from the directory that holds the config file. |
|
|
@@ -142,14 +143,14 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
|
|
|
142
143
|
| `env-file-missing` | warning | A configured envFile does not exist on disk, so nothing in it is ever loaded. | Create the file, or remove it from envFiles in the config file. |
|
|
143
144
|
| `env-file-skipped-line` | warning | A line in a configured envFile is not a blank line, a comment, or a binding, so nothing on it was loaded. | Rewrite the line as KEY=value, or start it with # to make it a comment. |
|
|
144
145
|
| `env-file-unreadable` | refused | A configured envFiles path is on disk and could not be read: a directory, or a file without read permission. The run stops before any step runs. | Make the file readable, replace the directory with a file, or remove the path from envFiles. |
|
|
145
|
-
| `environment-env-file-missing` | warning | An entry in one environment's own envFiles does not exist on disk. | Create the file, or remove it from that environment's envFiles in nukadoko.
|
|
146
|
-
| `events-inlet-missing` | error | A step's events counts execution events, and a world the run would serve names no {events} in its program
|
|
146
|
+
| `environment-env-file-missing` | warning | An entry in one environment's own envFiles does not exist on disk. | Create the file, or remove it from that environment's envFiles in the program in nukadoko.config.ts. |
|
|
147
|
+
| `events-inlet-missing` | error | A step's events counts execution events, and a world the run would serve names no {events} in its program, so the program has no file to write them to and each claim on the count is unjudged there (inlet-unnamed). | Set the variable the program reads to {events} under env in the program, such as EXECUTION_EVENTS: "{events}", and have the program append its execution events to that file. |
|
|
147
148
|
| `events-late` | note | nuka do found lines of the program's execution events that carry the step's trace id and arrived after the step ended, when the world stopped. They are in events-late.jsonl beside the step record, and are not in its observed.events. | No change is necessary. A job the step enqueued that performed after the step ended writes its lines then; observed.events.open names a job that had not performed. |
|
|
148
149
|
| `events-producer-ambiguous` | error | A step's events names more than one candidate step in of, and more than one of them runs earlier in the scenario, so the run cannot choose whose execution events to count and each claim on the count is unjudged. | Remove or move lines so that exactly one of the candidate steps runs before the line that counts their events. |
|
|
149
150
|
| `events-producer-missing` | error | A step's events counts the execution events of a step that no earlier line in the scenario runs, so each claim on the count is unjudged (producer-not-run). | Put a line that runs the step earlier in the scenario, or list the step an earlier line runs in that key's of. |
|
|
150
|
-
| `events-unread` | warning | A step's events counts execution events, and a world the run would start is one nukadoko does not serve (a url, or a project
|
|
151
|
+
| `events-unread` | warning | A step's events counts execution events, and a world the run would start is one nukadoko does not serve (a url, or a project whose config has no program), so it reads no execution events there and each claim on the count is unjudged (world-unread). | Run those scenarios in a world nukadoko serves, with {events} in env, or select one with --env. |
|
|
151
152
|
| `expects-tag-malformed` | error | A tag starts with @expects: but does not read as @expects:status=<500-599>, @expects:error=<class>, or @expects:page-error=<name>: an unknown kind, no value, a status outside 500 to 599, or a value with whitespace or "@". It accepts nothing, so under nuka run --no-check the failure it meant stays unexpected and its cell is broke. | Rewrite the tag as @expects:status=<500-599>, @expects:error=<class>, or @expects:page-error=<name>, one status, class, or name per tag; the unexpected-failure finding of a run spells the tag for what it saw. |
|
|
152
|
-
| `expects-unread` | warning | An @expects:error= tag accepts an unhandled error the program reports in its execution events, and no world the run would start reads them (the program
|
|
153
|
+
| `expects-unread` | warning | An @expects:error= tag accepts an unhandled error the program reports in its execution events, and no world the run would start reads them (the program names no {events}, the world runs at a url, or there is no program), so the tag can never match. | Name {events} in env of the program in nukadoko.config.ts for a world the run starts, such as env: { EXECUTION_EVENTS: "{events}" }, and have the program append its execution events there, or remove the tag. |
|
|
153
154
|
| `expects-unseen` | note | A scenario whose every execution passed carries an @expects: tag that matched nothing: the run saw every response, page error, or execution event of that kind in each execution, and none was the failure the tag accepts. A tag left in place accepts that failure in every later run. | Remove the tag when the failure it accepts no longer happens. When the failure is meant to happen, make the scenario cause it, so the tag names what the scenario does. |
|
|
154
155
|
| `fail-on-note-with-targets` | refused | nuka check with targets was given a --fail-on note code, and a check with targets computes no notes, so the gate could never fire. | Run nuka check without targets to gate on a note, or leave the note out of --fail-on. |
|
|
155
156
|
| `fail-on-unknown-code` | refused | --fail-on names a code that a nuka check report never contains. | Name an error, warning, or note code that nuka check --codes lists. |
|
|
@@ -208,10 +209,11 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
|
|
|
208
209
|
| `pause-not-current` | refused | nuka step answers a pause that is not the one the walk waits at: the walk has not reached it yet, has moved past it without that answer, or ended without reaching it. | Run nuka step wait --walk <n> to see the pause the walk waits at, and answer that pause. |
|
|
209
210
|
| `playwright-missing` | error | A feature line binds a step whose fixtures build page, context, pageAs, or request, and playwright does not resolve from the installed nukadoko, so the step would fail when it runs; or a step file imports playwright, playwright-core, or @playwright/test, itself or through another project file that the message names, which the project has not installed, so the file does not import. A step is reported once, at the first line that binds it. | Install the package that the message names in the project, at the version that the message names. |
|
|
210
211
|
| `program-exited` | warning | The program a world served exited while the scenarios still ran, so the requests after that found nothing listening. | Read the world's program.log, which the message names, for why the program exited. |
|
|
211
|
-
| `program-
|
|
212
|
+
| `program-file-moved` | refused | The project root holds a program file (nukadoko.program.ts, .mts, or .rb), which an earlier release read and this one does not: the program is part of the config now. | Move what the program file describes into the config as its program (program: () => ({ ... }) in nukadoko.config.ts, program: -> { { ... } } in nukadoko.config.rb), and delete the program file; CHANGELOG.md, under "The program moves into the config", shows the move. |
|
|
213
|
+
| `program-list-unread` | warning | A command under lists in the program in nukadoko.config.ts failed, passed its limit, or printed a line that is not one entry of its list, so that world's list was not read and nothing of it counts. | Correct the command the message names, or what it prints: one JSON object per line, in the shape docs/spec.md "Lists" gives for its kind. Its stderr is in the world's program.log. |
|
|
212
214
|
| `program-log-late` | note | nuka do found lines of the program's log that carry the step's trace id and arrived after the step ended, when the world stopped. They are in program-log-late.txt beside the step record, and are not in its observed.program_log. | No change is necessary. When it happens on every call, the program may buffer its output on a pipe; if so, set STDOUT.sync = true in Ruby, or PYTHONUNBUFFERED=1 for Python. |
|
|
213
|
-
| `program-placeholder-unfilled` | error | A command or an env value in nukadoko.
|
|
214
|
-
| `program-start-failed` | failed | The program in nukadoko.
|
|
215
|
+
| `program-placeholder-unfilled` | error | A command or an env value in the program in nukadoko.config.ts names a placeholder a world that nuka run with the same --env flags would start has no value for: {port} or {url} in a world with neither serve nor url, {condition.<name>} in one whose environment does not declare that condition, or anything but {root} in a build command. | Remove the placeholder from the field the message names, or give the world what fills it: serve or url for {port} or {url}, the condition under its environment's conditions for {condition.<name>}; in a build command, write only {root}, or move the command to prepare. |
|
|
216
|
+
| `program-start-failed` | failed | The program in nukadoko.config.ts did not start for a world: a build or prepare command failed or did not finish within its timeout_ms, the server did not answer its ready path in time, or setup or the url function threw or did not finish within its timeout_ms. The world's scenarios did not run. | Correct what the message names; the end of the world's program.log is in the message, and the whole file is in the world's directory. |
|
|
215
217
|
| `proof-run-incomplete` | warning | Under --concurrency, a proof round could not record a control's run: a BeforeAll or AfterAll hook failed in the worker the round started, or the worker exited without a record. Each control cell the round was given reads broke with the reason and proves nothing, so its row reads as one no control proves: held without --base, and under --base the base world runs for it. | Correct what the message names, such as the hook; the control proves on the next run. |
|
|
216
218
|
| `read-only-environment` | refused | A step that declares mutates: true targets an environment whose policy is read-only. | Run the step against an environment that allows writes, or declare mutates: false if it only reads. |
|
|
217
219
|
| `record-unmatched` | warning | A worker reported a record that matches no selected scenario, so nuka report cannot render it. | Run again without changing feature files while the run is in progress. |
|
|
@@ -266,13 +268,13 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
|
|
|
266
268
|
| `unexpected-failure` | failed | A scenario's steps passed and the program failed underneath one of them in a way no @expects: tag of the scenario names: a response with a status from 500 to 599, an error the page threw that nothing caught, or an error the program reported in its execution events with handled: false. Its cell is broke, so the claims that held prove nothing about the criterion. | Fix what failed in the program. A scenario that causes the failure on purpose names it with a tag on its Scenario line, such as @expects:status=503, @expects:error=<class>, or @expects:page-error=<name>; the finding's fix: line spells the tag. |
|
|
267
269
|
| `unfillable-required-key` | error | A step's args key is required, but nothing on this line (no pattern capture, no table/docstring attachment, and no declared from) can ever fill it. | Capture the key in the pattern, attach a table or a docstring, declare from for the key, or make the key optional. |
|
|
268
270
|
| `unknown-capture-key` | error | A pattern captures a key that is not a key of the step's args schema. | Rename the capture to a key of the args schema, or add the key to the schema. |
|
|
269
|
-
| `unknown-environment` | refused | --env names an environment that nukadoko.
|
|
271
|
+
| `unknown-environment` | refused | --env names an environment that the program in nukadoko.config.ts does not define. | Pass default or an environment the program in nukadoko.config.ts defines, or add it to environments there. |
|
|
270
272
|
| `unknown-parameter-type` | error | A pattern names a parameter type this project has not registered, such as {custom} with no matching config.parameterTypes entry. | Register the type in config.parameterTypes, or use a built-in type such as {key:string}. |
|
|
271
273
|
| `unknown-step` | refused | The command names a step that is not in the vocabulary. | Name a step that nuka steps lists. |
|
|
272
274
|
| `unnamed-capture` | error | A step's pattern has a capture with no name, such as {int} instead of {key:int}; every capture must name the args key it fills. | Name the capture after the args key that it fills, as {key:type}. |
|
|
273
275
|
| `unsupported-hook-tag-expression` | error | A compat hook's tag expression could not be parsed, so nukadoko cannot tell which scenarios it applies to. | Rewrite the hook's tags as a tag expression that nukadoko parses, such as @a and not @b. |
|
|
274
276
|
| `unterminated-capture` | error | A pattern has an opening { with no matching closing }, so the pattern cannot be parsed. | Close the capture with }, or escape a literal { as \\{. |
|
|
275
|
-
| `version-probe-failed` | warning | The environment's version probe did not answer, so the records have no target version. | Correct the environment's version setting in nukadoko.
|
|
277
|
+
| `version-probe-failed` | warning | The environment's version probe did not answer, so the records have no target version. | Correct the environment's version setting in the program in nukadoko.config.ts, or the endpoint it names. |
|
|
276
278
|
| `walk-failed` | failed | nuka step found the walk paused after a step that failed, or after a step whose AfterStep hook failed: the scenario is failed, and the pause names which of them failed and its message. The walk still waits for its answer, and nothing is left to stop. | Show the person the failure and the pause's views, answer next when they have seen it, and read the step record for the cause. |
|
|
277
279
|
| `walk-gone` | failed | nuka step found a walk whose nuka run --step process ended without recording how: it was killed, or it crashed, so its world, its browser, and its fixtures may not have been torn down. | Stop what the walk left running, if anything, and start the walk again with the command the finding names. |
|
|
278
280
|
| `walk-in-progress` | refused | nuka run --step found another walk in progress in this project: one walk at a time, since nuka step answers the walk the state directory names. | Finish the walk in progress with nuka step, or stop its nuka run --step process, then start this one. |
|
|
@@ -33,9 +33,9 @@ module Nukadoko
|
|
|
33
33
|
FRAGMENT: ::String
|
|
34
34
|
|
|
35
35
|
# JavaScript's \s, which the TypeScript engine's texts are cut by.
|
|
36
|
-
SPACE:
|
|
36
|
+
SPACE: String
|
|
37
37
|
|
|
38
|
-
WS:
|
|
38
|
+
WS: Regexp
|
|
39
39
|
|
|
40
40
|
# YAML's indicators: a plain scalar may not start with one, since
|
|
41
41
|
# YAML reads it as structure.
|
|
@@ -6,14 +6,19 @@
|
|
|
6
6
|
#
|
|
7
7
|
# - base: the ref's code with head's features/ and config, so a new or
|
|
8
8
|
# changed criterion runs where its behaviour should be absent. The ref's
|
|
9
|
-
# program
|
|
9
|
+
# program starts it, or head's when the ref has none: the program goes
|
|
10
|
+
# with the code, so the run writes the ref's config beside head's as
|
|
11
|
+
# nukadoko.tree-program.rb (or the ref's program file from before the
|
|
12
|
+
# program moved into the config as nukadoko.tree-legacy-program.rb).
|
|
10
13
|
# - old: head's working tree with the ref's features/ and config, so an
|
|
11
14
|
# unchanged criterion over a changed mapping runs under the steps it was
|
|
12
|
-
# approved with.
|
|
15
|
+
# approved with. Head's config goes beside it as nukadoko.tree-program.rb,
|
|
16
|
+
# so head's program starts it.
|
|
13
17
|
#
|
|
14
18
|
# The mapping is every file under features/ but a .feature file, the config
|
|
15
|
-
# file's bytes, and the program
|
|
16
|
-
# which decide where a criterion is
|
|
19
|
+
# file's bytes with its program lambda cut out, and the program's
|
|
20
|
+
# conditions and defaultEnvironments, which decide where a criterion is
|
|
21
|
+
# required. Every git command runs with
|
|
17
22
|
# hooks off, since a checkout's hook is the project's code and not the
|
|
18
23
|
# run's. Both trees are removed when the run ends.
|
|
19
24
|
module Nukadoko
|
|
@@ -23,10 +28,6 @@ module Nukadoko
|
|
|
23
28
|
|
|
24
29
|
FEATURES: ::String
|
|
25
30
|
|
|
26
|
-
CONFIG: ::String
|
|
27
|
-
|
|
28
|
-
PROGRAM: ::String
|
|
29
|
-
|
|
30
31
|
STATE: ::String
|
|
31
32
|
|
|
32
33
|
attr_reader ref: String
|
|
@@ -83,7 +84,7 @@ module Nukadoko
|
|
|
83
84
|
def prepare: (Array[[ String, Integer ]], Array[String]?, Array[String], Hash[Symbol, untyped]?) -> void
|
|
84
85
|
|
|
85
86
|
# The environments the old world runs in, with the conditions the ref's
|
|
86
|
-
# program
|
|
87
|
+
# program gives each; nil when the ref has no program, so
|
|
87
88
|
# head's environments are the old world's too.
|
|
88
89
|
# : (Hash[Symbol, untyped]?, Array[String]) -> Array[Environment]?
|
|
89
90
|
def old_environments_of: (Hash[Symbol, untyped]?, Array[String]) -> Array[Environment]?
|
|
@@ -108,10 +109,11 @@ module Nukadoko
|
|
|
108
109
|
# : (Array[String], String) -> Hash[String, String]
|
|
109
110
|
def mapping_files: (Array[String], String) -> Hash[String, String]
|
|
110
111
|
|
|
111
|
-
# The ref's program
|
|
112
|
-
#
|
|
113
|
-
#
|
|
114
|
-
|
|
112
|
+
# The ref's program: its program file from before the program moved
|
|
113
|
+
# into the config, or its config's program, read in a process of its
|
|
114
|
+
# own (ProjectProgram.elsewhere). nil when the ref has neither.
|
|
115
|
+
# : (String) -> Hash[Symbol, untyped]?
|
|
116
|
+
def read_program: (String) -> Hash[Symbol, untyped]?
|
|
115
117
|
|
|
116
118
|
# : (Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
117
119
|
def program_mapping: (Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
@@ -122,13 +124,17 @@ module Nukadoko
|
|
|
122
124
|
# : (String, String) -> void
|
|
123
125
|
def copy: (String, String) -> void
|
|
124
126
|
|
|
125
|
-
# The ref's checkout loses the ref's mapping and gains head's
|
|
126
|
-
# ref's program
|
|
127
|
-
#
|
|
128
|
-
|
|
127
|
+
# The ref's checkout loses the ref's mapping and gains head's. The
|
|
128
|
+
# ref's program stays: its program file under the tree's own name, or
|
|
129
|
+
# its config `ref_config` beside head's. When the ref has no program,
|
|
130
|
+
# head's config brings head's.
|
|
131
|
+
# : (Array[String], Array[String], String?) -> void
|
|
132
|
+
def overlay_base_tree: (Array[String], Array[String], String?) -> void
|
|
129
133
|
|
|
130
134
|
# Head's working tree with the ref's mapping in place of its own,
|
|
131
|
-
# written before the base checkout is overlaid.
|
|
135
|
+
# written before the base checkout is overlaid. Head's program stays:
|
|
136
|
+
# head's config goes beside the ref's, or a file that names no
|
|
137
|
+
# program when head has no config.
|
|
132
138
|
# : (Array[String], Array[String]) -> void
|
|
133
139
|
def write_old_tree: (Array[String], Array[String]) -> void
|
|
134
140
|
end
|
|
@@ -51,7 +51,7 @@ module Nukadoko
|
|
|
51
51
|
# `environments` is the selection a run without --env starts, for
|
|
52
52
|
# condition-unmet; nil when --env named the selection. `problems` are
|
|
53
53
|
# what the feature loader found that runs nothing.
|
|
54
|
-
# `config` holds what was found in the config and
|
|
54
|
+
# `config` holds what was found in the config and its program before
|
|
55
55
|
# any step loaded, such as an env file that is missing.
|
|
56
56
|
# : (Array[singleton(Step)], Array[Scenario], ?features: bool, ?full: bool, ?conditions: Array[String]?, ?environments: Array[Environment]?, ?problems: Array[FeatureProblem], ?config: Array[Finding]) -> void
|
|
57
57
|
def initialize: (Array[singleton(Step)], Array[Scenario], ?features: bool, ?full: bool, ?conditions: Array[String]?, ?environments: Array[Environment]?, ?problems: Array[FeatureProblem], ?config: Array[Finding]) -> void
|
|
@@ -96,6 +96,16 @@ module Nukadoko
|
|
|
96
96
|
# : () -> void
|
|
97
97
|
def check_unbound: () -> void
|
|
98
98
|
|
|
99
|
+
# A config parameter type no pattern names.
|
|
100
|
+
# : () -> void
|
|
101
|
+
def check_unused_parameter_types: () -> void
|
|
102
|
+
|
|
103
|
+
# A claim whose expected value is an args key a type with a
|
|
104
|
+
# transformer fills compares with what code made of the line, while
|
|
105
|
+
# the record would name the sentence as its source.
|
|
106
|
+
# : (singleton(Step)) -> void
|
|
107
|
+
def check_transformed: (singleton(Step)) -> void
|
|
108
|
+
|
|
99
109
|
# A from key every line fills with a capture never takes its value
|
|
100
110
|
# from the producer it names.
|
|
101
111
|
# : () -> void
|