nukadoko 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +153 -0
- data/README.ja.md +6 -3
- data/README.md +6 -3
- data/lib/nukadoko/aria_snapshot.rb +4 -4
- data/lib/nukadoko/base.rb +49 -29
- data/lib/nukadoko/check.rb +62 -5
- data/lib/nukadoko/claim_check.rb +2 -2
- data/lib/nukadoko/claim_rules.rb +1 -1
- data/lib/nukadoko/claim_sides.rb +481 -0
- data/lib/nukadoko/claims.rb +182 -20
- data/lib/nukadoko/cli.rb +24 -7
- data/lib/nukadoko/codes.json +20 -15
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/env_check.rb +1 -3
- data/lib/nukadoko/fixtures.rb +53 -21
- data/lib/nukadoko/init.rb +0 -1
- data/lib/nukadoko/js_json.rb +274 -0
- data/lib/nukadoko/js_pattern.rb +531 -0
- data/lib/nukadoko/parameter_types.rb +54 -0
- data/lib/nukadoko/parts.rb +1 -1
- data/lib/nukadoko/pattern.rb +112 -2
- data/lib/nukadoko/poll.rb +5 -3
- data/lib/nukadoko/program.rb +5 -5
- data/lib/nukadoko/project_files.rb +17 -0
- data/lib/nukadoko/project_program.rb +119 -0
- data/lib/nukadoko/run.rb +62 -17
- data/lib/nukadoko/run_record.rb +25 -22
- data/lib/nukadoko/scaffold.rb +2 -2
- data/lib/nukadoko/schema.rb +60 -18
- data/lib/nukadoko/secrets.rb +20 -4
- data/lib/nukadoko/spaces.rb +28 -0
- data/lib/nukadoko/step.rb +7 -1
- data/lib/nukadoko/text_fit.rb +1 -1
- data/lib/nukadoko/trace_actions.rb +4 -2
- data/lib/nukadoko/tree_passes.rb +6 -3
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko.rb +26 -2
- data/llms.txt +20 -18
- data/sig/generated/nukadoko/aria_snapshot.rbs +2 -2
- data/sig/generated/nukadoko/base.rbs +24 -18
- data/sig/generated/nukadoko/check.rbs +11 -1
- data/sig/generated/nukadoko/claim_sides.rbs +216 -0
- data/sig/generated/nukadoko/claims.rbs +46 -3
- data/sig/generated/nukadoko/cli.rbs +1 -1
- data/sig/generated/nukadoko/env_check.rbs +0 -4
- data/sig/generated/nukadoko/fixtures.rbs +25 -2
- data/sig/generated/nukadoko/init.rbs +0 -2
- data/sig/generated/nukadoko/js_json.rbs +109 -0
- data/sig/generated/nukadoko/js_pattern.rbs +194 -0
- data/sig/generated/nukadoko/parameter_types.rbs +27 -0
- data/sig/generated/nukadoko/pattern.rbs +59 -1
- data/sig/generated/nukadoko/poll.rbs +3 -2
- data/sig/generated/nukadoko/program.rbs +1 -1
- data/sig/generated/nukadoko/project_files.rbs +19 -0
- data/sig/generated/nukadoko/project_program.rbs +55 -0
- data/sig/generated/nukadoko/run.rbs +17 -3
- data/sig/generated/nukadoko/run_record.rbs +5 -4
- data/sig/generated/nukadoko/schema.rbs +22 -4
- data/sig/generated/nukadoko/secrets.rbs +17 -2
- data/sig/generated/nukadoko/spaces.rbs +31 -0
- data/sig/generated/nukadoko/trace_actions.rbs +3 -1
- data/sig/generated/nukadoko/tree_passes.rbs +2 -2
- data/sig/generated/nukadoko.rbs +11 -0
- data/skills/nukadoko/SKILL.md +2 -2
- data/skills/nukadoko/references/diagnosing.md +1 -1
- data/skills/nukadoko/references/examples/http-api.md +19 -16
- data/skills/nukadoko/references/fixtures.md +1 -1
- data/skills/nukadoko/references/perturbed-worlds.md +8 -6
- data/skills/nukadoko/references/program.md +20 -20
- data/skills/nukadoko/references/running.md +2 -2
- data/skills/nukadoko/references/scenario-rules.md +2 -2
- data/skills/nukadoko/references/verdicts.md +3 -3
- data/skills/nukadoko/references/writing-steps.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +6 -6
- metadata +19 -5
|
@@ -6,9 +6,67 @@
|
|
|
6
6
|
module Nukadoko
|
|
7
7
|
module Engine
|
|
8
8
|
class Pattern
|
|
9
|
+
CE: untyped
|
|
10
|
+
|
|
11
|
+
# The built-in parameter types as the JavaScript package defines them.
|
|
12
|
+
# The gem's own differ: its \s takes no Unicode space, so {word} read
|
|
13
|
+
# "a<no-break space>b" as one word, and its float takes no "1." prefix
|
|
14
|
+
# or the lookahead JavaScript's does, so a line bound to one step in
|
|
15
|
+
# one engine and to none in the other. A value is what the JavaScript
|
|
16
|
+
# transformer gives: Number for an integer (a double past 2**53),
|
|
17
|
+
# parseFloat for a float, and the matched text for a bigdecimal.
|
|
18
|
+
class Registry < Cucumber::CucumberExpressions::ParameterTypeRegistry
|
|
19
|
+
INTEGER: untyped
|
|
20
|
+
|
|
21
|
+
FLOAT: ::Regexp
|
|
22
|
+
|
|
23
|
+
WORD: ::Regexp
|
|
24
|
+
|
|
25
|
+
STRING: untyped
|
|
26
|
+
|
|
27
|
+
ANONYMOUS: ::Regexp
|
|
28
|
+
|
|
29
|
+
DECIMAL: ::Regexp
|
|
30
|
+
|
|
31
|
+
# JavaScript's Number of a text of digits.
|
|
32
|
+
# : (String?) -> Numeric?
|
|
33
|
+
def self.number: (String?) -> Numeric?
|
|
34
|
+
|
|
35
|
+
# JavaScript's parseFloat: the longest number at the start, or NaN.
|
|
36
|
+
# : (String?) -> Float?
|
|
37
|
+
def self.parse_float: (String?) -> Float?
|
|
38
|
+
|
|
39
|
+
# : () -> void
|
|
40
|
+
def initialize: () -> void
|
|
41
|
+
end
|
|
42
|
+
|
|
9
43
|
NAMED: ::Regexp
|
|
10
44
|
|
|
11
|
-
|
|
45
|
+
BUILT_IN: Array[String]
|
|
46
|
+
|
|
47
|
+
# The registry every pattern of the loaded project reads: the built-in
|
|
48
|
+
# types, and the config's parameterTypes on top of them.
|
|
49
|
+
# : () -> Registry
|
|
50
|
+
def self.registry: () -> Registry
|
|
51
|
+
|
|
52
|
+
# Why the config's parameterTypes could not be registered, in the
|
|
53
|
+
# TypeScript engine's words, or nil. While it is set no pattern
|
|
54
|
+
# matches a line, as no pattern binds there: nuka check reports it
|
|
55
|
+
# once, as parameter-type-invalid, and a run under --no-check stops.
|
|
56
|
+
# : () -> String?
|
|
57
|
+
def self.collision: () -> String?
|
|
58
|
+
|
|
59
|
+
# The names of the config's parameter types that have a transformer,
|
|
60
|
+
# whose capture a claim cannot compare with.
|
|
61
|
+
# : () -> Array[String]
|
|
62
|
+
def self.transformed: () -> Array[String]
|
|
63
|
+
|
|
64
|
+
# Registers the config's parameterTypes: each a name, a regexp, and an
|
|
65
|
+
# optional transformer, given the groups the regexp captured. A type
|
|
66
|
+
# with no transformer gives the text the regexp matched, or its first
|
|
67
|
+
# group, as the JavaScript package does.
|
|
68
|
+
# : (Array[Hash[Symbol, untyped]]) -> void
|
|
69
|
+
def self.configure: (Array[Hash[Symbol, untyped]]) -> void
|
|
12
70
|
|
|
13
71
|
attr_reader source: untyped
|
|
14
72
|
|
|
@@ -13,8 +13,9 @@ module Nukadoko
|
|
|
13
13
|
class Poll
|
|
14
14
|
INTERVAL: ::Float
|
|
15
15
|
|
|
16
|
-
#
|
|
17
|
-
|
|
16
|
+
# `sides` gives the claim inputs of one reading (Claims.judge).
|
|
17
|
+
# : (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], ?(^(untyped) -> ClaimSides::Inputs)?) -> void
|
|
18
|
+
def initialize: (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], ?(^(untyped) -> ClaimSides::Inputs)?) -> void
|
|
18
19
|
|
|
19
20
|
# A reading whose observe raised is kept with the first line of the
|
|
20
21
|
# error, and the poll reads again; only a last reading that raised
|
|
@@ -33,7 +33,7 @@ module Nukadoko
|
|
|
33
33
|
# : (?Array[String]) -> Array[Environment]
|
|
34
34
|
def environments: (?Array[String]) -> Array[Environment]
|
|
35
35
|
|
|
36
|
-
# Whether
|
|
36
|
+
# Whether the config gave a program, so each step names its world.
|
|
37
37
|
# : () -> bool
|
|
38
38
|
def file?: () -> bool
|
|
39
39
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/project_files.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The names of the files a project keeps nukadoko's settings in, one place
|
|
4
|
+
# for every part of the engine that reads, writes, or names them.
|
|
5
|
+
module Nukadoko
|
|
6
|
+
module Engine
|
|
7
|
+
CONFIG: ::String
|
|
8
|
+
|
|
9
|
+
# The program file of releases before the program moved into the
|
|
10
|
+
# config. A project may no longer hold one; a `--base` ref may.
|
|
11
|
+
LEGACY_PROGRAM: ::String
|
|
12
|
+
|
|
13
|
+
# What a `--base` run writes into a tree for the program it runs:
|
|
14
|
+
# another config whose program the tree runs, or a ref's legacy file.
|
|
15
|
+
TREE_PROGRAM: ::String
|
|
16
|
+
|
|
17
|
+
TREE_LEGACY_PROGRAM: ::String
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/project_program.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# A tree's program under test: the `program` lambda of its
|
|
4
|
+
# nukadoko.config.rb, called once. A config with no program has none, and a
|
|
5
|
+
# run starts no world for it.
|
|
6
|
+
#
|
|
7
|
+
# The program goes with the code and the criteria with the config, so a
|
|
8
|
+
# `nuka run --base` tree can hold one side's config and the other side's
|
|
9
|
+
# program. The run writes that program beside the tree's config: the other
|
|
10
|
+
# side's config as nukadoko.tree-program.rb, or a ref's program file from
|
|
11
|
+
# before the program moved into the config as
|
|
12
|
+
# nukadoko.tree-legacy-program.rb. A project's own program file is refused,
|
|
13
|
+
# with the move to make. Boundary: reading the program; starting it is
|
|
14
|
+
# Program's.
|
|
15
|
+
module Nukadoko
|
|
16
|
+
module Engine
|
|
17
|
+
module ProjectProgram
|
|
18
|
+
LIB: untyped
|
|
19
|
+
|
|
20
|
+
UPGRADING: ::String
|
|
21
|
+
|
|
22
|
+
# The program of the tree at `root`, whose config is already loaded.
|
|
23
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
24
|
+
def self.read: (String) -> Hash[Symbol, untyped]
|
|
25
|
+
|
|
26
|
+
# Nukadoko.program called from the config would describe a program
|
|
27
|
+
# nothing reads, so it is refused rather than left unstarted.
|
|
28
|
+
# : () -> Refusal
|
|
29
|
+
def self.called_in_config: () -> Refusal
|
|
30
|
+
|
|
31
|
+
# : () -> Refusal
|
|
32
|
+
def self.moved: () -> Refusal
|
|
33
|
+
|
|
34
|
+
# What a config's `program` returns, or nil when it has none.
|
|
35
|
+
# : (untyped, String) -> Hash[Symbol, untyped]?
|
|
36
|
+
def self.called: (untyped, String) -> Hash[Symbol, untyped]?
|
|
37
|
+
|
|
38
|
+
# The program `file` gives, read in a process of its own, since
|
|
39
|
+
# loading it here would replace this tree's config and fixtures: a
|
|
40
|
+
# config's program, or the options a legacy file passes to
|
|
41
|
+
# Nukadoko.program. Raises a Refusal naming the file when it does not
|
|
42
|
+
# load.
|
|
43
|
+
# : (String, legacy: bool) -> Hash[Symbol, untyped]?
|
|
44
|
+
def self.elsewhere: (String, legacy: bool) -> Hash[Symbol, untyped]?
|
|
45
|
+
|
|
46
|
+
# The text of a config with its program lambda cut out, so a change to
|
|
47
|
+
# the program alone leaves the config's mapping as it was: the
|
|
48
|
+
# program goes with the code, and a `--base` run compares only what
|
|
49
|
+
# decides how the criteria are read. A config with no program, or
|
|
50
|
+
# with more than one `program:` key, is read whole.
|
|
51
|
+
# : (String) -> String
|
|
52
|
+
def self.mapping_text: (String) -> String
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -8,13 +8,14 @@ module Nukadoko
|
|
|
8
8
|
module Engine
|
|
9
9
|
class Run
|
|
10
10
|
# `world` is head for a run, or base or old for a tree's pass, which
|
|
11
|
-
# writes into the head run's directory `dir
|
|
11
|
+
# writes into the head run's directory `dir`, and reads its env files
|
|
12
|
+
# from `head`'s root, with head's secrets as well as its own. `base` is the
|
|
12
13
|
# comparison a `--base` run judges its rows by. `scenarios` are in the
|
|
13
14
|
# run's order, which every round of every pass keeps; `records`, when
|
|
14
15
|
# given, gets each scenario's run.json entry as one line as it ends,
|
|
15
16
|
# and `rerun` is what a shuffled run's rerun lines name.
|
|
16
|
-
# : (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?) -> void
|
|
17
|
-
def initialize: (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?) -> void
|
|
17
|
+
# : (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?, ?head: Hash[Symbol, untyped]?) -> void
|
|
18
|
+
def initialize: (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?, ?head: Hash[Symbol, untyped]?) -> void
|
|
18
19
|
|
|
19
20
|
# : () -> Hash[Symbol, untyped]
|
|
20
21
|
def call: () -> Hash[Symbol, untyped]
|
|
@@ -188,11 +189,24 @@ module Nukadoko
|
|
|
188
189
|
|
|
189
190
|
private
|
|
190
191
|
|
|
192
|
+
# A value as a record stores it: JSON has no NaN or Infinity, and
|
|
193
|
+
# JavaScript writes either as null, so an arg a {float} read as "-"
|
|
194
|
+
# reaches the record the TypeScript engine writes.
|
|
195
|
+
# : (untyped) -> untyped
|
|
196
|
+
def stored: (untyped) -> untyped
|
|
197
|
+
|
|
191
198
|
# Runs one step whose args the block binds, and writes its record and
|
|
192
199
|
# HTTP log into `dir`.
|
|
193
200
|
# : (singleton(Step), Hash[Symbol, untyped], String, World, then_line: bool, at_line: Integer?, results: Array[untyped], origins: Hash[String, String]) { () -> [Hash[String, untyped], Hash[String, String]] } -> Hash[Symbol, untyped]
|
|
194
201
|
def execute: (singleton(Step), Hash[Symbol, untyped], String, World, then_line: bool, at_line: Integer?, results: Array[untyped], origins: Hash[String, String]) { () -> [ Hash[String, untyped], Hash[String, String] ] } -> Hash[Symbol, untyped]
|
|
195
202
|
|
|
203
|
+
# The args keys the line fills through a parameter type with a
|
|
204
|
+
# transformer, each with why a claim does not compare with it: code
|
|
205
|
+
# made the value, while the record would name the sentence. nuka check
|
|
206
|
+
# reports such a pattern; a run under --no-check agrees with it.
|
|
207
|
+
# : (untyped, Hash[String, String]) -> Hash[String, String]
|
|
208
|
+
def transformed_fills: (untyped, Hash[String, String]) -> Hash[String, String]
|
|
209
|
+
|
|
196
210
|
# A Then step's claims are judged on what it observed, or on its args
|
|
197
211
|
# when it reads nothing itself; any other step runs and returns.
|
|
198
212
|
# `step` is a step class whose observe or run its own file defines.
|
|
@@ -59,14 +59,15 @@ module Nukadoko
|
|
|
59
59
|
# and item claim as declared, how many items the list held and how
|
|
60
60
|
# many `where` selected, and the judged items, the broken first, at
|
|
61
61
|
# most 20, in index order.
|
|
62
|
-
# : (Hash[Symbol, untyped],
|
|
63
|
-
def self?.each_claim: (Hash[Symbol, untyped],
|
|
62
|
+
# : (Hash[Symbol, untyped], Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], ?patterns: Array[String]) -> Hash[Symbol, untyped]
|
|
63
|
+
def self?.each_claim: (Hash[Symbol, untyped], Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], ?patterns: Array[String]) -> Hash[Symbol, untyped]
|
|
64
64
|
|
|
65
65
|
# : (Hash[Symbol, untyped], untyped, Hash[String, String], Hash[String, String?], Array[String], untyped) -> Hash[Symbol, untyped]
|
|
66
66
|
def self?.item_declaration: (Hash[Symbol, untyped], untyped, Hash[String, String], Hash[String, String?], Array[String], untyped) -> Hash[Symbol, untyped]
|
|
67
67
|
|
|
68
|
-
#
|
|
69
|
-
|
|
68
|
+
# One where or item claim on one item, judged on the side the item gives.
|
|
69
|
+
# : (Hash[Symbol, untyped], Engine::ClaimSides::Side, Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], Array[String]) -> Hash[Symbol, untyped]
|
|
70
|
+
def self?.item_comparison: (Hash[Symbol, untyped], Engine::ClaimSides::Side, Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], Array[String]) -> Hash[Symbol, untyped]
|
|
70
71
|
|
|
71
72
|
# The claims of a scenario's step records, counted by outcome, in the
|
|
72
73
|
# fields run.json gives them.
|
|
@@ -74,11 +74,13 @@ module Nukadoko
|
|
|
74
74
|
# : (Hash[String, untyped]) -> untyped
|
|
75
75
|
def load: (Hash[String, untyped]) -> untyped
|
|
76
76
|
|
|
77
|
-
# Every way `value` departs from the schema, as `path: problem` lines
|
|
77
|
+
# Every way `value` departs from the schema, as `path: problem` lines in
|
|
78
|
+
# zod's words, so a step fails with the text the TypeScript engine gives.
|
|
78
79
|
# A key the schema does not declare is no problem: as a zod object does,
|
|
79
|
-
# the schema drops it (`strip`), and `dropped` names where.
|
|
80
|
-
#
|
|
81
|
-
|
|
80
|
+
# the schema drops it (`strip`), and `dropped` names where. `strict`
|
|
81
|
+
# refuses one at the root instead, as the TypeScript engine's args do.
|
|
82
|
+
# : (untyped, ?String?, ?strict: bool) -> Array[String]
|
|
83
|
+
def problems: (untyped, ?String?, ?strict: bool) -> Array[String]
|
|
82
84
|
|
|
83
85
|
# The value with every key the schema does not declare left out, at any
|
|
84
86
|
# depth, with string keys. Assumes `problems` found none.
|
|
@@ -105,9 +107,25 @@ module Nukadoko
|
|
|
105
107
|
# : (untyped, untyped, String) -> Array[String]
|
|
106
108
|
def self.dropped_type: (untyped, untyped, String) -> Array[String]
|
|
107
109
|
|
|
110
|
+
# A key the value does not hold, which zod reads as undefined.
|
|
111
|
+
MISSING: untyped
|
|
112
|
+
|
|
113
|
+
SAFE: untyped
|
|
114
|
+
|
|
115
|
+
# What zod calls a value's type in "received ...".
|
|
116
|
+
# : (untyped) -> String
|
|
117
|
+
def self.received: (untyped) -> String
|
|
118
|
+
|
|
119
|
+
# : (String, untyped) -> String
|
|
120
|
+
def self.invalid: (String, untyped) -> String
|
|
121
|
+
|
|
108
122
|
# : (untyped, untyped, String) -> Array[String]
|
|
109
123
|
def self.type_problems: (untyped, untyped, String) -> Array[String]
|
|
110
124
|
|
|
125
|
+
# zod's int: a finite whole number within Number.MAX_SAFE_INTEGER.
|
|
126
|
+
# : (untyped) -> String?
|
|
127
|
+
def self.integer_problem: (untyped) -> String?
|
|
128
|
+
|
|
111
129
|
# The JSON Schema `nuka describe` prints, as zod's own conversion gives it:
|
|
112
130
|
# the root is closed, and an inner object is closed only on the output
|
|
113
131
|
# side (`returns`), where zod drops the keys it does not declare.
|
|
@@ -82,12 +82,27 @@ module Nukadoko
|
|
|
82
82
|
# : Hash[String, String]
|
|
83
83
|
attr_reader values: untyped
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
|
|
85
|
+
# Each name with its value, a name twice when two sets held it with
|
|
86
|
+
# different values (`with`), so neither value goes unredacted.
|
|
87
|
+
# : Array[[String, String]]
|
|
88
|
+
attr_reader pairs: untyped
|
|
89
|
+
|
|
90
|
+
# : (?Hash[String, String] | Array[[String, String]]) -> void
|
|
91
|
+
def initialize: (?Hash[String, String] | Array[[ String, String ]]) -> void
|
|
87
92
|
|
|
88
93
|
# : () -> bool
|
|
89
94
|
def empty?: () -> bool
|
|
90
95
|
|
|
96
|
+
# Both sets: a tree's pass redacts with head's secrets as well as its
|
|
97
|
+
# own, since the tree's config must not decide which of head's values
|
|
98
|
+
# may print.
|
|
99
|
+
# : (Secrets) -> Secrets
|
|
100
|
+
def with: (Secrets) -> Secrets
|
|
101
|
+
|
|
102
|
+
# Every loaded value, each once.
|
|
103
|
+
# : () -> Array[String]
|
|
104
|
+
def shown_values: () -> Array[String]
|
|
105
|
+
|
|
91
106
|
# A copy of `value` with every secret spelling in its strings and
|
|
92
107
|
# keys written as its token. Two keys that redact to one would lose
|
|
93
108
|
# a subtree, so that raises.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/spaces.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Responsibility: the spaces JavaScript's trim, trimEnd, and \s take, so a
|
|
4
|
+
# text the Ruby engine trims ends where the TypeScript engine's does.
|
|
5
|
+
# Ruby's strip takes a NUL and no Unicode space, and [[:space:]] takes
|
|
6
|
+
# U+0085, which JavaScript keeps; a page's text often ends in a no-break
|
|
7
|
+
# space, so either would judge a claim the other way.
|
|
8
|
+
module Nukadoko
|
|
9
|
+
module Engine
|
|
10
|
+
module Spaces
|
|
11
|
+
CLASS: ::String
|
|
12
|
+
|
|
13
|
+
SPACE: ::Regexp
|
|
14
|
+
|
|
15
|
+
LEADING: ::Regexp
|
|
16
|
+
|
|
17
|
+
TRAILING: ::Regexp
|
|
18
|
+
|
|
19
|
+
BLANK: ::Regexp
|
|
20
|
+
|
|
21
|
+
# : (String) -> String
|
|
22
|
+
def self.trim: (String) -> String
|
|
23
|
+
|
|
24
|
+
# : (String) -> String
|
|
25
|
+
def self.trim_end: (String) -> String
|
|
26
|
+
|
|
27
|
+
# : (String) -> bool
|
|
28
|
+
def self.blank?: (String) -> bool
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
module Nukadoko
|
|
12
12
|
module Engine
|
|
13
13
|
module TraceActions
|
|
14
|
-
# Version 8 as the TypeScript engine measured it,
|
|
14
|
+
# Version 8 as the TypeScript engine measured it, version 9 as
|
|
15
|
+
# Playwright 1.63.0 writes it (the same fields and the same actions as
|
|
16
|
+
# version 8), and version 10 as
|
|
15
17
|
# Playwright 1.65.1 writes it for the Ruby client: the same `before`
|
|
16
18
|
# and `after` fields, with a number for `callId`.
|
|
17
19
|
KNOWN_VERSIONS: untyped
|
|
@@ -17,8 +17,8 @@ module Nukadoko
|
|
|
17
17
|
|
|
18
18
|
# `judged_by` says why head's passing executions of a row judged no
|
|
19
19
|
# claim in Then position (Run.then_judged_by).
|
|
20
|
-
# : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
21
|
-
def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
20
|
+
# : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String) -> void
|
|
21
|
+
def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String) -> void
|
|
22
22
|
|
|
23
23
|
# The worlds each tree's passes started, as run.json names them.
|
|
24
24
|
attr_reader worlds: untyped
|
data/sig/generated/nukadoko.rbs
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Generated from lib/nukadoko.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Nukadoko
|
|
4
|
+
# What a program file of a release before the program moved into the
|
|
5
|
+
# config calls. Only a `--base` ref still holds one, and the run reads it
|
|
6
|
+
# in a process of its own (Engine::ProjectProgram.elsewhere).
|
|
4
7
|
# : (**untyped) -> Hash[Symbol, untyped]
|
|
5
8
|
def self.program: (**untyped) -> Hash[Symbol, untyped]
|
|
6
9
|
|
|
10
|
+
# : () -> Hash[Symbol, untyped]?
|
|
11
|
+
def self.legacy_program: () -> Hash[Symbol, untyped]?
|
|
12
|
+
|
|
13
|
+
# The program under test of the project whose config load_project read.
|
|
7
14
|
# : () -> Hash[Symbol, untyped]
|
|
8
15
|
def self.program_options: () -> Hash[Symbol, untyped]
|
|
9
16
|
|
|
17
|
+
# Loads the config of the project at `root`, and reads its program.
|
|
18
|
+
# : (String) -> void
|
|
19
|
+
def self.load_project: (String) -> void
|
|
20
|
+
|
|
10
21
|
# : (**untyped) -> Hash[Symbol, untyped]
|
|
11
22
|
def self.config: (**untyped) -> Hash[Symbol, untyped]
|
|
12
23
|
|
data/skills/nukadoko/SKILL.md
CHANGED
|
@@ -23,7 +23,7 @@ touch, then one line for each of these that applies:
|
|
|
23
23
|
- A `mutates: true` step that reaches past the project (a real service, a
|
|
24
24
|
shared database, a file outside `scratch`) gets a go-ahead before its first
|
|
25
25
|
`nuka do`, once, not on every retry. A step that writes only under `scratch`,
|
|
26
|
-
or only to a server a fixture or `nukadoko.
|
|
26
|
+
or only to a server a fixture or the program in `nukadoko.config.ts` started, needs none
|
|
27
27
|
(`references/writing-steps.md`, "Asking before a step changes something").
|
|
28
28
|
- A step that needs `page`, `context`, `pageAs`, or `request` needs the project's
|
|
29
29
|
own `playwright`; `nuka check` reports `playwright-missing` with the
|
|
@@ -43,7 +43,7 @@ never commits, pushes, or publishes. Keep the narration short.
|
|
|
43
43
|
|
|
44
44
|
Run `nuka` from the directory that holds the config, and `nuka init` first
|
|
45
45
|
when there is none (`references/running.md`, "Setting up"); an app to start
|
|
46
|
-
needs `nukadoko.
|
|
46
|
+
needs the program in `nukadoko.config.ts` (`references/program.md`). A Ruby project
|
|
47
47
|
writes steps as the "Ruby" section of `llms.txt` says. Pick one line:
|
|
48
48
|
|
|
49
49
|
1. **Prose only** (a ticket, a request, a conversation):
|
|
@@ -99,7 +99,7 @@ a question for the person. A table the program writes for its own
|
|
|
99
99
|
bookkeeping (a telemetry row) or to run (a cache entry, a migration row) is
|
|
100
100
|
the program's to declare: a `lists.tables` command prints
|
|
101
101
|
`{"table":"events","holds":"bookkeeping"}` (or `"infrastructure"`) from
|
|
102
|
-
where the program already says it, never from a list in the
|
|
102
|
+
where the program already says it, never from a list in the config,
|
|
103
103
|
and a `db` count that names no `table` then leaves those lines out. The
|
|
104
104
|
line ends `left out 1 line: db insert into events (bookkeeping)`, and
|
|
105
105
|
`events_read.<key>.left_out` names each group. Otherwise the implementation
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Worked example: an HTTP API
|
|
2
2
|
|
|
3
3
|
A finished project for an API on `node:http`, built with nukadoko 0.16.1
|
|
4
|
-
on Node 24.22.0, with its Thens moved to claims and its server moved to
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
on Node 24.22.0, with its Thens moved to claims and its server moved to the program
|
|
5
|
+
in the release after 0.21.0, which also put the count behind a switch,
|
|
6
|
+
and that program moved into `nukadoko.config.ts` in the release after 0.26.0. Every output block below is copied from a real run of
|
|
7
7
|
that project, which is `examples/acceptance/http-api/` in the nukadoko
|
|
8
8
|
repository; CI runs it. The rules it follows are in
|
|
9
9
|
`../scenario-rules.md`.
|
|
@@ -91,7 +91,7 @@ Feature: items API
|
|
|
91
91
|
|
|
92
92
|
## The steps and the program
|
|
93
93
|
|
|
94
|
-
- `nukadoko.
|
|
94
|
+
- `program` in `nukadoko.config.ts`: starts the API once for each environment, on a
|
|
95
95
|
free port, waits until `GET /items` answers, and stops it after the
|
|
96
96
|
scenarios. The steps read its URL from `baseURL`. Its two
|
|
97
97
|
environments are the two sides of `ITEM_COUNT`, `count-off` and
|
|
@@ -123,12 +123,12 @@ Feature: items API
|
|
|
123
123
|
|
|
124
124
|
The two steps that POST keep the default `mutates: true`: they change the
|
|
125
125
|
API's state. They need no go-ahead before `nuka do`, because the only
|
|
126
|
-
server they reach is the one the program
|
|
126
|
+
server they reach is the one the program started.
|
|
127
127
|
|
|
128
|
-
`nukadoko.
|
|
128
|
+
`nukadoko.config.ts`:
|
|
129
129
|
|
|
130
130
|
```ts
|
|
131
|
-
import {
|
|
131
|
+
import { defineConfig } from "nukadoko";
|
|
132
132
|
|
|
133
133
|
// One API server for each environment of the run, on a port of its own.
|
|
134
134
|
// It keeps its items in memory, so a scenario sees the items earlier
|
|
@@ -137,14 +137,17 @@ import { defineProgram } from "nukadoko";
|
|
|
137
137
|
// its two sides, and conditions says which side each one is, so the
|
|
138
138
|
// scenario tagged @with:item_count runs in count-off as a control.
|
|
139
139
|
// ITEM_COUNT is the condition itself, so the switch the server reads and
|
|
140
|
-
// the side a cell counts for cannot disagree.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
// the side a cell counts for cannot disagree. No fixture starts the API:
|
|
141
|
+
// the steps reach it through baseURL.
|
|
142
|
+
export default defineConfig({
|
|
143
|
+
program: () => ({
|
|
144
|
+
serve: { command: "node src/server.ts", ready: "/items" },
|
|
145
|
+
env: { PORT: "{port}", ITEM_COUNT: "{condition.item_count}" },
|
|
146
|
+
environments: {
|
|
147
|
+
"count-off": { conditions: { item_count: false } },
|
|
148
|
+
"count-on": { conditions: { item_count: true } },
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
148
151
|
});
|
|
149
152
|
```
|
|
150
153
|
|
|
@@ -331,7 +334,7 @@ control's 2 runs, and the summary opens with the table:
|
|
|
331
334
|
| 2026-10-16 | The whole body against a docstring, or one claim per field | the whole body | the ticket names the body's fields; a scenario per field would repeat the request | none |
|
|
332
335
|
| 2026-10-17 | Acting on `repeated-scenario-prefix` | not acted on | the shared Given writes state the scenario reads | S8 |
|
|
333
336
|
| 2026-10-17 | `mutates` on the POST steps | the default `true`, no go-ahead | they change the API's state, but only on the server the fixture started | SKILL.md "Before the first command" |
|
|
334
|
-
| 2026-10-24 | Where the API server runs |
|
|
337
|
+
| 2026-10-24 | Where the API server runs | the program, one server for the run | the program is how nukadoko starts a program, and its `program.log` and run.json's `worlds` say which program answered; a fixture that starts one in-process says neither | S8 |
|
|
335
338
|
| 2026-10-24 | Expected bodies against a shared server | claims on what the scenario created: the name it sent, an id of at least 1, the body its Given returned | the exact bodies broke as soon as an earlier scenario had created an item (measured above) | S8 |
|
|
336
339
|
| 2026-10-24 | The unknown id | `0` | the API numbers items from 1, so no run reaches it; `42` exists once a run, or `--repeat`, has created 42 items | none |
|
|
337
340
|
| 2026-10-24 | A criterion behind a switch | two environments, `count-off` and `count-on`, with `conditions`, and `@with:item_count` on the scenario | one run shows the scenario breaking where the switch is off, a control that proves it; a scenario that only ran with the switch on would say nothing about whether it notices the count | none |
|
|
@@ -68,7 +68,7 @@ fixture depending on a `scenario`-scope one, and a fixture that destructures
|
|
|
68
68
|
fixture's own destructuring cannot be read, or names a fixture nukadoko
|
|
69
69
|
does not know. The finding names the fixture.
|
|
70
70
|
|
|
71
|
-
The program under test is not a fixture: `nukadoko.
|
|
71
|
+
The program under test is not a fixture: the program in `nukadoko.config.ts` builds it,
|
|
72
72
|
starts it once per world on a port of its own, and stops it after the
|
|
73
73
|
scenarios (`program.md`). A fixture that starts a server in-process
|
|
74
74
|
gives a run no record of which program answered. A fixture that connects
|
|
@@ -17,14 +17,14 @@ Four axes, and where each one lives:
|
|
|
17
17
|
below. The program reads each value from its environment variables, so
|
|
18
18
|
nothing new is needed in nukadoko.
|
|
19
19
|
|
|
20
|
-
## The program
|
|
20
|
+
## The program
|
|
21
21
|
|
|
22
22
|
Each environment declares its zone and its clock as `conditions`, and
|
|
23
23
|
`env` hands the same values to the program through `{condition.<name>}`,
|
|
24
24
|
so the column heading and the program cannot disagree:
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
import {
|
|
27
|
+
import { defineConfig } from "nukadoko";
|
|
28
28
|
|
|
29
29
|
// Two zones by two pinned clocks. A combination left out is not run, and
|
|
30
30
|
// nothing reports it, so the cross product is written once, here.
|
|
@@ -36,10 +36,12 @@ const environments = Object.fromEntries(
|
|
|
36
36
|
),
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
export default
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
program: () => ({
|
|
41
|
+
serve: { command: "node src/server.ts", ready: "/health" },
|
|
42
|
+
env: { PORT: "{port}", TZ: "{condition.tz}", NOW: "{condition.now}" },
|
|
43
|
+
environments,
|
|
44
|
+
}),
|
|
43
45
|
});
|
|
44
46
|
```
|
|
45
47
|
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
# The program under test
|
|
2
2
|
|
|
3
|
-
## The program
|
|
3
|
+
## The program
|
|
4
4
|
|
|
5
|
-
The config holds the criteria
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
The config holds the criteria, and its `program` holds how a run gets the
|
|
6
|
+
program the scenarios talk to: how to build it, prepare its state, start it,
|
|
7
|
+
and the env its processes get. `nuka init` does not write it: write it from
|
|
8
|
+
what the README or CI script already runs.
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
export default
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
import { defineConfig } from "nukadoko";
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
program: () => ({
|
|
15
|
+
build: ["npm run build"], // once per run, in the tree's root
|
|
16
|
+
prepare: ["node dist/migrate.js"], // once per world, with env below
|
|
17
|
+
serve: { command: "node dist/server.js", ready: "/health" },
|
|
18
|
+
env: { PORT: "{port}", DATABASE_PATH: "{dir}/app.sqlite3" },
|
|
19
|
+
}),
|
|
18
20
|
});
|
|
19
21
|
```
|
|
20
22
|
|
|
@@ -101,17 +103,16 @@ step's trace id by the time its record was written. Read the world's
|
|
|
101
103
|
`unrecorded-log` entry in the summary, decided from the whole log once the
|
|
102
104
|
world stopped: "carries no trace ids" means the program does not tag its
|
|
103
105
|
lines; a late line is on its step's `after-record` entry. When the world's
|
|
104
|
-
entry says none came in time, output buffered on a pipe is a
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
and tag it, in `config/environments/test.rb`:
|
|
106
|
+
entry says none came in time, output buffered on a pipe is a possible cause:
|
|
107
|
+
`STDOUT.sync = true` fixes it in Ruby and `PYTHONUNBUFFERED=1` in Python.
|
|
108
|
+
For Rails, send the test log to stdout and tag it, in `config/environments/test.rb`:
|
|
108
109
|
|
|
109
110
|
```ruby
|
|
110
111
|
config.logger = ActiveSupport::TaggedLogging.logger($stdout) if ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
111
112
|
config.log_tags = [ ->(request) { request.headers["traceparent"] } ]
|
|
112
113
|
```
|
|
113
114
|
|
|
114
|
-
with `RAILS_LOG_TO_STDOUT: "1"` in the program
|
|
115
|
+
with `RAILS_LOG_TO_STDOUT: "1"` in the program's `env`. A Node
|
|
115
116
|
server prints `req.headers.traceparent` at the start of each line it
|
|
116
117
|
writes for a request. A world at a `url` has no log nukadoko reads:
|
|
117
118
|
`observed.program_log` is `null`, and the server's own log finds a
|
|
@@ -195,6 +196,5 @@ that runs elsewhere, such as a staging server, and starts nothing: give it
|
|
|
195
196
|
`nuka run --base`, a `url` function receives `tree` and branches on it: one
|
|
196
197
|
that answers the base world with head's URL leaves that world not run.
|
|
197
198
|
|
|
198
|
-
A tree with no program
|
|
199
|
-
|
|
200
|
-
docs/spec.md has every field.
|
|
199
|
+
A tree with no program starts no world, which suits a command-line tool whose
|
|
200
|
+
steps run commands with `runCommand`. "Program" in docs/spec.md has every field.
|
|
@@ -30,7 +30,7 @@ kept in the order given.
|
|
|
30
30
|
|
|
31
31
|
## The program under test
|
|
32
32
|
|
|
33
|
-
`
|
|
33
|
+
The config's `program` builds, starts, and stops the
|
|
34
34
|
program the scenarios talk to, once per run (`references/program.md`).
|
|
35
35
|
|
|
36
36
|
## Environments
|
|
@@ -39,7 +39,7 @@ program the scenarios talk to, once per run (`references/program.md`).
|
|
|
39
39
|
file's `environments`, or `default`, which needs none. An entry overrides
|
|
40
40
|
any program field, adds `envFiles` after the config's, and may set
|
|
41
41
|
`policy: "read-only"` and `conditions`. `nuka run` without `--env` runs
|
|
42
|
-
what the program
|
|
42
|
+
what the program's `defaultEnvironments` names, or else every
|
|
43
43
|
environment that declares `conditions`, or `default` when none does;
|
|
44
44
|
`nuka do` without `--env` uses `default`. `nuka run --env a --env
|
|
45
45
|
b` runs every selected scenario in `a`, then in `b`, as one run: the
|