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
@@ -1,13 +1,15 @@
1
1
  # Generated from lib/nukadoko/trace.rb with RBS::Inline
2
2
 
3
- # The W3C trace context the engine puts on what a step sends to the world,
4
- # and the program's log read back by it, as the TypeScript engine does it.
5
- # Each step gets one trace id; each request to the world's origin, and
6
- # each process run_command starts, gets a span id of its own under it. A
7
- # line of program.log belongs to the step whose trace id it carries,
8
- # wherever it appears: every trace id of one world starts with the same
9
- # eight characters, so the id a line carries is the first place where
10
- # those begin 32 hexadecimal ones, and no list of ids is needed to read it.
3
+ # The W3C trace context the engine puts on what a step sends to the system,
4
+ # and each service's log read back by it, as the TypeScript engine does it.
5
+ # Each step gets one trace id; each request to the origin of a service of
6
+ # the system, and each process run_command starts, gets a span id of its
7
+ # own under it. A line of a service's program.log belongs to the step whose
8
+ # trace id it carries, wherever it appears, a line a service wrote for a
9
+ # request another service passed on included: every trace id of one system
10
+ # starts with the same eight characters, so the id a line carries is the
11
+ # first place where those begin 32 hexadecimal ones, and no list of ids is
12
+ # needed to read it.
11
13
  module Nukadoko
12
14
  module Engine
13
15
  module Trace
@@ -30,45 +32,96 @@ module Nukadoko
30
32
  # : (String, String) -> String
31
33
  def self.traceparent: (String, String) -> String
32
34
 
33
- # The trace id of the world `prefix` names that `line` carries, or nil.
35
+ # The trace id of the system `prefix` names that `line` carries, or nil.
34
36
  # : (String, String) -> String?
35
37
  def self.id_in: (String, String) -> String?
36
38
 
37
39
  # : (URI::Generic) -> String
38
40
  def self.origin: (URI::Generic) -> String
39
41
 
40
- # Only the world's origin gets the header: a third party's server may
41
- # answer a header it did not expect differently. A world at localhost
42
- # also answers at each name below localhost on the same port.
42
+ # Only the origins of the system's own services get the header: a
43
+ # third party's server, a service with `external: true` among them,
44
+ # may answer a header it did not expect differently. A service at
45
+ # localhost also answers at each name below localhost on the same port.
43
46
  # : (untyped, untyped) -> bool
44
47
  def self.stamps?: (untyped, untyped) -> bool
45
48
 
49
+ # The service of the system a request to `target` reaches: the first
50
+ # of `origins` (System#trace_origins) whose URL `stamps?` accepts, or
51
+ # nil for a request to no service's origin.
52
+ # : (Array[Hash[Symbol, untyped]], untyped) -> Hash[Symbol, untyped]?
53
+ def self.service_at: (Array[Hash[Symbol, untyped]], untyped) -> Hash[Symbol, untyped]?
54
+
46
55
  # The step that runs now, kept per thread as the processes are.
47
56
  # : () -> Boundary?
48
57
  def self.current: () -> Boundary?
49
58
 
50
- # : [T] (Boundary) { () -> T } -> T
51
- def self.within: [T] (Boundary) { () -> T } -> T
59
+ # : [T] (Boundary?) { () -> T } -> T
60
+ def self.within: [T] (Boundary?) { () -> T } -> T
52
61
 
53
- # One step's trace: what it stamped, and when it last did.
62
+ # One step's trace: what it stamped, at which service, and when it
63
+ # last did.
54
64
  class Boundary
55
65
  attr_reader trace_id: String
56
66
 
57
- attr_reader origin: String
67
+ attr_reader origins: Array[Hash[Symbol, untyped]]
58
68
 
59
69
  attr_reader stamped: Integer
60
70
 
61
- attr_reader spans: Array[String]
71
+ attr_reader stamped_by: Hash[String, Integer]
72
+
73
+ # The span ids of the requests the step stamped, by the service each
74
+ # went to, in the order sent: each service's events file reports the
75
+ # requests it served, so a request with no line is told from one
76
+ # another service has yet to report.
77
+ attr_reader spans: Hash[String, Array[String]]
78
+
79
+ # Stamped requests past MAX_SPANS, whose span ids are not kept, by
80
+ # service.
81
+ attr_reader spans_not_kept: Hash[String, Integer]
62
82
 
63
83
  attr_reader process_spans: Array[String]
64
84
 
85
+ attr_reader mcp_spans: Array[String]
86
+
65
87
  attr_reader last_stamp_at: Float?
66
88
 
67
- # : (String, String) -> void
68
- def initialize: (String, String) -> void
89
+ # `origins` are the system's services with a URL, each with whether a
90
+ # request there gets the step's traceparent.
91
+ # : (String, Array[Hash[Symbol, untyped]]) -> void
92
+ def initialize: (String, Array[Hash[Symbol, untyped]]) -> void
93
+
94
+ # The service a request to `url` gets the step's traceparent at, or
95
+ # nil when it is no stamped service's.
96
+ # : (untyped) -> Hash[Symbol, untyped]?
97
+ def stamped_at: (untyped) -> Hash[Symbol, untyped]?
98
+
99
+ # : (untyped) -> bool
100
+ def stamps?: (untyped) -> bool
101
+
102
+ # The name of the service of the system a request to `url` reaches,
103
+ # stamped or not, or nil when it is no service's origin: what an
104
+ # http.jsonl line names.
105
+ # : (untyped) -> String?
106
+ def service_at: (untyped) -> String?
107
+
108
+ # The URL of each service a request to gets the traceparent.
109
+ # : () -> Array[String]
110
+ def stamped_urls: () -> Array[String]
111
+
112
+ # The traceparent an MCP call carries in `params._meta`, with a
113
+ # span of its own.
114
+ # : () -> String
115
+ def mcp_traceparent: () -> String
116
+
117
+ # An MCP call's HTTP request to a stamped service goes out with the
118
+ # call's traceparent, and counts as one stamped request with the
119
+ # call's span however many requests its send makes.
120
+ # : (Hash[Symbol, untyped], String) -> void
121
+ def mcp_sent: (Hash[Symbol, untyped], String) -> void
69
122
 
70
123
  # The traceparent a request to `url` goes out with, or nil when it
71
- # is not the world's.
124
+ # is no stamped service's.
72
125
  # : (untyped) -> String?
73
126
  def stamp: (untyped) -> String?
74
127
 
@@ -76,18 +129,27 @@ module Nukadoko
76
129
  # for the request it may send, but the log is read a little longer.
77
130
  # : () -> String
78
131
  def process_traceparent: () -> String
79
- end
80
132
 
81
- # program.log read forward as the steps run: each step takes the
82
- # complete lines written since the last step read, keeps those that
83
- # carry its trace id, and, when it stamped anything, waits until the
84
- # log has been quiet for 30 ms (at most 300 ms) for lines still on
85
- # their way.
86
- class Log
87
- SLICE_FILE: ::String
133
+ private
88
134
 
89
- LATE_FILE: ::String
135
+ # : (String) -> void
136
+ def count: (String) -> void
137
+
138
+ # The span id of a request to `service`, under one cap over every
139
+ # service: a step that sends more requests than the cap is rare, and
140
+ # its events count the rest.
141
+ # : (String, String) -> void
142
+ def keep_span: (String, String) -> void
143
+ end
90
144
 
145
+ # A service's program.log read forward as the steps run: each step
146
+ # takes the complete lines written since the last step read, keeps
147
+ # those that carry its trace id, and, when it stamped anything, waits
148
+ # until the log has been quiet for 30 ms (at most 300 ms) for lines
149
+ # still on their way. Its slice goes beside the step record in
150
+ # program-log.<service>.txt, and its lines that arrived later in
151
+ # program-log-late.<service>.txt.
152
+ class Log
91
153
  QUIET: ::Float
92
154
 
93
155
  SETTLE: ::Float
@@ -100,14 +162,27 @@ module Nukadoko
100
162
 
101
163
  attr_reader prefix: String
102
164
 
103
- # : (String, String) -> void
104
- def initialize: (String, String) -> void
165
+ attr_reader service: String
166
+
167
+ # : (String) -> String
168
+ def self.slice_file: (String) -> String
169
+
170
+ # : (String) -> String
171
+ def self.late_file: (String) -> String
172
+
173
+ # Whether `name` is a file a service's slice or late lines take
174
+ # beside a step record, whatever the service's name, in any case.
175
+ # : (String) -> bool
176
+ def self.file?: (String) -> bool
177
+
178
+ # : (String, String, String) -> void
179
+ def initialize: (String, String, String) -> void
105
180
 
106
181
  # : (String, Boundary) -> Hash[Symbol, untyped]
107
182
  def slice: (String, Boundary) -> Hash[Symbol, untyped]
108
183
 
109
- # Once the world stopped: how many lines carry a trace id of the
110
- # world, and each step's lines that its slice did not read, written
184
+ # Once the system stopped: how many lines carry a trace id of the
185
+ # system, and each step's lines that its slice did not read, written
111
186
  # beside its record. `steps` maps a trace id to [lines read, dir].
112
187
  # : (Hash[String, Array[untyped]]) -> Hash[Symbol, untyped]
113
188
  def late: (Hash[String, Array[untyped]]) -> Hash[Symbol, untyped]
@@ -1,13 +1,20 @@
1
1
  # Generated from lib/nukadoko/tree_passes.rb with RBS::Inline
2
2
 
3
- # The base and the old world's passes of a `--base` run. Each row plans the
4
- # cells its verdict needs from its head cells (RunRecord.planned_world_cells),
3
+ # The base and the old system's passes of a `--base` run. Each row plans the
4
+ # cells its verdict needs from its head cells (RunRecord.planned_system_cells),
5
5
  # and each tree runs its planned rows one environment at a time, in a
6
6
  # process of its own started in the tree: a step file is loaded into the
7
7
  # process that runs it, and head's steps are already loaded in this one.
8
8
  # The pass writes its step records into the head run's directory, and its
9
9
  # executions and cells come back as JSON. A cell whose pass did not run
10
10
  # says why.
11
+ #
12
+ # Where both programs name {events}, the base system also runs, once and
13
+ # for run.json's `paths` alone, each row whose head cell is required and
14
+ # ran and that no base cell runs, so a criterion that did not change still
15
+ # shows what the code change did to its path. Such an execution carries
16
+ # `for_paths` and is no cell, so the table, the proof runs, and the
17
+ # verdicts never read it.
11
18
  module Nukadoko
12
19
  module Engine
13
20
  class TreePasses
@@ -17,11 +24,19 @@ module Nukadoko
17
24
 
18
25
  # `judged_by` says why head's passing executions of a row judged no
19
26
  # claim in Then position (Run.then_judged_by).
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
27
+ # `writes_events` says whether head's system of an environment writes
28
+ # execution events.
29
+ # `builds` are the builds head's pass ran (Program#builds): each pass
30
+ # gets them with those of the passes before it, so a checkout outside
31
+ # the repository builds once a run.
32
+ # `urls` is the key of the URL each service of head's system of each
33
+ # environment reached (Program.url_key), which the base's pass
34
+ # compares its own url function's answer with.
35
+ # : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String, ?writes_events: ^(Environment) -> bool, ?own_fields: Hash[String, Array[String]], ?builds: Hash[String, [String, String?]], ?urls: Hash[String, Hash[String, String]]) -> void
36
+ def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String, ?writes_events: ^(Environment) -> bool, ?own_fields: Hash[String, Array[String]], ?builds: Hash[String, [ String, String? ]], ?urls: Hash[String, Hash[String, String]]) -> void
22
37
 
23
- # The worlds each tree's passes started, as run.json names them.
24
- attr_reader worlds: untyped
38
+ # The systems each tree's passes started, as run.json names them.
39
+ attr_reader systems: untyped
25
40
 
26
41
  # Appends each tree execution to `executions`, and returns each row's
27
42
  # base and old cells by its scenario.
@@ -30,6 +45,10 @@ module Nukadoko
30
45
 
31
46
  private
32
47
 
48
+ # Whether head's cell of a row in an environment is required and ran.
49
+ # : (Scenario, Environment) -> bool
50
+ def ran_required?: (Scenario, Environment) -> bool
51
+
33
52
  # : (Scenario) -> Hash[Symbol, Array[String]]
34
53
  def plan: (Scenario) -> Hash[Symbol, Array[String]]
35
54
 
@@ -41,8 +60,17 @@ module Nukadoko
41
60
  # : (Scenario, String, Environment, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
42
61
  def cell: (Scenario, String, Environment, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
43
62
 
44
- # : (String, String, Environment, Array[Scenario]) -> Hash[Symbol, untyped]
45
- def run_tree: (String, String, Environment, Array[Scenario]) -> Hash[Symbol, untyped]
63
+ # `paths` are the rows the tree runs for paths alone, which its pass
64
+ # drops when the tree's own program names no {events}.
65
+ # : (String, String, Environment, Array[Scenario], ?Array[Scenario]) -> Hash[Symbol, untyped]
66
+ def run_tree: (String, String, Environment, Array[Scenario], ?Array[Scenario]) -> Hash[Symbol, untyped]
67
+
68
+ # How a pass's process ended, for a cell whose result was never
69
+ # written. Process::Status#exitstatus is nil once a signal stopped the
70
+ # process, where "ended with exit " named neither the signal nor that
71
+ # there was one.
72
+ # : (Process::Status) -> String
73
+ def self.ended: (Process::Status) -> String
46
74
  end
47
75
  end
48
76
  end
@@ -0,0 +1,141 @@
1
+ # Generated from lib/nukadoko/underneath.rb with RBS::Inline
2
+
3
+ # The failures underneath an execution (docs/spec.md "Failures
4
+ # underneath"): what its steps saw of the program failing, grouped by what
5
+ # an `@expects:` tag names; which of them no tag of the scenario accepts,
6
+ # which turns a pass broke in its cell; and the findings that say so.
7
+ # Pure, over a step's page events and the entries of its http.jsonl, and
8
+ # over run.json's scenarios. Writing those is Run#execute's, and folding
9
+ # the program's execution events into a step's `path` is the system's stop.
10
+ #
11
+ # Only a measured failure is counted: an entry of http.jsonl with a status
12
+ # from 500 to 599, and an error the page threw that nothing caught. Each is
13
+ # the failing party's own statement: the server chose the status, and the
14
+ # browser found no handler for what the page threw. What could not be seen
15
+ # (a page error past the record's cap, a page's request left out of
16
+ # http.jsonl, whose status was never kept) is kept apart as `unseen`, and
17
+ # is never counted as a failure.
18
+ module Nukadoko
19
+ module Engine
20
+ module Underneath
21
+ PREFIX: ::String
22
+
23
+ FAILED_STATUS: Range[Integer]
24
+
25
+ # The kinds in the order a failure is looked for under one step: the
26
+ # server's answer, the program's own report, then the page.
27
+ KIND_ORDER: untyped
28
+
29
+ # The failure `tag` names, as [kind, value], or nil when it does not
30
+ # read as `@expects:<kind>=<value>` (Check.expects_problem says why).
31
+ # : (String) -> [String, String]?
32
+ def self?.read_tag: (String) -> [ String, String ]?
33
+
34
+ # : (String, String) -> String
35
+ def self?.tag_text: (String, String) -> String
36
+
37
+ # The `@expects:` tags among a criterion's tags that read, each once,
38
+ # in the order the tags first name them.
39
+ # : (Array[String]) -> Array[String]
40
+ def self?.tags_of: (Array[String]) -> Array[String]
41
+
42
+ # A step's `underneath`, from its page events, its http.jsonl entries
43
+ # (nil when the file could not be read), how many entries could not
44
+ # be written, and the page requests left out of it by type. nil when
45
+ # the step saw no failure and missed nothing.
46
+ # : (Hash[Symbol, untyped]?, Array[Hash[Symbol, untyped]?]?, Integer?, Hash[untyped, Integer]?) -> Hash[Symbol, untyped]?
47
+ def self?.of_record: (Hash[Symbol, untyped]?, Array[Hash[Symbol, untyped]?]?, Integer?, Hash[untyped, Integer]?) -> Hash[Symbol, untyped]?
48
+
49
+ # : (Array[Hash[Symbol, untyped]?]) -> Array[Hash[Symbol, untyped]]
50
+ def self?.status_groups: (Array[Hash[Symbol, untyped]?]) -> Array[Hash[Symbol, untyped]]
51
+
52
+ # : (Hash[Symbol, untyped]?) -> Array[Hash[Symbol, untyped]]
53
+ def self?.page_error_groups: (Hash[Symbol, untyped]?) -> Array[Hash[Symbol, untyped]]
54
+
55
+ # A field of a hash read from either engine's run.json or in process.
56
+ # : (Hash[untyped, untyped]?, Symbol) -> untyped
57
+ def self?.at: (Hash[untyped, untyped]?, Symbol) -> untyped
58
+
59
+ # Whether a hash holds a key, a null value included: an unread
60
+ # http.jsonl is a null count.
61
+ # : (untyped, Symbol) -> bool
62
+ def self?.has?: (untyped, Symbol) -> bool
63
+
64
+ # What one step shows of one kind, each as the key a tag names, a
65
+ # count, and where the first one is. An unhandled error is the step's
66
+ # `path` entry, which the system's stop folded from every line of its
67
+ # trace; a `handled: true` error is the program going on, not failing.
68
+ # : (String, Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
69
+ def self?.found_under: (String, Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
70
+
71
+ # Every failure underneath `execution`, steps in order and, within a
72
+ # step, in KIND_ORDER, each with the tag that accepts it or nil.
73
+ # : (Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
74
+ def self?.failures: (Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
75
+
76
+ # The first failure underneath `execution` no tag of its scenario
77
+ # accepts: what turns a pass broke.
78
+ # : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
79
+ def self?.first_unexpected: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
80
+
81
+ # A request as a reason names it: its method and its path. The port
82
+ # of a system differs from run to run, so the full URL would make two
83
+ # runs that failed the same way disagree.
84
+ # : (Hash[Symbol, untyped]) -> String
85
+ def self?.request_of: (Hash[Symbol, untyped]) -> String
86
+
87
+ # The cell's reason for `failure`: the step's line and the failure's
88
+ # key, never a count or a message, so two runs that failed the same
89
+ # way agree.
90
+ # : (Hash[Symbol, untyped]) -> String
91
+ def self?.reason: (Hash[Symbol, untyped]) -> String
92
+
93
+ # : (Integer, String, String) -> String
94
+ def self?.count_of: (Integer, String, String) -> String
95
+
96
+ # `failure` as a finding and the summary name it, with where its
97
+ # first occurrence is.
98
+ # : (Hash[Symbol, untyped]) -> String
99
+ def self?.text: (Hash[Symbol, untyped]) -> String
100
+
101
+ # Whether a claim of `steps` was judged on lines still on their way.
102
+ # : (Array[Hash[Symbol, untyped]]) -> bool
103
+ def self?.judged_too_early?: (Array[Hash[Symbol, untyped]]) -> bool
104
+
105
+ # The failure underneath that turns `execution` broke in its cell:
106
+ # it passed, no claim of it was judged too early (its own broke), and
107
+ # a failure underneath it is one no tag of its scenario accepts. Only
108
+ # a pass: a fail is already the first failure that counts.
109
+ # : (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
110
+ def self?.demoting: (Hash[Symbol, untyped]) -> Hash[Symbol, untyped]?
111
+
112
+ # One `unexpected-failure` finding per head required execution a
113
+ # failure underneath turned broke, per scenario and environment,
114
+ # since the runs of `--repeat` would say it again. It names every
115
+ # failure no tag accepts under the first step that has one, and its
116
+ # `fix:` spells the tag for each.
117
+ # : (Array[Hash[Symbol, untyped]], label: ^(Hash[Symbol, untyped]) -> String, rerun: ^(Hash[Symbol, untyped]) -> String?) -> Array[Hash[Symbol, untyped]]
118
+ def self?.unexpected_findings: (Array[Hash[Symbol, untyped]], label: ^(Hash[Symbol, untyped]) -> String, rerun: ^(Hash[Symbol, untyped]) -> String?) -> Array[Hash[Symbol, untyped]]
119
+
120
+ # Whether an execution was watched for a kind whole, so a tag of that
121
+ # kind that matched nothing there matched nothing that happened:
122
+ # every entry of http.jsonl read and no page request left out of it,
123
+ # the page errors of a browser kept, or the program's events read
124
+ # with no line that may be any line and no gap where an error could
125
+ # still be. A step that sent no request has a gap too
126
+ # (`no-requests`), and no error of its trace can be missing.
127
+ # : (String, Hash[Symbol, untyped]) -> bool
128
+ def self?.watched?: (String, Hash[Symbol, untyped]) -> bool
129
+
130
+ NOT_SEEN: Hash[String, ^(String) -> String]
131
+
132
+ # One `expects-unseen` note per tag of a head required scenario, per
133
+ # environment, whose every execution passed and matched no failure
134
+ # that tag accepts, where each was watched for its kind whole. A tag
135
+ # left in place after its failure stopped happening accepts that
136
+ # failure in every later run.
137
+ # : (Array[Hash[Symbol, untyped]], label: ^(Hash[Symbol, untyped]) -> String) -> Array[Hash[Symbol, untyped]]
138
+ def self?.unseen_notes: (Array[Hash[Symbol, untyped]], label: ^(Hash[Symbol, untyped]) -> String) -> Array[Hash[Symbol, untyped]]
139
+ end
140
+ end
141
+ end
@@ -10,6 +10,8 @@ module Nukadoko
10
10
  class Verdict
11
11
  FIXES: untyped
12
12
 
13
+ TRAILER_KEY: String
14
+
13
15
  attr_reader judged: String
14
16
 
15
17
  attr_reader findings: Array[Hash[Symbol, untyped]]
@@ -32,6 +34,12 @@ module Nukadoko
32
34
  # : () -> Hash[Symbol, untyped]
33
35
  def envelope_fields: () -> Hash[Symbol, untyped]
34
36
 
37
+ # One git trailer line that stamps a commit with this answer. The tree
38
+ # named is the one the run recorded, so a reader compares it with the
39
+ # commit's own tree later and knows whether the stamp speaks for it.
40
+ # : () -> String
41
+ def trailer: () -> String
42
+
35
43
  # : () -> String
36
44
  def headline: () -> String
37
45
 
@@ -7,18 +7,57 @@ module Nukadoko
7
7
  module Vocabulary
8
8
  BROWSER: untyped
9
9
 
10
- # : (singleton(Step), String) -> Hash[Symbol, untyped]
11
- def self.entry: (singleton(Step), String) -> Hash[Symbol, untyped]
10
+ # : (singleton(Step), String, ?Array[singleton(Step)]) -> Hash[Symbol, untyped]
11
+ def self.entry: (singleton(Step), String, ?Array[singleton(Step)]) -> Hash[Symbol, untyped]
12
12
 
13
- # : (singleton(Step), String) -> Hash[Symbol, untyped]
14
- def self.describe: (singleton(Step), String) -> Hash[Symbol, untyped]
13
+ # `nuka steps <target>`: the steps the selected lines bind, and the steps
14
+ # those call through `parts`, each with the lines that bind it and the
15
+ # listed steps that call it. A line binds a step only when exactly one
16
+ # step matches it, as `nuka check` judges. A line that binds no single
17
+ # step is a finding: a list that leaves out the step a line was meant
18
+ # to bind reads as complete.
19
+ # : (Array[singleton(Step)], Array[Engine::Scenario]) -> [Array[[singleton(Step), Hash[Symbol, untyped]]], Array[Hash[Symbol, untyped]]]
20
+ def self.of_targets: (Array[singleton(Step)], Array[Engine::Scenario]) -> [ Array[[ singleton(Step), Hash[Symbol, untyped] ]], Array[Hash[Symbol, untyped]] ]
21
+
22
+ # : (singleton(Step), String, ?Array[singleton(Step)]) -> Hash[Symbol, untyped]
23
+ def self.describe: (singleton(Step), String, ?Array[singleton(Step)]) -> Hash[Symbol, untyped]
24
+
25
+ # `events` for a claim step that declares any: each key's `of` by step
26
+ # name, and its count as declared.
27
+ # : (singleton(Step)) -> Hash[String, Hash[Symbol, untyped]]?
28
+ def self.events: (singleton(Step)) -> Hash[String, Hash[Symbol, untyped]]?
29
+
30
+ # `files` for a claim step that declares any: each key's `of` by step
31
+ # name, and its change and directory when it names them.
32
+ # : (singleton(Step)) -> Hash[String, Hash[Symbol, untyped]]?
33
+ def self.files: (singleton(Step)) -> Hash[String, Hash[Symbol, untyped]]?
34
+
35
+ # `requires`, `gives`, and `ends` for a step that declares any.
36
+ # `given_by` names each step with a pattern whose gives names the
37
+ # state: the steps a line can run.
38
+ # : (singleton(Step), Array[singleton(Step)]) -> Hash[Symbol, untyped]
39
+ def self.states: (singleton(Step), Array[singleton(Step)]) -> Hash[Symbol, untyped]
15
40
 
16
41
  # : (singleton(Step)) -> Hash[untyped, untyped]?
17
42
  def self.from: (singleton(Step)) -> Hash[untyped, untyped]?
18
43
 
19
- # : (singleton(Step)) -> String
20
- def self.text: (singleton(Step)) -> String
44
+ # : (untyped) -> bool
45
+ def self.compat?: (untyped) -> bool
46
+
47
+ # : (singleton(Step), ?Array[singleton(Step)], ?Hash[Symbol, untyped]) -> String
48
+ def self.text: (singleton(Step), ?Array[singleton(Step)], ?Hash[Symbol, untyped]) -> String
49
+
50
+ WIDTH: ::Integer
51
+
52
+ # One item at two spaces, broken at spaces only, its later lines at
53
+ # four: a pattern or a description split mid-word could not be copied
54
+ # as the thing it names, so a word wider than the line keeps a line of
55
+ # its own.
56
+ # : (String) -> Array[String]
57
+ def self.wrap: (String) -> Array[String]
21
58
 
59
+ # A declared claim as one line: `count of orders equal n`, or
60
+ # `each of items: price greater-than 0` for a claim on each item.
22
61
  # : (Hash[Symbol, untyped]) -> String
23
62
  def self.claim_text: (Hash[Symbol, untyped]) -> String
24
63
  end
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: nukadoko
3
3
  description: Use when turning a requirement into a Gherkin scenario and the run that is its evidence, for a person to review, starting from whatever is on hand, whether that is raw prose with no stated acceptance criteria yet (a ticket, a request, a conversation), acceptance criteria that still need concrete scenarios, a scenario ready to write, a path already explored one `nuka do` call at a time and now worth fixing in a scenario, a browser app whose state cannot be repeated and has to be explored through a Playwright MCP server first, or a scenario a person wants to walk one step at a time, the run paused after each step while the agent explains its record and waits for the person's answer.
4
- compatibility: Requires the nukadoko npm package installed in the project (a devDependency), whose nuka CLI is run as `npx nuka`; the loop below shells out to it (nuka init, nuka steps, nuka describe, nuka scaffold, nuka do, nuka check, nuka run, nuka step, nuka verdict, nuka judge).
4
+ compatibility: Requires nukadoko installed in the project, the npm package (run as `npx nuka`) or the gem (run as `bundle exec nuka`); the loop below shells out to it (nuka init, nuka steps, nuka describe, nuka scaffold, nuka do, nuka check, nuka run, nuka step, nuka verdict, nuka judge).
5
5
  license: MIT
6
6
  ---
7
7
 
@@ -12,24 +12,26 @@ summary: the run is the evidence, and where the approval is recorded is
12
12
  the team's process. The feature is written before the implementation it judges,
13
13
  from the criteria and never from the program's output, which is what
14
14
  makes a green run evidence rather than agreement. This file is the order
15
- of work: open the reference a step names when you reach it.
16
- `node_modules/nukadoko/llms.txt` names every command, flag, and code.
15
+ of work: open the reference a step names when you reach it. `llms.txt`
16
+ in the package names every command, flag, and code.
17
+
18
+ **Which engine.** `nukadoko.config.rb` is Ruby (`bundle exec nuka`,
19
+ `references/ruby/`), `nukadoko.config.ts` or `.mts` TypeScript (`npx nuka`,
20
+ `references/typescript/`); `nuka` below is that launcher.
17
21
 
18
22
  ## Before the first command
19
23
 
20
24
  Say in two or three sentences what the loop is for and what it will
21
25
  touch, then one line for each of these that applies:
22
26
 
23
- - A `mutates: true` step that reaches past the project (a real service, a
27
+ - A mutating step that reaches past the project (a real service, a
24
28
  shared database, a file outside `scratch`) gets a go-ahead before its first
25
29
  `nuka do`, once, not on every retry. A step that writes only under `scratch`,
26
- or only to a server a fixture or the program in `nukadoko.config.ts` started, needs none
30
+ or only to a server a fixture or the program in the config started, needs none
27
31
  (`references/writing-steps.md`, "Asking before a step changes something").
28
- - A step that needs `page`, `context`, `pageAs`, or `request` needs the project's
29
- own `playwright`; `nuka check` reports `playwright-missing` with the
30
- install line. Adding it is a dependency change: ask first. A `page` step
31
- makes `nuka run` open a browser and take minutes. A project on e2e
32
- drives it through e2e instead (`references/fixtures.md`, last section).
32
+ - A `page` step needs Playwright (in TypeScript a `request` step too), and
33
+ `nuka check` reports `playwright-missing` with the install line: ask before
34
+ adding it. It makes `nuka run` open a browser and take minutes.
33
35
  - A Playwright MCP server, when the loop explores a browser app whose
34
36
  state cannot be repeated, drives the real application with whatever
35
37
  login it holds. A click that submits something there needs the same
@@ -43,8 +45,7 @@ never commits, pushes, or publishes. Keep the narration short.
43
45
 
44
46
  Run `nuka` from the directory that holds the config, and `nuka init` first
45
47
  when there is none (`references/running.md`, "Setting up"); an app to start
46
- needs the program in `nukadoko.config.ts` (`references/program.md`). A Ruby project
47
- writes steps as `references/ruby.md` says. Pick one line:
48
+ needs the program in the config (`references/program.md`). Pick one line:
48
49
 
49
50
  1. **Prose only** (a ticket, a request, a conversation):
50
51
  `references/from-prose.md`, then line 2.
@@ -72,18 +73,17 @@ If none is true, ask what this is supposed to do before writing anything.
72
73
  `Feature:` (`references/writing-the-feature.md`). Every expected value
73
74
  is one the criteria state; a value they do not state is a question for
74
75
  a person, not a guess and not a value read off the program.
75
- 2. **Steps.** `nuka steps` lists the vocabulary, `nuka describe <step>` one
76
- contract; reuse before scaffolding. `nuka scaffold --feature <file>` stubs
76
+ 2. **Steps.** Reuse first: `nuka steps [<feature>]` lists the vocabulary (or
77
+ a file's), `nuka describe <step>` one step. `nuka scaffold --feature <file>` stubs
77
78
  each undefined line and prints each stub's own `nuka scaffold ...
78
79
  --replace` line. Redo the When that runs a program or sends a request, and
79
80
  the Thens that read it, from those lines with `--description`, `--command
80
81
  <entry point>` (`--cwd`, `--argv`) or `--request "<METHOD> <path>"`, and
81
82
  `--from <step>.<key>` per value an earlier step returns (its producer has
82
83
  to return that key already). A step that needs only what an earlier line
83
- did `requires` the state that line's step `gives` (`references/states.md`).
84
- A Then declares `claims`, never `run` (`references/checking-steps.md`). Run
85
- each alone with `nuka do <step> --args '<json>'`
86
- (`references/writing-steps.md`). Finished projects: `references/examples/`.
84
+ did `requires` its state (`references/states.md`). A Then declares
85
+ `claims`, never `run` (`references/checking-steps.md`). Run each alone
86
+ with `nuka do <step> --args '<json>'` (`references/writing-steps.md`).
87
87
  3. **`nuka check <feature>`.** Fix every error and read every warning: a
88
88
  warning is a question about intent, not noise. Each finding names its
89
89
  file, a `fix:` (an edit) or `do:` (a command) line; apply or run it.