nukadoko 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +541 -3
- data/README.ja.md +20 -5
- data/README.md +12 -6
- data/docs/ci.ja.md +542 -0
- data/docs/ci.md +635 -0
- data/docs/commands.ja.md +1524 -0
- data/docs/commands.md +1281 -0
- data/docs/engines.json +19 -0
- data/docs/execution-events.ja.md +336 -0
- data/docs/execution-events.md +423 -0
- data/docs/glossary.json +1348 -0
- data/docs/guide.ja.md +733 -0
- data/docs/guide.md +815 -0
- data/docs/intent.ja.md +133 -0
- data/docs/intent.md +156 -0
- data/docs/layout.ja.md +442 -0
- data/docs/layout.md +399 -0
- data/docs/releasing.ja.md +186 -0
- data/docs/releasing.md +237 -0
- data/docs/ruby/reference.ja.md +302 -0
- data/docs/ruby/reference.md +368 -0
- data/docs/spec.ja.md +8916 -0
- data/docs/spec.md +11250 -0
- data/docs/tutorial.ja.md +451 -0
- data/docs/tutorial.md +458 -0
- data/docs/typescript/adopting.ja.md +231 -0
- data/docs/typescript/adopting.md +251 -0
- data/docs/typescript/doors.ja.md +301 -0
- data/docs/typescript/doors.md +329 -0
- data/docs/typescript/migration-playwright-test.ja.md +189 -0
- data/docs/typescript/migration-playwright-test.md +212 -0
- data/docs/typescript/migration.ja.md +391 -0
- data/docs/typescript/migration.md +505 -0
- data/docs/typescript/reference.ja.md +176 -0
- data/docs/typescript/reference.md +197 -0
- data/docs/typescript/upgrading.ja.md +1774 -0
- data/docs/typescript/upgrading.md +2224 -0
- data/docs/web-app.ja.md +627 -0
- data/docs/web-app.md +659 -0
- data/docs/writing-scenarios.ja.md +544 -0
- data/docs/writing-scenarios.md +563 -0
- data/lib/nukadoko/base.rb +12 -5
- data/lib/nukadoko/changed_files.rb +95 -0
- data/lib/nukadoko/check.rb +459 -51
- data/lib/nukadoko/claim_drops.rb +271 -0
- data/lib/nukadoko/claim_line.rb +24 -4
- data/lib/nukadoko/claim_rules.rb +143 -1
- data/lib/nukadoko/claim_sides.rb +157 -9
- data/lib/nukadoko/cli.rb +395 -48
- data/lib/nukadoko/codes.json +246 -21
- data/lib/nukadoko/codes.rb +21 -4
- data/lib/nukadoko/command.rb +120 -13
- data/lib/nukadoko/command_help.rb +128 -0
- data/lib/nukadoko/compat.rb +469 -0
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/definition.rb +157 -7
- data/lib/nukadoko/error_frames.rb +6 -3
- data/lib/nukadoko/events/count.rb +146 -0
- data/lib/nukadoko/events/counted.rb +114 -0
- data/lib/nukadoko/events/format.rb +257 -0
- data/lib/nukadoko/events/lists.rb +154 -0
- data/lib/nukadoko/events/path.rb +285 -0
- data/lib/nukadoko/events/read.rb +284 -0
- data/lib/nukadoko/events/reader.rb +490 -0
- data/lib/nukadoko/events/selection.rb +252 -0
- data/lib/nukadoko/events/tally.rb +438 -0
- data/lib/nukadoko/features.rb +2 -2
- data/lib/nukadoko/fixtures.rb +160 -35
- data/lib/nukadoko/http_recording.rb +6 -2
- data/lib/nukadoko/intent.rb +364 -0
- data/lib/nukadoko/intent_file.rb +81 -0
- data/lib/nukadoko/intent_view.rb +190 -0
- data/lib/nukadoko/js_json.rb +2 -1
- data/lib/nukadoko/judge.rb +2 -2
- data/lib/nukadoko/judgment_file.rb +1 -1
- data/lib/nukadoko/judgments.rb +4 -4
- data/lib/nukadoko/measure_mcp.rb +202 -0
- data/lib/nukadoko/parts.rb +8 -2
- data/lib/nukadoko/path_view.rb +252 -0
- data/lib/nukadoko/place_rows.rb +161 -0
- data/lib/nukadoko/program.rb +1265 -51
- data/lib/nukadoko/program_log.rb +122 -0
- data/lib/nukadoko/program_shape.rb +385 -0
- data/lib/nukadoko/project_fixtures.rb +43 -10
- data/lib/nukadoko/project_program.rb +5 -4
- data/lib/nukadoko/repeated_prefix.rb +310 -0
- data/lib/nukadoko/report_run.rb +3 -3
- data/lib/nukadoko/run.rb +1148 -159
- data/lib/nukadoko/run_record.rb +70 -46
- data/lib/nukadoko/scaffold.rb +24 -6
- data/lib/nukadoko/schema.rb +15 -2
- data/lib/nukadoko/secrets.rb +55 -5
- data/lib/nukadoko/states.rb +478 -0
- data/lib/nukadoko/step.rb +71 -2
- data/lib/nukadoko/step_fixtures.rb +52 -3
- data/lib/nukadoko/summary.rb +799 -29
- data/lib/nukadoko/table.rb +4 -2
- data/lib/nukadoko/text_fit.rb +20 -7
- data/lib/nukadoko/trace.rb +152 -45
- data/lib/nukadoko/tree_passes.rb +95 -33
- data/lib/nukadoko/underneath.rb +311 -0
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +166 -23
- data/lib/nukadoko/walk.rb +2 -2
- data/lib/nukadoko/walk_step.rb +1 -1
- data/lib/nukadoko.rb +23 -0
- data/llms.txt +41 -34
- data/sig/generated/nukadoko/base.rbs +4 -4
- data/sig/generated/nukadoko/changed_files.rbs +42 -0
- data/sig/generated/nukadoko/check.rbs +147 -10
- data/sig/generated/nukadoko/claim_drops.rbs +135 -0
- data/sig/generated/nukadoko/claim_line.rbs +11 -0
- data/sig/generated/nukadoko/claim_rules.rbs +49 -4
- data/sig/generated/nukadoko/claim_sides.rbs +63 -12
- data/sig/generated/nukadoko/cli.rbs +80 -7
- data/sig/generated/nukadoko/codes.rbs +19 -4
- data/sig/generated/nukadoko/command.rbs +68 -1
- data/sig/generated/nukadoko/command_help.rbs +18 -0
- data/sig/generated/nukadoko/compat.rbs +392 -0
- data/sig/generated/nukadoko/criteria.rbs +1 -1
- data/sig/generated/nukadoko/definition.rbs +50 -0
- data/sig/generated/nukadoko/error_frames.rbs +1 -1
- data/sig/generated/nukadoko/events/count.rbs +69 -0
- data/sig/generated/nukadoko/events/counted.rbs +70 -0
- data/sig/generated/nukadoko/events/format.rbs +163 -0
- data/sig/generated/nukadoko/events/lists.rbs +47 -0
- data/sig/generated/nukadoko/events/path.rbs +161 -0
- data/sig/generated/nukadoko/events/read.rbs +109 -0
- data/sig/generated/nukadoko/events/reader.rbs +226 -0
- data/sig/generated/nukadoko/events/selection.rbs +100 -0
- data/sig/generated/nukadoko/events/tally.rbs +227 -0
- data/sig/generated/nukadoko/features.rbs +6 -4
- data/sig/generated/nukadoko/fixtures.rbs +67 -11
- data/sig/generated/nukadoko/http_recording.rbs +1 -1
- data/sig/generated/nukadoko/intent.rbs +132 -0
- data/sig/generated/nukadoko/intent_file.rbs +46 -0
- data/sig/generated/nukadoko/intent_view.rbs +69 -0
- data/sig/generated/nukadoko/judgment_file.rbs +1 -1
- data/sig/generated/nukadoko/judgments.rbs +1 -1
- data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
- data/sig/generated/nukadoko/parts.rbs +2 -2
- data/sig/generated/nukadoko/path_view.rbs +105 -0
- data/sig/generated/nukadoko/place_rows.rbs +43 -0
- data/sig/generated/nukadoko/program.rbs +627 -23
- data/sig/generated/nukadoko/program_log.rbs +67 -0
- data/sig/generated/nukadoko/program_shape.rbs +147 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
- data/sig/generated/nukadoko/project_program.rbs +2 -1
- data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
- data/sig/generated/nukadoko/report_run.rbs +1 -1
- data/sig/generated/nukadoko/run.rbs +286 -41
- data/sig/generated/nukadoko/run_record.rbs +20 -12
- data/sig/generated/nukadoko/scaffold.rbs +3 -0
- data/sig/generated/nukadoko/schema.rbs +5 -0
- data/sig/generated/nukadoko/secrets.rbs +26 -3
- data/sig/generated/nukadoko/states.rbs +214 -0
- data/sig/generated/nukadoko/step.rbs +58 -1
- data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
- data/sig/generated/nukadoko/summary.rbs +256 -2
- data/sig/generated/nukadoko/table.rbs +3 -2
- data/sig/generated/nukadoko/trace.rbs +108 -33
- data/sig/generated/nukadoko/tree_passes.rbs +36 -8
- data/sig/generated/nukadoko/underneath.rbs +141 -0
- data/sig/generated/nukadoko/vocabulary.rbs +45 -6
- data/skills/nukadoko/SKILL.md +18 -18
- data/skills/nukadoko/references/checking-steps.md +16 -83
- data/skills/nukadoko/references/diagnosing.md +6 -6
- data/skills/nukadoko/references/evidence.md +19 -6
- data/skills/nukadoko/references/exploring.md +22 -7
- data/skills/nukadoko/references/fixtures.md +12 -32
- data/skills/nukadoko/references/judgments.md +12 -0
- data/skills/nukadoko/references/maintenance.md +1 -1
- data/skills/nukadoko/references/merge-risk.md +1 -1
- data/skills/nukadoko/references/parts.md +46 -23
- data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
- data/skills/nukadoko/references/program.md +168 -169
- data/skills/nukadoko/references/reviewing.md +20 -20
- data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
- data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
- data/skills/nukadoko/references/ruby/fixtures.md +34 -0
- data/skills/nukadoko/references/ruby/program.md +112 -0
- data/skills/nukadoko/references/ruby/step-files.md +115 -0
- data/skills/nukadoko/references/running.md +34 -34
- data/skills/nukadoko/references/scenario-rules.md +7 -6
- data/skills/nukadoko/references/states.md +7 -1
- data/skills/nukadoko/references/step-files.md +41 -120
- data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
- data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
- data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
- data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
- data/skills/nukadoko/references/typescript/fixtures.md +56 -0
- data/skills/nukadoko/references/typescript/program.md +111 -0
- data/skills/nukadoko/references/typescript/step-files.md +104 -0
- data/skills/nukadoko/references/verdicts.md +10 -10
- data/skills/nukadoko/references/writing-steps.md +67 -67
- data/skills/nukadoko/references/writing-the-feature.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +13 -8
- metadata +103 -7
- data/skills/nukadoko/references/ruby.md +0 -80
|
@@ -2,199 +2,198 @@
|
|
|
2
2
|
|
|
3
3
|
## The program
|
|
4
4
|
|
|
5
|
-
The config holds the criteria, and its `program` holds how a run gets the
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`prepare`, starts `serve` on a free port, waits until `ready` answers
|
|
25
|
-
2xx, runs the scenarios against that URL (the base URL of `page`,
|
|
26
|
-
`request`, and the `baseURL` fixture), and stops the program after the
|
|
27
|
-
AfterAll hooks. `nuka do` does the same for its one execution. No
|
|
28
|
-
terminal has to keep a server running, and no fixture starts one.
|
|
29
|
-
|
|
30
|
-
A command is an argv array, or a string split on whitespace. Neither goes
|
|
31
|
-
through a shell; write `["sh", "-c", "a && b"]` when one is needed. The program
|
|
32
|
-
learns its port only from `{port}`, in the command or in `env`. `ready` is a
|
|
33
|
-
path on the program's own server, and only a 2xx answer counts: a redirect is
|
|
34
|
-
not followed, so name a path that answers 200 with no login (`/up`, `/health`).
|
|
35
|
-
`url` is an `http:` or `https:` URL with no user or password in it.
|
|
5
|
+
The config holds the criteria, and its `program` holds how a run gets the program the
|
|
6
|
+
scenarios talk to: how to build it, prepare its state, start it, and the env its processes
|
|
7
|
+
get. `nuka init` does not write it: write it from what the README or CI script already
|
|
8
|
+
runs. How the config writes it is `typescript/program.md` or `ruby/program.md`; the gem
|
|
9
|
+
reads `serve`, `env`, `environments`, and `defaultEnvironments`, and the rest of this page
|
|
10
|
+
is the TypeScript engine's.
|
|
11
|
+
|
|
12
|
+
`nuka run` starts one system per environment: it runs `build` and `prepare`, starts
|
|
13
|
+
`serve` on a free port, waits until `ready` answers 2xx, runs the scenarios against that
|
|
14
|
+
URL (the base URL of `page`, `request`, and the `baseURL` fixture), and stops the program
|
|
15
|
+
after the AfterAll hooks. `nuka do` does the same for its one execution. No terminal has
|
|
16
|
+
to keep a server running, and no fixture starts one.
|
|
17
|
+
|
|
18
|
+
A command is an argv array, or a string split on whitespace. Neither goes through a shell;
|
|
19
|
+
write `["sh", "-c", "a && b"]` when one is needed. The program learns its port only from
|
|
20
|
+
`{port}`, in the command or in `env`. `ready` is a path on the program's own server, and
|
|
21
|
+
only a 2xx answer counts: a redirect is not followed, so name a path that answers 200 with
|
|
22
|
+
no login (`/up`, `/health`). `url` is an `http:` or `https:` URL with no user or password
|
|
23
|
+
in it.
|
|
36
24
|
|
|
37
25
|
| Placeholder | Its value |
|
|
38
26
|
| --- | --- |
|
|
39
|
-
| `{port}`, `{url}` | the
|
|
40
|
-
| `{
|
|
41
|
-
| `{
|
|
42
|
-
| `{
|
|
43
|
-
| `{
|
|
44
|
-
| `{
|
|
27
|
+
| `{port}`, `{url}` | the service's port (the one `serve` got, or the `url`'s, 443 or 80 when it names none) and URL |
|
|
28
|
+
| `{service.<name>.url}`, `{service.<name>.port}` | another service's URL and port in the same system |
|
|
29
|
+
| `{dir}` | the service's own directory under the run, `systems/<environment>/<service>/`: its database, its pid file |
|
|
30
|
+
| `{root}` | the directory the service's commands run in, the one placeholder `build` may name |
|
|
31
|
+
| `{system}` | the environment's name |
|
|
32
|
+
| `{token}` | random per system, redacted as `{{secret.SYSTEM_TOKEN}}` in every record |
|
|
33
|
+
| `{events}` | a private empty file a system nukadoko serves gets for its program's execution events |
|
|
45
34
|
| `{condition.<name>}` | the value the environment declares for that condition: `true`, `false`, or the string |
|
|
46
|
-
A placeholder a
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`program-placeholder-
|
|
50
|
-
run` with the same `--env` flags
|
|
51
|
-
refuse
|
|
52
|
-
|
|
53
|
-
One
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
A step reads the same `env`: in `process.env` during the run and in the
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`
|
|
70
|
-
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
|
|
35
|
+
A placeholder a system has no value for (`{port}` or `{url}` with neither `serve` nor
|
|
36
|
+
`url`, `{events}` without `serve`, `{condition.<name>}` the environment does not declare,
|
|
37
|
+
anything but `{root}` in `build`) is `program-placeholder-unfilled`, and `{world}`, the
|
|
38
|
+
old name of `{system}` that nothing fills, is `program-placeholder-renamed`: `nuka check`
|
|
39
|
+
reports them for the systems a `nuka run` with the same `--env` flags starts, and `nuka
|
|
40
|
+
run` and `nuka do` refuse them before any command runs.
|
|
41
|
+
|
|
42
|
+
One system serves every scenario of an environment, so what one scenario writes is there
|
|
43
|
+
for the next: a scenario creates what it reads and claims only on that
|
|
44
|
+
(`scenario-rules.md`, S8, and `typescript/examples/http-api.md`).
|
|
45
|
+
|
|
46
|
+
A step reads the same `env`: in `process.env` during the run and in the `env` fixture,
|
|
47
|
+
after the config's env files. `setup(system)` runs once per system before the first
|
|
48
|
+
scenario, to make its test tenant and seed data, and every step reads what it returns, a
|
|
49
|
+
JSON value, as the `setupResult` fixture; reading it where no `setup` makes one is
|
|
50
|
+
`setup-result-missing`. `stepsReach: "url"` makes a service URL the only way in, so
|
|
51
|
+
`runCommand` is refused there (`command-refused`, a `broke` cell, and the `check` note
|
|
52
|
+
`steps-reach-command`), and a system a team starts itself declares `stepsReach: "any"`,
|
|
53
|
+
the default. What `setup` prints reaches stderr and `program.log` redacted. A `setup` or
|
|
54
|
+
`url` function past its limit is abandoned and its `signal` aborted: it stops only if it
|
|
55
|
+
honours it.
|
|
56
|
+
|
|
57
|
+
Every phase has a limit: 600 s for each `build` or `prepare` command, 60 s for `serve` to
|
|
58
|
+
answer `ready`, `setup`, and a `url` function. Write `{ command, timeout_ms }` for a
|
|
59
|
+
command, `serve.timeout_ms`, `setup: { run, timeout_ms }`, or `url: { resolve, timeout_ms
|
|
60
|
+
}` for another, in whole milliseconds up to 2147483647, the longest delay a Node.js timer
|
|
61
|
+
keeps. Each phase prints `system <name>: <phase> started` on stderr, so a long wait names
|
|
62
|
+
what it waits on. A `build` or `prepare` command's process group is killed when the
|
|
63
|
+
command exits: a service that has to outlive `prepare`, such as a database, starts with
|
|
64
|
+
`setsid`, as a daemon does. `serve.command` stays in the foreground: one that daemonizes,
|
|
65
|
+
as `rails server -d` does, exits before `ready` answers and fails the system, and the
|
|
66
|
+
daemon keeps running, out of nukadoko's reach.
|
|
67
|
+
|
|
68
|
+
## Several services
|
|
69
|
+
|
|
70
|
+
`services` names each server of a program, with its own fields and `root`, where its code
|
|
71
|
+
is (`../billing`, a clone beside the repository); `primary` names the one the steps reach,
|
|
72
|
+
and `external: true` one only reached at its `url`. With no `services`, the program is one
|
|
73
|
+
service, `main`. `{service.<name>.url}` names another service's address, and a step
|
|
74
|
+
reaches one through the `services` fixture (`services.billing.url`), never a URL of its
|
|
75
|
+
own, so the same scenarios run where an environment moves every service to a `url`. A
|
|
76
|
+
`root` that is no directory is `program-service-root-missing`. Under `--base`, a `root`
|
|
77
|
+
outside the repository builds once, and the summary names its commit. docs/spec.md
|
|
78
|
+
"Services" has every rule.
|
|
74
79
|
|
|
75
80
|
## When it does not start
|
|
76
81
|
|
|
77
|
-
A
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`.nukadoko/runs/<run_id>/
|
|
81
|
-
runs in that environment. A fixed `port` something else already
|
|
82
|
-
on is refused the same way, since every request would reach a server
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
A system that does not start fails the run with `program-start-failed`, which names the
|
|
83
|
+
command, how it ended (a phase past its limit included), and the end of the failing
|
|
84
|
+
service's `program.log`: read that file first, at
|
|
85
|
+
`.nukadoko/runs/<run_id>/systems/<environment>/<service>/program.log` (`main` for one
|
|
86
|
+
service). No scenario runs in that environment. A fixed `port` something else already
|
|
87
|
+
answers on is refused the same way, since every request would reach a server nukadoko did
|
|
88
|
+
not start. `program-exited` (a warning) says the program died during the run, which the
|
|
89
|
+
failed steps alone would not.
|
|
85
90
|
|
|
86
|
-
`run.json`'s `
|
|
87
|
-
and
|
|
91
|
+
`run.json`'s `systems` names what each service ran (`services`), its URL, timings, log,
|
|
92
|
+
and the system's own `setup_result`; each step record names its system in `system_name`.
|
|
88
93
|
|
|
89
94
|
## Each step's lines of the program's log
|
|
90
95
|
|
|
91
|
-
Every request a step sends to
|
|
92
|
-
`request`, and a Chromium page) carries a W3C `traceparent` with the step's
|
|
93
|
-
trace id. A request that sets its own keeps it. When the program writes the
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
For Rails, send the test log to stdout and tag it, in `config/environments/test.rb`:
|
|
109
|
-
|
|
96
|
+
Every request a step sends to a service's origin, an external one aside (through `fetch`,
|
|
97
|
+
`node:http`, `request`, and a Chromium page), carries a W3C `traceparent` with the step's
|
|
98
|
+
own trace id. A request that sets its own keeps it. When the program writes the trace id
|
|
99
|
+
into its log lines, each step record gets each service's lines that carry it in
|
|
100
|
+
`program-log.<service>.txt`, counted in `observed.program_log.services`. Read that file
|
|
101
|
+
first when a step against the program fails: it holds what the server did for that step. A
|
|
102
|
+
line that arrived after the step ended is still that step's, in
|
|
103
|
+
`program-log-late.<service>.txt`; the summary names it on `after-record`.
|
|
104
|
+
|
|
105
|
+
`lines: 0` with `stamped` above 0 says only that no line carried the step's trace id by
|
|
106
|
+
the time its record was written. Read the system's `unrecorded-log` entry in the summary,
|
|
107
|
+
decided from the whole log once the system stopped: "carries no trace ids" means the
|
|
108
|
+
program does not tag its lines; a late line is on its step's `after-record` entry. When
|
|
109
|
+
the system's entry says none came in time, output buffered on a pipe is a possible cause:
|
|
110
|
+
`STDOUT.sync = true` fixes it in Ruby and `PYTHONUNBUFFERED=1` in Python. For Rails, send
|
|
111
|
+
the test log to stdout and tag it, in `config/environments/test.rb`:
|
|
112
|
+
<!-- engine: neither -->
|
|
110
113
|
```ruby
|
|
111
114
|
config.logger = ActiveSupport::TaggedLogging.logger($stdout) if ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
112
115
|
config.log_tags = [ ->(request) { request.headers["traceparent"] } ]
|
|
113
116
|
```
|
|
114
117
|
|
|
115
|
-
with `RAILS_LOG_TO_STDOUT: "1"` in the program's `env`. A Node
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
with `traceparent_sent_to`, the origins that received it.
|
|
118
|
+
with `RAILS_LOG_TO_STDOUT: "1"` in the program's `env`. A Node server prints
|
|
119
|
+
`req.headers.traceparent` at the start of each line it writes for a request. A service at
|
|
120
|
+
a `url` has no log nukadoko reads: its entry in `observed.program_log.services` is `null`,
|
|
121
|
+
and the server's own log finds a step's requests by the `traceparent` on its `http.jsonl`
|
|
122
|
+
lines, each with `traceparent_sent_to`, the origins that received it.
|
|
121
123
|
|
|
122
124
|
## Each step's execution events
|
|
123
125
|
|
|
124
|
-
A program can also write one JSON line per operation it ends (a request, a
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
(`references/evidence.md`); a tool
|
|
136
|
-
requests' `traceparent` header makes their lines
|
|
137
|
-
counts a tool's). Only the program gets the variable that
|
|
138
|
-
never a step or a process it starts, so no line a step writes reads as
|
|
139
|
-
program's. Read it to see what the program did inside a step: which tables it
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
`whole
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
126
|
+
A program can also write one JSON line per operation it ends (a request, a statement, a
|
|
127
|
+
transaction, a job, an outgoing call, a flag, an error) to the file `{events}` names, in
|
|
128
|
+
the format of docs/execution-events.md: `env: { EXECUTION_EVENTS: "{events}" }`. Each line
|
|
129
|
+
carries the request's `traceparent`, a job's the one that enqueued it, so the lines of
|
|
130
|
+
every process the program runs reach the step that caused them. Each service that names
|
|
131
|
+
`{events}` gets a file of its own, and each step record gets each service's lines,
|
|
132
|
+
redacted, in `events.<service>.jsonl` beside it, counted in `observed.events` (`{
|
|
133
|
+
trace_id, stamped, services, process_spans, whole, open }`, and `mcp_spans` after an MCP
|
|
134
|
+
call), whose `services` holds one entry per service (`{ lines, file, kinds, stamped,
|
|
135
|
+
stamped_spans, unreadable, unowned, process_requests }`, `null` for one whose events are
|
|
136
|
+
not read). A `runCommand` process gets the step's trace context as `TRACEPARENT`, an MCP
|
|
137
|
+
call through `measureMcp` in `params._meta.traceparent` (`references/evidence.md`); a tool
|
|
138
|
+
or a stdio server that copies it into its requests' `traceparent` header makes their lines
|
|
139
|
+
the step's (`process_requests` counts a tool's). Only the program gets the variable that
|
|
140
|
+
names `{events}`, never a step or a process it starts, so no line a step writes reads as
|
|
141
|
+
the program's. Read it to see what the program did inside a step: which tables it read and
|
|
142
|
+
wrote, which jobs it enqueued and ran.
|
|
143
|
+
|
|
144
|
+
`whole` and `open` are one answer for the step, over every service's lines: the trace is
|
|
145
|
+
one, and only the files are several. `whole: true` says every request the step stamped has
|
|
146
|
+
its `request` line, every job it enqueued performed, each `runCommand` process it ran
|
|
147
|
+
ended with its process group, each MCP call went to the system over HTTP, and nukadoko
|
|
148
|
+
reads the events of every service it sent a request to. `whole: false` never says nothing
|
|
149
|
+
more happened: `open` names why, one word each, a gap about one service naming it in
|
|
150
|
+
`service`: `no-requests` (no stamped request, `runCommand` process, or MCP call, such as a
|
|
151
|
+
Then that only reads the page), `processes-unbounded` (a process it ran still runs, left
|
|
152
|
+
its group running, or ran on Windows), `mcp-unbounded` (an MCP call went over stdio or to
|
|
153
|
+
another origin), `service-unrecorded` (a service it sent a request to names no `{events}`
|
|
154
|
+
or runs at a `url`), `no-lines` (no writer, or a wrong variable), `request-unreported`,
|
|
155
|
+
`jobs-pending` (with `job_ids`, matched per service), `unreadable` (a line spliced or
|
|
156
|
+
cut), `truncated`, `file-replaced`. A line that arrived later is in
|
|
157
|
+
`events-late.<service>.jsonl`, and the run summary names it. Each service's whole file,
|
|
158
|
+
redacted, is in `systems/<environment>/<service>/events.jsonl`; a system at a `url` has
|
|
159
|
+
none, and `observed.events` is `null` there. run.json's step gets `path`, what its trace
|
|
160
|
+
did, late lines included (writes, jobs, requests, flags; no reads), each entry naming the
|
|
161
|
+
`service` whose file held it; its flags and requests make run.json's `flags` (one row per
|
|
162
|
+
service, flag, and side) and `routes`, and `lists` (docs/spec.md "Lists") names those no
|
|
163
|
+
step reached (`references/verdicts.md`).
|
|
158
164
|
|
|
159
165
|
## Claiming what the program did
|
|
160
166
|
|
|
161
|
-
A Then counts an earlier step's events: `events: { writes: { of: placeScore,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
`
|
|
169
|
-
`
|
|
170
|
-
|
|
167
|
+
A Then counts an earlier step's events: `events: { writes: { of: placeScore, count: {
|
|
168
|
+
kind: "db", op: ["insert", "update", "delete", "other"], committed: true } } }` beside a
|
|
169
|
+
claim on `actual: "writes"` and a number. The key counts every service's lines of that
|
|
170
|
+
step's trace, or one service's with `service: "billing"` beside its `count`; `nuka check`
|
|
171
|
+
reports `events-service-unknown` for a name no service of the system has. It waits while
|
|
172
|
+
they may still be `whole` (the step's `timeout`, else 10 s), and is `unjudged`, naming the
|
|
173
|
+
gap, while the count is a range: an absence holds on a whole reading only. Its line and
|
|
174
|
+
`events_read` name what it `counted`, and what a `db` count with no `table` left out on
|
|
175
|
+
tables `lists.tables` marks (`left_out`, `references/diagnosing.md`); a line after the
|
|
176
|
+
claim makes the cell `broke`. `events-inlet-missing` and `events-unread` name a system
|
|
177
|
+
that reads none (a `--base` ref without `{events}` still runs).
|
|
171
178
|
|
|
172
179
|
## Environments and programs nukadoko does not start
|
|
173
180
|
|
|
174
|
-
An entry of `environments` overrides any field above (`env` merges by
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
```ts
|
|
179
|
-
env: { CHECKOUT_V2: "{condition.checkout_v2}" },
|
|
180
|
-
environments: {
|
|
181
|
-
"checkout-v1": { conditions: { checkout_v2: false } },
|
|
182
|
-
"checkout-v2": { conditions: { checkout_v2: true } },
|
|
183
|
-
},
|
|
184
|
-
```
|
|
181
|
+
An entry of `environments` overrides any field above (`env` merges by key). A feature
|
|
182
|
+
behind a switch gets one environment per side, each naming its side in `conditions`
|
|
183
|
+
("Environments" on your engine's page).
|
|
185
184
|
|
|
186
185
|
`conditions` sets nothing, and nukadoko does not check it against the program;
|
|
187
|
-
`{condition.checkout_v2}` hands the program the declared side, so the two
|
|
188
|
-
|
|
189
|
-
`@
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
A tree with no program starts no
|
|
200
|
-
|
|
186
|
+
`{condition.checkout_v2}` hands the program the declared side, so the two cannot disagree.
|
|
187
|
+
It says which side the environment is on for a scenario's `@with:checkout_v2` or
|
|
188
|
+
`@without:checkout_v2` tag (`references/verdicts.md`). `nuka run` without `--env` runs
|
|
189
|
+
every environment that declares `conditions`, or the ones a top-level
|
|
190
|
+
`defaultEnvironments` names, so a deployment target can declare its switches and stay out.
|
|
191
|
+
`url` in place of `serve` names a program that runs elsewhere, such as a staging server,
|
|
192
|
+
and starts nothing: it takes none of the top level's `build`, `prepare`, or `root`, so it
|
|
193
|
+
writes its own only to run one there, and it wants `policy: "read-only"` when the data
|
|
194
|
+
there belongs to someone else. Under `nuka run --base`, a `url` function receives `tree`
|
|
195
|
+
and branches on it: one that answers the base system with head's URL leaves that system
|
|
196
|
+
not run.
|
|
197
|
+
|
|
198
|
+
A tree with no program starts no system, which suits a command-line tool whose steps run
|
|
199
|
+
commands with `runCommand`. "Program" in docs/spec.md has every field.
|
|
@@ -15,7 +15,7 @@ npx nuka step wait
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
`--step` runs one scenario in one environment, and after each step it
|
|
18
|
-
pauses with the
|
|
18
|
+
pauses with the system, the browser, and the fixtures still open until a
|
|
19
19
|
`nuka step` call answers. Start it in the host's background mode (in
|
|
20
20
|
Claude Code, `run_in_background`), since it does not return until the
|
|
21
21
|
walk ends. `nuka step wait` waits up to `--timeout` seconds (default 90)
|
|
@@ -26,14 +26,14 @@ walk 1 paused after step 1/4 (passed): the shopper opens the cart
|
|
|
26
26
|
scenario: features/checkout.feature:12 Pay for a cart (default)
|
|
27
27
|
record: .nukadoko/runs/<run_id>/steps/<id>/record.json
|
|
28
28
|
view: page 1 http://127.0.0.1:41233/cart "Cart": <run_dir>/pauses/1/page.png <run_dir>/pauses/1/page.aria.yml
|
|
29
|
-
|
|
29
|
+
system: http://127.0.0.1:41233
|
|
30
30
|
do: nuka step next 1 --walk 1 (or: nuka step stop 1 --walk 1)
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
`--json` gives the same as fields: `walk`, `pause` (`pause`, `of`,
|
|
34
34
|
`line`, `text`, `step`, `status`, `record`, `failure` when the scenario
|
|
35
35
|
failed there, `remaining`, `paused_at`, `views`), `run_id`, `run_dir`,
|
|
36
|
-
`scenario`, `
|
|
36
|
+
`scenario`, `system`, and `do`. A wait that prints `starting` or
|
|
37
37
|
`running` ran out before the walk paused: run it again. A run that
|
|
38
38
|
refused (more than one scenario, say) never pauses, and a wait shows it
|
|
39
39
|
ended before its scenario ran. A wait reports each end once, then waits
|
|
@@ -54,20 +54,19 @@ For each pause, before you say anything about the step:
|
|
|
54
54
|
(`page-2.*`, `page.<name>.*` for a second page or a `pageAs` context),
|
|
55
55
|
taken after the step's record. What a page sent while the walk waited
|
|
56
56
|
is in `pauses/<n>/http.jsonl`, not in the step's.
|
|
57
|
-
- The
|
|
57
|
+
- The system, when there is one: its URL is live, so you can read it, but
|
|
58
58
|
anything you change there is what the next step finds.
|
|
59
59
|
|
|
60
60
|
What each part of `observed` says (a `null` channel means nothing was
|
|
61
61
|
measured there, not that nothing happened):
|
|
62
62
|
|
|
63
|
-
- `processes` lists each `runCommand`, with its command, `cwd`, `exit_code`,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
`hidden_bytes`).
|
|
63
|
+
- `processes` lists each `runCommand`, with its command, `cwd`, `exit_code`, `group`
|
|
64
|
+
(`running` if a process it started still ran in its group), `files` (what it added,
|
|
65
|
+
changed, or removed under its working directory), `stdout` and `stderr` (the files
|
|
66
|
+
in the record's directory that hold what it printed), `stdin` (the file that holds
|
|
67
|
+
what it was given), and `env` (how its environment differed from the runner's: each
|
|
68
|
+
name, with a value only when it is an existing absolute path, a decimal integer, or
|
|
69
|
+
a boolean, else its `hidden_bytes`).
|
|
71
70
|
- `http` counts the requests the step sent. Each is a line in `http.jsonl` with
|
|
72
71
|
its method, URL, status, request body, and response body. A line marked
|
|
73
72
|
`after_step_end` started after the record was written, so the record does not
|
|
@@ -76,12 +75,13 @@ measured there, not that nothing happened):
|
|
|
76
75
|
on its own. A line's `traceparent` is the value the request went out with,
|
|
77
76
|
nukadoko's or the step's own, and `traceparent_sent_to` the origins that
|
|
78
77
|
received it; nukadoko's value names the id the program's log lines carry.
|
|
79
|
-
- `program_log` counts
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- `events` counts
|
|
84
|
-
(late ones in `events-late
|
|
78
|
+
- `program_log.services` counts each service's lines, in `program-log.<service>.txt`
|
|
79
|
+
(late ones in `program-log-late.<service>.txt`): what it did for this step.
|
|
80
|
+
`lines: 0` with `stamped` above 0 is explained by the run summary's line
|
|
81
|
+
for the system (`program.md`); a service's `null`: it runs at a `url`.
|
|
82
|
+
- `events.services` counts each service's execution events by kind, in
|
|
83
|
+
`events.<service>.jsonl` (late ones in `events-late.<service>.jsonl`); `whole` and
|
|
84
|
+
`open` are the step's one answer over them all, a gap about one service naming it.
|
|
85
85
|
- `mcp` and `websocket` count the lines of `mcp.jsonl` and `websocket.jsonl` (`evidence.md`).
|
|
86
86
|
- `files` lists the paths the step changed in a scratch directory or wrote
|
|
87
87
|
through `node:fs`, each with its content after the step. A file the step asked
|
|
@@ -162,7 +162,7 @@ Tell the person, in their language and in plain words:
|
|
|
162
162
|
|
|
163
163
|
Then stop and wait for the person. Never answer a pause they have not
|
|
164
164
|
answered: the run waits exactly so that they judge each step while its
|
|
165
|
-
|
|
165
|
+
system is still there. Answer with the pause number they saw and the walk
|
|
166
166
|
number it printed (`walk 1 paused ...`), as the `do` line spells it:
|
|
167
167
|
|
|
168
168
|
- To go on: `npx nuka step next <n> --walk <w>`. It runs the next step
|
|
@@ -183,7 +183,7 @@ views, answer `next` once the person has seen them, and go to `diagnosing.md`. A
|
|
|
183
183
|
walk a signal ended (the host's background limit, Ctrl-C) prints `interrupted`;
|
|
184
184
|
one whose run was killed prints `walk-gone`, and its `do:` starts it again.
|
|
185
185
|
|
|
186
|
-
A walked run is not the run a reviewer approves (the
|
|
186
|
+
A walked run is not the run a reviewer approves (the system and the browser
|
|
187
187
|
stayed open between steps, and its summary says so): after the walk, run the
|
|
188
188
|
scenario once more without `--step`.
|
|
189
189
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Claim steps in Ruby
|
|
2
|
+
|
|
3
|
+
What a claim means, where its values come from, and every compare are in
|
|
4
|
+
`../checking-steps.md`. This page is how a Ruby step file writes one.
|
|
5
|
+
|
|
6
|
+
## A claim step
|
|
7
|
+
|
|
8
|
+
A Then declares `claims [...]` in place of `def run`, as a list of hashes
|
|
9
|
+
with the same keys as in TypeScript (`actual`, `view`, `at`, `count`,
|
|
10
|
+
`compare`, `expected`, `expected_view`). A key the line states is a field
|
|
11
|
+
of `args` with no `default:`.
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
# conformance/cases/cli/steps-rb/exits_with.rb
|
|
15
|
+
class ExitsWith < Nukadoko::Step
|
|
16
|
+
description "The process exit code is exactly this"
|
|
17
|
+
pattern "it exits with {code:int}"
|
|
18
|
+
args do
|
|
19
|
+
number :code, "The expected exit code"
|
|
20
|
+
field :exitCode, RunTally.returns[:exitCode]
|
|
21
|
+
end
|
|
22
|
+
from exitCode: [RunTally, :exitCode]
|
|
23
|
+
claims [{ actual: "exitCode", compare: "equal", expected: "code" }]
|
|
24
|
+
end
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## An expected value an earlier step returned
|
|
28
|
+
|
|
29
|
+
`from` names the step class and its key as a symbol, and
|
|
30
|
+
`field :<key>, <Step>.returns[:<key>]` reuses the producer's field.
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
# conformance/cases/http-api/steps-rb/list_has_created_item.rb
|
|
34
|
+
class ListHasCreatedItem < Nukadoko::Step
|
|
35
|
+
description "The item list holds the item an earlier step created, id and name"
|
|
36
|
+
pattern "the list has the item that was created"
|
|
37
|
+
args do
|
|
38
|
+
unknown :body, "The list the request got"
|
|
39
|
+
field :created, AnItemExists.returns[:body]
|
|
40
|
+
end
|
|
41
|
+
from body: [ListItems, :body], created: [AnItemExists, :body]
|
|
42
|
+
claims [{ actual: "body", compare: "has-item", expected: { from: "created" } }]
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Observe and poll
|
|
47
|
+
|
|
48
|
+
`def observe(...)` takes the fixtures as keyword arguments, as `run`
|
|
49
|
+
does, and reads the args through `args:`. Give every field a description,
|
|
50
|
+
so `nuka describe` connects a criterion's wording to the field that
|
|
51
|
+
answers it. `poll` takes `timeout_ms:` and `settled:`, or `false`.
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
# conformance/cases/poll/steps-rb/job_ends.rb
|
|
55
|
+
class JobEnds < Nukadoko::Step
|
|
56
|
+
pattern "the job ends {wanted:string}"
|
|
57
|
+
description "The job an earlier step started reaches this status in GET /jobs/:id"
|
|
58
|
+
args do
|
|
59
|
+
string :wanted, "The status the job is expected to reach"
|
|
60
|
+
field :id, StartJob.returns[:id]
|
|
61
|
+
end
|
|
62
|
+
from id: [StartJob, :id]
|
|
63
|
+
poll timeout_ms: 3000, settled: [{ actual: "status", compare: "not-equal", expected: { literal: "running" } }]
|
|
64
|
+
claims [{ actual: "status", compare: "equal", expected: "wanted" }]
|
|
65
|
+
|
|
66
|
+
def observe(request:, args:)
|
|
67
|
+
{ status: request.get("/jobs/#{args.id}").json["status"] }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## A page by role and name
|
|
73
|
+
|
|
74
|
+
`observe` returns the page or a locator, and nukadoko takes its ARIA
|
|
75
|
+
snapshot. playwright-ruby-client's methods are snake_case
|
|
76
|
+
(`page.get_by_role("form", name: "Scores")`).
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
# conformance/engine/projects/claim-aria/steps-rb/scores_form_shows.rb
|
|
80
|
+
class ScoresFormShows < Nukadoko::Step
|
|
81
|
+
pattern "the scores form shows"
|
|
82
|
+
description "The scores form's accessibility tree against the tree the docstring states"
|
|
83
|
+
args { string :tree, "Part of the ARIA snapshot the form shows" }
|
|
84
|
+
poll timeout_ms: 2000
|
|
85
|
+
claims [{ actual: "form", compare: "fits-aria-snapshot", expected: "tree" }]
|
|
86
|
+
|
|
87
|
+
def observe(page:, args:) = { form: page.get_by_role("form", name: "Scores") }
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## The files an earlier step changed
|
|
92
|
+
|
|
93
|
+
`files` names the paths the `Nukadoko.run_command` processes of an
|
|
94
|
+
earlier step changed, read from that step's record, and a claim reads the
|
|
95
|
+
key as its actual. `of` is the step class, or a list of them.
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# conformance/engine/projects/changed-files/steps-rb/notes_include.rb
|
|
99
|
+
class NotesInclude < Nukadoko::Step
|
|
100
|
+
pattern "the notes include {path:string}"
|
|
101
|
+
description "The notes the program added include one path"
|
|
102
|
+
args { string :path, "A path under notes/" }
|
|
103
|
+
files written: { of: WriteNotes, change: "added", under: "notes" }
|
|
104
|
+
claims [{ actual: "written", compare: "has-item", expected: "path" }]
|
|
105
|
+
end
|
|
106
|
+
```
|