nukadoko 0.5.0 → 0.7.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.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +553 -3
  3. data/README.ja.md +22 -6
  4. data/README.md +13 -7
  5. data/docs/ci.ja.md +542 -0
  6. data/docs/ci.md +635 -0
  7. data/docs/commands.ja.md +1524 -0
  8. data/docs/commands.md +1281 -0
  9. data/docs/engines.json +19 -0
  10. data/docs/execution-events.ja.md +336 -0
  11. data/docs/execution-events.md +423 -0
  12. data/docs/glossary.json +1348 -0
  13. data/docs/guide.ja.md +733 -0
  14. data/docs/guide.md +815 -0
  15. data/docs/intent.ja.md +133 -0
  16. data/docs/intent.md +156 -0
  17. data/docs/layout.ja.md +442 -0
  18. data/docs/layout.md +399 -0
  19. data/docs/releasing.ja.md +186 -0
  20. data/docs/releasing.md +237 -0
  21. data/docs/ruby/reference.ja.md +302 -0
  22. data/docs/ruby/reference.md +368 -0
  23. data/docs/spec.ja.md +8916 -0
  24. data/docs/spec.md +11250 -0
  25. data/docs/tutorial.ja.md +451 -0
  26. data/docs/tutorial.md +458 -0
  27. data/docs/typescript/adopting.ja.md +231 -0
  28. data/docs/typescript/adopting.md +251 -0
  29. data/docs/typescript/doors.ja.md +301 -0
  30. data/docs/typescript/doors.md +329 -0
  31. data/docs/typescript/migration-playwright-test.ja.md +189 -0
  32. data/docs/typescript/migration-playwright-test.md +212 -0
  33. data/docs/typescript/migration.ja.md +391 -0
  34. data/docs/typescript/migration.md +505 -0
  35. data/docs/typescript/reference.ja.md +176 -0
  36. data/docs/typescript/reference.md +197 -0
  37. data/docs/typescript/upgrading.ja.md +1774 -0
  38. data/docs/typescript/upgrading.md +2224 -0
  39. data/docs/web-app.ja.md +627 -0
  40. data/docs/web-app.md +659 -0
  41. data/docs/writing-scenarios.ja.md +544 -0
  42. data/docs/writing-scenarios.md +563 -0
  43. data/lib/nukadoko/base.rb +12 -5
  44. data/lib/nukadoko/changed_files.rb +95 -0
  45. data/lib/nukadoko/check.rb +459 -51
  46. data/lib/nukadoko/claim_drops.rb +271 -0
  47. data/lib/nukadoko/claim_line.rb +24 -4
  48. data/lib/nukadoko/claim_rules.rb +143 -1
  49. data/lib/nukadoko/claim_sides.rb +157 -9
  50. data/lib/nukadoko/cli.rb +403 -50
  51. data/lib/nukadoko/codes.json +246 -21
  52. data/lib/nukadoko/codes.rb +21 -4
  53. data/lib/nukadoko/command.rb +120 -13
  54. data/lib/nukadoko/command_help.rb +128 -0
  55. data/lib/nukadoko/compat.rb +469 -0
  56. data/lib/nukadoko/criteria.rb +1 -1
  57. data/lib/nukadoko/definition.rb +157 -7
  58. data/lib/nukadoko/error_frames.rb +6 -3
  59. data/lib/nukadoko/events/count.rb +146 -0
  60. data/lib/nukadoko/events/counted.rb +114 -0
  61. data/lib/nukadoko/events/format.rb +257 -0
  62. data/lib/nukadoko/events/lists.rb +154 -0
  63. data/lib/nukadoko/events/path.rb +285 -0
  64. data/lib/nukadoko/events/read.rb +284 -0
  65. data/lib/nukadoko/events/reader.rb +490 -0
  66. data/lib/nukadoko/events/selection.rb +252 -0
  67. data/lib/nukadoko/events/tally.rb +438 -0
  68. data/lib/nukadoko/features.rb +2 -2
  69. data/lib/nukadoko/fixtures.rb +160 -35
  70. data/lib/nukadoko/http_recording.rb +6 -2
  71. data/lib/nukadoko/intent.rb +364 -0
  72. data/lib/nukadoko/intent_file.rb +81 -0
  73. data/lib/nukadoko/intent_view.rb +190 -0
  74. data/lib/nukadoko/js_json.rb +2 -1
  75. data/lib/nukadoko/judge.rb +2 -2
  76. data/lib/nukadoko/judgment_file.rb +22 -1
  77. data/lib/nukadoko/judgments.rb +33 -3
  78. data/lib/nukadoko/measure_mcp.rb +202 -0
  79. data/lib/nukadoko/parts.rb +8 -2
  80. data/lib/nukadoko/path_view.rb +252 -0
  81. data/lib/nukadoko/place_rows.rb +161 -0
  82. data/lib/nukadoko/program.rb +1265 -51
  83. data/lib/nukadoko/program_log.rb +122 -0
  84. data/lib/nukadoko/program_shape.rb +385 -0
  85. data/lib/nukadoko/project_fixtures.rb +43 -10
  86. data/lib/nukadoko/project_program.rb +5 -4
  87. data/lib/nukadoko/repeated_prefix.rb +310 -0
  88. data/lib/nukadoko/report_run.rb +3 -3
  89. data/lib/nukadoko/run.rb +1156 -159
  90. data/lib/nukadoko/run_record.rb +70 -46
  91. data/lib/nukadoko/scaffold.rb +24 -6
  92. data/lib/nukadoko/schema.rb +15 -2
  93. data/lib/nukadoko/secrets.rb +55 -5
  94. data/lib/nukadoko/states.rb +478 -0
  95. data/lib/nukadoko/step.rb +71 -2
  96. data/lib/nukadoko/step_fixtures.rb +52 -3
  97. data/lib/nukadoko/summary.rb +803 -30
  98. data/lib/nukadoko/table.rb +4 -2
  99. data/lib/nukadoko/text_fit.rb +20 -7
  100. data/lib/nukadoko/trace.rb +152 -45
  101. data/lib/nukadoko/tree_passes.rb +95 -33
  102. data/lib/nukadoko/underneath.rb +311 -0
  103. data/lib/nukadoko/verdict.rb +18 -1
  104. data/lib/nukadoko/version.rb +1 -1
  105. data/lib/nukadoko/vocabulary.rb +166 -23
  106. data/lib/nukadoko/walk.rb +2 -2
  107. data/lib/nukadoko/walk_step.rb +1 -1
  108. data/lib/nukadoko.rb +23 -0
  109. data/llms.txt +42 -35
  110. data/sig/generated/nukadoko/base.rbs +4 -4
  111. data/sig/generated/nukadoko/changed_files.rbs +42 -0
  112. data/sig/generated/nukadoko/check.rbs +147 -10
  113. data/sig/generated/nukadoko/claim_drops.rbs +135 -0
  114. data/sig/generated/nukadoko/claim_line.rbs +11 -0
  115. data/sig/generated/nukadoko/claim_rules.rbs +49 -4
  116. data/sig/generated/nukadoko/claim_sides.rbs +63 -12
  117. data/sig/generated/nukadoko/cli.rbs +80 -7
  118. data/sig/generated/nukadoko/codes.rbs +19 -4
  119. data/sig/generated/nukadoko/command.rbs +68 -1
  120. data/sig/generated/nukadoko/command_help.rbs +18 -0
  121. data/sig/generated/nukadoko/compat.rbs +392 -0
  122. data/sig/generated/nukadoko/criteria.rbs +1 -1
  123. data/sig/generated/nukadoko/definition.rbs +50 -0
  124. data/sig/generated/nukadoko/error_frames.rbs +1 -1
  125. data/sig/generated/nukadoko/events/count.rbs +69 -0
  126. data/sig/generated/nukadoko/events/counted.rbs +70 -0
  127. data/sig/generated/nukadoko/events/format.rbs +163 -0
  128. data/sig/generated/nukadoko/events/lists.rbs +47 -0
  129. data/sig/generated/nukadoko/events/path.rbs +161 -0
  130. data/sig/generated/nukadoko/events/read.rbs +109 -0
  131. data/sig/generated/nukadoko/events/reader.rbs +226 -0
  132. data/sig/generated/nukadoko/events/selection.rbs +100 -0
  133. data/sig/generated/nukadoko/events/tally.rbs +227 -0
  134. data/sig/generated/nukadoko/features.rbs +6 -4
  135. data/sig/generated/nukadoko/fixtures.rbs +67 -11
  136. data/sig/generated/nukadoko/http_recording.rbs +1 -1
  137. data/sig/generated/nukadoko/intent.rbs +132 -0
  138. data/sig/generated/nukadoko/intent_file.rbs +46 -0
  139. data/sig/generated/nukadoko/intent_view.rbs +69 -0
  140. data/sig/generated/nukadoko/judgment_file.rbs +7 -1
  141. data/sig/generated/nukadoko/judgments.rbs +10 -0
  142. data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
  143. data/sig/generated/nukadoko/parts.rbs +2 -2
  144. data/sig/generated/nukadoko/path_view.rbs +105 -0
  145. data/sig/generated/nukadoko/place_rows.rbs +43 -0
  146. data/sig/generated/nukadoko/program.rbs +627 -23
  147. data/sig/generated/nukadoko/program_log.rbs +67 -0
  148. data/sig/generated/nukadoko/program_shape.rbs +147 -0
  149. data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
  150. data/sig/generated/nukadoko/project_program.rbs +2 -1
  151. data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
  152. data/sig/generated/nukadoko/report_run.rbs +1 -1
  153. data/sig/generated/nukadoko/run.rbs +286 -41
  154. data/sig/generated/nukadoko/run_record.rbs +20 -12
  155. data/sig/generated/nukadoko/scaffold.rbs +3 -0
  156. data/sig/generated/nukadoko/schema.rbs +5 -0
  157. data/sig/generated/nukadoko/secrets.rbs +26 -3
  158. data/sig/generated/nukadoko/states.rbs +214 -0
  159. data/sig/generated/nukadoko/step.rbs +58 -1
  160. data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
  161. data/sig/generated/nukadoko/summary.rbs +256 -2
  162. data/sig/generated/nukadoko/table.rbs +3 -2
  163. data/sig/generated/nukadoko/trace.rbs +108 -33
  164. data/sig/generated/nukadoko/tree_passes.rbs +36 -8
  165. data/sig/generated/nukadoko/underneath.rbs +141 -0
  166. data/sig/generated/nukadoko/verdict.rbs +8 -0
  167. data/sig/generated/nukadoko/vocabulary.rbs +45 -6
  168. data/skills/nukadoko/SKILL.md +18 -18
  169. data/skills/nukadoko/references/checking-steps.md +16 -83
  170. data/skills/nukadoko/references/diagnosing.md +6 -6
  171. data/skills/nukadoko/references/done.md +22 -0
  172. data/skills/nukadoko/references/evidence.md +19 -6
  173. data/skills/nukadoko/references/exploring.md +22 -7
  174. data/skills/nukadoko/references/fixtures.md +12 -32
  175. data/skills/nukadoko/references/judgments.md +18 -0
  176. data/skills/nukadoko/references/maintenance.md +1 -1
  177. data/skills/nukadoko/references/merge-risk.md +1 -1
  178. data/skills/nukadoko/references/parts.md +46 -23
  179. data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
  180. data/skills/nukadoko/references/program.md +168 -169
  181. data/skills/nukadoko/references/reviewing.md +20 -20
  182. data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
  183. data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
  184. data/skills/nukadoko/references/ruby/fixtures.md +34 -0
  185. data/skills/nukadoko/references/ruby/program.md +112 -0
  186. data/skills/nukadoko/references/ruby/step-files.md +115 -0
  187. data/skills/nukadoko/references/running.md +34 -34
  188. data/skills/nukadoko/references/scenario-rules.md +7 -6
  189. data/skills/nukadoko/references/states.md +7 -1
  190. data/skills/nukadoko/references/step-files.md +41 -120
  191. data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
  192. data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
  193. data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
  194. data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
  195. data/skills/nukadoko/references/typescript/fixtures.md +56 -0
  196. data/skills/nukadoko/references/typescript/program.md +111 -0
  197. data/skills/nukadoko/references/typescript/step-files.md +104 -0
  198. data/skills/nukadoko/references/verdicts.md +10 -10
  199. data/skills/nukadoko/references/writing-steps.md +67 -67
  200. data/skills/nukadoko/references/writing-the-feature.md +1 -1
  201. data/skills/nukadoko-verification/SKILL.md +13 -8
  202. metadata +103 -7
  203. data/skills/nukadoko/references/ruby.md +0 -80
data/llms.txt CHANGED
@@ -6,22 +6,22 @@ It is not an untyped free-form agent runner, and it approves nothing: a person r
6
6
 
7
7
  Declaration is separate from observation. A step declares `mutates`, its `args` and `returns` schemas, what it chains `from`, and the states it `requires`, `gives`, and `ends` (`"book-open"`, or `["signed-in", "person"]` for a state each person holds on their own); the record holds what the tool saw. `nuka check` reports `state-missing` at a line whose step requires a state no earlier line can have left holding, and its fix names the line to put first.
8
8
 
9
- A step either runs (`run`) or claims (`claims`). Only a Then claims, and a Then never runs: it declares which value it reads, how it compares that value, and where the expected value comes from (a key the sentence fills, an earlier step's result, a literal the sentence states, or a second reading), or names a count of what the program did inside an earlier step, which nukadoko reads from the program's execution events, or the files an earlier step's `runCommand` processes added, changed, or removed, which nukadoko reads from that step's record and leaves unjudged when it measured none, and nukadoko compares and records each claim, with where each value came from, as `held`, `broken`, `unjudged` (nukadoko could not judge it, so nothing is known about the criterion), or `unobserved` (`observe` threw, so nothing was read). Each side is judged as one plain JSON snapshot taken where the value comes from (a value that is not plain JSON, a Proxy, or one nested deeper than 256 levels leaves the claim unjudged), an args schema must not rewrite a value a claim reads (a claim reads the line's text as JSON with `expected_view: "json"`), and a literal must be exactly the sentence's own words. A typed Then does not call `expect`. For what a page shows, `observe` returns the page or a locator and a `fits-aria-snapshot` claim judges the ARIA snapshot nukadoko takes of it against a docstring that states part of the tree by role and name; what the docstring leaves out is not asked. A polled Then can name in `poll.settled` a state a reading cannot leave once it reaches it, as comparisons of what `observe` returns with literals the step writes: two consecutive readings in that state with a claim broken stop the poll before its timeout, the broken line and the record's `settled.stop` say so, and a settled reading never makes a claim hold. A Then whose `observe` reaches a page records, for each open page and each reading, the latest response the page finished receiving before the reading and the requests to the world in flight during it, with the step each was sent during (`pages`, indexes into `page_requests`, each with the `trace_id` and `span_id` of the `traceparent` it went out with, so the span id finds the page's http.jsonl line and the program's request line when pages share one step's trace), and its run summary line names a request in flight: an order, never what the page drew, and it changes no outcome. docs/spec.md "Claims" has the rules.
9
+ A step either runs (`run`) or claims (`claims`). Only a Then claims, and a Then never runs: it declares which value it reads, how it compares that value, and where the expected value comes from (a key the sentence fills, an earlier step's result, a literal the sentence states, or a second reading), or names a count of what the program did inside an earlier step, which nukadoko reads from the program's execution events, or the files an earlier step's `runCommand` processes added, changed, or removed, which nukadoko reads from that step's record and leaves unjudged when it measured none, and nukadoko compares and records each claim, with where each value came from, as `held`, `broken`, `unjudged` (nukadoko could not judge it, so nothing is known about the criterion), or `unobserved` (`observe` threw, so nothing was read). Each side is judged as one plain JSON snapshot taken where the value comes from (a value that is not plain JSON, a Proxy, or one nested deeper than 256 levels leaves the claim unjudged), an args schema must not rewrite a value a claim reads (a claim reads the line's text as JSON with `expected_view: "json"`), and a literal must be exactly the sentence's own words. A typed Then does not call `expect`. For what a page shows, `observe` returns the page or a locator and a `fits-aria-snapshot` claim judges the ARIA snapshot nukadoko takes of it against a docstring that states part of the tree by role and name; what the docstring leaves out is not asked. A polled Then can name in `poll.settled` a state a reading cannot leave once it reaches it, as comparisons of what `observe` returns with literals the step writes: two consecutive readings in that state with a claim broken stop the poll before its timeout, the broken line and the record's `settled.stop` say so, and a settled reading never makes a claim hold. A Then whose `observe` reaches a page records, for each open page and each reading, the latest response the page finished receiving before the reading and the requests to the system in flight during it, with the step each was sent during (`pages`, indexes into `page_requests`, each with the `trace_id` and `span_id` of the `traceparent` it went out with, so the span id finds the page's http.jsonl line and the program's request line when pages share one step's trace), and its run summary line names a request in flight: an order, never what the page drew, and it changes no outcome. docs/spec.md "Claims" has the rules.
10
10
 
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
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
- - `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`.
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, services, primary, stepsReach })`, 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 service's root; `prepare` runs once per system with the system'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(system)` runs after `ready`, before the first scenario, with `system` of `{ name, service, root, dir, tree, signal, url, port, env, services, conditions }`, and what it returns, a JSON value or nothing, reaches every step as the `setupResult` fixture and run.json as `systems[].setup_result` (a value that is not JSON fails the system with `program-start-failed`, naming the path of the part that cannot cross; a step that reads `setupResult` where no `setup` makes one throws `SetupResultMissingError`, and `nuka check` reports `setup-result-missing`). `stepsReach`, `"any"` by default and overridable per environment, says how far the code that runs with the scenarios may reach into the program: `"url"` makes a service URL the only way in, so `runCommand` starts no process and throws `CommandRefusedError` in a step, a project fixture, a hook, or `setup`, the step record keeps the command with `refused: "steps-reach-url"` and no exit code, that execution's cell is `broke`, the run reports `command-refused`, and `nuka check` reports `steps-reach-command` as a note before anything runs. A program of several servers names each under `services: { <name>: { root, build, prepare, serve | url, env, lists } }`, with `primary` naming the one the steps reach (required with two or more); `external: true` names one nukadoko only reaches at its `url`, whose requests carry no `traceparent`; a program that writes no `services` is one service named `main`. Every port is chosen before any service runs a command, so `{service.<name>.url}` and `{service.<name>.port}` name another service's; `build` and `prepare` run service by service in the order written, then every `serve` starts at once. A `root` relative to the project or absolute is `code: "tree"` inside the repository and `"checkout"` outside it: under `nuka run --base` a checkout is the same directory for head's system and the base's, built once a run, and run.json records its `commit` and `dirty` (`null` with no git or no commit; a dirty one fails nothing, and the run summary names each checkout on a line of its own). A `root` that is no directory is `program-service-root-missing`, before anything builds. The `services` fixture gives a step each service's `url`, `port`, `root`, `dir`, and `env` by name, and throws `UnknownServiceError` for a name the program does not write. `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 system nukadoko serves with `{events}`, of the tree the run started in (the `tables` command of every tree, and of `nuka do`'s system when its step counts execution events), each runs once after `setup`, in the root with the system's env and placeholders, within 60000 ms (`{ command, timeout_ms }`), its stderr in `program.log`; a system at a `url` and one with no events file read none, the base and old systems 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 system and no row, and raises the `program-list-unread` warning naming the command and the line (a base or old system'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 service's directory, `.nukadoko/runs/<run_id>/systems/<env>/<service>/`), `{service.<name>.url}`, `{service.<name>.port}`, `{root}`, `{system}`, `{token}` (random per system, redacted as `{{secret.SYSTEM_TOKEN}}`), `{events}` (in a system 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 system stops), and `{condition.<name>}` (the value the system's environment declares under `conditions`, as text); a placeholder with no value in that system (`{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 systems a `nuka run` with the same `--env` flags would start and by `nuka run` and `nuka do` for the systems 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 system per environment before its BeforeAll hooks and stops it after the scenarios; the system's URL, its primary service's, is the base URL of `page`, `context`, `pageAs`, `request`, and the `baseURL` fixture. `nuka do` starts one for its execution. Each service's `program.log`, in its directory, holds what its commands printed, redacted. run.json's `systems` lists each system (`name`, `tree`, `primary`, `url`, `error`, `timings` with `setup_ms` and `stop_ms`, and `services`, one entry per service with `name`, `code`, `root`, `url`, `commands`, `timings`, `log`, `error`, `program_log: { stamped, lines, late, tagged }`, counted when the system stops, `null` for a service at a `url`, and `events: { file, lines, owned, late, unowned, unreadable, undefined_kinds }` when the service names `{events}`, `null` for a service 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 system in `system_name`. Every request a step sends to the origin of one of the system's services but an external one (through `fetch`, `node:http`, `node:https`, a Playwright request context, or a Chromium page's documents, fetches, XHRs, and EventSources; for a `localhost` system, 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 system'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 system 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 system's eight characters begin 32 hexadecimal ones), wherever and whenever it appears, and redaction never changes a trace id of the system or a `traceparent` value holding one; each step record gets each service's lines so far in `program-log.<service>.txt` beside it, redacted, and `observed.program_log: { trace_id, stamped, services: { <service>: { lines, file, stamped, truncated? } } }` (`file` is `null` when `lines` is 0, and a service at a `url` is `null`); 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.<service>.txt` when the system stops, run.json's step gets `program_log_late: { <service>: { 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 system, decided from the whole log, when no line carries a trace id of the system, 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 service runs at a `url`; there its entry in `observed.program_log.services` is `null`. Each service that names `{events}` (`env: { EXECUTION_EVENTS: "{events}" }`) gets a file of its own, where the program can append one JSON line per operation it ends, 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 each service's lines, parsed, redacted (trace ids kept), and written again as JSON, in `events.<service>.jsonl` beside it, with `observed.events: { trace_id, stamped, services: { <service>: { lines, file, kinds, stamped, stamped_spans, unreadable, unowned, process_requests } }, process_spans, whole, open }`, with `mcp_spans` when the step sent an MCP call (a service whose events nukadoko does not read is `null`; a service's `stamped` counts the requests the step sent it, and `stamped_spans` are their span ids, at most 1000 over every service; `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), every service's file read together, with the same wait as the program's log. `whole` and `open` are one answer for the step over every service's lines, since the trace is one and only the files are several: `whole` is `true` when every request the step stamped has its `request` line in the file of the service it went to (by span id), every job enqueued in the trace performed in the service that enqueued it, every `runCommand` process it ran closed with no process of its group left, every MCP call it sent went out in a stamped request, and nukadoko reads the events of every service it sent a request to; otherwise `open` names why, one gap word each in this order, a gap about one service naming it in `service`: `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), `service-unrecorded` (`service`: the step sent that service a request and nukadoko reads none of its events, since it names no `{events}` or runs at a `url`), `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.<service>.jsonl`, run.json's step gets `events_late: { <service>: { lines, file, truncated? } }`, and `nuka do` prints an `events-late` note per service; the system's stop also gives each step of a system a service of which has an events file `path: { requests, entries, maybe, open }`, its trace counted by what each line did over every service's lines, late ones included: `requests` each `request` line's `service`, `method`, `route`, `status` in the order the step sent them, `entries` with `service` and `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 system's redacted copy is `systems/<env>/<service>/events.jsonl`, and the run summary gives the system one line when the file was not read, got no line, or holds lines no step record holds. A system at a `url` refuses `{events}`, and its steps' `observed.events` is `null`. A claim step's `events: { <key>: { of, count, service } }` 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`), `service` names the one service whose lines it counts and is left out to count every service's (a name no service of a system the run would start has is `events-service-unknown`, an error of `nuka check`), 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 system has reported no line of the kind; `system-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>`, with ` in service <name>` after it for a key that names one, `measured` `{ step_record_id: <own>, channel: "events_read.<key>" }`, and the step's `events_read.<key>`, `{ of, trace_id, count, service, range, counted, whole, open, maybe, lines, unreadable, unowned, file, waited_ms }` (`service` only on a key that names one), 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 system stops, each reading is counted again over every line of the trace, and a claim the whole count judges otherwise gets `after_system_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 system 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; one that writes `url` takes none of the top level's `build`, `prepare`, or `root`; a service's fields go under the entry's own `services`, by name) 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 system, 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
- - `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
- - `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 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
- - 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.
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 system: 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
+ - `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 system'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 system 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, and `service`, the service of the system whose origin answered it, absent for a request to no service's origin), `program_log` (when the run has a system URL: the step's slice of the program's log, above), `events` (when a service of the program names `{events}`, or `null` for a system at a `url`: the step's execution events, one entry per service, 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 system 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
+ - 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. Both packages ship `docs/` beside it, so a finding that cites the spec and a skill that links to a document open in the installed copy.
25
25
 
26
26
  ## Ruby
27
27
 
@@ -29,15 +29,16 @@ The `nukadoko` gem is a second engine that reads the same feature files and judg
29
29
 
30
30
  - `gem "nukadoko", group: :test` in the Gemfile, then `bundle exec nuka init`: it writes `nukadoko.config.rb`, `features/steps/`, the `.gitignore` entries, and a `scenarios` task in the Rakefile. Run every command as `bundle exec nuka`. It needs Ruby 3.4 or later.
31
31
  - A step is a class in `features/steps/<name>.rb` (`add_todo.rb` is `add-todo`): `class AddTodo < Nukadoko::Step` with `pattern`, `description`, `mutates`, `args { string :title, "what it is" }`, `returns { ... }`, `from title: [CreateTodo, :title]`, `parts [...]`, and `def run(request:, args:)`. Field kinds are `string`, `integer`, `number`, `boolean`, `enum`, `strings`, `table`, `object { ... }`, `unknown`, and `field :key, OtherStep.returns[:key]`; `null: true` allows nil.
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
- - The keyword arguments of `run` or `observe` name the fixtures, with `args:` only when the body reads them: the TypeScript names (`request`, `page`, `context`, `pageAs`, `env`, `requireEnv`, `baseURL`, `resultOf`, `call`, `section`, `poll`, `evidence`, `scratch`), and each `Nukadoko.fixture(:name) { |use| use.(value) }` in `nukadoko.config.rb`. `base_url`, `require_env`, `page_as`, and `result_of` are snake_case names of the same fixtures. A fixture TypeScript calls is a lambda: `page_as.("aki")`, `section.("paid")`, and `poll.(description: "the order") { value or nil }`. `skills/nukadoko/references/ruby.md` maps each TypeScript shape to its Ruby form.
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. `files written: { of: RunBuild, change: "added", under: "src" }` names the paths an earlier step's `Nukadoko.run_command` processes changed, which a claim reads as `actual: "written"`.
33
+ - The keyword arguments of `run` or `observe` name the fixtures, with `args:` only when the body reads them: the TypeScript names (`request`, `page`, `context`, `pageAs`, `env`, `requireEnv`, `baseURL`, `services`, `setupResult`, `resultOf`, `call`, `section`, `poll`, `evidence`, `scratch`), and each `Nukadoko.fixture(:name) { |use| use.(value) }` in `nukadoko.config.rb`. `base_url`, `require_env`, `page_as`, `setup_result`, and `result_of` are snake_case names of the same fixtures. A fixture TypeScript calls is a lambda: `page_as.("aki")`, `section.("paid")`, and `poll.(description: "the order") { value or nil }`. `skills/nukadoko/references/ruby/` writes each shape in Ruby, under the same headings as `references/typescript/`.
34
34
  - `page`, `context`, and `page_as` give playwright-ruby-client objects. Its `page.wait_for_url` takes a String or a Regexp (a Proc never matches), and `context.expect_page` raises ArgumentError: wait for a tab with `context.expect_event("page") { ... }`.
35
35
  - `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.
36
36
  - `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`.
37
37
  - `Nukadoko.config(envFiles: [".env"], secrets: { public: [...], redact: [...] })` loads env files and classifies their secrets as above.
38
38
  - `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.
39
39
  - 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.
40
- - Not in the gem yet: `requires`, `gives`, and `ends`, `measureMcp`, the `nukadoko/compat` door, and `nuka init --allure`.
40
+ - A cucumber-ruby suite comes in as it is: every `.rb` file under `features/` loads in cucumber-ruby's order (`features/support/env.rb`, the rest of `features/support/`, then the others), with `Given`, `When`, `Then`, `Before`, `After`, `AfterStep`, `BeforeAll`, `AfterAll`, `World`, and `ParameterType` at the top level. A compat step is named `compat: <pattern>`, takes the matched values and then a `DataTable` or doc string, runs on the scenario's World with a step record of its own, and is refused by `nuka do` (`compat-step-not-runnable`); `pending` fails it with the kind `unsupported`, and `open_page` and `open_request` return the measured page and request. The gem does not measure the World's reads and writes, so its compat step records have no `world`. [docs/ruby/reference.md](https://github.com/meganemura/nukadoko/blob/main/docs/ruby/reference.md) "Compat steps" lists what the door takes.
41
+ - Not in the gem: the Playwright Test door, which brings a JavaScript suite in. The gem's `Nukadoko.measure_mcp(transport)` is `measureMcp` for the mcp gem's client: it measures `send_request` and `send_notification`, and `nuka check` notes `MCP::Client.new(transport: MCP::Client::Stdio.new(...))`.
41
42
 
42
43
  ## The loop
43
44
 
@@ -46,18 +47,18 @@ Run them in this order. Exit 0 is the only pass.
46
47
  - `nuka steps [--json]`: the whole vocabulary, typed and compat: name, patterns, description, `mutates`, a claim step's claims and `poll`, and the states each step `requires` (each with `given_by`, the steps with a pattern that give it), `gives`, and `ends`.
47
48
  - `nuka describe <name>`: one step's full contract, schemas as JSON Schema.
48
49
  - 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.
49
- - `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`.
50
+ - `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 system'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`.
50
51
  - `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.
51
- - `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.
52
- - `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`.
52
+ - `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 systems 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.
53
+ - `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 system 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 system's URL or `null`, and `conditions` when it declares them), `systems` (each system 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`), `systems`, its columns `{ system, environment }` with `system` 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 `system`, `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 system's `lists.flags` list declares one: one row per `service`, `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 system 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 system whose list was not read), `paths` (only when a pair of sides read execution events: under `--base` each environment's base system against its head system, `between: { kind: "base" }`, base pairs first, for the rows the base ran there, which, when a service of both programs names `{events}`, is every row whose head cell there is required and ran (head's `{events}` alone builds the base system 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` (`system`, `environment`), side `a` being the base system, 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 `system` 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, system, 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 system 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 system 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 system 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` system (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` system (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 system alone, a workspace package linked into `node_modules` from inside the repository: the system 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 system; 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 system not run, so it has to branch on `tree`. A tree whose cells do not run says why on stderr, `<system> <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`.
53
54
  - `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.
54
- - `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.
55
+ - `nuka verdict [--json] [--trailer]`: 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`, `base`, and `trailer`. `--trailer` prints only that trailer, one git trailer line that stamps a commit (`Nukadoko-Verdict: passed run <run_id> tree <tree id>`; `failed`, `stale`, `none` when no run ended, or `unknown` when git gave no tree id; the tree is the one the run recorded, so compare it with `git rev-parse <commit>^{tree}`), and exits 0 whatever it says: it observes, and the plain command blocks. `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.
55
56
  - `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.
56
57
 
57
58
  Exploring one step at a time, when the path is not known yet:
58
59
 
59
- - `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.
60
- - `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.
60
+ - `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 system for this one execution and stops it after; a step that needs login state gets it from a fixture.
61
+ - `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 system, 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 system'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.
61
62
  - 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.
62
63
 
63
64
  ## Other commands
@@ -73,14 +74,14 @@ A command that stops before it has anything to report (a bad flag, a missing tar
73
74
 
74
75
  ## Documentation
75
76
 
76
- - [skills/nukadoko/SKILL.md](skills/nukadoko/SKILL.md): a requirement to a scenario and the run that is its evidence, for a person to review. `references/` beside it holds the rules a scenario follows (`scenario-rules.md`) and each procedure: writing steps, step files, steps that check something, parts, writing the feature, running, reading the verdict table (`verdicts.md`), worlds that differ in time zone or clock (`perturbed-worlds.md`), what `nuka verdict` says before a change is called done (`done.md`), a reviewer's merge-risk questions answered from a run (`merge-risk.md`), criteria a reader judges (`judgments.md`), diagnosing, exploring, walking a person through a run one step at a time, fixtures, evidence, maintenance, and starting from prose. `references/examples/` holds three finished projects (a CLI, an HTTP API, a stateful workflow) with the output of real runs.
77
- - [docs/migration.md](docs/migration.md): moving a cucumber-js suite across, in two stages, with the working rules for whoever does it (there is no migration skill: a migration happens once). A Playwright Test suite starts at [docs/migration-playwright-test.md](docs/migration-playwright-test.md).
77
+ - [skills/nukadoko/SKILL.md](skills/nukadoko/SKILL.md): a requirement to a scenario and the run that is its evidence, for a person to review. `references/` beside it holds the rules a scenario follows (`scenario-rules.md`) and each procedure: writing steps, step files, steps that check something, parts, writing the feature, running, reading the verdict table (`verdicts.md`), systems that differ in time zone or clock (`perturbed-systems.md`), what `nuka verdict` says before a change is called done (`done.md`), a reviewer's merge-risk questions answered from a run (`merge-risk.md`), criteria a reader judges (`judgments.md`), diagnosing, exploring, walking a person through a run one step at a time, fixtures, evidence, maintenance, and starting from prose. `references/ruby/` and `references/typescript/` hold each engine's step code under the same headings, and `references/typescript/examples/` holds three finished projects (a CLI, an HTTP API, a stateful workflow) with the output of real runs.
78
+ - [docs/typescript/migration.md](docs/typescript/migration.md): moving a cucumber-js suite across, in two stages, with the working rules for whoever does it (there is no migration skill: a migration happens once). A Playwright Test suite starts at [docs/typescript/migration-playwright-test.md](docs/typescript/migration-playwright-test.md).
78
79
  - [skills/nukadoko-verification/SKILL.md](skills/nukadoko-verification/SKILL.md): scenarios as the proof layer under a project's verification skill (a control CLI and a feature map): linking the map to scenarios, sharing one library between the CLI and the steps, reproducing a report red before the fix, and keeping evidence after cleanup.
79
80
  - [docs/spec.md](docs/spec.md): the design. "Typed steps" for `defineStep`; "Running" for scenarios and single steps; "Records" for every file a run writes; "Environments and secrets"; "Review" for what a person reads; "Checks and notes"; "CLI summary" for every command and flag; "Out of scope (honest limits)".
80
81
  - [docs/ci.md](docs/ci.md): the GitHub Actions job and the pull request comment.
81
- - [docs/upgrading.md](docs/upgrading.md): what a project changes between releases.
82
- - [docs/migration.md](docs/migration.md) and [docs/migration-playwright-test.md](docs/migration-playwright-test.md): the two migration doors in full.
83
- - [CHANGELOG.md](CHANGELOG.md): what changed in each release.
82
+ - [docs/typescript/upgrading.md](docs/typescript/upgrading.md): what a project changes between releases.
83
+ - [docs/typescript/migration.md](docs/typescript/migration.md) and [docs/typescript/migration-playwright-test.md](docs/typescript/migration-playwright-test.md): the two migration doors in full.
84
+ - [CHANGELOG.md](https://github.com/meganemura/nukadoko/blob/main/typescript/CHANGELOG.md): what changed in each release.
84
85
 
85
86
  Prefer `check` before `run`. Do not treat agent narrative as the step record. Stop after three failed repair attempts and report where things stand.
86
87
 
@@ -115,13 +116,14 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
115
116
  | `claim-compares-itself` | error | A claim's actual value and its expected value resolve to the same place: the same path of the same earlier line's result, or the same observe path, with a view and an at counted as steps of the path. Such a claim holds whatever the behaviour is. Also reported for a claim step whose observe receives a from value that an expected from reads, or one that holds it or that it holds, so observe could return the expected value as the actual one, and for one whose observe receives another from key that holds, or sits inside, the from value an actual reads when that claim's expected value is { observe }, so observe could return the actual value as the expected one. observe never receives the expected key itself, nor the actual from key of a claim whose expected value is { observe }. nuka run and nuka do break such a claim at run time too, so --no-check does not let it hold. | Take the expected value from the sentence (a capture, the docstring, or the table), or from another step's result, so the two sides can differ. For observe, take the key the finding names out of from, so observe does not receive it, or fill it from another step's result. |
116
117
  | `claim-expected-transformed` | error | A claim step names an args key as its expected value, and a pattern fills that key with a parameter type that config.parameterTypes or a compat defineParameterType registered with a transformer. The transformer rewrites the line's text before the claim reads it, so code would decide what the claim compares while the record labels the value as the sentence's. Under --no-check, nuka run leaves a claim that compares with such a key unjudged, so the run agrees with the check. | Capture the key with a type that has no transformer, such as {key:string}, and declare expected_view (text, lines, json, or comma-list) on the claim if the text needs one. |
117
118
  | `claim-field-stripped` | error | A lacks-field claim reads a value an earlier step returned, and that step's returns schema declares the value as an object that does not declare the field and keeps no key it does not declare: a z.object, which drops such a key when it parses the result, or a z.strictObject, which refuses it. The field is never there, so the claim never breaks, whatever the behaviour is. Also reported for a where claim that selects the items lacking such a field, which then never leaves an item out. Only a field the claim names as a literal, or that the line fills through a {word}, {string}, or anonymous capture, is checked; a schema that may keep the key (z.looseObject, a catchall, a union, a transform, or a default or a catch anywhere on the path, whose own value skips the schema at every depth below it) is taken to keep it. Under --no-check, nuka run and nuka do judge such a claim on what the step returned, as the producing step's record names the keys its returns dropped (returns_dropped): unjudged when the step returned the field, and held when it did not. Through a z.strictObject, the producing step fails when its result holds the field. | Declare the field in the producing step's returns as optional (such as password: z.unknown().optional()), so a result that holds it keeps it and one without it still parses, or declare that object with z.looseObject, which keeps the keys it does not declare. |
118
- | `claim-judged-early` | failed | A claim on a count of execution events was judged before every line it counts had arrived: the world's stop counted every line of the producer's trace, and the whole count judges the claim otherwise, so its cell is broke and proves nothing. | Have the program write a request's line after the work inside it, and run work that outlives the request as a job, which a reading waits for (docs/execution-events.md "Inside first"). |
119
+ | `claim-judged-early` | failed | A claim on a count of execution events was judged before every line it counts had arrived: the system's stop counted every line of the producer's trace, and the whole count judges the claim otherwise, so its cell is broke and proves nothing. | Have the program write a request's line after the work inside it, and run work that outlives the request as a job, which a reading waits for (docs/execution-events.md "Inside first"). |
119
120
  | `claim-kind-unknown` | error | An is-a claim's expected value is a plain string args key, read as it is or with expected_view text, and the line fills it through a {word}, {string}, or anonymous capture with a name that is none of the kinds is-a names, so the claim always breaks on that line. defineStep refuses a literal that names no kind; only the line says what a capture holds, so this half is the check's. | Write one of the kinds is-a names in the line (string, text, number, integer, boolean, list, array, object, null, uuid, date, timestamp, or url), or compare with another claim if the line states something else. |
120
121
  | `claim-not-an-array` | error | A claim counts the items of a value an earlier step returned, or an each claim reads each of its items, and that step's returns schema parses the value as something that is never an array: a string, a number, a boolean, an object, or a union, literal, or enum of only such values. count and each read an array alone, so the claim never holds, whatever the behaviour is. Only a value read with no view is checked, through the parsing wrappers (optional, nullable, readonly); a schema that may parse to an array (z.unknown, a transform, a default or a catch, whose own value skips the schema) is taken to be one. | Read the value through a view that makes an array (lines, comma-list, or json), point the claim at the array the step returns, or return the value as an array from the producing step. |
121
122
  | `claim-path-unknown` | error | A claim reads a path into a value an earlier step returned, and that step's returns schema has nothing at the path, so the value is undefined and the claim always breaks. | Correct the path to one the producing step's returns declares, or add the key to that step's returns. |
122
123
  | `claim-poll-unstated` | error | A claim step's observe reaches a browser page and the step does not state poll. A page between two renders can show any state for one frame, so the step has to say whether it reads once or until the claims hold. | Add poll: { timeout_ms } to read until every claim holds on two consecutive readings, or poll: false to read once. |
123
124
  | `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. |
124
125
  | `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. |
126
+ | `command-refused` | failed | A step, a fixture, or a hook of a system whose program declares stepsReach: "url" called runCommand, which starts a process: there, a service URL is the only way the code that runs with the scenarios reaches the program, so nothing was started. The cell is broke, whatever the execution came to, so a step that caught the refusal proves nothing. | Send the request to the service's URL instead (baseURL, or services.<name>.url), such as its test API, and create and read the state the scenario needs through that API. A system whose steps are meant to run the program's command line declares stepsReach: "any", the default. |
125
127
  | `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. |
126
128
  | `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>. |
127
129
  | `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. |
@@ -133,7 +135,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
133
135
  | `config-missing` | warning | There is no config file in the directory nuka runs in, so the defaults apply. | Run nuka from the directory that holds the config file, or run nuka init to write one. |
134
136
  | `contract-unreadable` | failed | nuka steps --json or nuka describe could not read part of a step's contract: its needs, a from entry, or an args or returns schema that JSON Schema cannot represent. The rest is printed, and the command exits 1. | Correct what the message names in the step file; a schema JSON Schema cannot represent, such as z.date(), still runs, and only its published contract is missing. |
135
137
  | `criteria-unchanged` | note | nuka verdict found that, under --base, no criterion of the newest run is new or changed: the run shows the criteria that were there still hold, and says nothing of what the change was for. | No change is necessary for a change that needs no criterion of its own, such as a refactor. A change of behaviour gets a scenario that says what it does. |
136
- | `criterion-moved` | failed | Under nuka run --base, an unchanged criterion passes at head, its mapping or its tags changed since the base, and the old world, head's code under the base's feature files and mapping, did not pass it or could not run it: the approved sentence no longer holds under the steps it was approved with. | Restore what the changed step, helper, or tag did, so the base's steps still pass on head's code, or correct what kept the old world from running, which the message names; a sentence that should now mean something else is edited, which makes it a changed criterion to prove. |
138
+ | `criterion-moved` | failed | Under nuka run --base, an unchanged criterion passes at head, its mapping or its tags changed since the base, and the old system, head's code under the base's feature files and mapping, did not pass it or could not run it: the approved sentence no longer holds under the steps it was approved with. | Restore what the changed step, helper, or tag did, so the base's steps still pass on head's code, or correct what kept the old system from running, which the message names; a sentence that should now mean something else is edited, which makes it a changed criterion to prove. |
137
139
  | `criterion-unproven` | failed | Under nuka run --base, a new or changed criterion passes at head, and nothing shows a Then failing where its behaviour is absent: its base cells passed, broke, were flaky, failed in fewer than --proof-runs runs, or did not run, and no control proves it. | Make a Then claim what the change added, so that it fails on the base's code; tag the scenario @held when the base already has the behaviour; or correct what kept its base cell from running, which the message names. |
138
140
  | `criterion-without-required-cell` | failed | A row of the verdict table has no required cell: no environment the run started meets every condition its scenario's tags name, so the row is failed and nothing ran that shows it holds. Only a run under --no-check reaches it; nuka check reports the scenario as condition-unmet. | Add an environment whose conditions meet the scenario's tags, run one that does with --env, or correct the tags. |
139
141
  | `done-callback-arity` | error | A compat hook or a matched compat step declares more parameters than nukadoko passes, which cucumber-js reads as a done() callback. | Remove the done callback parameter, and return a promise from the function instead. |
@@ -145,13 +147,14 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
145
147
  | `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. |
146
148
  | `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. |
147
149
  | `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. |
148
- | `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. |
149
- | `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. |
150
+ | `events-inlet-missing` | error | A step's events counts execution events, and a system 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. |
151
+ | `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 system stopped. They are in events-late.<service>.jsonl beside the step record, under the name of the service that wrote them, 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. |
150
152
  | `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. |
151
153
  | `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. |
152
- | `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. |
154
+ | `events-service-unknown` | error | A step's events names a service in service, and a system the run would start has no service of that name, so the count counts the lines of nothing and each claim on it reads 0. | Name one of the program's own services in that key's service, or leave service out to count every service's lines. |
155
+ | `events-unread` | warning | A step's events counts execution events, and a system 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 (system-unread). | Run those scenarios in a system nukadoko serves, with {events} in env, or select one with --env. |
153
156
  | `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. |
154
- | `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. |
157
+ | `expects-unread` | warning | An @expects:error= tag accepts an unhandled error the program reports in its execution events, and no system the run would start reads them (the program names no {events}, the system 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 system the run starts, such as env: { EXECUTION_EVENTS: "{events}" }, and have the program append its execution events there, or remove the tag. |
155
158
  | `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. |
156
159
  | `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. |
157
160
  | `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. |
@@ -209,13 +212,15 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
209
212
  | `pause-answered` | refused | nuka step names a pause that was already answered the other way, so this answer changes nothing. | Run nuka step wait --walk <n> to see where the walk stands, and answer the pause it shows. |
210
213
  | `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. |
211
214
  | `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. |
212
- | `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. |
215
+ | `program-exited` | warning | The program a system served exited while the scenarios still ran, so the requests after that found nothing listening. | Read the system's program.log, which the message names, for why the program exited. |
213
216
  | `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. |
214
- | `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. |
215
- | `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. |
216
- | `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. |
217
- | `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. |
218
- | `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. |
217
+ | `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 system'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 system's program.log. |
218
+ | `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 system stopped. They are in program-log-late.<service>.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. |
219
+ | `program-placeholder-renamed` | error | A command or an env value in the program in nukadoko.config.ts names {world}, the placeholder that is {system} now. Nothing fills a name nukadoko does not know, so the program would be handed those characters as they stand. | Write {system} in the field the message names, in place of {world}. |
220
+ | `program-placeholder-unfilled` | error | A command or an env value in the program in nukadoko.config.ts names a placeholder a system that nuka run with the same --env flags would start has no value for: {port} or {url} in a system 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 system 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. |
221
+ | `program-service-root-missing` | error | A service of the program in nukadoko.config.ts names a root, the directory its commands run in, that is no directory, in a system that nuka run with the same --env flags would start: a checkout of another repository that is not there, or a path with a mistake. nuka run and nuka do refuse such a system before anything builds. | Check out the service's code at the root that the message names, or point the service's root in nukadoko.config.ts at the directory that holds it. |
222
+ | `program-start-failed` | failed | The program in nukadoko.config.ts did not start for a system: 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 system's scenarios did not run. | Correct what the message names; the end of the system's program.log is in the message, and the whole file is in the system's directory. |
223
+ | `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 system runs for it. | Correct what the message names, such as the hook; the control proves on the next run. |
219
224
  | `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. |
220
225
  | `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. |
221
226
  | `removed-command` | refused | The command line names a command that an earlier release removed. | Use what the message names in its place. |
@@ -229,7 +234,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
229
234
  | `run-invalid` | refused | The run directory's run.json does not parse, has another schema version, or lacks a field nuka report reads. | Render a run directory that nuka run of this release wrote, unedited; the message names what is wrong. |
230
235
  | `run-missing` | failed | nuka verdict found no run that ended in this project, so nothing judged the working tree. | Run the criteria the change touches with nuka run, under --base with the commit the change started from, and read the verdict table before nuka verdict. |
231
236
  | `run-not-found` | refused | nuka report found no run to render: the directory it names holds no run.json, or the state directory holds no run that ended. | Name a run directory that holds a run.json, or run nuka run first. |
232
- | `run-partial` | failed | nuka verdict found that the newest run left out scenarios of the files it named, with a :line target or --tag, or was a walk (nuka run --step), whose world was open to anything between steps. Such a run is for debugging or exploring, and does not judge the criteria. | Run the feature files again without :line, --tag, or --step. |
237
+ | `run-partial` | failed | nuka verdict found that the newest run left out scenarios of the files it named, with a :line target or --tag, or was a walk (nuka run --step), whose system was open to anything between steps. Such a run is for debugging or exploring, and does not judge the criteria. | Run the feature files again without :line, --tag, or --step. |
233
238
  | `run-result-not-written` | failed | The run finished, and run.json could not be written, so the run fails: it has no record for a later command to read. | Correct what the message names, such as the state directory's permissions. |
234
239
  | `run-sources-invalid` | refused | The run directory's sources.json does not parse, lacks a field, or has another schema version. | Render a run directory that nuka run of this release wrote, unedited; the message names what is wrong. |
235
240
  | `run-sources-missing` | refused | The run directory holds no sources.json, the feature text nuka report --format allure and messages parse the run's scenarios from. A run an earlier release wrote has none. | Run the scenarios again with this release, and render that run. |
@@ -243,6 +248,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
243
248
  | `secrets-redact-key-too-short` | warning | A secrets.redact key's value is shorter than the minimum length build-secret-set.ts will actually redact, so it never gets redacted. | Use a longer value for the key, or remove the key from secrets.redact. |
244
249
  | `secrets-redact-key-unknown` | warning | A secrets.redact entry names a key that no envFile defines. | Define the key in an envFile, or remove it from secrets.redact. |
245
250
  | `serial-tag-on-scenario` | error | A @nukadoko:serial tag is on a Scenario/Scenario Outline line; nuka run --concurrency only reads it from the Feature line, so it has no effect there. | Move @nukadoko:serial to the Feature line. |
251
+ | `setup-result-missing` | error | A step the run would run, or a fixture it needs, destructures setupResult, and a system the run starts declares no setup, so nothing makes a value for it. Reading it throws there, every time. | Write setup in the program in nukadoko.config.ts for the system the finding names, and return what the steps read, such as { tenant }; or stop the step and its fixtures destructuring setupResult. |
246
252
  | `show-requests-failed` | warning | showRequests could not draw a request on its page, so no requests trace was written. http.jsonl still has every request. | Correct what the message names, such as a browser that is not installed (npx playwright install chromium), or turn showRequests off. |
247
253
  | `state-missing` | error | A step requires a state, and by what the steps of the earlier lines declare, the line can only be reached with that state not held: no step gives it, no earlier line gives it to that holder, or the last line that touched it ends it. nuka run refuses the scenario before any of its steps runs, --no-check included. | Put a line that runs a step whose gives names the state before the line that requires it, or move the line that ends it below that line. When the step of an earlier line gives the state without saying so, add the state to that step's gives. |
248
254
  | `state-shape-mismatch` | error | Steps name one state in two shapes, some with the args key that tells its holders apart ([state, key]) and some with the name alone, so no line that requires it is judged. | Write the state the same way in every step: with a key in each requires, gives, and ends entry, or with the name alone in all of them. |
@@ -254,6 +260,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
254
260
  | `step-needs-one-scenario` | refused | nuka run --step walks one execution of one scenario, and the run selects more than that: several scenarios, several environments, --repeat above 1, --base, or a scenario whose conditions do not hold in its environment. | Name one scenario with <file>:<line>, one environment with --env, and leave out --repeat and --base. |
255
261
  | `step-option-ignored` | warning | A defineStep call passes a key that defineStep does not read, such as rationale, which was removed, so the key has no effect and its value is shown nowhere. | Delete the key from the defineStep call. Move rationale text into a comment above defineStep first. |
256
262
  | `step-record-unreadable` | warning | A step wrote a step record that could not be read back, so run.json and the summary have no declaration or measurement for it. | Correct what the message names, such as a full disk or a process that removed the run directory during the run. |
263
+ | `steps-reach-command` | note | A system the run starts declares stepsReach: "url", and the body of a step it would run, or of a fixture it needs, calls runCommand, which starts a process that system refuses. Whether the call is reached depends on the body, so this is a note: the run refuses the call itself (command-refused). | Send the request to the service's URL instead (baseURL, or services.<name>.url), such as its test API. A job that must not ship such a call runs nuka check --fail-on steps-reach-command. |
257
264
  | `summary-not-written` | warning | The run finished, and a summary file could not be written. | Correct what the message names, such as the summary path's directory. |
258
265
  | `table-docstring-key-mismatch` | error | A step's table or docstring is attached to a line, but zero, or more than one, of its args keys is left unconsumed by pattern captures (exactly one must be left for the attachment to fill), or the one key it fills is of a type the attachment can never satisfy (a table is string[][], a docstring is a string). | Leave exactly one args key that no capture fills, typed string[][] for a table or string for a docstring, or remove the attachment from the line. |
259
266
  | `target-not-found` | refused | A target names a file or a directory that does not exist. | Name a file or a directory that exists. |
@@ -277,7 +284,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
277
284
  | `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 \\{. |
278
285
  | `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. |
279
286
  | `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. |
280
- | `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. |
287
+ | `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 system, 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. |
281
288
  | `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. |
282
289
  | `walk-not-current` | refused | nuka step names a walk that is not the walk in this project: a later walk replaced it, or no walk with that number started yet. An answer names its walk so that it cannot move a walk the person was not shown. | Run the nuka step wait the finding names, show the person the pause it prints, and answer with that walk's number. |
283
290
  | `walk-not-found` | refused | nuka step found no walk to answer or wait for: no nuka run --step recorded one, or the walk an answer is for was replaced by a later one. | Start a walk with nuka run <feature>:<line> --step, then run nuka step wait. |
@@ -293,7 +300,7 @@ Every code a finding can carry. `nuka check --codes` prints the same list as fin
293
300
  - stdout carries what was asked for: `do` one step record, `check`/`steps`/`clean` their report (one JSON value with `--json`), `describe` one JSON contract, `step` where the walk stands. `run` writes nothing there unless asked: one scenario's `run.json` entry per line under `--records`, or `run.json` under `--json`.
294
301
  - stderr carries what a person watches: `run` progress, the paths it wrote, and the summary line; the findings of a failed scenario, a refusal, an import failure, or a warning. Under `--json` nukadoko writes nothing there; Node's own process warnings and a step's own output still can.
295
302
  - Exit 0: done, and the report or run is green.
296
- - Exit 1: it ran and is red (a `check` error, a `failed`, `unproven`, or `moved` row of `run`'s verdict table, a `run` that failed outside every scenario (a hook, a world that did not start, a worker), or a failed `do` step, a step file that does not import, a `check --fail-on` hit, a `verdict` with no run that judged this working tree whole and left it green, a `report` that left out part of the run, `report-incomplete`, or a `steps` or `describe` that printed a step contract it could not read whole, `contract-unreadable`, or a `run` that selected no scenario, `nothing-selected`, or a `step` that found its walk paused where its scenario failed, `walk-failed`, or ended red, interrupted, or gone), or it failed while running.
303
+ - Exit 1: it ran and is red (a `check` error, a `failed`, `unproven`, or `moved` row of `run`'s verdict table, a `run` that failed outside every scenario (a hook, a system that did not start, a worker), or a failed `do` step, a step file that does not import, a `check --fail-on` hit, a `verdict` with no run that judged this working tree whole and left it green, a `report` that left out part of the run, `report-incomplete`, or a `steps` or `describe` that printed a step contract it could not read whole, `contract-unreadable`, or a `run` that selected no scenario, `nothing-selected`, or a `step` that found its walk paused where its scenario failed, `walk-failed`, or ended red, interrupted, or gone), or it failed while running.
297
304
  - Exit 2: refused, nothing ran (a bad flag, an invalid config, a missing target, an unknown step, a missing peer, `run` stopped by `check`). The refusal is a `refused` finding with a code; under `--json` it is in the envelope, whose `verdict` is `refused`.
298
305
  - Exit 128 + n: `run` or `do` stopped by signal n after teardown.
299
306
  - A step record's `error.kind`: `args_invalid`, `result_invalid`, `binding_invalid`, `world_invalid`, `timeout`, `unsupported`, `claim_broken`, `unobserved`, `claim_unjudged`, `step_error` (docs/spec.md "Records").