kumi 0.0.18 → 0.0.19

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 (676) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +25 -0
  5. data/CLAUDE.md +26 -139
  6. data/README.md +143 -372
  7. data/data/functions/agg/boolean.yaml +14 -0
  8. data/data/functions/agg/numeric.yaml +80 -0
  9. data/data/functions/agg/string.yaml +8 -0
  10. data/data/functions/core/arithmetic.yaml +50 -0
  11. data/data/functions/core/boolean.yaml +18 -0
  12. data/data/functions/core/comparison.yaml +42 -0
  13. data/data/functions/core/constructor.yaml +32 -0
  14. data/data/functions/core/select.yaml +7 -0
  15. data/data/functions/core/stencil.yaml +21 -0
  16. data/data/functions/core/string.yaml +19 -0
  17. data/data/kernels/javascript/agg/boolean.yaml +12 -0
  18. data/data/kernels/javascript/agg/numeric.yaml +27 -0
  19. data/data/kernels/javascript/agg/string.yaml +5 -0
  20. data/data/kernels/javascript/core/arithmetic.yaml +32 -0
  21. data/data/kernels/javascript/core/boolean.yaml +12 -0
  22. data/data/kernels/javascript/core/comparison.yaml +24 -0
  23. data/data/kernels/javascript/core/constructor.yaml +15 -0
  24. data/data/kernels/javascript/core/select.yaml +7 -0
  25. data/data/kernels/javascript/core/string.yaml +12 -0
  26. data/data/kernels/ruby/agg/boolean.yaml +18 -0
  27. data/data/kernels/ruby/agg/numeric.yaml +29 -0
  28. data/data/kernels/ruby/agg/string.yaml +5 -0
  29. data/data/kernels/ruby/core/arithmetic.yaml +38 -0
  30. data/data/kernels/ruby/core/boolean.yaml +15 -0
  31. data/data/kernels/ruby/core/comparison.yaml +30 -0
  32. data/data/kernels/ruby/core/constructor.yaml +17 -0
  33. data/data/kernels/ruby/core/select.yaml +4 -0
  34. data/data/kernels/ruby/core/string.yaml +15 -0
  35. data/debug_ordering.rb +52 -0
  36. data/docs/FORM_SCHEMA.md +85 -0
  37. data/docs/OUTPUT_SCHEMA.md +69 -0
  38. data/docs/SYNTAX.md +626 -373
  39. data/golden/array_element/expected/ast.txt +21 -0
  40. data/golden/array_element/expected/input_plan.txt +5 -0
  41. data/golden/array_element/expected/lir_00_unoptimized.txt +13 -0
  42. data/golden/array_element/expected/lir_01_hoist_scalar_references.txt +13 -0
  43. data/golden/array_element/expected/lir_02_inlined.txt +13 -0
  44. data/golden/array_element/expected/lir_03_cse.txt +13 -0
  45. data/golden/array_element/expected/lir_04_1_loop_fusion.txt +13 -0
  46. data/golden/array_element/expected/lir_04_loop_invcm.txt +13 -0
  47. data/golden/array_element/expected/lir_06_const_prop.txt +13 -0
  48. data/golden/array_element/expected/nast.txt +7 -0
  49. data/golden/array_element/expected/schema_javascript.mjs +13 -0
  50. data/golden/array_element/expected/schema_ruby.rb +41 -0
  51. data/golden/array_element/expected/snast.txt +7 -0
  52. data/golden/array_element/expected.json +5 -0
  53. data/golden/array_element/input.json +9 -0
  54. data/golden/array_element/schema.kumi +11 -0
  55. data/golden/array_index/expected/ast.txt +59 -0
  56. data/golden/array_index/expected/input_plan.txt +5 -0
  57. data/golden/array_index/expected/lir_00_unoptimized.txt +41 -0
  58. data/golden/array_index/expected/lir_01_hoist_scalar_references.txt +41 -0
  59. data/golden/array_index/expected/lir_02_inlined.txt +42 -0
  60. data/golden/array_index/expected/lir_03_cse.txt +40 -0
  61. data/golden/array_index/expected/lir_04_1_loop_fusion.txt +40 -0
  62. data/golden/array_index/expected/lir_04_loop_invcm.txt +40 -0
  63. data/golden/array_index/expected/lir_06_const_prop.txt +40 -0
  64. data/golden/array_index/expected/nast.txt +33 -0
  65. data/golden/array_index/expected/schema_javascript.mjs +46 -0
  66. data/golden/array_index/expected/schema_ruby.rb +75 -0
  67. data/golden/array_index/expected/snast.txt +33 -0
  68. data/golden/array_index/expected.json +5 -0
  69. data/golden/array_index/input.json +1 -0
  70. data/golden/array_index/schema.kumi +19 -0
  71. data/golden/array_operations/expected/ast.txt +50 -0
  72. data/golden/array_operations/expected/input_plan.txt +10 -0
  73. data/golden/array_operations/expected/lir_00_unoptimized.txt +47 -0
  74. data/golden/array_operations/expected/lir_01_hoist_scalar_references.txt +47 -0
  75. data/golden/array_operations/expected/lir_02_inlined.txt +47 -0
  76. data/golden/array_operations/expected/lir_03_cse.txt +47 -0
  77. data/golden/array_operations/expected/lir_04_1_loop_fusion.txt +47 -0
  78. data/golden/array_operations/expected/lir_04_loop_invcm.txt +47 -0
  79. data/golden/array_operations/expected/lir_06_const_prop.txt +47 -0
  80. data/golden/array_operations/expected/nast.txt +32 -0
  81. data/golden/array_operations/expected/schema_javascript.mjs +60 -0
  82. data/golden/array_operations/expected/schema_ruby.rb +91 -0
  83. data/golden/array_operations/expected/snast.txt +32 -0
  84. data/golden/array_operations/expected.json +27 -0
  85. data/golden/array_operations/input.json +8 -0
  86. data/golden/array_operations/schema.kumi +12 -10
  87. data/golden/cascade_logic/expected/ast.txt +37 -0
  88. data/golden/cascade_logic/expected/input_plan.txt +2 -0
  89. data/golden/cascade_logic/expected/lir_00_unoptimized.txt +29 -0
  90. data/golden/cascade_logic/expected/lir_01_hoist_scalar_references.txt +29 -0
  91. data/golden/cascade_logic/expected/lir_02_inlined.txt +37 -0
  92. data/golden/cascade_logic/expected/lir_03_cse.txt +30 -0
  93. data/golden/cascade_logic/expected/lir_04_1_loop_fusion.txt +30 -0
  94. data/golden/cascade_logic/expected/lir_04_loop_invcm.txt +30 -0
  95. data/golden/cascade_logic/expected/lir_06_const_prop.txt +30 -0
  96. data/golden/cascade_logic/expected/nast.txt +32 -0
  97. data/golden/cascade_logic/expected/schema_javascript.mjs +31 -0
  98. data/golden/cascade_logic/expected/schema_ruby.rb +57 -0
  99. data/golden/cascade_logic/expected/snast.txt +32 -0
  100. data/golden/cascade_logic/expected.json +5 -0
  101. data/golden/cascade_logic/input.json +4 -0
  102. data/golden/cascade_logic/schema.kumi +1 -3
  103. data/golden/chained_fusion/expected/ast.txt +57 -0
  104. data/golden/chained_fusion/expected/input_plan.txt +13 -0
  105. data/golden/chained_fusion/expected/lir_00_unoptimized.txt +76 -0
  106. data/golden/chained_fusion/expected/lir_01_hoist_scalar_references.txt +76 -0
  107. data/golden/chained_fusion/expected/lir_02_inlined.txt +114 -0
  108. data/golden/chained_fusion/expected/lir_03_cse.txt +97 -0
  109. data/golden/chained_fusion/expected/lir_04_1_loop_fusion.txt +99 -0
  110. data/golden/chained_fusion/expected/lir_04_loop_invcm.txt +97 -0
  111. data/golden/chained_fusion/expected/lir_06_const_prop.txt +97 -0
  112. data/golden/chained_fusion/expected/nast.txt +55 -0
  113. data/golden/chained_fusion/expected/schema_javascript.mjs +116 -0
  114. data/golden/chained_fusion/expected/schema_ruby.rb +149 -0
  115. data/golden/chained_fusion/expected/snast.txt +55 -0
  116. data/golden/chained_fusion/expected.json +45 -0
  117. data/golden/chained_fusion/input.json +51 -0
  118. data/golden/chained_fusion/schema.kumi +52 -0
  119. data/golden/element_arrays/expected/ast.txt +55 -0
  120. data/golden/element_arrays/expected/input_plan.txt +7 -0
  121. data/golden/element_arrays/expected/lir_00_unoptimized.txt +81 -0
  122. data/golden/element_arrays/expected/lir_01_hoist_scalar_references.txt +81 -0
  123. data/golden/element_arrays/expected/lir_02_inlined.txt +85 -0
  124. data/golden/element_arrays/expected/lir_03_cse.txt +83 -0
  125. data/golden/element_arrays/expected/lir_04_1_loop_fusion.txt +83 -0
  126. data/golden/element_arrays/expected/lir_04_loop_invcm.txt +83 -0
  127. data/golden/element_arrays/expected/lir_06_const_prop.txt +83 -0
  128. data/golden/element_arrays/expected/nast.txt +42 -0
  129. data/golden/element_arrays/expected/schema_javascript.mjs +106 -0
  130. data/golden/element_arrays/expected/schema_ruby.rb +141 -0
  131. data/golden/element_arrays/expected/snast.txt +42 -0
  132. data/golden/element_arrays/expected.json +55 -0
  133. data/golden/element_arrays/input.json +12 -0
  134. data/golden/element_arrays/schema.kumi +21 -0
  135. data/golden/empty_and_null_inputs/expected/ast.txt +42 -0
  136. data/golden/empty_and_null_inputs/expected/input_plan.txt +12 -0
  137. data/golden/empty_and_null_inputs/expected/lir_00_unoptimized.txt +31 -0
  138. data/golden/empty_and_null_inputs/expected/lir_01_hoist_scalar_references.txt +31 -0
  139. data/golden/empty_and_null_inputs/expected/lir_02_inlined.txt +51 -0
  140. data/golden/empty_and_null_inputs/expected/lir_03_cse.txt +49 -0
  141. data/golden/empty_and_null_inputs/expected/lir_04_1_loop_fusion.txt +49 -0
  142. data/golden/empty_and_null_inputs/expected/lir_04_loop_invcm.txt +49 -0
  143. data/golden/empty_and_null_inputs/expected/lir_06_const_prop.txt +49 -0
  144. data/golden/empty_and_null_inputs/expected/nast.txt +18 -0
  145. data/golden/empty_and_null_inputs/expected/schema_javascript.mjs +47 -0
  146. data/golden/empty_and_null_inputs/expected/schema_ruby.rb +79 -0
  147. data/golden/empty_and_null_inputs/expected/snast.txt +18 -0
  148. data/golden/empty_and_null_inputs/expected.json +8 -0
  149. data/golden/empty_and_null_inputs/input.json +16 -0
  150. data/golden/empty_and_null_inputs/schema.kumi +30 -0
  151. data/golden/game_of_life/expected/ast.txt +118 -0
  152. data/golden/game_of_life/expected/input_plan.txt +5 -0
  153. data/golden/game_of_life/expected/lir_00_unoptimized.txt +343 -0
  154. data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +343 -0
  155. data/golden/game_of_life/expected/lir_02_inlined.txt +1918 -0
  156. data/golden/game_of_life/expected/lir_03_cse.txt +766 -0
  157. data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +766 -0
  158. data/golden/game_of_life/expected/lir_04_loop_invcm.txt +766 -0
  159. data/golden/game_of_life/expected/lir_06_const_prop.txt +766 -0
  160. data/golden/game_of_life/expected/nast.txt +104 -0
  161. data/golden/game_of_life/expected/schema_javascript.mjs +98 -0
  162. data/golden/game_of_life/expected/schema_ruby.rb +125 -0
  163. data/golden/game_of_life/expected/snast.txt +104 -0
  164. data/golden/game_of_life/expected.json +3 -0
  165. data/golden/game_of_life/input.json +8 -0
  166. data/golden/game_of_life/schema.kumi +33 -0
  167. data/golden/hash_keys/expected/ast.txt +29 -0
  168. data/golden/hash_keys/expected/input_plan.txt +2 -0
  169. data/golden/hash_keys/expected/lir_00_unoptimized.txt +18 -0
  170. data/golden/hash_keys/expected/lir_01_hoist_scalar_references.txt +18 -0
  171. data/golden/hash_keys/expected/lir_02_inlined.txt +18 -0
  172. data/golden/hash_keys/expected/lir_03_cse.txt +18 -0
  173. data/golden/hash_keys/expected/lir_04_1_loop_fusion.txt +18 -0
  174. data/golden/hash_keys/expected/lir_04_loop_invcm.txt +18 -0
  175. data/golden/hash_keys/expected/lir_06_const_prop.txt +18 -0
  176. data/golden/hash_keys/expected/nast.txt +46 -0
  177. data/golden/hash_keys/expected/schema_javascript.mjs +34 -0
  178. data/golden/hash_keys/expected/schema_ruby.rb +61 -0
  179. data/golden/hash_keys/expected/snast.txt +46 -0
  180. data/golden/hash_keys/expected.json +20 -0
  181. data/golden/hash_keys/input.json +4 -0
  182. data/golden/hash_keys/schema.kumi +14 -0
  183. data/golden/hash_value/expected/ast.txt +37 -0
  184. data/golden/hash_value/expected/input_plan.txt +7 -0
  185. data/golden/hash_value/expected/lir_00_unoptimized.txt +30 -0
  186. data/golden/hash_value/expected/lir_01_hoist_scalar_references.txt +30 -0
  187. data/golden/hash_value/expected/lir_02_inlined.txt +36 -0
  188. data/golden/hash_value/expected/lir_03_cse.txt +33 -0
  189. data/golden/hash_value/expected/lir_04_1_loop_fusion.txt +33 -0
  190. data/golden/hash_value/expected/lir_04_loop_invcm.txt +33 -0
  191. data/golden/hash_value/expected/lir_06_const_prop.txt +33 -0
  192. data/golden/hash_value/expected/nast.txt +25 -0
  193. data/golden/hash_value/expected/schema_javascript.mjs +46 -0
  194. data/golden/hash_value/expected/schema_ruby.rb +75 -0
  195. data/golden/hash_value/expected/snast.txt +25 -0
  196. data/golden/hash_value/expected.json +19 -0
  197. data/golden/hash_value/input.json +12 -0
  198. data/golden/hash_value/schema.kumi +19 -0
  199. data/golden/hierarchical_complex/expected/ast.txt +85 -0
  200. data/golden/hierarchical_complex/expected/input_plan.txt +23 -0
  201. data/golden/hierarchical_complex/expected/lir_00_unoptimized.txt +87 -0
  202. data/golden/hierarchical_complex/expected/lir_01_hoist_scalar_references.txt +87 -0
  203. data/golden/hierarchical_complex/expected/lir_02_inlined.txt +115 -0
  204. data/golden/hierarchical_complex/expected/lir_03_cse.txt +89 -0
  205. data/golden/hierarchical_complex/expected/lir_04_1_loop_fusion.txt +89 -0
  206. data/golden/hierarchical_complex/expected/lir_04_loop_invcm.txt +89 -0
  207. data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +89 -0
  208. data/golden/hierarchical_complex/expected/nast.txt +49 -0
  209. data/golden/hierarchical_complex/expected/schema_javascript.mjs +121 -0
  210. data/golden/hierarchical_complex/expected/schema_ruby.rb +151 -0
  211. data/golden/hierarchical_complex/expected/snast.txt +49 -0
  212. data/golden/hierarchical_complex/expected.json +34 -0
  213. data/golden/hierarchical_complex/input.json +26 -0
  214. data/golden/hierarchical_complex/schema.kumi +38 -0
  215. data/golden/input_reference/expected/ast.txt +46 -0
  216. data/golden/input_reference/expected/input_plan.txt +15 -0
  217. data/golden/input_reference/expected/lir_00_unoptimized.txt +39 -0
  218. data/golden/input_reference/expected/lir_01_hoist_scalar_references.txt +39 -0
  219. data/golden/input_reference/expected/lir_02_inlined.txt +39 -0
  220. data/golden/input_reference/expected/lir_03_cse.txt +39 -0
  221. data/golden/input_reference/expected/lir_04_1_loop_fusion.txt +39 -0
  222. data/golden/input_reference/expected/lir_04_loop_invcm.txt +39 -0
  223. data/golden/input_reference/expected/lir_06_const_prop.txt +39 -0
  224. data/golden/input_reference/expected/nast.txt +21 -0
  225. data/golden/input_reference/expected/schema_javascript.mjs +45 -0
  226. data/golden/input_reference/expected/schema_ruby.rb +74 -0
  227. data/golden/input_reference/expected/snast.txt +21 -0
  228. data/golden/input_reference/expected.json +7 -0
  229. data/golden/input_reference/input.json +11 -0
  230. data/golden/input_reference/schema.kumi +22 -0
  231. data/golden/interleaved_fusion/expected/ast.txt +51 -0
  232. data/golden/interleaved_fusion/expected/input_plan.txt +13 -0
  233. data/golden/interleaved_fusion/expected/lir_00_unoptimized.txt +53 -0
  234. data/golden/interleaved_fusion/expected/lir_01_hoist_scalar_references.txt +53 -0
  235. data/golden/interleaved_fusion/expected/lir_02_inlined.txt +89 -0
  236. data/golden/interleaved_fusion/expected/lir_03_cse.txt +77 -0
  237. data/golden/interleaved_fusion/expected/lir_04_1_loop_fusion.txt +77 -0
  238. data/golden/interleaved_fusion/expected/lir_04_loop_invcm.txt +77 -0
  239. data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +77 -0
  240. data/golden/interleaved_fusion/expected/nast.txt +41 -0
  241. data/golden/interleaved_fusion/expected/schema_javascript.mjs +86 -0
  242. data/golden/interleaved_fusion/expected/schema_ruby.rb +122 -0
  243. data/golden/interleaved_fusion/expected/snast.txt +41 -0
  244. data/golden/interleaved_fusion/expected.json +37 -0
  245. data/golden/interleaved_fusion/input.json +26 -0
  246. data/golden/interleaved_fusion/schema.kumi +57 -0
  247. data/golden/let_inline/expected/ast.txt +33 -0
  248. data/golden/let_inline/expected/input_plan.txt +2 -0
  249. data/golden/let_inline/expected/lir_00_unoptimized.txt +26 -0
  250. data/golden/let_inline/expected/lir_01_hoist_scalar_references.txt +26 -0
  251. data/golden/let_inline/expected/lir_02_inlined.txt +36 -0
  252. data/golden/let_inline/expected/lir_03_cse.txt +30 -0
  253. data/golden/let_inline/expected/lir_04_1_loop_fusion.txt +30 -0
  254. data/golden/let_inline/expected/lir_04_loop_invcm.txt +30 -0
  255. data/golden/let_inline/expected/lir_06_const_prop.txt +30 -0
  256. data/golden/let_inline/expected/nast.txt +26 -0
  257. data/golden/let_inline/expected/schema_javascript.mjs +11 -0
  258. data/golden/let_inline/expected/schema_ruby.rb +37 -0
  259. data/golden/let_inline/expected/snast.txt +26 -0
  260. data/golden/let_inline/expected.json +1 -0
  261. data/golden/let_inline/input.json +1 -0
  262. data/golden/let_inline/schema.kumi +11 -0
  263. data/golden/loop_fusion/expected/ast.txt +44 -0
  264. data/golden/loop_fusion/expected/input_plan.txt +13 -0
  265. data/golden/loop_fusion/expected/lir_00_unoptimized.txt +43 -0
  266. data/golden/loop_fusion/expected/lir_01_hoist_scalar_references.txt +43 -0
  267. data/golden/loop_fusion/expected/lir_02_inlined.txt +62 -0
  268. data/golden/loop_fusion/expected/lir_03_cse.txt +57 -0
  269. data/golden/loop_fusion/expected/lir_04_1_loop_fusion.txt +57 -0
  270. data/golden/loop_fusion/expected/lir_04_loop_invcm.txt +57 -0
  271. data/golden/loop_fusion/expected/lir_06_const_prop.txt +57 -0
  272. data/golden/loop_fusion/expected/nast.txt +32 -0
  273. data/golden/loop_fusion/expected/schema_javascript.mjs +64 -0
  274. data/golden/loop_fusion/expected/schema_ruby.rb +97 -0
  275. data/golden/loop_fusion/expected/snast.txt +32 -0
  276. data/golden/loop_fusion/expected.json +30 -0
  277. data/golden/loop_fusion/input.json +28 -0
  278. data/golden/loop_fusion/schema.kumi +32 -0
  279. data/golden/min_reduce_scope/expected/ast.txt +49 -0
  280. data/golden/min_reduce_scope/expected/input_plan.txt +9 -0
  281. data/golden/min_reduce_scope/expected/lir_00_unoptimized.txt +59 -0
  282. data/golden/min_reduce_scope/expected/lir_01_hoist_scalar_references.txt +59 -0
  283. data/golden/min_reduce_scope/expected/lir_02_inlined.txt +63 -0
  284. data/golden/min_reduce_scope/expected/lir_03_cse.txt +60 -0
  285. data/golden/min_reduce_scope/expected/lir_04_1_loop_fusion.txt +60 -0
  286. data/golden/min_reduce_scope/expected/lir_04_loop_invcm.txt +60 -0
  287. data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +60 -0
  288. data/golden/min_reduce_scope/expected/nast.txt +29 -0
  289. data/golden/min_reduce_scope/expected/schema_javascript.mjs +66 -0
  290. data/golden/min_reduce_scope/expected/schema_ruby.rb +99 -0
  291. data/golden/min_reduce_scope/expected/snast.txt +29 -0
  292. data/golden/min_reduce_scope/expected.json +9 -0
  293. data/golden/min_reduce_scope/input.json +18 -0
  294. data/golden/min_reduce_scope/schema.kumi +25 -0
  295. data/golden/mixed_dimensions/expected/ast.txt +54 -0
  296. data/golden/mixed_dimensions/expected/input_plan.txt +15 -0
  297. data/golden/mixed_dimensions/expected/lir_00_unoptimized.txt +42 -0
  298. data/golden/mixed_dimensions/expected/lir_01_hoist_scalar_references.txt +42 -0
  299. data/golden/mixed_dimensions/expected/lir_02_inlined.txt +48 -0
  300. data/golden/mixed_dimensions/expected/lir_03_cse.txt +48 -0
  301. data/golden/mixed_dimensions/expected/lir_04_1_loop_fusion.txt +48 -0
  302. data/golden/mixed_dimensions/expected/lir_04_loop_invcm.txt +48 -0
  303. data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +48 -0
  304. data/golden/mixed_dimensions/expected/nast.txt +22 -0
  305. data/golden/mixed_dimensions/expected/schema_javascript.mjs +53 -0
  306. data/golden/mixed_dimensions/expected/schema_ruby.rb +84 -0
  307. data/golden/mixed_dimensions/expected/snast.txt +22 -0
  308. data/golden/mixed_dimensions/expected.json +6 -0
  309. data/golden/mixed_dimensions/input.json +22 -0
  310. data/golden/mixed_dimensions/schema.kumi +35 -0
  311. data/golden/multirank_hoisting/expected/ast.txt +72 -0
  312. data/golden/multirank_hoisting/expected/input_plan.txt +18 -0
  313. data/golden/multirank_hoisting/expected/lir_00_unoptimized.txt +75 -0
  314. data/golden/multirank_hoisting/expected/lir_01_hoist_scalar_references.txt +75 -0
  315. data/golden/multirank_hoisting/expected/lir_02_inlined.txt +126 -0
  316. data/golden/multirank_hoisting/expected/lir_03_cse.txt +109 -0
  317. data/golden/multirank_hoisting/expected/lir_04_1_loop_fusion.txt +109 -0
  318. data/golden/multirank_hoisting/expected/lir_04_loop_invcm.txt +109 -0
  319. data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +109 -0
  320. data/golden/multirank_hoisting/expected/nast.txt +39 -0
  321. data/golden/multirank_hoisting/expected/schema_javascript.mjs +128 -0
  322. data/golden/multirank_hoisting/expected/schema_ruby.rb +162 -0
  323. data/golden/multirank_hoisting/expected/snast.txt +39 -0
  324. data/golden/multirank_hoisting/expected.json +15 -0
  325. data/golden/multirank_hoisting/input.json +19 -0
  326. data/golden/multirank_hoisting/schema.kumi +38 -0
  327. data/golden/nested_hash/expected/ast.txt +22 -0
  328. data/golden/nested_hash/expected/input_plan.txt +5 -0
  329. data/golden/nested_hash/expected/lir_00_unoptimized.txt +10 -0
  330. data/golden/nested_hash/expected/lir_01_hoist_scalar_references.txt +10 -0
  331. data/golden/nested_hash/expected/lir_02_inlined.txt +10 -0
  332. data/golden/nested_hash/expected/lir_03_cse.txt +10 -0
  333. data/golden/nested_hash/expected/lir_04_1_loop_fusion.txt +10 -0
  334. data/golden/nested_hash/expected/lir_04_loop_invcm.txt +10 -0
  335. data/golden/nested_hash/expected/lir_06_const_prop.txt +10 -0
  336. data/golden/nested_hash/expected/nast.txt +8 -0
  337. data/golden/nested_hash/expected/schema_javascript.mjs +9 -0
  338. data/golden/nested_hash/expected/schema_ruby.rb +35 -0
  339. data/golden/nested_hash/expected/snast.txt +8 -0
  340. data/golden/nested_hash/expected.json +3 -0
  341. data/golden/nested_hash/input.json +7 -0
  342. data/golden/nested_hash/schema.kumi +11 -0
  343. data/golden/reduction_broadcast/expected/ast.txt +49 -0
  344. data/golden/reduction_broadcast/expected/input_plan.txt +13 -0
  345. data/golden/reduction_broadcast/expected/lir_00_unoptimized.txt +49 -0
  346. data/golden/reduction_broadcast/expected/lir_01_hoist_scalar_references.txt +49 -0
  347. data/golden/reduction_broadcast/expected/lir_02_inlined.txt +80 -0
  348. data/golden/reduction_broadcast/expected/lir_03_cse.txt +68 -0
  349. data/golden/reduction_broadcast/expected/lir_04_1_loop_fusion.txt +68 -0
  350. data/golden/reduction_broadcast/expected/lir_04_loop_invcm.txt +68 -0
  351. data/golden/reduction_broadcast/expected/lir_06_const_prop.txt +68 -0
  352. data/golden/reduction_broadcast/expected/nast.txt +24 -0
  353. data/golden/reduction_broadcast/expected/schema_javascript.mjs +74 -0
  354. data/golden/reduction_broadcast/expected/schema_ruby.rb +110 -0
  355. data/golden/reduction_broadcast/expected/snast.txt +24 -0
  356. data/golden/reduction_broadcast/expected.json +25 -0
  357. data/golden/reduction_broadcast/input.json +19 -0
  358. data/golden/reduction_broadcast/schema.kumi +34 -0
  359. data/golden/roll/expected/ast.txt +36 -0
  360. data/golden/roll/expected/input_plan.txt +3 -0
  361. data/golden/roll/expected/lir_00_unoptimized.txt +56 -0
  362. data/golden/roll/expected/lir_01_hoist_scalar_references.txt +56 -0
  363. data/golden/roll/expected/lir_02_inlined.txt +56 -0
  364. data/golden/roll/expected/lir_03_cse.txt +55 -0
  365. data/golden/roll/expected/lir_04_1_loop_fusion.txt +55 -0
  366. data/golden/roll/expected/lir_04_loop_invcm.txt +55 -0
  367. data/golden/roll/expected/lir_06_const_prop.txt +55 -0
  368. data/golden/roll/expected/nast.txt +26 -0
  369. data/golden/roll/expected/schema_javascript.mjs +65 -0
  370. data/golden/roll/expected/schema_ruby.rb +95 -0
  371. data/golden/roll/expected/snast.txt +26 -0
  372. data/golden/roll/expected.json +6 -0
  373. data/golden/roll/input.json +1 -0
  374. data/golden/roll/schema.kumi +13 -0
  375. data/golden/shift/expected/ast.txt +48 -0
  376. data/golden/shift/expected/input_plan.txt +3 -0
  377. data/golden/shift/expected/lir_00_unoptimized.txt +96 -0
  378. data/golden/shift/expected/lir_01_hoist_scalar_references.txt +96 -0
  379. data/golden/shift/expected/lir_02_inlined.txt +96 -0
  380. data/golden/shift/expected/lir_03_cse.txt +90 -0
  381. data/golden/shift/expected/lir_04_1_loop_fusion.txt +90 -0
  382. data/golden/shift/expected/lir_04_loop_invcm.txt +90 -0
  383. data/golden/shift/expected/lir_06_const_prop.txt +90 -0
  384. data/golden/shift/expected/nast.txt +38 -0
  385. data/golden/shift/expected/schema_javascript.mjs +106 -0
  386. data/golden/shift/expected/schema_ruby.rb +138 -0
  387. data/golden/shift/expected/snast.txt +38 -0
  388. data/golden/shift/expected.json +8 -0
  389. data/golden/shift/input.json +1 -0
  390. data/golden/shift/schema.kumi +15 -0
  391. data/golden/shift_2d/expected/ast.txt +88 -0
  392. data/golden/shift_2d/expected/input_plan.txt +5 -0
  393. data/golden/shift_2d/expected/lir_00_unoptimized.txt +274 -0
  394. data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +274 -0
  395. data/golden/shift_2d/expected/lir_02_inlined.txt +274 -0
  396. data/golden/shift_2d/expected/lir_03_cse.txt +262 -0
  397. data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +262 -0
  398. data/golden/shift_2d/expected/lir_04_loop_invcm.txt +262 -0
  399. data/golden/shift_2d/expected/lir_06_const_prop.txt +262 -0
  400. data/golden/shift_2d/expected/nast.txt +74 -0
  401. data/golden/shift_2d/expected/schema_javascript.mjs +320 -0
  402. data/golden/shift_2d/expected/schema_ruby.rb +358 -0
  403. data/golden/shift_2d/expected/snast.txt +74 -0
  404. data/golden/shift_2d/expected.json +15 -0
  405. data/golden/shift_2d/input.json +14 -0
  406. data/golden/shift_2d/schema.kumi +25 -0
  407. data/golden/simple_math/expected/ast.txt +40 -0
  408. data/golden/simple_math/expected/input_plan.txt +2 -0
  409. data/golden/simple_math/expected/lir_00_unoptimized.txt +31 -0
  410. data/golden/simple_math/expected/lir_01_hoist_scalar_references.txt +31 -0
  411. data/golden/simple_math/expected/lir_02_inlined.txt +31 -0
  412. data/golden/simple_math/expected/lir_03_cse.txt +31 -0
  413. data/golden/simple_math/expected/lir_04_1_loop_fusion.txt +31 -0
  414. data/golden/simple_math/expected/lir_04_loop_invcm.txt +31 -0
  415. data/golden/simple_math/expected/lir_06_const_prop.txt +31 -0
  416. data/golden/simple_math/expected/nast.txt +33 -0
  417. data/golden/simple_math/expected/schema_javascript.mjs +33 -0
  418. data/golden/simple_math/expected/schema_ruby.rb +59 -0
  419. data/golden/simple_math/expected/snast.txt +33 -0
  420. data/golden/simple_math/expected.json +1 -0
  421. data/golden/simple_math/input.json +4 -0
  422. data/golden/simple_math/schema.kumi +2 -1
  423. data/golden/streaming_basics/expected/ast.txt +64 -0
  424. data/golden/streaming_basics/expected/input_plan.txt +8 -0
  425. data/golden/streaming_basics/expected/lir_00_unoptimized.txt +73 -0
  426. data/golden/streaming_basics/expected/lir_01_hoist_scalar_references.txt +73 -0
  427. data/golden/streaming_basics/expected/lir_02_inlined.txt +100 -0
  428. data/golden/streaming_basics/expected/lir_03_cse.txt +84 -0
  429. data/golden/streaming_basics/expected/lir_04_1_loop_fusion.txt +84 -0
  430. data/golden/streaming_basics/expected/lir_04_loop_invcm.txt +84 -0
  431. data/golden/streaming_basics/expected/lir_06_const_prop.txt +84 -0
  432. data/golden/streaming_basics/expected/nast.txt +48 -0
  433. data/golden/streaming_basics/expected/schema_javascript.mjs +94 -0
  434. data/golden/streaming_basics/expected/schema_ruby.rb +127 -0
  435. data/golden/streaming_basics/expected/snast.txt +48 -0
  436. data/golden/streaming_basics/expected.json +10 -0
  437. data/golden/streaming_basics/input.json +8 -0
  438. data/golden/streaming_basics/schema.kumi +24 -0
  439. data/golden/tuples/expected/ast.txt +48 -0
  440. data/golden/tuples/expected/input_plan.txt +1 -0
  441. data/golden/tuples/expected/lir_00_unoptimized.txt +40 -0
  442. data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +40 -0
  443. data/golden/tuples/expected/lir_02_inlined.txt +48 -0
  444. data/golden/tuples/expected/lir_03_cse.txt +48 -0
  445. data/golden/tuples/expected/lir_04_1_loop_fusion.txt +48 -0
  446. data/golden/tuples/expected/lir_04_loop_invcm.txt +48 -0
  447. data/golden/tuples/expected/lir_06_const_prop.txt +48 -0
  448. data/golden/tuples/expected/nast.txt +42 -0
  449. data/golden/tuples/expected/schema_javascript.mjs +51 -0
  450. data/golden/tuples/expected/schema_ruby.rb +77 -0
  451. data/golden/tuples/expected/snast.txt +42 -0
  452. data/golden/tuples/expected.json +7 -0
  453. data/golden/tuples/input.json +3 -0
  454. data/golden/tuples/schema.kumi +11 -0
  455. data/golden/tuples_and_arrays/expected/ast.txt +44 -0
  456. data/golden/tuples_and_arrays/expected/input_plan.txt +7 -0
  457. data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +41 -0
  458. data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +41 -0
  459. data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +62 -0
  460. data/golden/tuples_and_arrays/expected/lir_03_cse.txt +51 -0
  461. data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +51 -0
  462. data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +51 -0
  463. data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +51 -0
  464. data/golden/tuples_and_arrays/expected/nast.txt +28 -0
  465. data/golden/tuples_and_arrays/expected/schema_javascript.mjs +58 -0
  466. data/golden/tuples_and_arrays/expected/schema_ruby.rb +88 -0
  467. data/golden/tuples_and_arrays/expected/snast.txt +28 -0
  468. data/golden/tuples_and_arrays/expected.json +18 -0
  469. data/golden/tuples_and_arrays/input.json +7 -0
  470. data/golden/tuples_and_arrays/schema.kumi +38 -0
  471. data/golden/with_constants/expected/ast.txt +28 -0
  472. data/golden/with_constants/expected/input_plan.txt +2 -0
  473. data/golden/with_constants/expected/lir_00_unoptimized.txt +17 -0
  474. data/golden/with_constants/expected/lir_01_hoist_scalar_references.txt +17 -0
  475. data/golden/with_constants/expected/lir_02_inlined.txt +17 -0
  476. data/golden/with_constants/expected/lir_03_cse.txt +17 -0
  477. data/golden/with_constants/expected/lir_04_1_loop_fusion.txt +17 -0
  478. data/golden/with_constants/expected/lir_04_loop_invcm.txt +17 -0
  479. data/golden/with_constants/expected/lir_06_const_prop.txt +17 -0
  480. data/golden/with_constants/expected/nast.txt +21 -0
  481. data/golden/with_constants/expected/schema_javascript.mjs +18 -0
  482. data/golden/with_constants/expected/schema_ruby.rb +44 -0
  483. data/golden/with_constants/expected/snast.txt +15 -0
  484. data/golden/with_constants/schema.kumi +10 -0
  485. data/lib/kumi/analyzer.rb +76 -24
  486. data/lib/kumi/configuration.rb +60 -0
  487. data/lib/kumi/core/analyzer/binder.rb +121 -0
  488. data/lib/kumi/core/analyzer/checkpoint.rb +15 -9
  489. data/lib/kumi/core/analyzer/constant_evaluator.rb +32 -37
  490. data/lib/kumi/core/analyzer/constant_folding_helpers.rb +55 -0
  491. data/lib/kumi/core/analyzer/debug.rb +14 -16
  492. data/lib/kumi/core/analyzer/fn_aliases.rb +46 -0
  493. data/lib/kumi/core/analyzer/folder.rb +94 -0
  494. data/lib/kumi/core/analyzer/macro_expander.rb +69 -0
  495. data/lib/kumi/core/analyzer/passes/assemble_irv2_pass.rb +130 -0
  496. data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +71 -0
  497. data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +181 -0
  498. data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +317 -0
  499. data/lib/kumi/core/analyzer/passes/codegen/js/emitter.rb +75 -0
  500. data/lib/kumi/core/analyzer/passes/codegen/js/output_buffer.rb +103 -0
  501. data/lib/kumi/core/analyzer/passes/codegen/js_pass.rb +27 -0
  502. data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +321 -0
  503. data/lib/kumi/core/analyzer/passes/codegen/ruby/emitter.rb +85 -0
  504. data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +111 -0
  505. data/lib/kumi/core/analyzer/passes/codegen/ruby_pass.rb +32 -0
  506. data/lib/kumi/core/analyzer/passes/constant_folding_pass.rb +33 -0
  507. data/lib/kumi/core/analyzer/passes/contract_checker_pass.rb +220 -0
  508. data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +5 -6
  509. data/lib/kumi/core/analyzer/passes/input_access_planner_pass.rb +7 -3
  510. data/lib/kumi/core/analyzer/passes/input_collector.rb +74 -122
  511. data/lib/kumi/core/analyzer/passes/input_form_schema_pass.rb +43 -0
  512. data/lib/kumi/core/analyzer/passes/ir_dependency_pass.rb +1 -1
  513. data/lib/kumi/core/analyzer/passes/ir_execution_schedule_pass.rb +1 -1
  514. data/lib/kumi/core/analyzer/passes/join_reduce_planning_pass.rb +21 -23
  515. data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +84 -0
  516. data/lib/kumi/core/analyzer/passes/lir/dead_code_elimination_pass.rb +93 -0
  517. data/lib/kumi/core/analyzer/passes/lir/hoist_scalar_references_pass.rb +115 -0
  518. data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +274 -0
  519. data/lib/kumi/core/analyzer/passes/lir/instruction_scheduling_pass.rb +198 -0
  520. data/lib/kumi/core/analyzer/passes/lir/kernel_binding_pass.rb +30 -0
  521. data/lib/kumi/core/analyzer/passes/lir/local_cse_pass.rb +121 -0
  522. data/lib/kumi/core/analyzer/passes/lir/loop_fusion_pass.rb +156 -0
  523. data/lib/kumi/core/analyzer/passes/lir/loop_invariant_code_motion_pass.rb +148 -0
  524. data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +407 -0
  525. data/lib/kumi/core/analyzer/passes/lir/stencil_emitter.rb +243 -0
  526. data/lib/kumi/core/analyzer/passes/lir/validation_pass.rb +83 -0
  527. data/lib/kumi/core/analyzer/passes/load_input_cse.rb +17 -16
  528. data/lib/kumi/core/analyzer/passes/lower_to_ir_pass.rb +4 -2
  529. data/lib/kumi/core/analyzer/passes/lower_to_irv2_pass.rb +197 -0
  530. data/lib/kumi/core/analyzer/passes/name_indexer.rb +4 -1
  531. data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +237 -0
  532. data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +156 -0
  533. data/lib/kumi/core/analyzer/passes/output_schema_pass.rb +38 -0
  534. data/lib/kumi/core/analyzer/passes/pass_base.rb +30 -4
  535. data/lib/kumi/core/analyzer/passes/precompute_access_paths_pass.rb +93 -0
  536. data/lib/kumi/core/analyzer/passes/scope_resolution_pass.rb +33 -30
  537. data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -26
  538. data/lib/kumi/core/analyzer/passes/snast_pass.rb +229 -0
  539. data/lib/kumi/core/analyzer/passes/toposorter.rb +1 -0
  540. data/lib/kumi/core/analyzer/passes/type_checker.rb +13 -0
  541. data/lib/kumi/core/analyzer/passes/type_inferencer_pass.rb +14 -16
  542. data/lib/kumi/core/analyzer/passes/unsat_detector.rb +2 -1
  543. data/lib/kumi/core/analyzer/plans.rb +12 -0
  544. data/lib/kumi/core/analyzer/state_serde.rb +4 -4
  545. data/lib/kumi/core/analyzer/structs/access_plan.rb +2 -2
  546. data/lib/kumi/core/analyzer/unsat_constant_evaluator.rb +59 -0
  547. data/lib/kumi/core/compiler/access_codegen.rb +1 -1
  548. data/lib/kumi/core/compiler/access_emit/base.rb +9 -5
  549. data/lib/kumi/core/compiler/access_emit/each_indexed.rb +10 -3
  550. data/lib/kumi/core/compiler/access_emit/materialize.rb +12 -5
  551. data/lib/kumi/core/compiler/access_emit/ravel.rb +10 -3
  552. data/lib/kumi/core/compiler/access_emit/read.rb +4 -1
  553. data/lib/kumi/core/compiler/access_planner.rb +42 -4
  554. data/lib/kumi/core/compiler/access_planner_v2.rb +164 -0
  555. data/lib/kumi/core/explain.rb +18 -11
  556. data/lib/kumi/core/functions/loader.rb +47 -0
  557. data/lib/kumi/core/functions/model.rb +10 -0
  558. data/lib/kumi/core/functions/type_rules.rb +108 -0
  559. data/lib/kumi/core/ir/execution_engine/interpreter.rb +1 -1
  560. data/lib/kumi/core/ir/execution_engine/profiler.rb +107 -97
  561. data/lib/kumi/core/ir.rb +6 -2
  562. data/lib/kumi/core/irv2/builder.rb +48 -0
  563. data/lib/kumi/core/irv2/declaration.rb +28 -0
  564. data/lib/kumi/core/irv2/module.rb +108 -0
  565. data/lib/kumi/core/irv2/value.rb +28 -0
  566. data/lib/kumi/core/lir/analyze.rb +64 -0
  567. data/lib/kumi/core/lir/build.rb +363 -0
  568. data/lib/kumi/core/lir/emit.rb +62 -0
  569. data/lib/kumi/core/lir/structs/instruction.rb +44 -0
  570. data/lib/kumi/core/lir/structs/literal.rb +14 -0
  571. data/lib/kumi/core/lir/structs/stamp.rb +13 -0
  572. data/lib/kumi/core/lir/support/error.rb +9 -0
  573. data/lib/kumi/core/lir/support/ids.rb +34 -0
  574. data/lib/kumi/core/lir/validate.rb +74 -0
  575. data/lib/kumi/core/lir.rb +34 -0
  576. data/lib/kumi/core/nast.rb +216 -0
  577. data/lib/kumi/core/ruby_parser/dsl.rb +2 -2
  578. data/lib/kumi/core/ruby_parser/dsl_cascade_builder.rb +1 -1
  579. data/lib/kumi/core/ruby_parser/expression_converter.rb +10 -0
  580. data/lib/kumi/core/ruby_parser/input_builder.rb +16 -17
  581. data/lib/kumi/core/ruby_parser/schema_builder.rb +36 -10
  582. data/lib/kumi/core/ruby_parser/sugar.rb +64 -0
  583. data/lib/kumi/core/types/builder.rb +2 -2
  584. data/lib/kumi/core/types/normalizer.rb +2 -0
  585. data/lib/kumi/core/types/validator.rb +10 -3
  586. data/lib/kumi/core/types.rb +7 -0
  587. data/lib/kumi/dev/codegen.rb +194 -0
  588. data/lib/kumi/dev/golden/generator.rb +105 -0
  589. data/lib/kumi/dev/golden/reporter.rb +160 -0
  590. data/lib/kumi/dev/golden/representation.rb +45 -0
  591. data/lib/kumi/dev/golden/result.rb +98 -0
  592. data/lib/kumi/dev/golden/runtime_test.rb +93 -0
  593. data/lib/kumi/dev/golden/suite.rb +131 -0
  594. data/lib/kumi/dev/golden/verifier.rb +76 -0
  595. data/lib/kumi/dev/golden.rb +75 -0
  596. data/lib/kumi/dev/ir.rb +4 -4
  597. data/lib/kumi/dev/parse.rb +1 -1
  598. data/lib/kumi/dev/pretty_printer.rb +229 -0
  599. data/lib/kumi/dev/printer/irv2_formatter.rb +163 -0
  600. data/lib/kumi/dev/printer/width_aware_json.rb +44 -0
  601. data/lib/kumi/dev/profile_aggregator.rb +36 -38
  602. data/lib/kumi/dev/profile_runner.rb +19 -23
  603. data/lib/kumi/dev/runner.rb +12 -22
  604. data/lib/kumi/dev/support/kumi_runner.mjs +39 -0
  605. data/lib/kumi/dev.rb +3 -3
  606. data/lib/kumi/frontends/ruby.rb +12 -12
  607. data/lib/kumi/frontends/text.rb +26 -21
  608. data/lib/kumi/frontends.rb +6 -8
  609. data/lib/kumi/kernel_registry.rb +59 -0
  610. data/lib/kumi/pack/builder.rb +229 -0
  611. data/lib/kumi/pack.rb +15 -0
  612. data/lib/kumi/registry_v2/loader.rb +81 -0
  613. data/lib/kumi/registry_v2.rb +118 -0
  614. data/lib/kumi/schema.rb +83 -43
  615. data/lib/kumi/support/diff.rb +3 -2
  616. data/lib/kumi/support/ir_render.rb +1 -1
  617. data/lib/kumi/support/lir_printer.rb +143 -0
  618. data/lib/kumi/support/nast_printer.rb +93 -0
  619. data/lib/kumi/support/s_expression_printer.rb +5 -4
  620. data/lib/kumi/support/snast_printer.rb +111 -0
  621. data/lib/kumi/syntax/call_expression.rb +1 -1
  622. data/lib/kumi/syntax/input_declaration.rb +2 -2
  623. data/lib/kumi/syntax/node.rb +4 -12
  624. data/lib/kumi/syntax/root.rb +10 -0
  625. data/lib/kumi/syntax/trait_declaration.rb +1 -0
  626. data/lib/kumi/syntax/value_declaration.rb +1 -0
  627. data/lib/kumi/version.rb +1 -1
  628. data/lib/kumi.rb +47 -5
  629. metadata +571 -54
  630. data/docs/AST.md +0 -133
  631. data/docs/DSL.md +0 -154
  632. data/docs/FUNCTIONS.md +0 -176
  633. data/docs/VECTOR_SEMANTICS.md +0 -286
  634. data/docs/compiler_design_principles.md +0 -86
  635. data/docs/dev/analyzer-debug.md +0 -52
  636. data/docs/dev/parse-command.md +0 -64
  637. data/docs/dev/vm-profiling.md +0 -95
  638. data/docs/development/README.md +0 -120
  639. data/docs/development/error-reporting.md +0 -361
  640. data/docs/features/README.md +0 -58
  641. data/docs/features/analysis-type-inference.md +0 -42
  642. data/docs/features/analysis-unsat-detection.md +0 -71
  643. data/docs/features/hierarchical-broadcasting.md +0 -415
  644. data/docs/features/input-declaration-system.md +0 -58
  645. data/docs/features/performance.md +0 -14
  646. data/docs/features/s-expression-printer.md +0 -77
  647. data/docs/schema_metadata/broadcasts.md +0 -53
  648. data/docs/schema_metadata/cascades.md +0 -45
  649. data/docs/schema_metadata/declarations.md +0 -54
  650. data/docs/schema_metadata/dependencies.md +0 -57
  651. data/docs/schema_metadata/evaluation_order.md +0 -29
  652. data/docs/schema_metadata/examples.md +0 -95
  653. data/docs/schema_metadata/inferred_types.md +0 -46
  654. data/docs/schema_metadata/inputs.md +0 -86
  655. data/docs/schema_metadata.md +0 -108
  656. data/golden/mixed_nesting/schema.kumi +0 -42
  657. data/lib/kumi/core/function_registry/collection_functions.rb +0 -298
  658. data/lib/kumi/core/function_registry/comparison_functions.rb +0 -33
  659. data/lib/kumi/core/function_registry/conditional_functions.rb +0 -48
  660. data/lib/kumi/core/function_registry/function_builder.rb +0 -184
  661. data/lib/kumi/core/function_registry/logical_functions.rb +0 -214
  662. data/lib/kumi/core/function_registry/math_functions.rb +0 -74
  663. data/lib/kumi/core/function_registry/stat_functions.rb +0 -156
  664. data/lib/kumi/core/function_registry/string_functions.rb +0 -57
  665. data/lib/kumi/core/function_registry/type_functions.rb +0 -53
  666. data/lib/kumi/core/function_registry.rb +0 -176
  667. data/lib/kumi/registry.rb +0 -32
  668. data/lib/kumi/runtime/executable.rb +0 -135
  669. data/lib/kumi/runtime/run.rb +0 -105
  670. data/performance_results.txt +0 -63
  671. data/scripts/analyze_broadcast_methods.rb +0 -68
  672. data/scripts/analyze_cascade_methods.rb +0 -74
  673. data/scripts/check_broadcasting_coverage.rb +0 -51
  674. data/scripts/find_dead_code.rb +0 -114
  675. data/scripts/generate_function_docs.rb +0 -71
  676. data/scripts/test_mixed_nesting_performance.rb +0 -206
@@ -1,176 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kumi
4
- module Core
5
- # Internal function registry (single source of truth).
6
- module FunctionRegistry
7
- Entry = FunctionBuilder::Entry
8
-
9
- CORE_OPERATORS = %i[== > < >= <= != between?].freeze
10
-
11
- # Build core functions once
12
- CORE_FUNCTIONS = {}.tap do |registry|
13
- [
14
- ComparisonFunctions.definitions,
15
- MathFunctions.definitions,
16
- StringFunctions.definitions,
17
- LogicalFunctions.definitions,
18
- CollectionFunctions.definitions,
19
- ConditionalFunctions.definitions,
20
- TypeFunctions.definitions,
21
- StatFunctions.definitions
22
- ].each do |defs|
23
- defs.each do |name, entry|
24
- raise ArgumentError, "Duplicate core function: #{name}" if registry.key?(name)
25
-
26
- registry[name] = entry
27
- end
28
- end
29
- end.freeze
30
-
31
- @lock = Mutex.new
32
- @functions = CORE_FUNCTIONS.transform_values(&:dup)
33
- @frozen = false
34
-
35
- class FrozenError < RuntimeError; end
36
-
37
- class << self
38
- def auto_register(*mods)
39
- mods.each do |mod|
40
- mod.public_instance_methods(false).each do |m|
41
- next if function?(m)
42
-
43
- register(m) { |*args| mod.new.public_send(m, *args) }
44
- end
45
- mod.singleton_methods(false).each do |m|
46
- next if function?(m)
47
-
48
- fn = mod.method(m)
49
- register(m) { |*args| fn.call(*args) }
50
- end
51
- end
52
- end
53
-
54
- #
55
- # Lifecycle
56
- #
57
- def reset!
58
- @lock.synchronize do
59
- @functions = CORE_FUNCTIONS.transform_values(&:dup)
60
- @frozen = false
61
- end
62
- end
63
-
64
- def freeze!
65
- @lock.synchronize do
66
- @functions.each_value(&:freeze)
67
- @functions.freeze
68
- @frozen = true
69
- end
70
- end
71
-
72
- def frozen?
73
- @frozen
74
- end
75
-
76
- #
77
- # Registration
78
- #
79
- # Unified entry point; used by both public and internal callers.
80
- def register(name, fn_or = nil, **meta, &block)
81
- fn = fn_or || block
82
- raise ArgumentError, "block or Proc required" unless fn.is_a?(Proc)
83
-
84
- defaults = {
85
- arity: fn.arity,
86
- param_types: [:any],
87
- return_type: :any,
88
- description: nil,
89
- param_modes: nil,
90
- reducer: false,
91
- structure_function: false
92
- }
93
- register_with_metadata(name, fn, **defaults, **meta)
94
- end
95
-
96
- # Back-compat explicit API
97
- def register_with_metadata(name, fn, arity:, param_types: [:any], return_type: :any,
98
- description: nil, param_modes: nil, reducer: false,
99
- structure_function: false)
100
- @lock.synchronize do
101
- raise FrozenError, "registry is frozen" if @frozen
102
- raise ArgumentError, "Function #{name.inspect} already registered" if @functions.key?(name)
103
-
104
- @functions[name] = Entry.new(
105
- fn: fn,
106
- arity: arity,
107
- param_types: param_types,
108
- return_type: return_type,
109
- description: description,
110
- param_modes: param_modes,
111
- reducer: reducer,
112
- structure_function: structure_function
113
- )
114
- end
115
- end
116
-
117
- #
118
- # Queries
119
- #
120
- def function?(name)
121
- @functions.key?(name)
122
- end
123
- alias supported? function?
124
-
125
- def operator?(name)
126
- name.is_a?(Symbol) && function?(name) && CORE_OPERATORS.include?(name)
127
- end
128
-
129
- def entry(name)
130
- @functions[name]
131
- end
132
-
133
- def fetch(name)
134
- ent = entry(name)
135
- raise Kumi::Errors::UnknownFunction, "Unknown function: #{name}" unless ent
136
-
137
- ent.fn
138
- end
139
-
140
- def signature(name)
141
- ent = entry(name) or raise Kumi::Errors::UnknownFunction, "Unknown function: #{name}"
142
- { arity: ent.arity, param_types: ent.param_types, return_type: ent.return_type, description: ent.description }
143
- end
144
-
145
- def reducer?(name)
146
- ent = entry(name)
147
- ent ? !!ent.reducer : false
148
- end
149
-
150
- def structure_function?(name)
151
- ent = entry(name)
152
- ent ? !!ent.structure_function : false
153
- end
154
-
155
- def all_functions
156
- @functions.keys
157
- end
158
- alias all all_functions
159
-
160
- def functions
161
- @functions.dup
162
- end
163
-
164
- # Introspection helpers
165
- def comparison_operators = ComparisonFunctions.definitions.keys
166
- def math_operations = MathFunctions.definitions.keys
167
- def string_operations = StringFunctions.definitions.keys
168
- def logical_operations = LogicalFunctions.definitions.keys
169
- def collection_operations = CollectionFunctions.definitions.keys
170
- def conditional_operations = ConditionalFunctions.definitions.keys
171
- def type_operations = TypeFunctions.definitions.keys
172
- def stat_operations = StatFunctions.definitions.keys
173
- end
174
- end
175
- end
176
- end
data/lib/kumi/registry.rb DELETED
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kumi
4
- # Public facade for the function registry.
5
- # Delegates to Kumi::Core::FunctionRegistry.
6
- module Registry
7
- Entry = Core::FunctionRegistry::FunctionBuilder::Entry
8
- FrozenError = Core::FunctionRegistry::FrozenError
9
-
10
- class << self
11
- def auto_register(*mods)
12
- Core::FunctionRegistry.auto_register(*mods)
13
- end
14
-
15
- def method_missing(name, ...)
16
- if Core::FunctionRegistry.respond_to?(name)
17
- Core::FunctionRegistry.public_send(name, ...)
18
- else
19
- super
20
- end
21
- end
22
-
23
- def respond_to_missing?(name, include_private = false)
24
- Core::FunctionRegistry.respond_to?(name, include_private) || super
25
- end
26
-
27
- def freeze!
28
- Core::FunctionRegistry.freeze!
29
- end
30
- end
31
- end
32
- end
@@ -1,135 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kumi
4
- module Runtime
5
- # Executable / Reader: evaluation interface for compiled schemas
6
- #
7
- # BUILD:
8
- # - Executable.from_analysis(state) consumes:
9
- # * :ir_module (lowered IR)
10
- # * :access_plans (for AccessBuilder)
11
- # * function registry
12
- # - Builds accessor lambdas once per plan id.
13
- #
14
- # EVALUATION:
15
- # - program.read(inputs, mode: :public|:wrapped, target: nil)
16
- # * mode=:public → returns ā€œuser valuesā€ (scalars and plain Ruby arrays). Vec results are exposed as their lifted scalar.
17
- # * mode=:wrapped → returns internal VM structures for introspection:
18
- # - Scalars as {k: :scalar, v: ...}
19
- # - Vec twins available as :name__vec (and :name for lifted scalar)
20
- # * target: symbol → short-circuit after computing the requested declaration and its dependencies.
21
- #
22
- # NAMING & TWINS (TODO: we are not exposing for now):
23
- # - Every vectorized declaration with indices has:
24
- # * :name__vec → internal vec form (rows with idx)
25
- # * :name → lifted scalar form (nested arrays shaped by scope)
26
- # - only :name is visible (TODO: For now, we do not expose the twins)
27
- #
28
- # CACHING / MEMOIZATION:
29
- # - Values are computed once per evaluation; dependent requests reuse cached slots.
30
- #
31
- # ERROR SURFACE:
32
- # - VM errors are wrapped as Kumi::Core::Errors::RuntimeError with op context (decl/op index).
33
- # - Accessors raise descriptive KeyError for missing fields/arrays (policy-aware).
34
- #
35
- # DEBUGGING:
36
- # - DEBUG_LOWER=1 to print IR at build time
37
- # - DEBUG_VM_ARGS=1 to trace VM execution
38
- # - Accessors can be debugged independently with DEBUG_ACCESSOR_OPS=1
39
- class Executable
40
- def self.from_analysis(state, registry: nil, schema_name: nil)
41
- ir = state.fetch(:ir_module)
42
- access_plans = state.fetch(:access_plans)
43
- input_metadata = state[:input_metadata] || {}
44
- dependents = state[:dependents] || {}
45
- schedules = state[:ir_execution_schedules] || {}
46
-
47
- accessors = Dev::Profiler.phase("compiler.access_builder") do
48
- Kumi::Core::Compiler::AccessBuilder.build(access_plans)
49
- end
50
-
51
- access_meta = {}
52
-
53
- # access_plans.each_value do |plans|
54
- # plans.each do |p|
55
- # access_meta[p.accessor_key] = { mode: p.mode, scope: p.scope }
56
-
57
- # # Build precise field -> plan_ids mapping for invalidation
58
- # root_field = p.accessor_key.to_s.split(":").first.split(".").first.to_sym
59
- # field_to_plan_ids[root_field] << p.accessor_key
60
- # end
61
- # end
62
-
63
- # Use the internal functions hash that VM expects
64
- registry ||= Kumi::Registry.functions
65
- new(ir: ir, accessors: accessors, access_meta: access_meta, registry: registry,
66
- input_metadata: input_metadata, dependents: dependents,
67
- schema_name: schema_name, schedules: schedules)
68
- end
69
-
70
- def initialize(ir:, accessors:, access_meta:, registry:, input_metadata:, dependents: {}, schedules: {}, schema_name: nil)
71
- @ir = ir.freeze
72
- @acc = accessors.freeze
73
- @meta = access_meta.freeze
74
- @reg = registry
75
- @input_metadata = input_metadata.freeze
76
- @dependents = dependents.freeze
77
- @schema_name = schema_name
78
- @schedules = schedules
79
- @decl = @ir.decls.map { |d| [d.name, d] }.to_h
80
- @accessor_cache = {} # Persistent accessor cache across evaluations
81
- end
82
-
83
- def decl?(name) = @decl.key?(name)
84
-
85
- def read(input, mode: :ruby)
86
- Run.new(self, input, mode: mode, input_metadata: @input_metadata, dependents: @dependents, declarations: @decl.keys)
87
- end
88
-
89
- # API compatibility for backward compatibility
90
- def evaluate(ctx, *key_names)
91
- target_keys = key_names.empty? ? @decl.keys : validate_keys(key_names)
92
-
93
- # Handle context wrapping for backward compatibility
94
- input = ctx.respond_to?(:ctx) ? ctx.ctx : ctx
95
-
96
- target_keys.each_with_object({}) do |key, result|
97
- result[key] = eval_decl(key, input, mode: :ruby)
98
- end
99
- end
100
-
101
- def eval_decl(name, input, mode: :ruby, declaration_cache: {})
102
- raise Kumi::Core::Errors::RuntimeError, "unknown decl #{name}" unless decl?(name)
103
-
104
- schedule = @schedules[name]
105
- # If the caller asked for a specific binding, schedule deps once
106
-
107
- runtime = {
108
- accessor_cache: @accessor_cache,
109
- declaration_cache: declaration_cache, # run-local cache
110
- schema_name: @schema_name,
111
- target: name
112
- }
113
-
114
- out = Dev::Profiler.phase("vm.run", target: name) do
115
- Kumi::Core::IR::ExecutionEngine.run(schedule, input: input, runtime: runtime, accessors: @acc, registry: @reg).fetch(name)
116
- end
117
-
118
- mode == :ruby ? unwrap(@decl[name], out) : out
119
- end
120
-
121
- def unwrap(_decl, v)
122
- v[:k] == :scalar ? v[:v] : v # no grouping needed
123
- end
124
-
125
- private
126
-
127
- def validate_keys(keys)
128
- unknown_keys = keys - @decl.keys
129
- return keys if unknown_keys.empty?
130
-
131
- raise Kumi::Errors::RuntimeError, "No binding named #{unknown_keys.first}"
132
- end
133
- end
134
- end
135
- end
@@ -1,105 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kumi
4
- module Runtime
5
- class Run
6
- def initialize(program, input, mode:, input_metadata:, dependents:, declarations:)
7
- @program = program
8
- @input = input
9
- @mode = mode
10
- @input_metadata = input_metadata
11
- @declarations = declarations
12
- @dependents = dependents
13
- @cache = {}
14
- end
15
-
16
- def key?(name)
17
- @declarations.include? name
18
- end
19
-
20
- def get(name)
21
- unless @cache.key?(name)
22
- # Get the result in VM internal format
23
- vm_result = @program.eval_decl(name, @input, mode: :wrapped, declaration_cache: @cache)
24
- # Store VM format for cross-VM caching
25
- @cache[name] = vm_result
26
- end
27
-
28
- # Convert to requested format when returning
29
- vm_result = @cache[name]
30
- @mode == :wrapped ? vm_result : @program.unwrap(nil, vm_result)
31
- end
32
-
33
- def to_h
34
- slice(*@declarations)
35
- end
36
-
37
- def [](name)
38
- get(name)
39
- end
40
-
41
- def slice(*keys)
42
- return {} if keys.empty?
43
-
44
- keys.each_with_object({}) { |key, result| result[key] = get(key) }
45
- end
46
-
47
- def compiled_schema
48
- @program
49
- end
50
-
51
- def method_missing(sym, *args, **kwargs, &)
52
- return super unless args.empty? && kwargs.empty? && key?(sym)
53
-
54
- get(sym)
55
- end
56
-
57
- def respond_to_missing?(sym, priv = false)
58
- key?(sym) || super
59
- end
60
-
61
- def update(**changes)
62
- affected_declarations = Set.new
63
-
64
- changes.each do |field, value|
65
- raise ArgumentError, "unknown input field: #{field}" unless input_field_exists?(field)
66
-
67
- validate_domain_constraint(field, value)
68
-
69
- @input[field] = value
70
- if (deps = @dependents[field])
71
- deps.each { |d| @cache.delete(d) }
72
- end
73
- end
74
-
75
- self
76
- end
77
-
78
- private
79
-
80
- def input_field_exists?(field)
81
- # Check if field is declared in input block
82
- @input_metadata.key?(field)
83
- end
84
-
85
- def validate_domain_constraint(field, value)
86
- field_meta = @input_metadata[field]
87
- return unless field_meta&.dig(:domain)
88
-
89
- domain = field_meta[:domain]
90
- return unless violates_domain?(value, domain)
91
-
92
- raise ArgumentError, "value #{value} is not in domain #{domain}"
93
- end
94
-
95
- def violates_domain?(value, domain)
96
- case domain
97
- when Range, Array
98
- !domain.include?(value)
99
- else
100
- false
101
- end
102
- end
103
- end
104
- end
105
- end
@@ -1,63 +0,0 @@
1
- === MIXED NESTING SCHEMA PERFORMANCE TEST ===
2
- Test run: 2025-08-21 01:31:06 -0300
3
- Ruby version: 3.3.8
4
-
5
- āœ… Schema loaded successfully
6
-
7
- === COMPILATION PERFORMANCE ===
8
-
9
- Tiny ( 1 items): 2.47ms
10
- Small ( 4 items): 3.67ms
11
- Medium ( 25 items): 1.86ms
12
- Large (100 items): 1.92ms
13
- XLarge (200 items): 2.96ms
14
- Huge (250 items): 2.0ms
15
-
16
- === EXECUTION PERFORMANCE ===
17
-
18
- Tiny ( 1 items): avg= 0.54ms, throughput= 1.8 items/ms
19
- Small ( 4 items): avg= 0.64ms, throughput= 6.2 items/ms
20
- Medium ( 25 items): avg= 1.15ms, throughput= 21.8 items/ms
21
- Large (100 items): avg= 3.61ms, throughput= 27.7 items/ms
22
- XLarge (200 items): avg= 7.25ms, throughput= 27.6 items/ms
23
- Huge (250 items): avg= 11.8ms, throughput= 21.2 items/ms
24
-
25
- === SCALING ANALYSIS ===
26
-
27
- 50 items: 0.87ms (57.2 items/ms)
28
- 100 items: 1.45ms (68.9 items/ms)
29
- 200 items: 2.85ms (70.3 items/ms)
30
- 400 items: 5.75ms (69.6 items/ms)
31
- 800 items: 15.16ms (52.8 items/ms)
32
-
33
- === MEMORY ANALYSIS ===
34
-
35
- Iteration 0: RSS=35472KB (Δ256KB)
36
- Iteration 3: RSS=35472KB (Δ256KB)
37
- Iteration 6: RSS=35472KB (Δ256KB)
38
- Iteration 9: RSS=35472KB (Δ256KB)
39
-
40
- === SAMPLE OUTPUT VALIDATION ===
41
-
42
- org_name: Global Corp
43
- region_names: ["Region 1", "Region 2"]
44
- total_capacity: [147, 173]
45
- org_classification: Enterprise
46
-
47
- === PERFORMANCE BOTTLENECKS IDENTIFIED ===
48
-
49
- 1. Deep nesting (5+ levels) creates complex IR with many lift operations
50
- 2. Each nested access requires scope transitions
51
- 3. Compilation cold start: ~80ms first time
52
- 4. Linear scaling with data size is expected behavior
53
- 5. Memory usage is stable (no leaks detected)
54
-
55
- === RECOMMENDATIONS ===
56
-
57
- • For production: Cache compiled schemas to avoid cold start
58
- • For large datasets: Consider schema restructuring to reduce nesting
59
- • Current performance acceptable for <1000 items
60
- • Deep nesting workable but monitor performance with >10,000 items
61
-
62
- Test completed at: 2025-08-21 01:31:06 -0300
63
- Total runtime: 0.37s
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "json"
5
-
6
- coverage_file = "coverage/.resultset.json"
7
-
8
- unless File.exist?(coverage_file)
9
- puts "āŒ No coverage data found. Run tests first:"
10
- puts " COVERAGE=true bundle exec rspec"
11
- exit 1
12
- end
13
-
14
- data = JSON.parse(File.read(coverage_file))
15
- coverage = data.values.first["coverage"]
16
-
17
- broadcast_file = coverage.find { |file, _| file.include?("broadcast_detector.rb") }
18
-
19
- if broadcast_file
20
- file_path, line_data = broadcast_file
21
- lines = line_data["lines"]
22
-
23
- puts "šŸ” BroadcastDetector Coverage Analysis:"
24
- puts "File: #{File.basename(file_path)}"
25
-
26
- total_lines = lines.count { |hits| !hits.nil? }
27
- covered_lines = lines.count { |hits| hits && hits > 0 }
28
- coverage_percent = (covered_lines.to_f / total_lines * 100).round(1)
29
-
30
- puts "Coverage: #{coverage_percent}% (#{covered_lines}/#{total_lines} lines)"
31
-
32
- # Find uncovered method definitions
33
- file_content = File.read(file_path)
34
- uncovered_methods = []
35
- covered_methods = []
36
-
37
- file_content.lines.each_with_index do |line, i|
38
- if line.match?(/^\s*def\s+(\w+)/)
39
- method_name = line.match(/^\s*def\s+(\w+)/)[1]
40
- line_hits = lines[i]
41
-
42
- if line_hits.nil?
43
- # Line not tracked
44
- elsif line_hits == 0
45
- uncovered_methods << "#{method_name} (line #{i+1})"
46
- else
47
- covered_methods << "#{method_name} (line #{i+1})"
48
- end
49
- end
50
- end
51
-
52
- puts "\nšŸ“Š Method Coverage Summary:"
53
- puts " Total methods: #{covered_methods.length + uncovered_methods.length}"
54
- puts " Covered methods: #{covered_methods.length}"
55
- puts " Uncovered methods: #{uncovered_methods.length}"
56
-
57
- if uncovered_methods.any?
58
- puts "\n🚨 Uncovered methods (potential dead code):"
59
- uncovered_methods.each { |m| puts " - #{m}" }
60
- end
61
-
62
- if covered_methods.any?
63
- puts "\nāœ… Covered methods:"
64
- covered_methods.each { |m| puts " - #{m}" }
65
- end
66
- else
67
- puts "āŒ BroadcastDetector file not found in coverage data"
68
- end
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "json"
5
-
6
- coverage_file = "coverage/.resultset.json"
7
- target_file = "cascade_executor_builder.rb"
8
-
9
- unless File.exist?(coverage_file)
10
- puts "āŒ No coverage data found. Run tests first"
11
- exit 1
12
- end
13
-
14
- data = JSON.parse(File.read(coverage_file))
15
- coverage = data.values.first["coverage"]
16
-
17
- file_entry = coverage.find { |file, _| file.include?(target_file) }
18
-
19
- if file_entry
20
- file_path, line_data = file_entry
21
- lines = line_data["lines"]
22
-
23
- puts "šŸ” CascadeExecutorBuilder Method Coverage:"
24
- puts "=" * 50
25
-
26
- file_content = File.read(file_path)
27
- methods = []
28
-
29
- file_content.lines.each_with_index do |line, i|
30
- if line.match?(/^\s*def\s+/)
31
- method_match = line.match(/^\s*def\s+(self\.)?(\w+)/)
32
- if method_match
33
- method_name = method_match[2]
34
- is_class_method = !method_match[1].nil?
35
- line_hits = lines[i]
36
-
37
- status = if line_hits.nil?
38
- "⚪ NOT TRACKED"
39
- elsif line_hits == 0
40
- "🚨 UNCOVERED"
41
- else
42
- "āœ… COVERED (#{line_hits} hits)"
43
- end
44
-
45
- prefix = is_class_method ? "self." : ""
46
- methods << {
47
- name: "#{prefix}#{method_name}",
48
- line: i + 1,
49
- hits: line_hits,
50
- status: status
51
- }
52
- end
53
- end
54
- end
55
-
56
- methods.each do |method|
57
- printf " %-25s (line %3d) %s\n", method[:name], method[:line], method[:status]
58
- end
59
-
60
- uncovered = methods.select { |m| m[:hits] == 0 }
61
- covered = methods.select { |m| m[:hits] && m[:hits] > 0 }
62
-
63
- puts "\nšŸ“Š Summary:"
64
- puts " Total methods: #{methods.length}"
65
- puts " Covered: #{covered.length}"
66
- puts " Uncovered: #{uncovered.length}"
67
-
68
- if uncovered.any?
69
- puts "\n🚨 Uncovered methods (potential dead code):"
70
- uncovered.each { |m| puts " #{m[:name]} (line #{m[:line]})" }
71
- end
72
- else
73
- puts "āŒ #{target_file} not found in coverage data"
74
- end
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "json"
5
-
6
- coverage_file = "coverage/.resultset.json"
7
-
8
- unless File.exist?(coverage_file)
9
- puts "āŒ No coverage data found. Run tests first"
10
- exit 1
11
- end
12
-
13
- data = JSON.parse(File.read(coverage_file))
14
- coverage = data.values.first["coverage"]
15
-
16
- broadcasting_files = [
17
- "cascade_executor_builder.rb",
18
- "vectorized_function_builder.rb",
19
- "nested_structure_utils.rb",
20
- "broadcast_detector.rb"
21
- ]
22
-
23
- puts "šŸ” Broadcasting Files Coverage:"
24
- puts "=" * 60
25
-
26
- broadcasting_files.each do |filename|
27
- file_entry = coverage.find { |file, _| file.include?(filename) }
28
-
29
- if file_entry
30
- file_path, line_data = file_entry
31
- lines = line_data["lines"]
32
-
33
- total_lines = lines.count { |hits| !hits.nil? }
34
- covered_lines = lines.count { |hits| hits && hits > 0 }
35
- coverage_percent = total_lines > 0 ? (covered_lines.to_f / total_lines * 100).round(1) : 0
36
-
37
- status = if coverage_percent == 0
38
- "🚨 DEAD"
39
- elsif coverage_percent < 20
40
- "šŸ”“ LOW"
41
- elsif coverage_percent < 50
42
- "🟔 MEDIUM"
43
- else
44
- "āœ… GOOD"
45
- end
46
-
47
- printf "%-35s %s %6.1f%% (%d/%d lines)\n", filename, status, coverage_percent, covered_lines, total_lines
48
- else
49
- printf "%-35s āŒ NOT FOUND\n", filename
50
- end
51
- end