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
@@ -0,0 +1,67 @@
1
+ # Generated from lib/nukadoko/program_log.rb with RBS::Inline
2
+
3
+ # A system's program.log, the one file that holds what its build, prepare,
4
+ # serve, and lists commands printed, and what its setup and url function
5
+ # printed, each line redacted as it arrives, as the TypeScript engine
6
+ # writes it. Which commands run is Program's.
7
+ #
8
+ # A child process writes into a pipe, never into the file: a program
9
+ # that wrote the file itself would leave every secret it printed there,
10
+ # and each step's slice and late lines copy the file. Each stream of each
11
+ # command is a pipe of its own, read by a thread of its own, and split
12
+ # into lines before it is redacted, so a secret a read cuts in two is
13
+ # still one line when it is redacted, and a stdout line and a stderr line
14
+ # never splice. A line is written as soon as it is complete, so a step
15
+ # that reads the log at its end sees what the program printed while the
16
+ # step ran. The file opens at the first line, so a system that runs no
17
+ # command leaves no empty log behind.
18
+ module Nukadoko
19
+ module Engine
20
+ class ProgramLog
21
+ # How long a stopped command's streams may stay open: a process it
22
+ # left behind can hold them open for good.
23
+ STREAMS_CLOSE: ::Float
24
+
25
+ attr_reader path: String
26
+
27
+ # : (String, Secrets) -> void
28
+ def initialize: (String, Secrets) -> void
29
+
30
+ # Whether anything was written.
31
+ # : () -> bool
32
+ def written?: () -> bool
33
+
34
+ # Appends one line nukadoko writes itself, such as the command about
35
+ # to run, and gives it back as it was written.
36
+ # : (String) -> String
37
+ def note: (String) -> String
38
+
39
+ # The write end of a pipe for one stream of one child process, and
40
+ # the thread that reads its other end into the log until every
41
+ # writer has closed it. `echo` also gets each line, redacted.
42
+ # : (?echo: untyped) -> [IO, Thread]
43
+ def pipe: (?echo: untyped) -> [ IO, Thread ]
44
+
45
+ # The complete lines of `carry` and then `chunk`, without their
46
+ # newlines, and the bytes after the last newline, held for the next
47
+ # chunk. A read can end inside a line or inside a character; both are
48
+ # bytes, and a newline byte is never part of a UTF-8 character, so
49
+ # splitting on it before decoding keeps every character whole.
50
+ # : (String, String) -> [Array[String], String]
51
+ def self.lines: (String, String) -> [ Array[String], String ]
52
+
53
+ # Waits until each of `drains`, every pipe of this log unless named,
54
+ # has read its pipe to the end, for STREAMS_CLOSE at most in all.
55
+ # : (?Array[Thread]) -> void
56
+ def settle: (?Array[Thread]) -> void
57
+
58
+ # : () -> void
59
+ def close: () -> void
60
+
61
+ private
62
+
63
+ # : (String, untyped) -> void
64
+ def print_line: (String, untyped) -> void
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,147 @@
1
+ # Generated from lib/nukadoko/program_shape.rb with RBS::Inline
2
+
3
+ # The shape of what the program lambda of nukadoko.config.rb returns, as
4
+ # the TypeScript engine's program schema reads it: every key is one this
5
+ # engine reads, every value is one it can use, and `serve` gets its
6
+ # defaults. A key the program does not know is refused, never skipped: a
7
+ # misspelt `ready` left the system ready on any answer from "/", which no
8
+ # record would show. A key the TypeScript engine reads and this one does
9
+ # not yet is refused too, naming it, so a program never describes a step
10
+ # that silently does not happen. Boundary: shape only; starting the
11
+ # program is Program's.
12
+ module Nukadoko
13
+ module Engine
14
+ module ProgramShape
15
+ MAX_TIMEOUT_MS: ::Integer
16
+
17
+ DEFAULT_SERVE_TIMEOUT_MS: ::Integer
18
+
19
+ ENVIRONMENT_NAME: ::Regexp
20
+
21
+ CONDITION_NAME: ::Regexp
22
+
23
+ CONDITION_VALUE: ::Regexp
24
+
25
+ SERVICE_NAME: ::Regexp
26
+
27
+ SERVE_KEYS: untyped
28
+
29
+ PROGRAM_KEYS: untyped
30
+
31
+ # How far the code that runs with the scenarios may reach into the
32
+ # program: a service URL only, or the program's command line too.
33
+ STEPS_REACH: untyped
34
+
35
+ LIST_KEYS: untyped
36
+
37
+ TOP_KEYS: untyped
38
+
39
+ ENVIRONMENT_KEYS: untyped
40
+
41
+ COMMAND_KEYS: untyped
42
+
43
+ # What one service is, under services: how nukadoko builds, prepares,
44
+ # and starts it, or where it reaches it.
45
+ SERVICE_KEYS: untyped
46
+
47
+ # What an environment changes of one service.
48
+ ENVIRONMENT_SERVICE_KEYS: untyped
49
+
50
+ # The fields that belong to one service alone: env is the program's
51
+ # too, under every service's own.
52
+ SERVICE_ONLY_KEYS: untyped
53
+
54
+ # The fields external: true leaves a service without.
55
+ NOT_EXTERNAL_KEYS: untyped
56
+
57
+ EXTERNAL_WHY: ::String
58
+
59
+ # The program with `serve`'s defaults filled, or a Refusal naming
60
+ # each problem, as `Invalid program at <file>: program.<path>: <why>`.
61
+ # : (Hash[Symbol, untyped], String) -> Hash[Symbol, untyped]
62
+ def self.read: (Hash[Symbol, untyped], String) -> Hash[Symbol, untyped]
63
+
64
+ # One level's fields: the keys it may hold, each value checked, and
65
+ # `serve` with its defaults.
66
+ # : (Hash[Symbol, untyped], Array[Symbol], Array[String], Array[String]) -> Hash[Symbol, untyped]
67
+ def self.fields: (Hash[Symbol, untyped], Array[Symbol], Array[String], Array[String]) -> Hash[Symbol, untyped]
68
+
69
+ # Each service's fields, by name, as `keys` allows them: a service of
70
+ # the top level, or what an environment changes of one.
71
+ # : (untyped, Array[Symbol], Array[String], Array[String]) -> untyped
72
+ def self.services: (untyped, Array[Symbol], Array[String], Array[String]) -> untyped
73
+
74
+ # A service nukadoko only reaches has a url and nothing else: it runs
75
+ # none of its commands and starts no process to give an env.
76
+ # : (Hash[Symbol, untyped], String, Array[String]) -> void
77
+ def self.external: (Hash[Symbol, untyped], String, Array[String]) -> void
78
+
79
+ # services replaces the top level's service fields, never sits beside
80
+ # them, so one system has one way to be written; with more than one
81
+ # service, primary names the one the steps reach; an environment
82
+ # changes only services the top level names; and no two services of
83
+ # one system take the same fixed port.
84
+ # : (Hash[Symbol, untyped], Array[String]) -> void
85
+ def self.services_shaped: (Hash[Symbol, untyped], Array[String]) -> void
86
+
87
+ # No two services of one system take the same fixed port. The top
88
+ # level's ports are checked once, for the default system; an
89
+ # environment's only where it writes a port of its own, so a clash
90
+ # the top level makes is named once.
91
+ # : (Hash[untyped, untyped], Hash[String, Hash[Symbol, untyped]], Array[String]) -> void
92
+ def self.ports_shared: (Hash[untyped, untyped], Hash[String, Hash[Symbol, untyped]], Array[String]) -> void
93
+
94
+ # A key it does not know, with the known key it matches when only its
95
+ # case differs: that is a fact about the shape, not a guess.
96
+ # : (Symbol, Array[Symbol]) -> String
97
+ def self.described: (Symbol, Array[Symbol]) -> String
98
+
99
+ # : (untyped, String, Array[String]) -> untyped
100
+ def self.serve: (untyped, String, Array[String]) -> untyped
101
+
102
+ # A build or prepare list: each entry a command, or a command with a
103
+ # timeout_ms of its own.
104
+ # : (untyped, String, Array[String]) -> void
105
+ def self.commands: (untyped, String, Array[String]) -> void
106
+
107
+ # `lists`: one command per kind of list the program prints, each a
108
+ # build entry's shape.
109
+ # : (untyped, String, Array[String]) -> void
110
+ def self.lists: (untyped, String, Array[String]) -> void
111
+
112
+ # : (untyped) -> bool
113
+ def self.command?: (untyped) -> bool
114
+
115
+ # A program nukadoko does not start: a URL, a lambda that returns one,
116
+ # or `{ resolve:, timeout_ms: }`.
117
+ # : (untyped, String, Array[String]) -> void
118
+ def self.url: (untyped, String, Array[String]) -> void
119
+
120
+ # A lambda run once the program answers, or `{ run:, timeout_ms: }`.
121
+ # : (untyped, String, Array[String]) -> void
122
+ def self.setup: (untyped, String, Array[String]) -> void
123
+
124
+ # Why `ready` cannot be the path polled on the system's own server: a
125
+ # second "/" or a "\" after the first names another host, which could
126
+ # answer for a program that never started.
127
+ # : (String) -> String?
128
+ def self.ready_problem: (String) -> String?
129
+
130
+ # : (untyped) -> String?
131
+ def self.timeout_problem: (untyped) -> String?
132
+
133
+ # : (untyped, String, Array[String]) -> void
134
+ def self.env: (untyped, String, Array[String]) -> void
135
+
136
+ # Each condition is a fact a `@with:` tag reads: a boolean, or a word
137
+ # with no whitespace and no "@". "true" and "false" as strings are
138
+ # refused, since a string reads as on whatever it says.
139
+ # : (untyped, String, Array[String]) -> void
140
+ def self.conditions: (untyped, String, Array[String]) -> void
141
+
142
+ # `defaultEnvironments` names environments of this program, each once.
143
+ # : (Hash[Symbol, untyped], Array[String]) -> void
144
+ def self.default_environments: (Hash[Symbol, untyped], Array[String]) -> void
145
+ end
146
+ end
147
+ end
@@ -4,6 +4,8 @@
4
4
  # `use` and calls it with the value; whatever follows that call is the
5
5
  # teardown, as with Playwright's `use()`. The block runs in a Fiber, so the
6
6
  # teardown waits until the scope ends, and runs whether the steps passed.
7
+ # `use` returns how the scope ended, "passed" or "failed", so a teardown
8
+ # can keep what a failure left for a person to look at.
7
9
  #
8
10
  # Nukadoko.fixture(:store) { |use| use.(Signup::Store.new) }
9
11
  # Nukadoko.fixture(:db, scope: :process) { |use, env:| db = connect(env); use.(db); db.close }
@@ -49,9 +51,20 @@ module Nukadoko
49
51
  # : (Fixture, Hash[Symbol, untyped]) -> untyped
50
52
  def build: (Fixture, Hash[Symbol, untyped]) -> untyped
51
53
 
52
- # Every teardown runs; the first failure is raised after the rest.
53
- # : () -> void
54
- def teardown: () -> void
54
+ # Every teardown runs, and each one that raised is returned by name. A
55
+ # cleanup error does not change the outcome of steps that already
56
+ # passed: the caller records it and warns. Each fixture's `use`
57
+ # returns `outcome`: a scope that did not finish is "failed".
58
+ # : (?String) -> Array[{ fixture: String, message: String }]
59
+ def teardown: (?String) -> Array[{ fixture: String, message: String }]
60
+
61
+ # The warnings that report teardown errors, one finding each.
62
+ # : (Array[{ fixture: String, message: String }]) { (String) -> String } -> Array[Hash[Symbol, untyped]]
63
+ def self.findings: (Array[{ fixture: String, message: String }]) { (String) -> String } -> Array[Hash[Symbol, untyped]]
64
+
65
+ # The same warnings as stderr lines.
66
+ # : (Array[{ fixture: String, message: String }]) { (String) -> String } -> Array[String]
67
+ def self.warnings: (Array[{ fixture: String, message: String }]) { (String) -> String } -> Array[String]
55
68
  end
56
69
  end
57
70
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # A tree's program under test: the `program` lambda of its
4
4
  # nukadoko.config.rb, called once. A config with no program has none, and a
5
- # run starts no world for it.
5
+ # run starts no system for it.
6
6
  #
7
7
  # The program goes with the code and the criteria with the config, so a
8
8
  # `nuka run --base` tree can hold one side's config and the other side's
@@ -20,6 +20,7 @@ module Nukadoko
20
20
  UPGRADING: ::String
21
21
 
22
22
  # The program of the tree at `root`, whose config is already loaded.
23
+ # Its shape is checked whichever file holds it (ProgramShape).
23
24
  # : (String) -> Hash[Symbol, untyped]
24
25
  def self.read: (String) -> Hash[Symbol, untyped]
25
26
 
@@ -0,0 +1,172 @@
1
+ # Generated from lib/nukadoko/repeated_prefix.rb with RBS::Inline
2
+
3
+ # The `repeated-scenario-prefix` notes of a finished run: the scenarios of
4
+ # this run that open with the same steps. It reads the run's own scenario
5
+ # entries and the step records they cite, and writes nothing; `nuka run`
6
+ # adds the notes to the run's findings before run.json is written, so
7
+ # run.json, the summary, and `--json` carry the same notes. A note never
8
+ # changes the exit code. Boundary: it judges nothing about a verdict.
9
+ #
10
+ # It reports measured repetition, and names a process-scope fixture as the
11
+ # place to lift an opening only when every shared step declares `mutates
12
+ # false`. An opening ends at the first When or Then, since a step there is
13
+ # what the scenario exercises, not its setup; and two steps are the same
14
+ # step only when their docstring or table is the same too. Both facts come
15
+ # from the scenario as the run's features hold it. An entry whose scenario
16
+ # the features do not hold with the same step texts is keyed by its texts
17
+ # alone.
18
+ #
19
+ # Which opening a note names depends on the scenarios alone: within one
20
+ # family of nested openings, the one that covers the most step executions,
21
+ # then the longer one, then the one that comes first in the feature files.
22
+ # Measured time only decides whether an opening clears the 2% floor.
23
+ # Ranking by time named a different opening from run to run on a fast
24
+ # suite, where the differences were timing noise. The same as the
25
+ # TypeScript engine.
26
+ module Nukadoko
27
+ module Engine
28
+ module RepeatedPrefix
29
+ # Under this share of the run's summed scenario time an opening is noise.
30
+ FLOOR: ::Float
31
+
32
+ # A step that exercises what the scenario is about, where an opening ends.
33
+ EXERCISES: untyped
34
+
35
+ # Where a scenario is written, as the note names the earliest one.
36
+ class Place < Data
37
+ attr_reader feature(): untyped
38
+
39
+ attr_reader line(): untyped
40
+
41
+ def self.new: (untyped feature, untyped line) -> instance
42
+ | (feature: untyped, line: untyped) -> instance
43
+
44
+ def self.members: () -> [ :feature, :line ]
45
+
46
+ def members: () -> [ :feature, :line ]
47
+ end
48
+
49
+ # One opening, and what the records that walked it add up to.
50
+ class Node
51
+ attr_reader texts: Array[String]
52
+
53
+ attr_reader parent: Node?
54
+
55
+ attr_reader children: Hash[String, Node]
56
+
57
+ # True once a step on the way to this node carries a docstring or table.
58
+ attr_accessor with_argument: bool
59
+
60
+ attr_accessor count: Integer
61
+
62
+ attr_accessor ms: Integer
63
+
64
+ # True once a record reached this node's own step from a scenario's
65
+ # own steps, not from a Background, or from a scenario the features
66
+ # do not hold.
67
+ attr_accessor outside_background: bool
68
+
69
+ # The earliest scenario, in source order, that opens with this prefix.
70
+ attr_accessor first: Place?
71
+
72
+ # True once a record of this node's own step lacks `mutates false`:
73
+ # it declares `mutates true`, is a compat step with no declaration,
74
+ # or has no step record to read the declaration from.
75
+ attr_accessor may_write: bool
76
+
77
+ # : (Array[String], bool, Node?) -> void
78
+ def initialize: (Array[String], bool, Node?) -> void
79
+ end
80
+
81
+ # The run's notes. `dir` is the run directory, which each step entry's
82
+ # `record` is relative to; `scenarios` are head's own executions, and
83
+ # `features` the scenarios the run selected.
84
+ # : (String, Array[Hash[Symbol, untyped]], Array[Scenario]) -> Array[Hash[Symbol, untyped]]
85
+ def self.findings: (String, Array[Hash[Symbol, untyped]], Array[Scenario]) -> Array[Hash[Symbol, untyped]]
86
+
87
+ # One record per scenario, the latest started: a `--repeat` run holds
88
+ # several records for one scenario, and a run over several
89
+ # environments one per environment. Counting them would report the
90
+ # scenario's own repetition as an opening shared between scenarios
91
+ # that are the same one, and a process fixture is built once per
92
+ # environment anyway, so lifting it would save nothing across them.
93
+ # : (Array[Hash[Symbol, untyped]]) -> Array[Hash[Symbol, untyped]]
94
+ def self.one_per_scenario: (Array[Hash[Symbol, untyped]]) -> Array[Hash[Symbol, untyped]]
95
+
96
+ # : (untyped) -> Float?
97
+ def self.moment: (untyped) -> Float?
98
+
99
+ # : (untyped, untyped) -> Integer
100
+ def self.elapsed: (untyped, untyped) -> Integer
101
+
102
+ # Every opening the records walked, each with how many scenarios
103
+ # walked it and how long their steps up to it took.
104
+ # : (String, Array[Hash[Symbol, untyped]], Array[Scenario]) -> Node
105
+ def self.trie: (String, Array[Hash[Symbol, untyped]], Array[Scenario]) -> Node
106
+
107
+ # The node one record reached through one step, with that record counted.
108
+ # : (Node, Hash[Symbol, untyped], PickleStep?, Place, Integer, Hash[Symbol, untyped]?) -> Node
109
+ def self.reached: (Node, Hash[Symbol, untyped], PickleStep?, Place, Integer, Hash[Symbol, untyped]?) -> Node
110
+
111
+ # The steps of the scenario a record ran, when the run's features hold
112
+ # that scenario with the same step texts.
113
+ # : (Hash[Symbol, untyped], Scenario?) -> Array[PickleStep]?
114
+ def self.opening_lines: (Hash[Symbol, untyped], Scenario?) -> Array[PickleStep]?
115
+
116
+ # A record that is not there, or not readable, says nothing about the
117
+ # step's own time or what it declares; the node reads as a step that
118
+ # may write, so no fixture is named for it.
119
+ # : (String) -> Hash[Symbol, untyped]?
120
+ def self.step_record: (String) -> Hash[Symbol, untyped]?
121
+
122
+ # : (Place, Place) -> bool
123
+ def self.before?: (Place, Place) -> bool
124
+
125
+ # Each opening two or more scenarios walked that clears the floor.
126
+ # : (Node, Float, ?Array[Node]) -> Array[Node]
127
+ def self.candidates: (Node, Float, ?Array[Node]) -> Array[Node]
128
+
129
+ # : (Node, Node) -> bool
130
+ def self.ancestor?: (Node, Node) -> bool
131
+
132
+ # True when `one` names a better opening than `other`: it covers more
133
+ # step executions, or as many with more steps, or comes first in
134
+ # source order. Every candidate has a place, since a record reached it.
135
+ # : (Node, Node) -> bool
136
+ def self.ranks_above?: (Node, Node) -> bool
137
+
138
+ # One note per family of nested openings: the best of the family, and
139
+ # none of the openings it holds or sits inside.
140
+ # : (Array[Node]) -> Array[Node]
141
+ def self.without_overlaps: (Array[Node]) -> Array[Node]
142
+
143
+ # The first shared step, in order, that may write.
144
+ # : (Node) -> String?
145
+ def self.first_writing_step: (Node) -> String?
146
+
147
+ # True when every record reached every shared step from a Background.
148
+ # : (Node) -> bool
149
+ def self.all_from_background?: (Node) -> bool
150
+
151
+ # The shared steps, in order, as the nodes that hold them.
152
+ # : (Node) -> Array[Node]
153
+ def self.chain: (Node) -> Array[Node]
154
+
155
+ # A number with at most `digits` after the point and no trailing zero,
156
+ # as JavaScript writes one.
157
+ # : (Float, Integer) -> String
158
+ def self.number: (Float, Integer) -> String
159
+
160
+ # : (Node, Integer) -> Hash[Symbol, untyped]
161
+ def self.note: (Node, Integer) -> Hash[Symbol, untyped]
162
+
163
+ IN_BACKGROUND: ::String
164
+
165
+ # Where the opening can go. `mutates` is the step's own declaration,
166
+ # so this trusts it rather than guessing from the trace whether the
167
+ # opening wrote anything.
168
+ # : (Node, bool) -> String
169
+ def self.lift: (Node, bool) -> String
170
+ end
171
+ end
172
+ end
@@ -89,7 +89,7 @@ module Nukadoko
89
89
  # : () -> Array[Feature]
90
90
  def read_features: () -> Array[Feature]
91
91
 
92
- # An execution of the base or the old world is a cell of the table,
92
+ # An execution of the base or the old system is a cell of the table,
93
93
  # not a test result, so the formats render head's executions alone.
94
94
  # : () -> Array[Scenario]
95
95
  def read_scenarios: () -> Array[Scenario]