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
@@ -48,14 +48,16 @@ module Nukadoko
48
48
 
49
49
  attr_reader doc_string(): untyped
50
50
 
51
+ attr_reader doc_string_media_type(): untyped
52
+
51
53
  attr_reader background(): untyped
52
54
 
53
- def self.new: (untyped text, untyped line, untyped kind, untyped table, untyped doc_string, untyped background) -> instance
54
- | (text: untyped, line: untyped, kind: untyped, table: untyped, doc_string: untyped, background: untyped) -> instance
55
+ def self.new: (untyped text, untyped line, untyped kind, untyped table, untyped doc_string, untyped doc_string_media_type, untyped background) -> instance
56
+ | (text: untyped, line: untyped, kind: untyped, table: untyped, doc_string: untyped, doc_string_media_type: untyped, background: untyped) -> instance
55
57
 
56
- def self.members: () -> [ :text, :line, :kind, :table, :doc_string, :background ]
58
+ def self.members: () -> [ :text, :line, :kind, :table, :doc_string, :doc_string_media_type, :background ]
57
59
 
58
- def members: () -> [ :text, :line, :kind, :table, :doc_string, :background ]
60
+ def members: () -> [ :text, :line, :kind, :table, :doc_string, :doc_string_media_type, :background ]
59
61
  end
60
62
 
61
63
  # What makes a file, or a part of one, run nothing: a file that does
@@ -31,7 +31,7 @@ module Nukadoko
31
31
  class Request
32
32
  attr_reader log: Array[Hash[Symbol, untyped]]
33
33
 
34
- # `base_url` is the world's URL, which a path joins onto; a project with
34
+ # `base_url` is the system's URL, which a path joins onto; a project with
35
35
  # no program has none. An absolute URL, http or https, goes where it
36
36
  # names, so a step can call a third-party API and still have its
37
37
  # requests recorded.
@@ -58,8 +58,11 @@ module Nukadoko
58
58
  class Browser
59
59
  # `secrets` gives the run's loaded secrets when a screenshot is taken,
60
60
  # since an environment's env files are read after the browser is made.
61
- # : (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets) -> void
62
- def initialize: (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets) -> void
61
+ # `stamped` are the URLs of the system's services a page's request to
62
+ # gets the step's traceparent (System#trace_origins); the primary's by
63
+ # default.
64
+ # : (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets, ?stamped: Array[String]?) -> void
65
+ def initialize: (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets, ?stamped: Array[String]?) -> void
63
66
 
64
67
  # Opaque, so a masked secret leaves no trace of its glyphs.
65
68
  MASK_COLOR: ::String
@@ -97,7 +100,7 @@ module Nukadoko
97
100
  # that step's.
98
101
  attr_writer step: Hash[Symbol, untyped]?
99
102
 
100
- # Which requests to the world the page had finished receiving the
103
+ # Which requests to the system the page had finished receiving the
101
104
  # response of, and which were in flight, around a claim step's
102
105
  # reading: an order of the events this process received, never a
103
106
  # claim that the page drew from a response. Only a document, a
@@ -110,8 +113,49 @@ module Nukadoko
110
113
  # : [T] () { () -> T } -> T
111
114
  def reading: [T] () { () -> T } -> T
112
115
 
113
- # : () -> nil
114
- def begin_step: () -> nil
116
+ # A step's page events start empty, and so does its tally of the
117
+ # page's requests left out of http.jsonl.
118
+ # : () -> void
119
+ def begin_step: () -> void
120
+
121
+ PAGE_EVENT_KINDS: untyped
122
+
123
+ # A redirect loop or a chatty page can emit thousands of these in one
124
+ # step, so each kind keeps 100 entries and counts the rest under
125
+ # `truncated`, never by changing the kind's own shape.
126
+ PAGE_EVENTS_CAP: ::Integer
127
+
128
+ # The page's requests that land in http.jsonl, with their status; a
129
+ # script, a stylesheet, or an image is only counted, by its type.
130
+ PAGE_LOGGED_TYPES: untyped
131
+
132
+ # What the page of `context` did that no step asked about: each
133
+ # console.error call, each error it threw that nothing caught (the
134
+ # name an @expects:page-error= tag accepts), and each request that
135
+ # failed at the network level, each with `as` for a named context.
136
+ # : (untyped, String?) -> void
137
+ def watch_page: (untyped, String?) -> void
138
+
139
+ # : (Symbol, Hash[Symbol, untyped]) -> void
140
+ def note_page_event: (Symbol, Hash[Symbol, untyped]) -> void
141
+
142
+ # The step's page events as its record holds them, nil when there
143
+ # were none: each kind a bare array, and `truncated` naming each kind
144
+ # that hit the cap with its true total.
145
+ # : () -> Hash[Symbol, untyped]?
146
+ def page_events: () -> Hash[Symbol, untyped]?
147
+
148
+ # The page's requests the step's http.jsonl left out, by type, nil
149
+ # when there were none.
150
+ # : () -> Hash[String, Integer]?
151
+ def http_omitted: () -> Hash[String, Integer]?
152
+
153
+ # A listener that writes each response the page received to `log`:
154
+ # a document, a fetch, or an XMLHttpRequest with its status, so a
155
+ # failure underneath a step is the server's own answer; any other
156
+ # request is counted by its type.
157
+ # : (Array[Hash[Symbol, untyped]], String?) -> ^(untyped) -> void
158
+ def page_logger: (Array[Hash[Symbol, untyped]], String?) -> ^(untyped) -> void
115
159
 
116
160
  # A claim step's `pages`, `page_requests`, and `judged_view`, after
117
161
  # the reading its claims were judged on, when a page was open.
@@ -137,15 +181,17 @@ module Nukadoko
137
181
  # : () -> Float
138
182
  def monotonic: () -> Float
139
183
 
140
- # A page's documents, fetches, and XMLHttpRequests to the world get
184
+ # A page's documents, fetches, and XMLHttpRequests to a stamped
185
+ # service of the system get
141
186
  # the running step's traceparent through the Chrome DevTools
142
187
  # Protocol's Fetch domain, on a session of the page's own: a header set
143
188
  # on the whole context would reach other origins too, and a route
144
189
  # turns the browser's cache off. Images, scripts, and stylesheets are
145
190
  # left out, since each paused request costs a round trip. A session
146
- # that cannot be opened leaves the page's requests unstamped.
147
- # : (untyped) -> void
148
- def stamp: (untyped) -> void
191
+ # that cannot be opened leaves the page's requests unstamped, and so
192
+ # does a system with no service to stamp.
193
+ # : (untyped, untyped) -> void
194
+ def stamp: (untyped, untyped) -> void
149
195
 
150
196
  # How long a pause waits for each capture of the page's view. A page
151
197
  # whose main thread is stuck answers none of them, and without a
@@ -183,7 +229,7 @@ module Nukadoko
183
229
  # The page of a browser context of its own, named `name`, so a second
184
230
  # person in the scenario has cookies and storage of their own. The
185
231
  # context opens on the first call for the name in the scenario, with
186
- # `options` over the world's base URL, and a later call gets the same
232
+ # `options` over the system's base URL, and a later call gets the same
187
233
  # page. Each step that calls it gets a trace chunk, trace.<name>.zip,
188
234
  # and the page's requests go to the step's log with `as`.
189
235
  # : (String, Hash[untyped, untyped]?, String, Array[Hash[Symbol, untyped]]) -> untyped
@@ -202,6 +248,16 @@ module Nukadoko
202
248
  # : () -> Hash[String, [String, untyped]]
203
249
  def step_named: () -> Hash[String, [ String, untyped ]]
204
250
 
251
+ # When each page request started, by the request itself, for its
252
+ # http.jsonl line's duration.
253
+ # : () -> Hash[untyped, Float]
254
+ def page_started: () -> Hash[untyped, Float]
255
+
256
+ # The traceparents page requests went out with, by method and URL,
257
+ # oldest first.
258
+ # : () -> Hash[[String, String], Array[String]]
259
+ def page_stamps: () -> Hash[[ String, String ], Array[String]]
260
+
205
261
  public
206
262
 
207
263
  # : () -> void
@@ -3,7 +3,7 @@
3
3
  # Requests a step sends through Net::HTTP itself, without the `request`
4
4
  # fixture, measured as the TypeScript engine measures a step's own `fetch`:
5
5
  # each lands in the step's http.jsonl with `via: "net/http"`, and one to
6
- # the world's origin carries the step's traceparent. It records only while
6
+ # the system's origin carries the step's traceparent. It records only while
7
7
  # a step runs, on the thread that runs it, so a fixture's setup, the
8
8
  # engine's own readiness check, and the `request` fixture (which records
9
9
  # its requests itself) go through Net::HTTP untouched.
@@ -0,0 +1,132 @@
1
+ # Generated from lib/nukadoko/intent.rb with RBS::Inline
2
+
3
+ # Responsibility: the intent file's format (docs/intent.md): what a change
4
+ # declares it means to do differently, as one Markdown table whose rows
5
+ # are target x observation x before -> after, each cell in the execution
6
+ # events vocabulary. Reading it, writing it back, and the two questions a
7
+ # row answers about one entry of a path: does the row aim at it, and does
8
+ # a difference on it go the way the row says. Pure. Boundary: where the
9
+ # file is and what git says of it are IntentFile's; which criteria a row
10
+ # reached, and what each came to, are IntentView's.
11
+ #
12
+ # Only the table whose header is exactly
13
+ # `| Target | Observation | Before | After |` is read; prose around it is
14
+ # for people. A cell's terms are the events vocabulary: a kind, and
15
+ # `field<op>value` over a line's fields, so a row names what the program
16
+ # reports and never a step, a criterion's text, or an id.
17
+ #
18
+ # A value is JSON when it parses as JSON and is otherwise the bare text:
19
+ # `plan:team` and `"plan:team"` are one value, and `10` is a number. A
20
+ # term ends at a space outside a JSON string or brackets, so a value with
21
+ # spaces is written as JSON, and a `|` in a cell is written `\|`, as
22
+ # Markdown has it.
23
+ #
24
+ # Before and after say how many lines a step's path counts for an
25
+ # observation with no bare field (`0` -> `1`), or which value the bare
26
+ # field had. Both left empty says the observation is not meant to change
27
+ # at all, which is how a refactor declares that decisions stay as they
28
+ # were. A row that cannot be read is a problem named by its line, never
29
+ # left out in silence.
30
+ module Nukadoko
31
+ module Engine
32
+ module Intent
33
+ FILE: ::String
34
+
35
+ HEADER: untyped
36
+
37
+ OPS: untyped
38
+
39
+ FIELD: ::Regexp
40
+
41
+ # The cells of a Markdown table line: between its outer pipes, split
42
+ # at each `|` that `\` does not escape, each trimmed, `\|` read as `|`.
43
+ # : (String) -> Array[String]?
44
+ def self?.table_cells: (String) -> Array[String]?
45
+
46
+ # A cell as a table line holds it: `|` escaped.
47
+ # : (String) -> String
48
+ def self?.cell_text: (String) -> String
49
+
50
+ # The terms of a cell, split at each run of spaces outside a JSON
51
+ # string and outside brackets.
52
+ # : (String) -> Array[String]
53
+ def self?.split_terms: (String) -> Array[String]
54
+
55
+ # A value as written: JSON when it parses, the bare text otherwise.
56
+ # : (String) -> untyped
57
+ def self?.value_of: (String) -> untyped
58
+
59
+ # A value as a cell writes it: bare when that reads back as the same
60
+ # value and holds no space, pipe, quote, or bracket, and JSON
61
+ # otherwise.
62
+ # : (untyped) -> String
63
+ def self?.value_text: (untyped) -> String
64
+
65
+ # : (String) -> Hash[Symbol, untyped]
66
+ def self?.term_of: (String) -> Hash[Symbol, untyped]
67
+
68
+ # Why a field cannot be read on a kind's lines, or nil.
69
+ # : (String, String) -> String?
70
+ def self?.field_problem: (String, String) -> String?
71
+
72
+ # A term as a path's key reads it: an `http` origin on loopback
73
+ # without its port, as a path keeps it.
74
+ # : (String, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
75
+ def self?.key_term: (String, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
76
+
77
+ # : (String) -> Integer?
78
+ def self?.count_of: (String) -> Integer?
79
+
80
+ # : (Integer, Integer, Hash[Symbol, String]) -> Hash[Symbol, untyped]
81
+ def self?.row_of: (Integer, Integer, Hash[Symbol, String]) -> Hash[Symbol, untyped]
82
+
83
+ # Reads the intent file's text: `{ rows:, problems: }`. Pure.
84
+ # : (String) -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
85
+ def self?.parse: (String) -> Hash[Symbol, Array[Hash[Symbol, untyped]]]
86
+
87
+ # The table a list of rows' cells makes, header first: what `parse`
88
+ # reads back to the same cells.
89
+ # : (Array[Hash[Symbol, String]]) -> String
90
+ def self?.table: (Array[Hash[Symbol, String]]) -> String
91
+
92
+ # For each writer's own kind a row observes, every field a row reads
93
+ # on it, so a path counts the kind by them.
94
+ # : (Hash[Symbol, untyped]) -> Hash[String, Array[String]]
95
+ def self?.own_fields: (Hash[Symbol, untyped]) -> Hash[String, Array[String]]
96
+
97
+ # Two values are one when their JSON is, objects' keys in any order.
98
+ # : (untyped, untyped) -> bool
99
+ def self?.same_value?: (untyped, untyped) -> bool
100
+
101
+ # : (untyped) -> String
102
+ def self?.canonical: (untyped) -> String
103
+
104
+ # The value a key or a line holds at a field: a path's own key holds
105
+ # a dotted field as one name, a line as nested objects. `nil` with
106
+ # `found: false` when it holds none.
107
+ # : (Hash[String, untyped], String) -> [bool, untyped]
108
+ def self?.field_value: (Hash[String, untyped], String) -> [ bool, untyped ]
109
+
110
+ # Whether a term holds on a record. A field the record lacks meets no
111
+ # term, and an order compares two numbers or two strings alone.
112
+ # : (Hash[Symbol, untyped], Hash[String, untyped]) -> bool
113
+ def self?.term_holds?: (Hash[Symbol, untyped], Hash[String, untyped]) -> bool
114
+
115
+ # Whether a row aims at an entry of a path: its kind, and every
116
+ # condition and filter holds on it.
117
+ # : (Hash[Symbol, untyped], Hash[String, untyped]) -> bool
118
+ def self?.observes?: (Hash[Symbol, untyped], Hash[String, untyped]) -> bool
119
+
120
+ # : (Hash[Symbol, untyped], Integer) -> bool
121
+ def self?.within?: (Hash[Symbol, untyped], Integer) -> bool
122
+
123
+ # Whether a difference on an entry the row observes goes the way the
124
+ # row says. For a count: the base side can hold `before` and head
125
+ # `after`. For a value: the entry holds `before` and fewer lines at
126
+ # head, or `after` and more; the caller pairs the two. A row meant not
127
+ # to change declares no difference.
128
+ # : (Hash[Symbol, untyped], Hash[String, untyped], Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Symbol?
129
+ def self?.declares: (Hash[Symbol, untyped], Hash[String, untyped], Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Symbol?
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,46 @@
1
+ # Generated from lib/nukadoko/intent_file.rb with RBS::Inline
2
+
3
+ # Responsibility: the intent a change declares (docs/intent.md), read
4
+ # under `nuka run --base`: the file at the repository's top as head's
5
+ # working tree holds it, and what git says of it since the base. Boundary:
6
+ # git and the disk only; the format is Intent's, what each row came to
7
+ # IntentView's.
8
+ #
9
+ # The file is the change's when the change wrote it: a file the base
10
+ # already holds unchanged is an earlier change's intent, merged with it,
11
+ # and says nothing about this one. So a run reads it only when head's
12
+ # text differs from the base's, and a change that removes it declares
13
+ # nothing.
14
+ #
15
+ # The reviewer reads when it was declared: in the change's first commit,
16
+ # before anything it judges was written, or later, and each commit since
17
+ # that changed it again. A change of intent is itself a difference the
18
+ # reviewer approves, so it is named, never folded into the rows.
19
+ module Nukadoko
20
+ module Engine
21
+ module IntentFile
22
+ # git did not answer.
23
+ class GitFailed < StandardError
24
+ end
25
+
26
+ # The intent the change at `project` declares against `base_commit`:
27
+ # `{ intent:, record: }`, the record run.json's `intent` before its
28
+ # rows are judged, or nil when it declares none. Raises GitFailed
29
+ # when git does not answer.
30
+ # : (String, String) -> Hash[Symbol, untyped]?
31
+ def self?.read: (String, String) -> Hash[Symbol, untyped]?
32
+
33
+ # : (String, *String) -> String
34
+ def self?.git: (String, *String) -> String
35
+
36
+ # The file at a commit, or nil when the commit holds none.
37
+ # : (String, String) -> String?
38
+ def self?.at_commit: (String, String) -> String?
39
+
40
+ # The commits after `base` up to HEAD, oldest first, each with its
41
+ # subject: all of them, or with `file`, those that changed it.
42
+ # : (String, String, ?String?) -> Array[Hash[Symbol, String]]
43
+ def self?.commits_since: (String, String, ?String?) -> Array[Hash[Symbol, String]]
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,69 @@
1
+ # Generated from lib/nukadoko/intent_view.rb with RBS::Inline
2
+
3
+ # Responsibility: what each row of a change's intent came to against the
4
+ # base pairs of run.json's `paths` (docs/intent.md), and which row declares
5
+ # each difference there. Pure: it reads the comparisons, the scenarios
6
+ # they name, and each criterion's tags. Boundary: reading the intent is
7
+ # Intent's, comparing two paths PathView's; this module adds the account
8
+ # and changes no count.
9
+ #
10
+ # A row aims at a criterion that carries every tag of its target, and,
11
+ # when its target or a bare field reads a line's values, whose steps on
12
+ # either side hold an entry those values meet. A row that counts lines
13
+ # with no such term aims at every criterion its tags name, since `0 -> 1`
14
+ # must be told apart from nothing happening where nothing was there to
15
+ # see. Each criterion it aims at either did what it says or did not: a
16
+ # row meant to change declares a difference there, and one meant not to
17
+ # change finds no difference on what it observes that no other row
18
+ # declares. A row that aimed at no compared criterion was not reached.
19
+ #
20
+ # A value row declares a difference only in pairs, within one step: the
21
+ # lines that held the old value go, and as many that hold the new one
22
+ # come. A value that went somewhere else is no such pair, so neither half
23
+ # is declared.
24
+ #
25
+ # Only a decided difference (`changed`) is declared or not: an `open` one
26
+ # could still read the same. A changed criterion of a base pair whose
27
+ # every difference a row declares, with no step that ran on one side
28
+ # alone, is explained by the intent; a new or changed criterion keeps its
29
+ # own sentences as the account for the rest; anything else is a
30
+ # difference nothing the change declares asked for.
31
+ module Nukadoko
32
+ module Engine
33
+ module IntentView
34
+ # : (Hash[Symbol, untyped]) -> String
35
+ def self?.place_text: (Hash[Symbol, untyped]) -> String
36
+
37
+ # A difference's key, as a row reads it.
38
+ # : (Hash[Symbol, untyped]) -> Hash[String, untyped]
39
+ def self?.key_of: (Hash[Symbol, untyped]) -> Hash[String, untyped]
40
+
41
+ # : (Hash[Symbol, untyped]?) -> Array[Hash[String, untyped]]
42
+ def self?.keys_of_path: (Hash[Symbol, untyped]?) -> Array[Hash[String, untyped]]
43
+
44
+ # Whether a row aims at a criterion, from its tags and every entry its
45
+ # two sides' steps hold.
46
+ # : (Hash[Symbol, untyped], Array[String], Array[Hash[String, untyped]]) -> bool
47
+ def self?.aims?: (Hash[Symbol, untyped], Array[String], Array[Hash[String, untyped]]) -> bool
48
+
49
+ # The first row that declares each difference of one step, by its
50
+ # index among `changed`, in the rows' order: a count at once, a value
51
+ # in pairs.
52
+ # : (Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]]) -> Hash[Integer, Integer]
53
+ def self?.declared: (Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]]) -> Hash[Integer, Integer]
54
+
55
+ # Judges each row against the base pairs of `paths`: `{ paths:, rows: }`.
56
+ # `tags_of` gives a criterion's tags, as head's feature file has them.
57
+ # : (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], ^(Hash[Symbol, untyped]) -> Array[String]) -> Hash[Symbol, untyped]
58
+ def self?.judge: (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], ^(Hash[Symbol, untyped]) -> Array[String]) -> Hash[Symbol, untyped]
59
+
60
+ # The findings that gate a run whose change declares an intent: each
61
+ # problem reading it, each criterion with a difference nothing the
62
+ # change declares, and each row that did not happen where it aimed. A
63
+ # row not reached gates nothing. `rerun` gives the command that runs
64
+ # one criterion against the same base.
65
+ # : (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], ^(Hash[Symbol, untyped]) -> String) -> Array[Hash[Symbol, untyped]]
66
+ def self?.findings: (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], ^(Hash[Symbol, untyped]) -> String) -> Array[Hash[Symbol, untyped]]
67
+ end
68
+ end
69
+ end
@@ -7,7 +7,7 @@
7
7
  # The files sit in `judgments/` at the project root, one per feature file
8
8
  # at the same relative path with `.json` added, outside the features
9
9
  # directory on purpose: there every file is mapping, so a judgment added
10
- # would make `--base` run each unchanged criterion again in the old world,
10
+ # would make `--base` run each unchanged criterion again in the old system,
11
11
  # when a judgment changes no step. Nor do they live in the run directory,
12
12
  # which retention removes and nobody reviews: a judgment is committed, and
13
13
  # the commit and its review are the record of who judged.
@@ -34,6 +34,12 @@ module Nukadoko
34
34
  # root and sorted. nil when git does not answer.
35
35
  # : (String, String) -> Array[String]?
36
36
  def self?.changed: (String, String) -> Array[String]?
37
+
38
+ # What `commit` holds as the judgments of a feature file: its
39
+ # entries, none when it holds no such file, or why the file did not
40
+ # parse. nil when git does not answer.
41
+ # : (String, String, String) -> Hash[Symbol, untyped]?
42
+ def self?.at_commit: (String, String, String) -> Hash[Symbol, untyped]?
37
43
  end
38
44
  end
39
45
  end
@@ -89,6 +89,16 @@ module Nukadoko
89
89
  # : (Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], ^(String) -> Array[Hash[Symbol, untyped]]) -> Array[Hash[Symbol, untyped]]
90
90
  def self?.with_judgments: (Array[Hash[Symbol, untyped]], Array[Hash[Symbol, untyped]], ^(String) -> Array[Hash[Symbol, untyped]]) -> Array[Hash[Symbol, untyped]]
91
91
 
92
+ # Under --base, each judgment a read cites gains `in_base`: true when
93
+ # the base's file already held that very judgment (the same claim,
94
+ # value, verdict, judge, reason, and time), false when the change
95
+ # brought it. A change cannot be trusted to judge its own output any
96
+ # more than to rewrite its own Thens, and the old system covers only
97
+ # the Thens. `base_entries_of` answers nil for a feature whose base
98
+ # file could not be read, and its reads stay unmarked.
99
+ # : (Array[Hash[Symbol, untyped]], ^(String) -> Array[Hash[Symbol, untyped]]?) -> Array[Hash[Symbol, untyped]]
100
+ def self?.with_base_judgments: (Array[Hash[Symbol, untyped]], ^(String) -> Array[Hash[Symbol, untyped]]?) -> Array[Hash[Symbol, untyped]]
101
+
92
102
  # : (Array[Hash[Symbol, untyped]]) -> bool
93
103
  def self?.open?: (Array[Hash[Symbol, untyped]]) -> bool
94
104
 
@@ -0,0 +1,104 @@
1
+ # Generated from lib/nukadoko/measure_mcp.rb with RBS::Inline
2
+
3
+ # `Nukadoko.measure_mcp`, which makes the MCP calls a step sends through a
4
+ # client's transport part of the step record (docs/spec.md "MCP calls"):
5
+ # each request and notification becomes a line of the step's mcp.jsonl
6
+ # with the answer it got, and carries the step's trace context in
7
+ # `params._meta.traceparent`, so the server's log lines and execution
8
+ # events for the call are the step's. It decides no verdict: an `isError`
9
+ # result or a JSON-RPC error is an answer the step reads.
10
+ #
11
+ # It wraps the transport, not the client. The mcp gem's client calls only
12
+ # `send_request(request:)`, which returns the answer, and
13
+ # `send_notification(notification:)` on its transport, so the wrapper
14
+ # measures those two and hands every other method to the transport as it
15
+ # is: a project keeps the official client, and nukadoko requires no MCP
16
+ # gem.
17
+ #
18
+ # It finds the step at each send, on the thread that sends, as the
19
+ # requests a step sends through Net::HTTP are found. A client is usually
20
+ # made in a scenario fixture, outside every step, and called from several
21
+ # steps, so a step bound when the transport was wrapped would be the wrong
22
+ # one. A message sent outside every step (the client's `initialize`, or a
23
+ # request the client sends from a thread of its own) goes as it was given
24
+ # and is recorded nowhere.
25
+ #
26
+ # Over HTTP to the system, the request the transport sends for a call goes
27
+ # out with the call's traceparent as its header, and counts as a stamped
28
+ # request with the call's span, so the program's `request` line for it
29
+ # closes the call. Over stdio no line can close a call: that is the
30
+ # `mcp-unbounded` gap.
31
+ module Nukadoko
32
+ # `transport`, measured: give it to the MCP client in its place.
33
+ # : [T] (T) -> T
34
+ def self.measure_mcp: [T] (T) -> T
35
+
36
+ module Engine
37
+ module McpCalls
38
+ FILE: ::String
39
+
40
+ # The params member that names each method's target, by the line
41
+ # field that keeps it. A method MCP adds later is one more row.
42
+ TARGETS: Hash[String, [ Symbol, String ]]
43
+
44
+ # : [T] (Array[Hash[Symbol, untyped]]) { () -> T } -> T
45
+ def self.collect: [T] (Array[Hash[Symbol, untyped]]) { () -> T } -> T
46
+
47
+ # The call whose transport is sending now: the traceparent its HTTP
48
+ # request takes, and the origins that got it.
49
+ # : () -> Hash[Symbol, untyped]?
50
+ def self.sending: () -> Hash[Symbol, untyped]?
51
+
52
+ # : [T] (Hash[Symbol, untyped]) { () -> T } -> T
53
+ def self.sending_as: [T] (Hash[Symbol, untyped]) { () -> T } -> T
54
+
55
+ # The header an MCP call's own HTTP request to a service of the system
56
+ # takes: the call's traceparent, so the header and `params._meta`
57
+ # carry one value. Nil outside a call, or to another origin.
58
+ # : (String) -> String?
59
+ def self.traceparent_for: (String) -> String?
60
+
61
+ # A member of a message, whichever kind of key it was written with.
62
+ # : (untyped, String) -> untyped
63
+ def self.member: (untyped, String) -> untyped
64
+
65
+ # : (untyped) -> String?
66
+ def self.traceparent_in: (untyped) -> String?
67
+
68
+ # `message` with `traceparent` in `params._meta`, as a new Hash with
69
+ # keys of the kind the message has. A message that already carries a
70
+ # traceparent keeps it, as a request that sets its own header does,
71
+ # and one whose `params` is not a Hash goes as it was: JSON-RPC allows
72
+ # positional params, and an Array has no place for the key.
73
+ # : (Hash[untyped, untyped], String) -> Hash[untyped, untyped]
74
+ def self.stamp: (Hash[untyped, untyped], String) -> Hash[untyped, untyped]
75
+
76
+ # A call as it starts: the message as it goes out, and the
77
+ # traceparent nukadoko gave it, nil when it kept the step's own or
78
+ # the run has no system.
79
+ # : (Hash[untyped, untyped]) -> Hash[Symbol, untyped]
80
+ def self.start: (Hash[untyped, untyped]) -> Hash[Symbol, untyped]
81
+
82
+ # The mcp.jsonl line of a call and how it ended. The params and the
83
+ # result are their JSON text, kept as a body is; a JSON-RPC error
84
+ # keeps its code and the first line of its message, which can carry
85
+ # a stack. The record redacts the line as it writes it.
86
+ # : (Hash[Symbol, untyped], **untyped) -> Hash[Symbol, untyped]
87
+ def self.line: (Hash[Symbol, untyped], **untyped) -> Hash[Symbol, untyped]
88
+
89
+ # : (untyped) -> Hash[Symbol, untyped]
90
+ def self.kept: (untyped) -> Hash[Symbol, untyped]
91
+
92
+ # The transport, measured. Recording never breaks the call: the
93
+ # transport's own error goes on to the client unchanged.
94
+ class Measured < SimpleDelegator
95
+ # : (request: Hash[untyped, untyped]) ?{ () -> void } -> untyped
96
+ def send_request: (request: Hash[untyped, untyped]) ?{ () -> void } -> untyped
97
+
98
+ # A notification has no answer, so its line is written as it goes.
99
+ # : (notification: Hash[untyped, untyped]) -> untyped
100
+ def send_notification: (notification: Hash[untyped, untyped]) -> untyped
101
+ end
102
+ end
103
+ end
104
+ end
@@ -14,8 +14,8 @@ module Nukadoko
14
14
 
15
15
  attr_reader calls: untyped
16
16
 
17
- # : (singleton(Nukadoko::Step), Hash[Symbol, untyped]) -> void
18
- def initialize: (singleton(Nukadoko::Step), Hash[Symbol, untyped]) -> void
17
+ # : (singleton(Nukadoko::Step), Hash[Symbol, untyped], ?refuse: ^(untyped) -> String?) -> void
18
+ def initialize: (singleton(Nukadoko::Step), Hash[Symbol, untyped], ?refuse: ^(untyped) -> String?) -> void
19
19
 
20
20
  # : () -> Proc
21
21
  def to_proc: () -> Proc