nukadoko 0.1.0 → 0.3.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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +417 -0
  3. data/README.ja.md +62 -7
  4. data/README.md +19 -5
  5. data/exe/nuka +8 -0
  6. data/lib/nukadoko/aria_snapshot.rb +1008 -0
  7. data/lib/nukadoko/aria_tree.rb +150 -0
  8. data/lib/nukadoko/base.rb +294 -0
  9. data/lib/nukadoko/check.rb +669 -22
  10. data/lib/nukadoko/claim_check.rb +177 -0
  11. data/lib/nukadoko/claim_check_run.rb +293 -0
  12. data/lib/nukadoko/claim_line.rb +381 -0
  13. data/lib/nukadoko/claim_rules.rb +519 -0
  14. data/lib/nukadoko/claim_sides.rb +469 -0
  15. data/lib/nukadoko/claims.rb +576 -37
  16. data/lib/nukadoko/cli.rb +814 -22
  17. data/lib/nukadoko/codes.json +947 -0
  18. data/lib/nukadoko/codes.rb +19 -0
  19. data/lib/nukadoko/command.rb +214 -12
  20. data/lib/nukadoko/criteria.rb +172 -0
  21. data/lib/nukadoko/definition.rb +33 -41
  22. data/lib/nukadoko/env_check.rb +88 -0
  23. data/lib/nukadoko/features.rb +80 -10
  24. data/lib/nukadoko/fixtures.rb +329 -11
  25. data/lib/nukadoko/http_recording.rb +68 -0
  26. data/lib/nukadoko/init.rb +129 -0
  27. data/lib/nukadoko/js_json.rb +274 -0
  28. data/lib/nukadoko/js_pattern.rb +531 -0
  29. data/lib/nukadoko/judge.rb +221 -0
  30. data/lib/nukadoko/judgment_file.rb +78 -0
  31. data/lib/nukadoko/judgments.rb +256 -0
  32. data/lib/nukadoko/literal.rb +129 -0
  33. data/lib/nukadoko/measured.rb +105 -0
  34. data/lib/nukadoko/order.rb +84 -0
  35. data/lib/nukadoko/parts.rb +43 -22
  36. data/lib/nukadoko/pattern.rb +73 -3
  37. data/lib/nukadoko/poll.rb +21 -8
  38. data/lib/nukadoko/program.rb +105 -17
  39. data/lib/nukadoko/project_files.rb +17 -0
  40. data/lib/nukadoko/project_fixtures.rb +17 -2
  41. data/lib/nukadoko/project_program.rb +119 -0
  42. data/lib/nukadoko/report_allure.rb +751 -0
  43. data/lib/nukadoko/report_messages.rb +167 -0
  44. data/lib/nukadoko/report_run.rb +169 -0
  45. data/lib/nukadoko/run.rb +898 -91
  46. data/lib/nukadoko/run_record.rb +535 -0
  47. data/lib/nukadoko/scaffold.rb +1015 -0
  48. data/lib/nukadoko/schema.rb +120 -21
  49. data/lib/nukadoko/secrets.rb +375 -0
  50. data/lib/nukadoko/selection.rb +163 -0
  51. data/lib/nukadoko/signature.rb +4 -1
  52. data/lib/nukadoko/skill.rb +36 -0
  53. data/lib/nukadoko/spaces.rb +28 -0
  54. data/lib/nukadoko/step.rb +68 -21
  55. data/lib/nukadoko/summary.rb +662 -0
  56. data/lib/nukadoko/table.rb +34 -2
  57. data/lib/nukadoko/text_fit.rb +179 -0
  58. data/lib/nukadoko/trace.rb +244 -0
  59. data/lib/nukadoko/trace_actions.rb +116 -0
  60. data/lib/nukadoko/tree_passes.rb +122 -0
  61. data/lib/nukadoko/verdict.rb +128 -0
  62. data/lib/nukadoko/version.rb +2 -1
  63. data/lib/nukadoko/vocabulary.rb +6 -0
  64. data/lib/nukadoko/walk.rb +305 -0
  65. data/lib/nukadoko/walk_files.rb +473 -0
  66. data/lib/nukadoko/walk_step.rb +149 -0
  67. data/lib/nukadoko.rb +60 -2
  68. data/llms.txt +297 -0
  69. data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
  70. data/sig/generated/nukadoko/aria_tree.rbs +142 -0
  71. data/sig/generated/nukadoko/base.rbs +142 -0
  72. data/sig/generated/nukadoko/check.rbs +255 -0
  73. data/sig/generated/nukadoko/claim_check.rbs +118 -0
  74. data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
  75. data/sig/generated/nukadoko/claim_line.rbs +158 -0
  76. data/sig/generated/nukadoko/claim_rules.rbs +172 -0
  77. data/sig/generated/nukadoko/claim_sides.rbs +207 -0
  78. data/sig/generated/nukadoko/claims.rbs +208 -0
  79. data/sig/generated/nukadoko/cli.rbs +182 -0
  80. data/sig/generated/nukadoko/codes.rbs +16 -0
  81. data/sig/generated/nukadoko/command.rbs +109 -0
  82. data/sig/generated/nukadoko/criteria.rbs +83 -0
  83. data/sig/generated/nukadoko/definition.rbs +30 -0
  84. data/sig/generated/nukadoko/env_check.rbs +34 -0
  85. data/sig/generated/nukadoko/features.rbs +101 -0
  86. data/sig/generated/nukadoko/fixtures.rbs +175 -0
  87. data/sig/generated/nukadoko/http_recording.rbs +29 -0
  88. data/sig/generated/nukadoko/init.rbs +64 -0
  89. data/sig/generated/nukadoko/js_json.rbs +109 -0
  90. data/sig/generated/nukadoko/js_pattern.rbs +194 -0
  91. data/sig/generated/nukadoko/judge.rbs +64 -0
  92. data/sig/generated/nukadoko/judgment_file.rbs +39 -0
  93. data/sig/generated/nukadoko/judgments.rbs +120 -0
  94. data/sig/generated/nukadoko/literal.rbs +71 -0
  95. data/sig/generated/nukadoko/measured.rbs +42 -0
  96. data/sig/generated/nukadoko/order.rbs +54 -0
  97. data/sig/generated/nukadoko/parts.rbs +35 -0
  98. data/sig/generated/nukadoko/pattern.rbs +62 -0
  99. data/sig/generated/nukadoko/poll.rbs +41 -0
  100. data/sig/generated/nukadoko/program.rbs +101 -0
  101. data/sig/generated/nukadoko/project_files.rbs +19 -0
  102. data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
  103. data/sig/generated/nukadoko/project_program.rbs +55 -0
  104. data/sig/generated/nukadoko/report_allure.rbs +268 -0
  105. data/sig/generated/nukadoko/report_messages.rbs +68 -0
  106. data/sig/generated/nukadoko/report_run.rbs +102 -0
  107. data/sig/generated/nukadoko/run.rbs +264 -0
  108. data/sig/generated/nukadoko/run_record.rbs +175 -0
  109. data/sig/generated/nukadoko/scaffold.rbs +328 -0
  110. data/sig/generated/nukadoko/schema.rbs +155 -0
  111. data/sig/generated/nukadoko/secrets.rbs +172 -0
  112. data/sig/generated/nukadoko/selection.rbs +73 -0
  113. data/sig/generated/nukadoko/signature.rbs +17 -0
  114. data/sig/generated/nukadoko/skill.rbs +20 -0
  115. data/sig/generated/nukadoko/spaces.rbs +31 -0
  116. data/sig/generated/nukadoko/step.rbs +115 -0
  117. data/sig/generated/nukadoko/summary.rbs +204 -0
  118. data/sig/generated/nukadoko/table.rbs +43 -0
  119. data/sig/generated/nukadoko/text_fit.rbs +70 -0
  120. data/sig/generated/nukadoko/trace.rbs +127 -0
  121. data/sig/generated/nukadoko/trace_actions.rbs +40 -0
  122. data/sig/generated/nukadoko/tree_passes.rbs +48 -0
  123. data/sig/generated/nukadoko/verdict.rbs +56 -0
  124. data/sig/generated/nukadoko/version.rbs +5 -0
  125. data/sig/generated/nukadoko/vocabulary.rbs +25 -0
  126. data/sig/generated/nukadoko/walk.rbs +139 -0
  127. data/sig/generated/nukadoko/walk_files.rbs +189 -0
  128. data/sig/generated/nukadoko/walk_step.rbs +50 -0
  129. data/sig/generated/nukadoko.rbs +26 -0
  130. data/sig/nukadoko.rbs +5 -48
  131. data/skills/nukadoko/SKILL.md +120 -0
  132. data/skills/nukadoko/references/checking-steps.md +200 -0
  133. data/skills/nukadoko/references/diagnosing.md +200 -0
  134. data/skills/nukadoko/references/done.md +99 -0
  135. data/skills/nukadoko/references/evidence.md +124 -0
  136. data/skills/nukadoko/references/examples/cli.md +230 -0
  137. data/skills/nukadoko/references/examples/http-api.md +342 -0
  138. data/skills/nukadoko/references/examples/workflow.md +173 -0
  139. data/skills/nukadoko/references/exploring.md +184 -0
  140. data/skills/nukadoko/references/fixtures.md +198 -0
  141. data/skills/nukadoko/references/from-prose.md +51 -0
  142. data/skills/nukadoko/references/judgments.md +95 -0
  143. data/skills/nukadoko/references/maintenance.md +97 -0
  144. data/skills/nukadoko/references/merge-risk.md +74 -0
  145. data/skills/nukadoko/references/parts.md +152 -0
  146. data/skills/nukadoko/references/perturbed-worlds.md +109 -0
  147. data/skills/nukadoko/references/program.md +200 -0
  148. data/skills/nukadoko/references/reviewing.md +200 -0
  149. data/skills/nukadoko/references/running.md +200 -0
  150. data/skills/nukadoko/references/scenario-rules.md +188 -0
  151. data/skills/nukadoko/references/states.md +66 -0
  152. data/skills/nukadoko/references/step-files.md +200 -0
  153. data/skills/nukadoko/references/verdicts.md +200 -0
  154. data/skills/nukadoko/references/writing-steps.md +200 -0
  155. data/skills/nukadoko/references/writing-the-feature.md +165 -0
  156. data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
  157. data/skills/nukadoko/scripts/merge-risk.jq +56 -0
  158. data/skills/nukadoko-verification/SKILL.md +263 -0
  159. metadata +133 -1
@@ -0,0 +1,662 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require "json"
5
+ require "time"
6
+
7
+ # summary.md: the run as a person reads it, rendered from run.json alone,
8
+ # in the TypeScript engine's words, so a summary never says something
9
+ # run.json does not and `nuka report` renders the same file again from a
10
+ # run.json copied off another machine. The sections this engine has no
11
+ # field for yet (removed criteria, paths, flags, routes, judgments) are
12
+ # left out, as the TypeScript engine leaves them out of a run without
13
+ # them.
14
+ module Nukadoko
15
+ module Engine
16
+ module Summary
17
+ MARKER = "<!-- nukadoko:run -->"
18
+ # A failed scenario is its cell, and a row with no required cell is
19
+ # its reason line, so the findings list leaves those out.
20
+ TABLE_CODES = %w[scenario-failed walk-stopped criterion-without-required-cell].freeze
21
+ RED = %w[failed unproven moved].freeze
22
+ VALUE_TEXT_LIMIT = 120
23
+ STDOUT_JSON_LIMIT = 200
24
+ ANSI = /\e\[[0-9;]*[A-Za-z]/
25
+ THROW_LOCATION = %r{\A(?:(.*?): )?(?:node:|file://|/|[A-Za-z]:[\\/]).*:\d+\z}
26
+ CARETS = /\A\s*\^+\s*\z/
27
+ CLAIMS_LEAD = "Each line is one claim of a Then: the actual value and where it came from, how it was compared, " \
28
+ "the expected value and where it came from, whether it held, and the recorded channel that holds the actual value " \
29
+ "(`measured: none` when no channel does, or when another channel holds the same number). " \
30
+ "An expected value an earlier step returned or `observe` read gets the same, as `expected measured`."
31
+ CONTROL_NOTE = " An entry marked `control` is a control's: a claim it broke is evidence that the scenario tells the behaviour apart, not a failure."
32
+ LIMIT_KINDS = %w[left-out check-skipped control-not-proving no-claim judgment unmeasured after-record unrecorded-log unrecorded-events].freeze
33
+ LIMIT_HEADINGS = {
34
+ "left-out" => ["Criteria not run"],
35
+ "check-skipped" => ["Static check skipped"],
36
+ "control-not-proving" => ["Held, and no control failed at a Then",
37
+ "a control of each criterion below ran where its conditions do not hold, and none failed at a Then, so nothing shows its Then notices the behaviour is absent"],
38
+ "no-claim" => ["Scenarios with no claim", "in each scenario below, no claim on a Then line was judged (held, broken, or unjudged)"],
39
+ "judgment" => ["Held on a judgment",
40
+ "each criterion below asks a reader to judge a value its Then read, and a committed judgment cites that value; nukadoko checks the citation, never the judgment"],
41
+ "unmeasured" => ["Unmeasured actions", "each step below did something nukadoko records but cannot measure, so its record has no evidence of what that action did"]
42
+ }.freeze
43
+
44
+ module_function
45
+
46
+ #: (Hash[Symbol, untyped]) -> String
47
+ def render(doc)
48
+ lines = [MARKER, *title(doc), *table(doc), *reasons(doc), *limits_section(doc), *condition(doc),
49
+ *removed(doc), *claims(doc), *findings(doc), *rerun(doc)]
50
+ "#{lines.join("\n")}\n"
51
+ end
52
+
53
+ # Text outside a code span: `\` doubled first, so the `\` before a
54
+ # `|` survives both the table parser and the inline one, and `<`
55
+ # never opens a tag.
56
+ #: (untyped) -> String
57
+ def cell_text(text) = text.to_s.gsub("\\", "\\\\\\\\").gsub("|", "\\|").gsub("<", "&lt;")
58
+
59
+ # A code span longer than any backtick run inside it.
60
+ #: (untyped) -> String
61
+ def code_span(text)
62
+ text = text.to_s
63
+ fence = "`" * ((text.scan(/`+/).map(&:size).max || 0) + 1)
64
+ padded = text.start_with?("`") || text.end_with?("`") ? " #{text} " : text
65
+ "#{fence}#{padded}#{fence}"
66
+ end
67
+
68
+ #: (untyped) -> String
69
+ def cell_code(text) = code_span(text).gsub("|", "\\|")
70
+
71
+ #: (Integer, String, String) -> String
72
+ def count_of(count, one, many) = "#{count} #{count == 1 ? one : many}"
73
+
74
+ #: (Integer) -> String
75
+ def duration(ms)
76
+ total = (([ms, 0].max) / 1000.0).round
77
+ hours, rest = total.divmod(3600)
78
+ minutes, seconds = rest.divmod(60)
79
+ parts = []
80
+ parts << "#{hours}h" if hours.positive?
81
+ parts << "#{minutes}m" if hours.positive? || minutes.positive?
82
+ parts << "#{seconds}s"
83
+ parts.join(" ")
84
+ end
85
+
86
+ #: (untyped) -> String
87
+ def value_text(value)
88
+ text = JSON.generate(value)
89
+ text.length > VALUE_TEXT_LIMIT ? "#{text[0, VALUE_TEXT_LIMIT]}..." : text
90
+ end
91
+
92
+ # The first line with text in it; a Node throw location with its
93
+ # source line and carets is skipped, and a line that ends in a colon
94
+ # takes the next line after it.
95
+ #: (untyped, ?bool) -> String?
96
+ def first_visible_line(text, join = true)
97
+ lines = text.to_s.gsub(ANSI, "").split(/\r\n?|[\n\u2028\u2029]/)
98
+ first = lines.index { !_1.strip.empty? }
99
+ return nil unless first
100
+
101
+ line = lines[first].strip
102
+ location = THROW_LOCATION.match(line)
103
+ if location && first + 2 < lines.size && CARETS.match?(lines[first + 2])
104
+ error = first_visible_line(lines[(first + 3)..].join("\n"), join)
105
+ return location[1] ? "#{location[1]}: #{error}" : error if error
106
+ end
107
+ if join && line.end_with?(":")
108
+ after = first_visible_line(lines[(first + 1)..].join("\n"), false)
109
+ return "#{line} #{after}" if after
110
+ end
111
+ line
112
+ end
113
+
114
+ #: (untyped) -> String
115
+ def first_error_line(message) = first_visible_line(message) || "(no message)"
116
+
117
+ #: (Hash[Symbol, untyped]) -> String
118
+ def cell_word(cell)
119
+ case cell[:outcome]
120
+ when "not-run" then "·"
121
+ when "pass" then "pass"
122
+ else "#{cell[:outcome]}@#{cell[:line]}"
123
+ end
124
+ end
125
+
126
+ #: (Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
127
+ def head_scenarios(doc) = doc[:scenarios].reject { _1[:world] }
128
+
129
+ #: (Hash[untyped, untyped]) -> String
130
+ def conditions_text(conditions)
131
+ return "none" if conditions.empty?
132
+
133
+ conditions.map { |name, value| "#{name}: #{value.is_a?(String) ? JSON.generate(value) : value}" }.join(", ")
134
+ end
135
+
136
+ #: (Hash[Symbol, untyped]) -> Array[String]
137
+ def title(doc)
138
+ rows = doc[:table][:rows]
139
+ count = ->(verdict) { rows.count { _1[:verdict] == verdict } }
140
+ criteria = count_of(rows.size, "criterion", "criteria")
141
+ envs = doc[:environments].size
142
+ parts = [envs > 1 ? "#{criteria} in #{envs} environments" : criteria, "#{count.("held")} held"]
143
+ %w[proven removed failed unproven moved].each { parts << "#{count.(_1)} #{_1}" if count.(_1).positive? }
144
+ # Judgments are counted apart from the verdicts they stand beside, so
145
+ # a reader never adds a judged row to the held ones it is counted in.
146
+ Judgments::TITLE_ORDER.each do |state|
147
+ judged = rows.count { _1.dig(:judgment, :state) == state }
148
+ parts << "#{judged} #{judged == 1 ? "judgment" : "judgments"} #{state}" if judged.positive?
149
+ end
150
+ lines = ["# nukadoko run #{doc[:verdict]}: #{parts.join(", ")}"]
151
+ lines.push("", walk_sentence(doc[:walk])) if doc[:walk]
152
+ explained = rows.any? do |row|
153
+ next true if %w[unproven moved].include?(row[:verdict])
154
+ next true if row[:judgment] && row[:judgment][:state] != "judged"
155
+ next false unless row[:verdict] == "failed"
156
+
157
+ required = row[:cells].select { _1[:role] == "required" }
158
+ required.empty? || required.any? { !%w[pass not-run].include?(_1[:outcome]) }
159
+ end
160
+ if doc[:verdict] == "failed" && !explained
161
+ lines.push("", "No scenario that ran failed, but the run did: a BeforeAll or AfterAll hook, or a worker that wrote no scenario, " \
162
+ "failed outside every scenario. The findings below name it.")
163
+ end
164
+ lines
165
+ end
166
+
167
+ #: (Hash[Symbol, untyped]) -> String
168
+ def table_cell(cell)
169
+ notes = [*("control" if cell[:role] == "control"), *("#{cell[:runs]} runs" if cell[:runs].to_i > 1)]
170
+ "#{cell_word(cell)}#{notes.empty? ? "" : " (#{notes.join(", ")})"}"
171
+ end
172
+
173
+ #: (Hash[Symbol, untyped]) -> Array[String]
174
+ def table(doc)
175
+ worlds = doc[:table][:worlds]
176
+ rows = doc[:table][:rows]
177
+ base = doc[:table][:base]
178
+ return [] if rows.empty?
179
+
180
+ heading = lambda do |column|
181
+ declared = column[:world] == "head" ? doc[:environments].find { _1[:name] == column[:environment] }&.dig(:conditions) : nil #: Hash[untyped, untyped]?
182
+ "#{column[:world]} #{column[:environment]}#{declared ? " (#{conditions_text(declared)})" : ""}"
183
+ end
184
+ change = lambda do |row|
185
+ next [] unless base
186
+
187
+ renamed = row[:renamed_from] ? ", renamed from #{cell_code(row[:renamed_from][:feature])} #{cell_text(row[:renamed_from][:name])}" : ""
188
+ ["#{row[:change]}#{renamed}#{", retagged" if row[:retagged]}"]
189
+ end
190
+ seen = seen_column(doc)
191
+ # The judgment column only when a row has one.
192
+ judged = rows.any? { _1[:judgment] }
193
+ [
194
+ *base_line(doc),
195
+ "",
196
+ "| verdict | #{"judgment | " if judged}criterion | #{"change | " if base}#{worlds.map { cell_text(heading.(_1)) }.join(" | ")}#{" | seen" if seen} |",
197
+ "| --- | #{"--- | " if judged}--- | #{"--- | " if base}#{worlds.map { "---" }.join(" | ")}#{" | ---" if seen} |",
198
+ *rows.map do |row|
199
+ written = [*row[:conditions], *row[:expects]]
200
+ tags = written.empty? ? "" : " #{written.map { cell_code(_1) }.join(" ")}"
201
+ cells = worlds.map do |column|
202
+ cell = row[:cells].find { _1[:world] == column[:world] && _1[:environment] == column[:environment] }
203
+ cell ? table_cell(cell) : ""
204
+ end
205
+ judgment = judged ? [row.dig(:judgment, :state).to_s] : []
206
+ "| #{[row[:verdict], *judgment, "#{cell_code("#{row[:feature]}:#{row[:line]}")} #{cell_text(row[:name])}#{tags}", *change.(row), *cells, *(seen ? [seen.(row)] : [])].join(" | ")} |"
207
+ end
208
+ ]
209
+ end
210
+
211
+ # The line above the table under `--base`: what the run compared with,
212
+ # how many criteria changed, and whether the mapping changed and what
213
+ # in it, since an unchanged criterion over a changed mapping is what
214
+ # the old world was run for.
215
+ #: (Hash[Symbol, untyped]) -> Array[String]
216
+ def base_line(doc)
217
+ base = doc[:table][:base] or return []
218
+ rows = doc[:table][:rows]
219
+ count = ->(change) { rows.count { _1[:change] == change } }
220
+ changes = "#{count.("unchanged")} unchanged, #{count.("changed")} changed, #{count.("new")} new, #{count.("removed")} removed"
221
+ mapping = doc[:table][:mapping_changes]
222
+ parts = []
223
+ if mapping
224
+ parts << "#{mapping[:files].size == 1 ? "file" : "files"} #{mapping[:files].map { cell_code(_1) }.join(", ")}" if mapping[:files].any?
225
+ parts << "the config's mapping part" if mapping[:config]
226
+ parts << "the conditions of #{mapping[:conditions].map { cell_code(_1) }.join(", ")}" if mapping[:conditions].any?
227
+ parts << "defaultEnvironments" if mapping[:default_environments]
228
+ end
229
+ unchanged = rows.select { _1[:change] == "unchanged" && _1[:verdict] != "failed" }
230
+ ran_old = unchanged.count do |row|
231
+ old = row[:cells].select { _1[:world] == "old" }
232
+ old.any? && old.none? { _1[:outcome] == "not-run" }
233
+ end
234
+ old_ran = if ran_old == unchanged.size then "so the old world ran each unchanged criterion under the base's steps."
235
+ else "so each unchanged criterion needed the old world, but it ran #{ran_old.zero? ? "none of them" : "only #{ran_old} of the #{unchanged.size}"}; each moved row says why."
236
+ end
237
+ mapping_line = if doc[:table][:mapping_changed]
238
+ "The mapping changed (#{parts.empty? ? "the base's could not be read" : parts.join("; ")}), #{old_ran}"
239
+ else "The mapping did not change, so no unchanged criterion needed the old world."
240
+ end
241
+ compared = base[:commit].start_with?(base[:ref]) ? cell_code(base[:ref]) : "#{cell_code(base[:ref])} (`#{base[:commit][0, 7]}`)"
242
+ # Judgments are not mapping, so the line names them apart: a reviewer
243
+ # approves what a judge said beside what the steps do.
244
+ judgments = doc[:table][:judgments_changed] || []
245
+ judgment_line = if judgments.empty? then ""
246
+ else " #{judgments.size == 1 ? "A judgment file" : "Judgment files"} changed since the base: #{judgments.map { cell_code(_1) }.join(", ")}."
247
+ end
248
+ ["", "Compared with #{compared}: #{changes}. #{mapping_line}#{judgment_line}"]
249
+ end
250
+
251
+ # Each criterion the base holds and head does not, with its sentences
252
+ # at the base, so a reader approving the change sees what it drops.
253
+ #: (Hash[Symbol, untyped]) -> Array[String]
254
+ def removed(doc)
255
+ rows = doc[:table][:rows].select { _1[:verdict] == "removed" }
256
+ return [] if rows.empty?
257
+
258
+ lines = ["", "## Removed criteria", "", "Each criterion below is in the base and not in head, quoted as the base has it."]
259
+ rows.each do |row|
260
+ text = row[:lines] || []
261
+ fence = "`" * ([2, *text.flat_map { _1.scan(/`+/).map(&:size) }].max + 1)
262
+ lines.push("", "### #{cell_code("#{row[:feature]}:#{row[:line]}")} #{cell_text(row[:name])}", "", "#{fence}gherkin", *text, fence)
263
+ end
264
+ lines
265
+ end
266
+
267
+ # A capture taken at least this long after its reading says so beside
268
+ # its link: a page that changes on a timer of a few hundred
269
+ # milliseconds can show another state by then.
270
+ LATE_VIEW_MS = 100
271
+
272
+ # Where a Then's judged moment can be seen: each open page's view
273
+ # right after the reading its claims were judged on, its screenshot
274
+ # before its ARIA snapshot, or, for a Then that read no page, the
275
+ # requests its own step sent. Each link is [label, href, after_ms].
276
+ #: (Hash[Symbol, untyped]) -> Array[Array[untyped]]
277
+ def seen_links(step)
278
+ pages = step.dig(:judged_view, :pages) || []
279
+ links = pages.flat_map do |page|
280
+ name = pages.size == 1 ? "page" : "page #{page[:page]}#{page[:as].nil? ? "" : " of #{page[:as]}"}"
281
+ [*(page[:screenshot] ? [[name, page[:screenshot][:file], page[:screenshot][:after_reading_ms]]] : []),
282
+ *(page[:aria] ? [["#{name} ARIA", page[:aria][:file], page[:aria][:after_reading_ms]]] : [])]
283
+ end
284
+ # A Then that read a page is linked to its view or to nothing: the
285
+ # requests its pages sent during the step are not what it read.
286
+ return links if step[:judged_view] || step[:pages]
287
+
288
+ http = step.dig(:observed, :http)
289
+ return [] unless step[:record] && http.is_a?(Integer) && http.positive?
290
+
291
+ [["responses", "#{step[:record].sub(%r{/+\z}, "")}/http.jsonl"]]
292
+ end
293
+
294
+ #: (String, String) -> String
295
+ def markdown_link(label, href)
296
+ text = label.gsub(/[\r\n]/, " ").gsub(/[\\\[\]]/) { "\\#{_1}" }
297
+ return "#{text} `#{href.gsub(/[\r\n]/, " ").tr("`", "'")}`" if href.match?(/[<>\n\r]/)
298
+
299
+ "[#{text}](<#{href}>)"
300
+ end
301
+
302
+ #: (Array[Array[untyped]]) -> String
303
+ def seen_text(links) = links.map { |label, href, after| "#{markdown_link(label, href)}#{after && after >= LATE_VIEW_MS ? " (taken #{after} ms after the reading)" : ""}" }.join(", ")
304
+
305
+ #: (Hash[Symbol, untyped]) -> (^(Hash[Symbol, untyped]) -> String)?
306
+ def seen_column(doc)
307
+ chosen = {}
308
+ head_scenarios(doc).each do |scenario|
309
+ key = [scenario[:feature], scenario[:line]]
310
+ held = chosen[key]
311
+ chosen[key] = scenario if held.nil? || (held[:status] == "passed" && scenario[:status] != "passed")
312
+ end
313
+ links_of = lambda do |scenario|
314
+ scenario[:steps].filter_map do |step|
315
+ next unless step[:claims]
316
+
317
+ label, href = seen_links(step).first
318
+ markdown_link((step[:line] || scenario[:line]).to_s, href).gsub("|", "\\|") if href
319
+ end
320
+ end
321
+ return nil if chosen.values.none? { links_of.(_1).any? }
322
+
323
+ ->(row) { (scenario = chosen[[row[:feature], row[:line]]]) ? links_of.(scenario).join(" ") : "" }
324
+ end
325
+
326
+ #: (Hash[Symbol, untyped]) -> Array[String]
327
+ def reasons(doc)
328
+ red = doc[:table][:rows].select { RED.include?(_1[:verdict]) }
329
+ # A row the judgments leave red says why on a line of its own, before
330
+ # the verdicts' reasons: its verdict may be green.
331
+ open = doc[:table][:rows].select { _1[:judgment] && _1[:judgment][:state] != "judged" }
332
+ return [] if red.empty? && open.empty?
333
+
334
+ lines = [""]
335
+ open.each do |row|
336
+ lines << "- #{code_span("#{row[:feature]}:#{row[:line]}")} #{cell_text(row[:name])}: judgment #{row[:judgment][:state]}: #{cell_text(row[:judgment][:reason])}"
337
+ end
338
+ red.each do |row|
339
+ lines << "- #{code_span("#{row[:feature]}:#{row[:line]}")} #{cell_text(row[:name])}: #{cell_text(row[:reason])}"
340
+ world = { "moved" => "old", "unproven" => "base" }.fetch(row[:verdict], "head")
341
+ cell = row[:cells].find { _1[:world] == world && _1[:role] == "required" && !%w[pass not-run].include?(_1[:outcome]) }
342
+ next unless cell
343
+
344
+ execution = doc[:scenarios].find do |scenario|
345
+ at = scenario[:row] || { feature: scenario[:feature], line: scenario[:line] }
346
+ at[:feature] == row[:feature] && at[:line] == row[:line] && (scenario[:world] || "head") == world &&
347
+ scenario[:environment] == cell[:environment] && scenario[:status] != "passed"
348
+ end
349
+ failure = execution && describe_failure(execution)
350
+ lines << " - #{world == "head" ? "" : "#{world}: "}#{failure}" if failure
351
+ end
352
+ lines
353
+ end
354
+
355
+ # Where an execution stopped: the step, the error's first line, the
356
+ # producers that exited nonzero, the last command that did, the
357
+ # record, and where the Then can be seen.
358
+ #: (Hash[Symbol, untyped]) -> String?
359
+ def describe_failure(scenario)
360
+ if scenario[:status] == "stopped" && scenario[:stopped]
361
+ last = scenario[:steps][scenario[:stopped][:after_step] - 1] || {}
362
+ parts = ["#{cell_text("step \"#{last[:text]}\"")}: #{code_span("the walk was stopped after this step with nuka step stop")}"]
363
+ parts << "record #{code_span(last[:record])}" if last[:record]
364
+ return parts.join("; ")
365
+ end
366
+ step = scenario[:steps].find { !%w[passed skipped].include?(_1[:status]) }
367
+ return nil unless step
368
+
369
+ parts = ["#{cell_text("step \"#{step[:text]}\"")}: #{code_span(first_error_line(step.dig(:error, :message)))}"]
370
+ exited_producers(step[:used]).each do |name, code, output|
371
+ parts << "used #{cell_text(name)} exit #{code}: #{code_span(output)}"
372
+ end
373
+ command = (step.dig(:observed, :processes) || []).reverse.find { _1[:exit_code] != 0 }
374
+ parts << "ran #{code_span(command[:command].join(" "))}" if command
375
+ parts << "record #{code_span(step[:record])}" if step[:record]
376
+ seen = step[:claims] ? seen_text(seen_links(step)) : ""
377
+ parts << "seen #{seen}" unless seen.empty?
378
+ parts.join("; ")
379
+ end
380
+
381
+ #: (Array[Hash[Symbol, untyped]]?) -> Array[[untyped, Integer, String]]
382
+ def exited_producers(used)
383
+ (used || []).filter_map do |entry|
384
+ result = entry[:result]
385
+ next unless result.is_a?(Hash)
386
+
387
+ code, stderr, stdout = result.values_at(:exitCode, :stderr, :stdout)
388
+ next unless code.is_a?(Integer) && code != 0 && stderr.is_a?(String)
389
+
390
+ from_stdout = stdout.is_a?(String) ? stdout_line(stdout) : nil
391
+ [entry[:step], code, first_visible_line(stderr) || (from_stdout ? "stdout: #{from_stdout}" : "(no output)")]
392
+ end
393
+ end
394
+
395
+ #: (String) -> String?
396
+ def stdout_line(stdout)
397
+ text = stdout.gsub(ANSI, "").strip
398
+ return nil if text.empty?
399
+
400
+ compact = (JSON.generate(JSON.parse(text)).gsub("\u2028", "\\u2028").gsub("\u2029", "\\u2029") rescue nil) if text.start_with?("{", "[")
401
+ return first_visible_line(text) unless compact
402
+
403
+ compact.length > STDOUT_JSON_LIMIT ? "#{compact[0, STDOUT_JSON_LIMIT]}..." : compact
404
+ end
405
+
406
+ # The gaps a green verdict does not cover, computed again from
407
+ # run.json's other fields, never read from a stored list.
408
+ #: (Hash[Symbol, untyped]) -> Array[Hash[Symbol, untyped]]
409
+ def limits(doc)
410
+ head = head_scenarios(doc)
411
+ rows = doc[:table][:rows]
412
+ list = []
413
+ left_out = doc[:table][:left_out].to_i
414
+ if left_out.positive?
415
+ list << { kind: "left-out", fix: "run again with `--env` naming an environment that meets their conditions",
416
+ detail: left_out == 1 ? "1 criterion not run: its conditions hold in no selected environment" : "#{left_out} criteria not run: their conditions hold in no selected environment" }
417
+ end
418
+ if doc[:check] == "skipped"
419
+ list << { kind: "check-skipped", detail: "the run started with `nuka run --no-check`, so no finding of `nuka check` held it back", do: "nuka check" }
420
+ end
421
+ red = rows.select { RED.include?(_1[:verdict]) }.map { [_1[:feature], _1[:line]] }
422
+ unjudged = head.select { _1[:role] != "control" && _1[:judged_by] && _1[:judged_by] != "judgment" && !red.include?([_1[:feature], _1[:line]]) }
423
+ places = unjudged.map { [_1[:feature], _1[:line]] }
424
+ # A row a judgment decides compares nothing in its Then, so no
425
+ # control of it could fail there: its entry is the judgment's.
426
+ judged_rows = rows.select { _1[:judgment] }.map { [_1[:feature], _1[:line]] }
427
+ rows.each do |row|
428
+ next if row[:verdict] != "held" || places.include?([row[:feature], row[:line]]) || judged_rows.include?([row[:feature], row[:line]])
429
+
430
+ limit = control_limit(row, head)
431
+ list << limit if limit
432
+ end
433
+ by_place = ->(a, b) { [a[:feature].to_s, a[:line].to_i] <=> [b[:feature].to_s, b[:line].to_i] }
434
+ list.concat(unjudged.uniq { [_1[:feature], _1[:line]] }.map do |scenario|
435
+ { kind: "no-claim", feature: scenario[:feature], line: scenario[:line], text: scenario[:scenario],
436
+ detail: "no claim on a Then line was judged in it", fix: "end the scenario with a Then whose step declares claims" }
437
+ end.sort(&by_place))
438
+ list.concat(judgment_limits(rows))
439
+ list.sort_by.with_index { |limit, index| [LIMIT_KINDS.index(limit[:kind]), index] }
440
+ end
441
+
442
+ # One entry per row a judgment holds green: nukadoko checked that the
443
+ # value is the one judged, and nothing of the judgment itself. A value
444
+ # judged as an ARIA snapshot names what that leaves out: a change only
445
+ # to how the page looks keeps the snapshot, and so the judgment.
446
+ #: (Array[Hash[Symbol, untyped]]) -> Array[Hash[Symbol, untyped]]
447
+ def judgment_limits(rows)
448
+ rows.filter_map do |row|
449
+ judgment = row[:judgment]
450
+ next unless judgment && judgment[:state] == "judged"
451
+
452
+ by = judgment[:reads].map { _1.dig(:judgment, :by) || "" }.uniq.map { code_span(_1) }.join(", ")
453
+ aria = judgment[:reads].any? { _1[:measured] == "aria-snapshot" } ? "; it is bound to the ARIA snapshot, so a change only to how the page looks keeps it current" : ""
454
+ { kind: "judgment", feature: row[:feature], line: row[:line], text: row[:name],
455
+ detail: "stands on a judgment by #{by}: nukadoko checked that the value is the one judged, not the judgment#{aria}" }
456
+ end
457
+ end
458
+
459
+ #: (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]]) -> Hash[Symbol, untyped]?
460
+ def control_limit(row, head)
461
+ controls = row[:cells].select { _1[:world] == "head" && _1[:role] == "control" }
462
+ return nil if controls.empty?
463
+
464
+ outcomes = controls.map { _1[:outcome] }
465
+ fix = if outcomes.include?("pass") then "make the Then check what its condition switches, or check that the control's environment switches it"
466
+ elsif outcomes.include?("broke") then "make the steps before the Then run where its conditions do not hold, so the Then is what fails there"
467
+ end
468
+ stopped = head.find do |scenario|
469
+ scenario[:feature] == row[:feature] && scenario[:line] == row[:line] && scenario[:role] == "control" &&
470
+ scenario[:status] != "passed" && controls.any? { _1[:environment] == scenario[:environment] }
471
+ end
472
+ record = stopped && stopped[:steps].find { !%w[passed skipped].include?(_1[:status]) }&.dig(:record)
473
+ { kind: "control-not-proving", feature: row[:feature], line: row[:line], text: row[:name],
474
+ detail: "no control failed at a Then where its conditions do not hold (#{controls.map { "#{_1[:environment]}: #{cell_word(_1)}" }.join(", ")})",
475
+ record: record, fix: fix }.compact
476
+ end
477
+
478
+ #: (Hash[Symbol, untyped]) -> String
479
+ def closer_text(limit) = [*("do: #{code_span(limit[:do])}" if limit[:do]), *("fix: #{limit[:fix]}" if limit[:fix])].join("; ")
480
+
481
+ #: (Hash[Symbol, untyped], bool) -> String
482
+ def limit_place(limit, named)
483
+ return "" unless limit[:feature]
484
+
485
+ environment = named && limit[:environment] ? " (#{cell_text(limit[:environment])})" : ""
486
+ "#{code_span("#{limit[:feature]}:#{limit[:line]}")}#{limit[:text] ? " #{cell_text(limit[:text])}" : ""}#{environment}"
487
+ end
488
+
489
+ #: (Hash[Symbol, untyped]) -> Array[String]
490
+ def limits_section(doc)
491
+ list = limits(doc)
492
+ return [] if list.empty?
493
+
494
+ named = doc[:environments].size > 1
495
+ lines = ["", "## What this run does not show", "",
496
+ "Each item below is something the verdicts above do not cover, listed under its kind in run.json's `limits`.", ""]
497
+ tail = ->(text) { text.empty? ? "" : "; #{text}" }
498
+ LIMIT_KINDS.each do |kind|
499
+ entries = list.select { _1[:kind] == kind }
500
+ next if entries.empty?
501
+
502
+ name, lead = LIMIT_HEADINGS.fetch(kind)
503
+ closers = entries.map { closer_text(_1) }.uniq
504
+ shared = entries.size > 1 && closers.size == 1 ? closers.first : ""
505
+ only = entries.first
506
+ if entries.size == 1 && limit_place(only, named).empty?
507
+ lines << "- **#{name}** (`#{kind}`): #{only[:detail]}#{tail.(closer_text(only))}"
508
+ next
509
+ end
510
+ lines << "- **#{name}** (`#{kind}`, #{entries.size})#{lead ? ": #{lead}" : ""}#{tail.(shared)}"
511
+ entries.each do |limit|
512
+ record = limit[:record] ? "; record #{code_span(limit[:record])}" : ""
513
+ lines << " - #{limit_place(limit, named)}: #{limit[:detail]}#{record}#{shared.empty? ? tail.(closer_text(limit)) : ""}"
514
+ end
515
+ end
516
+ lines
517
+ end
518
+
519
+ #: (Array[String]) -> String
520
+ def tag_flags(expressions) = code_span(expressions.map { "--tag #{JSON.generate(_1)}" }.join(" "))
521
+
522
+ #: (Hash[Symbol, untyped]) -> Array[String]
523
+ def condition(doc)
524
+ commit = doc[:commit]
525
+ commit_line = if commit.nil? then "- commit: unknown (no git state was readable when the run started)"
526
+ else "- commit: `#{commit[:sha][0, 7]}`#{" with uncommitted changes" if commit[:dirty]}"
527
+ end
528
+ environments = doc[:environments].map do |environment|
529
+ at = environment[:base_url] ? " at #{environment[:base_url]}" : ""
530
+ notes = [*("conditions #{conditions_text(environment[:conditions])}" if environment[:conditions]),
531
+ *("target version #{environment[:target_version]}" if environment[:target_version])]
532
+ "- environment: #{environment[:name]}#{at}#{notes.empty? ? "" : " (#{notes.join(", ")})"}"
533
+ end
534
+ tagged = doc[:tag_selection]
535
+ selection = if doc[:selection] == "full"
536
+ tagged ? "- selection: full (every scenario of the targeted files meets #{tag_flags(tagged[:expressions])})" : "- selection: full"
537
+ elsif tagged
538
+ "- selection: partial (#{tag_flags(tagged[:expressions])} left out #{count_of(tagged[:left_out], "scenario", "scenarios")} of the targeted files)"
539
+ else "- selection: partial (a line target left out other scenarios of its file)"
540
+ end
541
+ proof = doc[:table][:proof_runs]
542
+ proof_line = if proof == Table::PROOF_RUNS then []
543
+ else ["- proof runs: #{proof} (`--proof-runs`: a control proves its row once it breaks the same claim at one Then line in #{proof} runs)"]
544
+ end
545
+ elapsed = ((Time.iso8601(doc[:finished_at]) - Time.iso8601(doc[:started_at])) * 1000).round
546
+ order = doc[:order]
547
+ order_line = if order && order[:kind] == "shuffled"
548
+ ["- order: shuffled, seed #{order[:seed]} (`--order shuffled:#{order[:seed]}` runs this order again)"]
549
+ else []
550
+ end
551
+ browsers = doc[:scenarios].filter_map { "#{_1[:browser][:type]} #{_1[:browser][:version]}" if _1[:browser] }.uniq
552
+ browser = browsers.empty? ? "- browser: none launched" : "- browser: #{browsers.join(", ")}"
553
+ ["", commit_line, *environments, browser, selection, *order_line, *proof_line,
554
+ "- nukadoko: #{doc[:nukadoko]}", "- run: #{doc[:run_id]}",
555
+ "- started #{doc[:started_at]}, finished #{doc[:finished_at]} (#{duration(elapsed)})"]
556
+ end
557
+
558
+ # The claim as ClaimLine writes it, then where its values were
559
+ # measured: a value no recorded channel holds is what a constant in
560
+ # step code looks like, so the line says `measured: none`.
561
+ #: (Hash[Symbol, untyped], String?) -> String
562
+ def claim_line(claim, own) = "#{ClaimLine.line(claim)}#{measured_text(claim, own)}"
563
+
564
+ #: (Hash[Symbol, untyped], String?) -> String
565
+ def measured_text(claim, own)
566
+ return "" if claim[:outcome] == "unobserved"
567
+
568
+ actual = "; measured: #{channel_text(claim[:measured], own)}"
569
+ return claim.key?(:expected_measured) ? "#{actual}; expected measured: #{channel_text(claim[:expected_measured], own)}" : actual unless claim[:each]
570
+
571
+ declared = [*(claim[:each][:where] || []).each_with_index.map { ["where[#{_2}]", _1] }, *claim[:each][:claims].each_with_index.map { ["claims[#{_2}]", _1] }]
572
+ .select { _2.key?(:expected_measured) }.map { "#{_1} #{channel_text(_2[:expected_measured], own)}" }
573
+ declared.empty? ? actual : "#{actual}; expected measured: #{declared.join(", ")}"
574
+ end
575
+
576
+ #: (Hash[Symbol, untyped]?, String?) -> String
577
+ def channel_text(measured, own)
578
+ return "none" unless measured
579
+
580
+ measured[:step_record_id] == own ? measured[:channel] : "#{measured[:channel]} of #{measured[:step_record_id]}"
581
+ end
582
+
583
+ #: (Hash[Symbol, untyped]) -> Array[String]
584
+ def claims(doc)
585
+ named = doc[:environments].size > 1
586
+ any_control = false
587
+ entries = {}
588
+ head_scenarios(doc).each do |scenario|
589
+ scenario[:steps].each do |step|
590
+ next unless step[:claims]
591
+
592
+ where = "#{scenario[:feature]}:#{step[:line] || scenario[:line]}"
593
+ control = scenario[:role] == "control"
594
+ any_control ||= control
595
+ marks = [*(cell_text(scenario[:environment]) if named), *("control" if control)]
596
+ attempts = step[:attempts].to_i > 1 ? ", #{step[:attempts]} readings" : ""
597
+ observation = step[:observation] == "unobserved" ? ", observed nothing" : ""
598
+ head = "- #{cell_code(where)} #{cell_text(step[:text])}#{marks.empty? ? "" : " (#{marks.join(", ")})"}#{attempts}#{observation}"
599
+ claim_lines = step[:claims].map { " - #{cell_text(claim_line(_1, step[:step_record_id]))}" }
600
+ key = [head, *claim_lines].join("\n")
601
+ next if entries.key?(key)
602
+
603
+ seen = seen_text(seen_links(step))
604
+ entries[key] = [[scenario[:feature], step[:line] || scenario[:line]], ["#{head}#{seen.empty? ? "" : "; seen: #{seen}"}", *claim_lines]]
605
+ end
606
+ end
607
+ return [] if entries.empty?
608
+
609
+ lead = "#{CLAIMS_LEAD}#{CONTROL_NOTE if any_control}"
610
+ seen_note = " `seen` links what the Then's pages showed right after the reading its claims were judged on, or, for a Then that read no page, " \
611
+ "the requests its step sent; a capture taken 100 ms or more after the reading says so. The claims judged the values above, " \
612
+ "not these files, and the scenario's `final.png` is the page as the scenario ended, not as it was judged."
613
+ lead += seen_note if entries.values.any? { _2.first.include?("; seen: ") }
614
+ ["", "## Claims", "", lead, "", *entries.values.each_with_index.sort_by { |(place, _), index| [*place, index] }.flat_map { _1.first.last }]
615
+ end
616
+
617
+ #: (Hash[Symbol, untyped]) -> String
618
+ def where_of(finding)
619
+ return finding[:line] ? "#{finding[:file]}:#{finding[:line]}" : finding[:file] if finding[:file]
620
+
621
+ finding[:step] || "-"
622
+ end
623
+
624
+ #: (Hash[Symbol, untyped]) -> Array[String]
625
+ def findings(doc)
626
+ list = doc[:findings].reject { TABLE_CODES.include?(_1[:code]) }
627
+ return [] if list.empty?
628
+
629
+ ["", "## Findings", "", *list.map { "- #{_1[:severity]} `#{_1[:code]}` #{cell_text(where_of(_1))}: #{cell_text(_1[:message])}" }]
630
+ end
631
+
632
+ # The heading names what the commands under it rerun: a stopped walk
633
+ # did not fail, so a heading that called it failed would state
634
+ # something false.
635
+ #: (Hash[Symbol, untyped]) -> Array[String]
636
+ def rerun(doc)
637
+ named = head_scenarios(doc).select { _1[:do] }
638
+ commands = named.map { _1[:do] }.uniq
639
+ return [] if commands.empty?
640
+
641
+ stopped = named.any? { _1[:status] == "stopped" }
642
+ failed = named.any? { _1[:status] != "stopped" }
643
+ what = if failed && stopped then "failed or stopped"
644
+ elsif stopped then "stopped"
645
+ else "failed"
646
+ end
647
+ ["", "## Rerun a #{what} scenario", "", "```sh", *commands, "```"]
648
+ end
649
+
650
+ # A walk is a run that paused after each step for an answer: its
651
+ # verdicts were measured, but between steps the world and the browser
652
+ # were open to anything, which no record covers. The longest pause
653
+ # says how long that was.
654
+ #: (Hash[Symbol, untyped]) -> String
655
+ def walk_sentence(walk)
656
+ longest = [0, *walk[:pauses].map { ((Time.iso8601(_1[:answered_at]) - Time.iso8601(_1[:paused_at])) * 1000).round }].max
657
+ "Walked one step at a time (`nuka run --step`): #{count_of(walk[:pauses].size, "pause", "pauses")}, the longest #{duration(longest)}. " \
658
+ "Between steps the world and the browser were open to anything, so this run is not the run a reviewer approves."
659
+ end
660
+ end
661
+ end
662
+ end