roast-ai 0.4.7 → 0.4.8

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 (250) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/Rakefile +2 -0
  4. data/examples/README.md +9 -0
  5. data/examples/available_tools_demo/workflow.yml +1 -1
  6. data/examples/basic_prompt_workflow/workflow.md +1 -0
  7. data/examples/basic_prompt_workflow/workflow.yml +14 -0
  8. data/lib/roast/version.rb +1 -1
  9. data/lib/roast/workflow/base_step.rb +2 -3
  10. data/lib/roast/workflow/step_loader.rb +2 -7
  11. data/lib/roast.rb +6 -1
  12. metadata +4 -239
  13. data/CHANGELOG.md +0 -369
  14. data/examples/agent_continue/add_documentation/prompt.md +0 -5
  15. data/examples/agent_continue/add_error_handling/prompt.md +0 -5
  16. data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
  17. data/examples/agent_continue/combined_workflow.yml +0 -24
  18. data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
  19. data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
  20. data/examples/agent_continue/document_with_context/prompt.md +0 -5
  21. data/examples/agent_continue/explore_api/prompt.md +0 -6
  22. data/examples/agent_continue/implement_client/prompt.md +0 -6
  23. data/examples/agent_continue/inline_workflow.yml +0 -20
  24. data/examples/agent_continue/refactor_code/prompt.md +0 -2
  25. data/examples/agent_continue/verify_changes/prompt.md +0 -6
  26. data/examples/agent_continue/workflow.yml +0 -27
  27. data/examples/agent_workflow/README.md +0 -75
  28. data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
  29. data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
  30. data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
  31. data/examples/agent_workflow/workflow.png +0 -0
  32. data/examples/agent_workflow/workflow.yml +0 -16
  33. data/examples/api_workflow/README.md +0 -85
  34. data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
  35. data/examples/api_workflow/generate_report/prompt.md +0 -10
  36. data/examples/api_workflow/prompt.md +0 -10
  37. data/examples/api_workflow/transform_data/prompt.md +0 -10
  38. data/examples/api_workflow/workflow.png +0 -0
  39. data/examples/api_workflow/workflow.yml +0 -30
  40. data/examples/apply_diff_demo/README.md +0 -58
  41. data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
  42. data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
  43. data/examples/apply_diff_demo/workflow.yml +0 -24
  44. data/examples/available_tools_demo/workflow.png +0 -0
  45. data/examples/bash_prototyping/README.md +0 -53
  46. data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
  47. data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
  48. data/examples/bash_prototyping/api_testing.png +0 -0
  49. data/examples/bash_prototyping/api_testing.yml +0 -14
  50. data/examples/bash_prototyping/check_processes/prompt.md +0 -11
  51. data/examples/bash_prototyping/generate_report/prompt.md +0 -16
  52. data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
  53. data/examples/bash_prototyping/system_analysis.png +0 -0
  54. data/examples/bash_prototyping/system_analysis.yml +0 -14
  55. data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
  56. data/examples/case_when/README.md +0 -58
  57. data/examples/case_when/detect_language/prompt.md +0 -16
  58. data/examples/case_when/workflow.png +0 -0
  59. data/examples/case_when/workflow.yml +0 -58
  60. data/examples/cmd/README.md +0 -99
  61. data/examples/cmd/analyze_project/prompt.md +0 -57
  62. data/examples/cmd/basic_demo/prompt.md +0 -48
  63. data/examples/cmd/basic_workflow.png +0 -0
  64. data/examples/cmd/basic_workflow.yml +0 -16
  65. data/examples/cmd/check_repository/prompt.md +0 -57
  66. data/examples/cmd/create_and_verify/prompt.md +0 -56
  67. data/examples/cmd/dev_workflow.png +0 -0
  68. data/examples/cmd/dev_workflow.yml +0 -26
  69. data/examples/cmd/explore_project/prompt.md +0 -67
  70. data/examples/cmd/explorer_workflow.png +0 -0
  71. data/examples/cmd/explorer_workflow.yml +0 -21
  72. data/examples/cmd/smart_tool_selection/prompt.md +0 -99
  73. data/examples/coding_agent_with_model.yml +0 -20
  74. data/examples/coding_agent_with_retries.yml +0 -30
  75. data/examples/conditional/README.md +0 -161
  76. data/examples/conditional/check_condition/prompt.md +0 -1
  77. data/examples/conditional/simple_workflow.png +0 -0
  78. data/examples/conditional/simple_workflow.yml +0 -15
  79. data/examples/conditional/workflow.png +0 -0
  80. data/examples/conditional/workflow.yml +0 -23
  81. data/examples/context_management_demo/README.md +0 -43
  82. data/examples/context_management_demo/workflow.yml +0 -42
  83. data/examples/direct_coerce_syntax/README.md +0 -32
  84. data/examples/direct_coerce_syntax/workflow.png +0 -0
  85. data/examples/direct_coerce_syntax/workflow.yml +0 -36
  86. data/examples/dot_notation/README.md +0 -37
  87. data/examples/dot_notation/workflow.png +0 -0
  88. data/examples/dot_notation/workflow.yml +0 -44
  89. data/examples/exit_on_error/README.md +0 -50
  90. data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
  91. data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
  92. data/examples/exit_on_error/workflow.png +0 -0
  93. data/examples/exit_on_error/workflow.yml +0 -19
  94. data/examples/grading/README.md +0 -71
  95. data/examples/grading/analyze_coverage/prompt.md +0 -52
  96. data/examples/grading/calculate_final_grade.rb +0 -67
  97. data/examples/grading/format_result.rb +0 -64
  98. data/examples/grading/generate_grades/prompt.md +0 -105
  99. data/examples/grading/generate_recommendations/output.txt +0 -17
  100. data/examples/grading/generate_recommendations/prompt.md +0 -60
  101. data/examples/grading/js_test_runner +0 -31
  102. data/examples/grading/rb_test_runner +0 -19
  103. data/examples/grading/read_dependencies/prompt.md +0 -16
  104. data/examples/grading/run_coverage.rb +0 -54
  105. data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
  106. data/examples/grading/verify_test_helpers/prompt.md +0 -53
  107. data/examples/grading/workflow.md +0 -8
  108. data/examples/grading/workflow.png +0 -0
  109. data/examples/grading/workflow.rb.md +0 -6
  110. data/examples/grading/workflow.ts+tsx.md +0 -6
  111. data/examples/grading/workflow.yml +0 -41
  112. data/examples/instrumentation.rb +0 -76
  113. data/examples/interpolation/README.md +0 -50
  114. data/examples/interpolation/analyze_file/prompt.md +0 -1
  115. data/examples/interpolation/analyze_patterns/prompt.md +0 -27
  116. data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
  117. data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
  118. data/examples/interpolation/sample.js +0 -48
  119. data/examples/interpolation/sample.rb +0 -42
  120. data/examples/interpolation/workflow.md +0 -1
  121. data/examples/interpolation/workflow.png +0 -0
  122. data/examples/interpolation/workflow.yml +0 -21
  123. data/examples/iteration/IMPLEMENTATION.md +0 -88
  124. data/examples/iteration/README.md +0 -68
  125. data/examples/iteration/analyze_complexity/prompt.md +0 -22
  126. data/examples/iteration/generate_recommendations/prompt.md +0 -21
  127. data/examples/iteration/generate_report/prompt.md +0 -129
  128. data/examples/iteration/implement_fix/prompt.md +0 -25
  129. data/examples/iteration/prioritize_issues/prompt.md +0 -24
  130. data/examples/iteration/prompts/analyze_file.md +0 -28
  131. data/examples/iteration/prompts/generate_summary.md +0 -24
  132. data/examples/iteration/prompts/update_report.md +0 -29
  133. data/examples/iteration/prompts/write_report.md +0 -22
  134. data/examples/iteration/read_file/prompt.md +0 -9
  135. data/examples/iteration/select_next_issue/prompt.md +0 -25
  136. data/examples/iteration/simple_workflow.md +0 -39
  137. data/examples/iteration/simple_workflow.yml +0 -58
  138. data/examples/iteration/update_fix_count/prompt.md +0 -26
  139. data/examples/iteration/verify_fix/prompt.md +0 -29
  140. data/examples/iteration/workflow.png +0 -0
  141. data/examples/iteration/workflow.yml +0 -42
  142. data/examples/json_handling/README.md +0 -32
  143. data/examples/json_handling/workflow.png +0 -0
  144. data/examples/json_handling/workflow.yml +0 -52
  145. data/examples/mcp/README.md +0 -223
  146. data/examples/mcp/analyze_changes/prompt.md +0 -8
  147. data/examples/mcp/analyze_issues/prompt.md +0 -4
  148. data/examples/mcp/analyze_schema/prompt.md +0 -4
  149. data/examples/mcp/check_data_quality/prompt.md +0 -5
  150. data/examples/mcp/check_documentation/prompt.md +0 -4
  151. data/examples/mcp/create_recommendations/prompt.md +0 -5
  152. data/examples/mcp/database_workflow.png +0 -0
  153. data/examples/mcp/database_workflow.yml +0 -29
  154. data/examples/mcp/env_demo/workflow.png +0 -0
  155. data/examples/mcp/env_demo/workflow.yml +0 -34
  156. data/examples/mcp/fetch_pr_context/prompt.md +0 -4
  157. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
  158. data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
  159. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
  160. data/examples/mcp/filesystem_demo/workflow.png +0 -0
  161. data/examples/mcp/filesystem_demo/workflow.yml +0 -38
  162. data/examples/mcp/generate_insights/prompt.md +0 -4
  163. data/examples/mcp/generate_report/prompt.md +0 -6
  164. data/examples/mcp/generate_review/prompt.md +0 -16
  165. data/examples/mcp/github_workflow.png +0 -0
  166. data/examples/mcp/github_workflow.yml +0 -32
  167. data/examples/mcp/multi_mcp_workflow.png +0 -0
  168. data/examples/mcp/multi_mcp_workflow.yml +0 -58
  169. data/examples/mcp/post_review/prompt.md +0 -3
  170. data/examples/mcp/save_report/prompt.md +0 -6
  171. data/examples/mcp/search_issues/prompt.md +0 -2
  172. data/examples/mcp/summarize/prompt.md +0 -1
  173. data/examples/mcp/test_filesystem/prompt.md +0 -6
  174. data/examples/mcp/test_github/prompt.md +0 -8
  175. data/examples/mcp/test_read/prompt.md +0 -1
  176. data/examples/mcp/workflow.png +0 -0
  177. data/examples/mcp/workflow.yml +0 -35
  178. data/examples/no_model_fallback/README.md +0 -17
  179. data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
  180. data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
  181. data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
  182. data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
  183. data/examples/no_model_fallback/sample.rb +0 -42
  184. data/examples/no_model_fallback/workflow.yml +0 -19
  185. data/examples/openrouter_example/README.md +0 -48
  186. data/examples/openrouter_example/analyze_input/prompt.md +0 -16
  187. data/examples/openrouter_example/generate_response/prompt.md +0 -9
  188. data/examples/openrouter_example/workflow.png +0 -0
  189. data/examples/openrouter_example/workflow.yml +0 -12
  190. data/examples/pre_post_processing/README.md +0 -111
  191. data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
  192. data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
  193. data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
  194. data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
  195. data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
  196. data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
  197. data/examples/pre_post_processing/post_processing/output.txt +0 -24
  198. data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
  199. data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
  200. data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
  201. data/examples/pre_post_processing/workflow.png +0 -0
  202. data/examples/pre_post_processing/workflow.yml +0 -21
  203. data/examples/retry/workflow.yml +0 -23
  204. data/examples/rspec_to_minitest/README.md +0 -68
  205. data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
  206. data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
  207. data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
  208. data/examples/rspec_to_minitest/workflow.md +0 -10
  209. data/examples/rspec_to_minitest/workflow.png +0 -0
  210. data/examples/rspec_to_minitest/workflow.yml +0 -40
  211. data/examples/shared_config/README.md +0 -52
  212. data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
  213. data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
  214. data/examples/shared_config/shared.png +0 -0
  215. data/examples/shared_config/shared.yml +0 -7
  216. data/examples/single_target_prepost/README.md +0 -36
  217. data/examples/single_target_prepost/post_processing/output.txt +0 -27
  218. data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
  219. data/examples/single_target_prepost/workflow.png +0 -0
  220. data/examples/single_target_prepost/workflow.yml +0 -20
  221. data/examples/smart_coercion_defaults/README.md +0 -65
  222. data/examples/smart_coercion_defaults/workflow.png +0 -0
  223. data/examples/smart_coercion_defaults/workflow.yml +0 -44
  224. data/examples/step_configuration/README.md +0 -84
  225. data/examples/step_configuration/workflow.png +0 -0
  226. data/examples/step_configuration/workflow.yml +0 -57
  227. data/examples/swarm_example.yml +0 -25
  228. data/examples/tool_config_example/README.md +0 -109
  229. data/examples/tool_config_example/example_step/prompt.md +0 -42
  230. data/examples/tool_config_example/workflow.png +0 -0
  231. data/examples/tool_config_example/workflow.yml +0 -17
  232. data/examples/user_input/README.md +0 -90
  233. data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
  234. data/examples/user_input/funny_name/workflow.png +0 -0
  235. data/examples/user_input/funny_name/workflow.yml +0 -25
  236. data/examples/user_input/generate_summary/prompt.md +0 -11
  237. data/examples/user_input/simple_input_demo/workflow.png +0 -0
  238. data/examples/user_input/simple_input_demo/workflow.yml +0 -35
  239. data/examples/user_input/survey_workflow.png +0 -0
  240. data/examples/user_input/survey_workflow.yml +0 -71
  241. data/examples/user_input/welcome_message/prompt.md +0 -3
  242. data/examples/user_input/workflow.png +0 -0
  243. data/examples/user_input/workflow.yml +0 -73
  244. data/examples/workflow_generator/README.md +0 -27
  245. data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
  246. data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
  247. data/examples/workflow_generator/get_user_input/prompt.md +0 -14
  248. data/examples/workflow_generator/info_from_roast.rb +0 -22
  249. data/examples/workflow_generator/workflow.png +0 -0
  250. data/examples/workflow_generator/workflow.yml +0 -34
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CalculateFinalGrade < Roast::Workflow::BaseStep
4
- attr_accessor :llm_analysis
5
-
6
- WEIGHTS = {
7
- line_coverage: 0.1,
8
- method_coverage: 0.1,
9
- branch_coverage: 0.3,
10
- test_helpers: 0.1,
11
- mocks_and_stubs: 0.1,
12
- readability: 0.1,
13
- maintainability: 0.1,
14
- effectiveness: 0.1,
15
- }.freeze
16
-
17
- def call
18
- @llm_analysis = workflow.output["generate_grades"].merge(workflow.output["analyze_coverage"])
19
- weighted_sum = WEIGHTS.sum do |criterion, weight|
20
- score = llm_analysis[criterion.to_s]["score"].to_f / 10.0
21
- score * weight
22
- end
23
-
24
- {
25
- final_score: {
26
- weighted_score: weighted_sum,
27
- letter_grade: calculate_letter_grade(weighted_sum),
28
- },
29
- rubric_scores: calculate_rubric_scores,
30
- }
31
- end
32
-
33
- private
34
-
35
- def calculate_letter_grade(score)
36
- case score
37
- when 0.9..1.0
38
- "A"
39
- when 0.8...0.9
40
- "B"
41
- when 0.7...0.8
42
- "C"
43
- when 0.6...0.7
44
- "D"
45
- else
46
- "F"
47
- end
48
- end
49
-
50
- def calculate_rubric_scores
51
- scores = {}
52
-
53
- WEIGHTS.each_key do |criterion|
54
- raw_score = llm_analysis[criterion.to_s]["score"].to_f
55
- normalized_score = raw_score / 10.0
56
-
57
- scores[criterion] = {
58
- raw_value: raw_score,
59
- score: normalized_score,
60
- description: llm_analysis[criterion.to_s]["justification"],
61
- weighted_score: normalized_score * WEIGHTS[criterion],
62
- }
63
- end
64
-
65
- scores
66
- end
67
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class FormatResult < Roast::Workflow::BaseStep
4
- RUBRIC = {
5
- line_coverage: { description: "Line Coverage", weight: 0.1 },
6
- method_coverage: { description: "Method Coverage", weight: 0.1 },
7
- branch_coverage: { description: "Branch Coverage", weight: 0.3 },
8
- test_helpers: { description: "Test Helpers Usage", weight: 0.1 },
9
- mocks_and_stubs: { description: "Mocks and Stubs Usage", weight: 0.1 },
10
- readability: { description: "Test Readability", weight: 0.1 },
11
- maintainability: { description: "Test Maintainability", weight: 0.1 },
12
- effectiveness: { description: "Test Effectiveness", weight: 0.1 },
13
- }.freeze
14
-
15
- def call
16
- append_to_final_output(<<~OUTPUT)
17
- ========== TEST GRADE REPORT ==========
18
- Test file: #{workflow.file}
19
- OUTPUT
20
-
21
- format_results
22
- append_to_final_output("\n\n")
23
- end
24
-
25
- private
26
-
27
- def format_results
28
- # With HashWithIndifferentAccess, we can simply access with either syntax
29
- grade_data = workflow.output["calculate_final_grade"]
30
-
31
- unless grade_data
32
- return append_to_final_output("Error: Grading data not available. This may be because you're replaying the workflow from this step, but the previous step data is missing or not found in the selected session.")
33
- end
34
-
35
- format_grade(grade_data)
36
-
37
- # Make sure rubric_scores exists before trying to iterate over it
38
- unless grade_data[:rubric_scores]
39
- return append_to_final_output("Error: Rubric scores data not available in the workflow output.")
40
- end
41
-
42
- append_to_final_output("RUBRIC SCORES:")
43
- grade_data[:rubric_scores].each do |category, data|
44
- # Safely access RUBRIC with a fallback for potentially missing categories
45
- rubric_item = RUBRIC[category.to_sym] || { description: "Unknown Category", weight: 0 }
46
-
47
- append_to_final_output(" #{rubric_item[:description]} (#{(rubric_item[:weight] * 100).round}% of grade):")
48
- append_to_final_output(" Value: #{data[:raw_value] || "N/A"}")
49
- append_to_final_output(" Score: #{data[:score] ? (data[:score] * 10).round : "N/A"}/10 - \"#{data[:description] || "No description available"}\"")
50
- end
51
- end
52
-
53
- def format_grade(grade_data)
54
- return append_to_final_output("\nError: Final grade data not available.") unless grade_data && grade_data[:final_score]
55
-
56
- letter_grade = grade_data[:final_score][:letter_grade]
57
- celebration_emoji = letter_grade == "A" ? "šŸŽ‰" : ""
58
- append_to_final_output(<<~OUTPUT)
59
- \nFINAL GRADE:
60
- Score: #{(grade_data[:final_score][:weighted_score] * 100).round}/100
61
- Letter Grade: #{letter_grade} #{celebration_emoji}
62
- OUTPUT
63
- end
64
- end
@@ -1,105 +0,0 @@
1
- These are the key testing guidelines to consider in your evaluation:
2
-
3
- - Tests should serve as specifications that define expected behaviors
4
- - Tests should have descriptive names that clearly communicate intent
5
- - Tests should focus on behavior rather than implementation details
6
- - Excessive mocking/stubbing should be avoided in favor of testing real behavior
7
- - Tests should be well-structured with minimal setup complexity
8
- - Tests should be maintainable and not break when implementation details change
9
- - Tests should cover edge cases and error conditions
10
- - Tests should follow proper naming conventions and directory structure
11
- - Tests should not modify the behaviour of the code being tested (e.g. making a private method public in tests)
12
-
13
- Now consider the full transcript and evaluate the test being graded based on the following rubrics on a scale of 1-10:
14
-
15
- <test_helpers>
16
- 0-1: Extremely poor helper usage - Helpers used incorrectly or inappropriately, making tests harder to understand
17
- 2-3: Poor helper usage - Helpers are poorly designed, tightly coupled to implementation, or used incorrectly
18
- 4-5: Basic helper usage - Helpers work but may be poorly organized or not reusable
19
- 6-7: Good helper usage - Helpers are well-designed and used appropriately
20
- 8-9: Very good helper usage - Helpers are well-factored, reusable, and make tests clearer
21
- 10: Excellent helper usage - Helpers are perfectly designed, highly reusable, and significantly improve test clarity and maintainability. Also give this score to tests that DO NOT use test helpers at all.
22
- </test_helpers>
23
-
24
- <mocks_and_stubs>
25
- 0-1: Extremely poor mocking - Mocks/stubs used incorrectly or excessively, completely hiding real behavior
26
- 2-3: Poor mocking - Heavy reliance on mocks that couple tests to implementation; mocks don't match real behavior
27
- 4-5: Basic mocking - Mocks used appropriately but may be overused or not match implementation exactly
28
- 6-7: Good mocking - Mocks used judiciously where needed; generally match implementation
29
- 8-9: Very good mocking - Minimal mocking focused on external dependencies; accurately reflects real behavior
30
- 10: Excellent mocking - Mocks used only where absolutely necessary (external APIs, etc); perfectly match real implementations; maintain loose coupling
31
- </mocks_and_stubs>
32
-
33
- <readability>
34
- 0-1: Extremely poor readability - Test purpose is impossible to understand; no structure or organization
35
- 2-3: Poor readability - Test names are vague or misleading; structure is confusing with no clear assertions
36
- 4-5: Basic readability - Structure is understandable but not optimized for clarity
37
- 6-7: Good readability - Structure is logical with clear assertions
38
- 8-9: Very readable - Well-organized with explicit, meaningful test names and assertions
39
- 10: Exceptionally readable - Test names serve as perfect specifications; elegant structure with context-providing descriptions; self-documenting with clear setup, execution, and verification phases
40
- </readability>
41
-
42
- <maintenability>
43
- 0-1: Extremely brittle - Tests are completely coupled to implementation details
44
- 2-3: Highly unmaintainable - Will require significant rework when code changes because of heavy coupling to implementation details
45
- 4-5: Somewhat maintainable - Some coupling to implementation details
46
- 6-7: Reasonably maintainable - Tests mostly focus on behavior over implementation; limited coupling to implementation details
47
- 8-9: Highly maintainable - Tests focus on behavior rather than implementation; changes to implementation should rarely break tests
48
- 10: Exceptionally maintainable - Tests purely focus on behavior and public interfaces; implementation can be completely refactored without breaking tests; well-factored test helpers and fixtures
49
- </maintenability>
50
-
51
- <effectiveness>
52
- 0-1: Ineffective - Don't validate actual behavior and could pass even if code is broken
53
- 2-3: Minimally effective - Only the most basic functionality validated. Many incorrect behaviors would not be caught
54
- 4-5: Partially effective - Only catch obvious issues but miss subtle bugs; limited validation of actual outcomes
55
- 6-7: Reasonably effective - Should catch most common bugs
56
- 8-9: Highly effective - Should catch nearly all bugs
57
- 10: Exceptionally effective - Should catch even subtle edge case bugs; validate both positive and negative cases
58
- </effectiveness>
59
-
60
- While grading, consider the following goals as being applicable across all rubrics:
61
-
62
- SUBJECTIVE:
63
- - Well-written: Organized, easy to understand, and follow best practices
64
- - Real behavior: Validate what the code does rather than implementation details
65
- - Isolated: Should not depend on external systems, services, or APIs. Note: The use of fixtures such as `shops(:snowdevil)` is expected and should not be penalized. The only exception is when the SUT is being loaded as a fixture unnecessarily when it could be instantiated directly.
66
-
67
- OBJECTIVE
68
- - Idempotent: Should be able to run repeatedly without affecting outcome or side effects.
69
- - Deterministic: Should produce the same results across all runs and environments.
70
- - No sleep: Does not include sleep calls or rely on timing for synchronization.
71
- - Concurrent: Properly handles concurrent execution paths without errors.
72
- - Timeless: Does not depend on the current date or time. Will not fail due to changes such as daylight savings or leap years. Specifically with regards to handling time, look for anti-patterns like `Time.current + 7.days.to_i`, which fails on DST changes. The correct approach is `7.days.from_now`.
73
-
74
- VIOLATING ANY OBJECTIVE GOAL SHOULD RESULT IN AN OVERALL SCORE LESS THAN 5!
75
-
76
- Provide a brief justification for each score, using a maximum of 1-3 sentences. (Note that specific recommendations for improvement are not needed at this step.)
77
-
78
- You are acting as a stern and relentless striver for excellence in programming, so you must be highly critical. The point of this grading exercise is to facilitate substantial improvement, not just stroking the programmer's ego. Do not hesitate to give a failing overall score (0) for serious violations!
79
-
80
- RESPONSE FORMAT: You must respond in JSON format within <json> XML tags.
81
-
82
- <json>
83
- {
84
- "test_helpers": {
85
- "score": 4,
86
- "justification": "Helpers are used incorrectly in several places, reducing test maintainability and clarity. The assert_valid_record helper is being misused with hashes instead of model instances."
87
- },
88
- "mocks_and_stubs": {
89
- "score": 4,
90
- "justification": "Several mocks don't match the actual implementation, making tests brittle and potentially hiding production bugs. For example, mocking success: true when the service returns status: 'success'."
91
- },
92
- "readability": {
93
- "score": 8,
94
- "justification": "Test names clearly describe behavior being tested."
95
- },
96
- "maintainability": {
97
- "score": 6,
98
- "justification": "Tests mostly focus on behavior but have some coupling to implementation."
99
- },
100
- "effectiveness": {
101
- "score": 7,
102
- "justification": "Tests validate most expected behaviors and would catch common bugs."
103
- }
104
- }
105
- </json>
@@ -1,17 +0,0 @@
1
- ========== TEST RECOMMENDATIONS ==========
2
- <%- if response.recommendations.empty? -%>
3
- No recommendations found.
4
- <%- else -%>
5
- <%- response.recommendations.each_with_index do |rec, index| -%>
6
- Recommendation #<%= index + 1 %>:
7
- Description: <%= rec.description %>
8
- Impact: <%= rec.impact %>
9
- Priority: <%= rec.priority %>
10
-
11
- Code Suggestion:
12
-
13
- <%= rec.code_suggestion %>
14
-
15
- <%- end -%>
16
- <%- end -%>
17
- ===========================================
@@ -1,60 +0,0 @@
1
- Finally, based on the conversation transcript above, go ahead and provide specific, actionable recommendations that would most effectively improve the overall test score.
2
-
3
- Focus on recommendations that would:
4
-
5
- 1. Increase coverage
6
- 2. Add more assertions where needed
7
- 3. Make the tests more maintainable or readable
8
- 4. Ensure tests serve as specifications by having clear, descriptive names
9
- 5. Reduce excessive mocking/stubbing that couples tests to implementation details
10
- 6. Improve test structure to reduce setup complexity
11
- 7. Ensure tests focus on behavior rather than implementation details
12
- 8. Ensure gaps in private methods are tested through public methods
13
- 9. Fix any issues with test helpers that are used incorrectly or unnecessarily
14
- 10. Improve efficiency by combining or deleting tests where appropriate (note that having more than one assertion per test is acceptable)
15
- 11. Fix any violations of the objective criteria (idempotency, determinism, etc.)
16
- 12. Be specific about edge cases that should be covered by tests. Write down in the recommendations which edge cases you are referring to.
17
- 13. Do not recommend the use of RSpec features like `let` for Minispec tests.
18
-
19
- IF YOU IDENTIFY EDGE CASES, YOU MUST BE SPECIFIC ABOUT THEM IN THE RECOMMENDATIONS.
20
-
21
- RESPONSE FORMAT: You must respond in JSON format inside <json> XML tags without additional commentary.
22
-
23
- Example:
24
-
25
- <json>
26
- {
27
- "recommendations": [
28
- {
29
- "description": "Add tests for uncovered method X",
30
- "impact": "Would increase method coverage by Y%",
31
- "priority": "High",
32
- "code_suggestion": "def test_method_x_with_valid_input\n result = subject.method_x('valid_input')\n assert_equal expected_result, result\nend"
33
- },
34
- {
35
- "description": "Fix time handling to avoid DST issues",
36
- "impact": "Would make tests deterministic across DST changes",
37
- "priority": "High",
38
- "code_suggestion": "# Replace\nexpiry_time = Time.current + 7.days.to_i\n\n# With\nexpiry_time = 7.days.from_now"
39
- },
40
- {
41
- "description": "Add edge case tests for the show action for when the parameter X is blank",
42
- "impact": "Would improve test completeness and effectiveness",
43
- "priority": "Medium",
44
- "code_suggestion": "..."
45
- },
46
- {
47
- "description": "Improve test descriptions to better serve as specifications",
48
- "impact": "Would make tests more valuable as documentation",
49
- "priority": "Medium",
50
- "code_suggestion": "# Replace\ndef test_process\n\n# With\ndef test_process_returns_success_with_valid_input"
51
- },
52
- {
53
- "description": "Replace implementation-focused mocks with behavior assertions",
54
- "impact": "Would make tests less brittle and more maintainable",
55
- "priority": "High",
56
- "code_suggestion": "# Replace\nUserNotifier.expects(:notify).with(user, 'welcome')\n\n# With\nassert_sends_notification(user, 'welcome') do\n subject.process\nend"
57
- }
58
- ]
59
- }
60
- </json>
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- if ARGV.length != 2
5
- puts "Usage: #{File.basename($PROGRAM_NAME)} SUBJECT_FILE TEST_FILE"
6
- exit 1
7
- end
8
-
9
- subject_file, test_file = ARGV
10
-
11
- def detect_package_manager
12
- return "pnpm" if File.exist?(File.join(Dir.pwd, "pnpm-lock.yaml"))
13
- return "yarn" if File.exist?(File.join(Dir.pwd, "yarn.lock"))
14
-
15
- "npm"
16
- end
17
-
18
- jest_options = [
19
- "--verbose",
20
- "--no-colors",
21
- "--ci",
22
- "--coverageReporters=text-summary",
23
- "--collectCoverageFrom=#{subject_file}",
24
- ]
25
-
26
- # Assumes the test command is `test:coverage`
27
- # Both admin-web and checkout-web use this command
28
- command = "#{detect_package_manager} run test:coverage -- #{test_file} #{jest_options.join(" ")}"
29
-
30
- $stderr.puts "Running: #{command}"
31
- puts Roast::Helpers::CmdRunner.system(command)
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "rubygems"
5
- require "bundler/setup"
6
-
7
- require "roast/helpers/minitest_coverage_runner"
8
-
9
- # Suppress fancy minitest reporting
10
- ENV["RM_INFO"] = "true"
11
-
12
- if ARGV.length != 2
13
- puts "Usage: #{File.basename($PROGRAM_NAME)} SUBJECT_FILE TEST_FILE"
14
- exit 1
15
- end
16
-
17
- test_file, subject_file = ARGV
18
-
19
- Roast::Helpers::MinitestCoverageRunner.new(test_file, subject_file).run
@@ -1,16 +0,0 @@
1
- Use the provided functions to find and read important dependencies of the provided test file named <%= workflow.file %>.
2
-
3
- The first dependency you should always look for is the source file for the prime subject of the test (whatever class this test file is claiming to test). Use `read_file` to read the subject's source code into your conversation transcript, but only if it's not already there from a previous chat.
4
-
5
- If you can identify other important application-level dependencies then read them too.
6
- How many extra dependencies to research is left to your discretion, but ALWAYS make sure you have the subject under test (SUT) in your context before responding.
7
-
8
- Once you are finished using tool functions, respond with the relative path to the source file of the SUT inside <sut> tags. IMPORTANT: Include the full relative path from the project root, including any directory prefixes like lib/, app/, etc.
9
-
10
- Example:
11
-
12
- If you are told to find the dependencies of `test/services/country_db_interface_test.rb`,
13
- then you would use the functions as explained above and ultimately respond with `<sut>app/services/country_db_interface.rb</sut>`
14
-
15
- If the file is found at `lib/roast/workflow/workflow_initializer.rb`, respond with `<sut>lib/roast/workflow/workflow_initializer.rb</sut>` (include the lib/ prefix)
16
-
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RunCoverage < Roast::Workflow::BaseStep
4
- def call
5
- # Run the test with coverage analysis
6
- run_test_with_coverage
7
- end
8
-
9
- private
10
-
11
- def run_test_with_coverage
12
- subject_file = workflow.output["read_dependencies"]
13
- subject_file = subject_file.match(%r{<sut>(.*?)</sut>})&.[](1) || subject_file
14
- test_file = workflow.file
15
- extension = File.extname(test_file).gsub(".", "")
16
-
17
- # Handle JS/TS test files
18
- extension = "js" if ["js", "jsx", "ts", "tsx"].include?(extension)
19
-
20
- # Get the absolute path to the test_runner executable
21
- test_runner_path = File.expand_path("#{extension}_test_runner", __dir__)
22
-
23
- # Make sure the test_runner executable exists
24
- unless File.exist?(test_runner_path)
25
- Roast::Helpers::Logger.error("Test runner executable not found: #{test_runner_path}")
26
- exit(1)
27
- end
28
-
29
- # Resolve paths to prevent issues when pwd differs from project root
30
- resolved_subject_file = Roast::Helpers::PathResolver.resolve(subject_file)
31
- unless File.exist?(resolved_subject_file)
32
- Roast::Helpers::Logger.error("Subject file not found: #{resolved_subject_file}")
33
- exit(1)
34
- end
35
-
36
- resolved_test_file = Roast::Helpers::PathResolver.resolve(test_file)
37
- unless File.exist?(resolved_test_file)
38
- Roast::Helpers::Logger.error("Test file not found: #{resolved_test_file}")
39
- exit(1)
40
- end
41
-
42
- # Run the test_runner using shadowenv for environment consistency
43
- command = "shadowenv exec --dir . -- #{test_runner_path} #{resolved_test_file} #{resolved_subject_file}"
44
- output, status = Roast::Helpers::CmdRunner.capture2(command)
45
-
46
- unless status.success?
47
- Roast::Helpers::Logger.error("Test runner exited with non-zero status: #{status.exitstatus}")
48
- Roast::Helpers::Logger.error(output)
49
- exit(status.exitstatus)
50
- end
51
-
52
- output
53
- end
54
- end
@@ -1,12 +0,0 @@
1
- Find places in the provided test code where stubbing and mocking are used. Search for the corresponding implementation source code of those dependencies elsewhere in the codebase to validate that the stub or mock matches the implementation that it is doubling. Use the tool functions provided to find and read the dependencies.
2
-
3
- Once you've found the dependencies, verify that any mocks and stubs accurately reflect the real implementation. If there are discrepancies, list them out alphabetically with:
4
-
5
- 1. The name of the mocked/stubbed method
6
- 2. What the mock/stub expects in terms of arguments and/or return values
7
- 3. What the actual implementation actually takes as arguments and returns
8
- 4. Suggestions for fixing the discrepancy
9
-
10
- Note: If there are no discrepancies, do not summarize those that accurately reflect their real implementations in the codebase, just respond "All mocks and stubs verified."
11
-
12
- IMPORTANT: There's absolutely no need for you to waste time grepping for methods/functions that you know belong to testing libraries such as Mocha's `expects` and `stubs`. Only search for the implementation of things that are stubbed and/or mocked in the test to verify whether the test code matches the implementation code.
@@ -1,53 +0,0 @@
1
- Now identify custom test helpers used in this test for the following purpose:
2
-
3
- 1. Analyzing if they are used correctly
4
- 2. Understanding test code that has had significant chunks of implementation abstracted away into helpers
5
- 3. Fully understanding custom assertions that are not included by default in Ruby on Rails or part of your base knowledge
6
-
7
- Your grep tool function is vital for this work. It provides 4 lines of context before and after the matching line.
8
-
9
- For example, if you call `grep(string: "def assert_sql")`, the output will include:
10
-
11
- ```
12
- .test/support/helpers/sql_assertions.rb-101- end
13
- .test/support/helpers/sql_assertions.rb-102- result
14
- .test/support/helpers/sql_assertions.rb-103- end
15
- .test/support/helpers/sql_assertions.rb-104-
16
- .test/support/helpers/sql_assertions.rb:105: def assert_sql(*patterns_to_match, **kwargs, &block)
17
- .test/support/helpers/sql_assertions.rb-106- mysql_only_test!
18
- .test/support/helpers/sql_assertions.rb-107-
19
- .test/support/helpers/sql_assertions.rb-108- result = T.let(nil, T.nilable(T::Boolean))
20
- .test/support/helpers/sql_assertions.rb-109- counter = ActiveRecord::SQLCounter.new(**kwargs)
21
- ```
22
-
23
- Unfortunately, many test helper methods are undocumented. In those cases (like the example above) the pre-context will be junk. However, there are a number of helper methods that do have very specific and narrow use cases, and those do tend to be well-documented. In those cases, you should use `read_file` to be able to read the full documentation.
24
-
25
- For example, here is the result of calling `grep(string: "def assert_sql_events")`
26
-
27
- ```
28
- .test/support/helpers/externals_helper.rb-93- # @example Logs events in the list that did not occur
29
- .test/support/helpers/externals_helper.rb-94- # expected_queries = { "Shop Load" => 1, "User Load" => 1 }
30
- .test/support/helpers/externals_helper.rb-95- # # Fails and reports that User Load occured 0 times instead of expected 1
31
- .test/support/helpers/externals_helper.rb-96- # assert_sql_events(expected_queries) { Shop.current_or_find(shop.id) }
32
- .test/support/helpers/externals_helper.rb:97: def assert_sql_events(expected_events, &block)
33
- .test/support/helpers/externals_helper.rb-98- mysql_only_test!
34
- .test/support/helpers/externals_helper.rb-99-
35
- .test/support/helpers/externals_helper.rb-100- mysql_events = ExternalsCollector.new(&block).events
36
- .test/support/helpers/externals_helper.rb-101- .select { |e| e.first == :mysql }
37
- ```
38
-
39
- Notice that the documentation for the `assert_sql_events` method is cutoff. Use your `read_file` tool function to get the whole test helper source code and gain better understanding of how it is intended to be used, with the side benefit of also being able to see how it is implemented.
40
-
41
- Note: You will undoubtedly already be familiar with some of Minitest and RSpec's built-in helpers. There is no need to search for those, since they are packaged as gems you won't find them anyway.
42
-
43
- DO NOT FORGET TO PREPEND `def` TO YOUR QUERY TO FIND A METHOD DEFINITION INSTEAD OF USAGES, otherwise you may bring back a very large and useless result set!!!
44
-
45
- Once you are done understanding the custom test helpers used in the test file, analyze and report on whether it seems like any of the helpers are:
46
-
47
- 1. Used incorrectly
48
- 2. Used unnecessarily
49
- 3. Any other problem related to the use of helper methods
50
-
51
- Where possible, use your best judgment to make recommendations for how to fix problems that you find, but ONLY related to test helpers.
52
-
53
- Note: You are only being used to help find problems so it is not necessary to report on correct usage of helpers or to make positive comments.
@@ -1,8 +0,0 @@
1
- As a senior software engineer and testing expert, evaluate the quality of this test file based on guidelines that will be subsequently provided.
2
-
3
- Next I will now provide the source code of the test that we will be analyzing, and then step you through a series of analysis activities, before finally asking you to provided a final report.
4
-
5
- <test>
6
- # <%= file %>
7
- <%= File.read(file) %>
8
- </test>
Binary file
@@ -1,6 +0,0 @@
1
- As a senior Ruby engineer and testing expert, evaluate the quality of this Ruby test file. Next I will now provide the source code of the test that we will be analyzing, and then step you through a series of analysis activities, before finally asking you to provided a final report.
2
-
3
- <test>
4
- # <%= file %>
5
- <%= File.read(file) %>
6
- </test>
@@ -1,6 +0,0 @@
1
- As a senior front-end engineer and testing expert, evaluate the quality of this test file. Next I will now provide the source code of the test that we will be analyzing, and then step you through a series of analysis activities, before finally asking you to provided a final report.
2
-
3
- <test>
4
- # <%= file %>
5
- <%= File.read(file) %>
6
- </test>
@@ -1,41 +0,0 @@
1
- name: Test Grading
2
- api_token: $(echo $OPENAI_API_KEY)
3
- # model: anthropic:claude-opus-4
4
- model: gpt-4.1-mini
5
-
6
- tools:
7
- - Roast::Tools::Grep
8
- - Roast::Tools::ReadFile
9
- - Roast::Tools::SearchFile
10
-
11
- # Uncomment this to run the workflow on modified tests automatically
12
- # each: '% cd $(git rev-parse --show-toplevel) && git status --porcelain | grep "_test\.rb" | cut -c4- | xargs realpath'
13
-
14
- steps:
15
- - read_dependencies
16
- - run_coverage
17
- -
18
- - analyze_coverage
19
- - verify_test_helpers
20
- - verify_mocks_and_stubs
21
- - generate_grades
22
- - calculate_final_grade
23
- - format_result
24
- - generate_recommendations
25
-
26
- # set non-default attributes for steps below
27
- analyze_coverage:
28
- # model: gpt-4.1-mini
29
- json: true
30
-
31
- generate_grades:
32
- # model: o3
33
- json: true
34
-
35
- generate_recommendations:
36
- # model: o3
37
- json: true
38
- params:
39
- max_completion_tokens: 5_000
40
-
41
-
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Demonstration of how to use the Roast instrumentation hooks
4
- # This file would typically be placed in PROJECT_ROOT/.roast/initializers/
5
- # for automatic loading during workflow execution
6
-
7
- # Example: Log all workflow and step events
8
- ActiveSupport::Notifications.subscribe(/roast\.workflow\./) do |name, start, finish, _id, payload|
9
- duration = finish - start
10
-
11
- case name
12
- when "roast.workflow.start"
13
- puts "\nšŸš€ Workflow starting: #{payload[:name]}"
14
- puts " Path: #{payload[:workflow_path]}"
15
- puts " Options: #{payload[:options]}"
16
- when "roast.workflow.complete"
17
- status = payload[:success] ? "āœ… Successfully" : "āŒ With errors"
18
- puts "\n#{status} completed workflow in #{duration.round(2)} seconds"
19
- end
20
- end
21
-
22
- # Example: Track step execution times
23
- ActiveSupport::Notifications.subscribe(/roast\.step\./) do |name, start, finish, _id, payload|
24
- duration = finish - start
25
-
26
- case name
27
- when "roast.step.start"
28
- puts "\n ā–¶ļø Step starting: #{payload[:step_name]}"
29
- when "roast.step.complete"
30
- puts " āœ… Step completed: #{payload[:step_name]} (#{duration.round(3)}s)"
31
- when "roast.step.error"
32
- puts " āŒ Step failed: #{payload[:step_name]}"
33
- puts " Error: #{payload[:error]} - #{payload[:message]}"
34
- end
35
- end
36
-
37
- # Example: Monitor AI interactions
38
- ActiveSupport::Notifications.subscribe(/roast\.chat_completion\./) do |name, start, finish, _id, payload|
39
- case name
40
- when "roast.chat_completion.start"
41
- puts "\n šŸ¤– AI request starting (model: #{payload[:model]})"
42
- puts " Parameters: #{payload[:parameters].inspect}" if payload[:parameters].any?
43
- when "roast.chat_completion.complete"
44
- duration = finish - start
45
- puts " šŸ¤– AI request completed in #{duration.round(2)}s (execution time: #{payload[:execution_time].round(2)}s)"
46
- puts " Response size: #{payload[:response_size]} characters"
47
- when "roast.chat_completion.error"
48
- puts " šŸ¤– AI request failed: #{payload[:error]} - #{payload[:message]}"
49
- puts " Execution time: #{payload[:execution_time].round(2)}s"
50
- end
51
- end
52
-
53
- # Example: Track tool executions
54
- ActiveSupport::Notifications.subscribe(/roast\.tool\./) do |name, _start, _finish, _id, payload|
55
- case name
56
- when "roast.tool.execute"
57
- puts "\n šŸ”§ Executing tool: #{payload[:function_name]}"
58
- when "roast.tool.complete"
59
- puts " šŸ”§ Tool completed: #{payload[:function_name]} (#{payload[:execution_time].round(3)}s)"
60
- puts " Cache enabled: #{payload[:cache_enabled]}"
61
- when "roast.tool.error"
62
- puts " šŸ”§ Tool failed: #{payload[:function_name]}"
63
- puts " Error: #{payload[:error]} - #{payload[:message]}"
64
- puts " Execution time: #{payload[:execution_time].round(3)}s"
65
- end
66
- end
67
-
68
- # In a Shopify-specific initializer (e.g., .roast/initializers/monorail.rb),
69
- # you could replace these logging examples with actual Monorail tracking:
70
- #
71
- # ActiveSupport::Notifications.subscribe("roast.workflow.start") do |name, start, finish, id, payload|
72
- # Roast::Support::Monorail.track_command("run", {
73
- # "workflow_path" => payload[:workflow_path],
74
- # "name" => payload[:name]
75
- # })
76
- # end