hecks 2.9.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (600) hide show
  1. checksums.yaml +4 -4
  2. data/exe/hecks +51 -6
  3. data/lib/hecks/adapters/driven/heki/journal.rb +1 -1
  4. data/lib/hecks/adapters/driven/lambda/client.rb +1 -1
  5. data/lib/hecks/adapters/driven/lambda.rb +1 -1
  6. data/lib/hecks/adapters/driven/memory.rb +16 -3
  7. data/lib/hecks/adapters/driven/postgres/reconnect.rb +6 -2
  8. data/lib/hecks/adapters/driven/postgres/shared_connection.rb +180 -0
  9. data/lib/hecks/adapters/driven/postgres.rb +4 -2
  10. data/lib/hecks/adapters/driven/prism.rb +41 -8
  11. data/lib/hecks/adapters/driven/tenant_provisioner.rb +73 -16
  12. data/lib/hecks/behaviors/expectations.rb +1 -1
  13. data/lib/hecks/behaviors.rb +1 -1
  14. data/lib/hecks/bench/cli.rb +62 -0
  15. data/lib/hecks/bench/environment.rb +71 -0
  16. data/lib/hecks/bench/postgres_probe.rb +30 -0
  17. data/lib/hecks/bench/report.rb +76 -0
  18. data/lib/hecks/bench/ruby_runner.rb +93 -0
  19. data/lib/hecks/bench/run.rb +55 -0
  20. data/lib/hecks/bench/rust_runner.rb +101 -0
  21. data/lib/hecks/bench/stats.rb +46 -0
  22. data/lib/hecks/bench/suite.rb +98 -0
  23. data/lib/hecks/bench/workload.rb +89 -0
  24. data/lib/hecks/bench.rb +17 -0
  25. data/lib/hecks/bluebook/assembly/contracts.rb +2 -0
  26. data/lib/hecks/bluebook/attribute.rb +1 -1
  27. data/lib/hecks/bluebook/behaviour/aggregate.rb +30 -1
  28. data/lib/hecks/bluebook/behaviour/domain_port.rb +7 -0
  29. data/lib/hecks/bluebook/chapter.rb +6 -2
  30. data/lib/hecks/bluebook/domain_port.rb +36 -5
  31. data/lib/hecks/bluebook/dsl/bluebook_builder/validation.rb +10 -0
  32. data/lib/hecks/bluebook/dsl/bluebook_builder.rb +8 -0
  33. data/lib/hecks/bluebook/dsl/bootstrap_table.rb +2 -1
  34. data/lib/hecks/bluebook/dsl/domain_port_builder.rb +31 -3
  35. data/lib/hecks/bluebook/dsl/hecksagon_builder.rb +122 -3
  36. data/lib/hecks/bluebook/dsl/lifecycle_builder.rb +1 -1
  37. data/lib/hecks/bluebook/dsl/query_builder.rb +27 -1
  38. data/lib/hecks/bluebook/dsl/rule_reference.rb +1 -1
  39. data/lib/hecks/bluebook/dsl/world_builder.rb +29 -2
  40. data/lib/hecks/bluebook/expression/canonical_form.rb +1 -1
  41. data/lib/hecks/bluebook/expression/resolver.rb +3 -2
  42. data/lib/hecks/bluebook/hexagon.rb +13 -5
  43. data/lib/hecks/bluebook/meta_validator/reconstruction.rb +1 -0
  44. data/lib/hecks/bluebook/meta_validator/syntax_boot.rb +4 -1
  45. data/lib/hecks/bluebook/meta_validator/verdict_cache.rb +246 -0
  46. data/lib/hecks/bluebook/meta_validator.rb +9 -4
  47. data/lib/hecks/bluebook/model_check.rb +23 -0
  48. data/lib/hecks/bluebook/pattern_subset.rb +38 -0
  49. data/lib/hecks/bluebook/query.rb +20 -5
  50. data/lib/hecks/bluebook/smoke_test.rb +1 -1
  51. data/lib/hecks/canonical_json.rb +30 -0
  52. data/lib/hecks/chapters.rb +102 -0
  53. data/lib/hecks/cli/behaviors.rb +61 -0
  54. data/lib/hecks/cli/canonicalise.rb +25 -0
  55. data/lib/hecks/cli/check_engine_agreement.rb +32 -0
  56. data/lib/hecks/cli/check_era.rb +88 -0
  57. data/lib/hecks/cli/console.rb +66 -0
  58. data/lib/hecks/cli/deploy_template_diff.rb +40 -0
  59. data/lib/hecks/cli/doc_coverage.rb +32 -0
  60. data/lib/hecks/cli/document.rb +2 -2
  61. data/lib/hecks/cli/expression_projection.rb +41 -0
  62. data/lib/hecks/cli/follow.rb +88 -0
  63. data/lib/hecks/cli/history.rb +44 -0
  64. data/lib/hecks/cli/ir.rb +1 -1
  65. data/lib/hecks/cli/mcp.rb +3 -3
  66. data/lib/hecks/cli/model_check.rb +7 -4
  67. data/lib/hecks/cli/pattern_cases.rb +47 -0
  68. data/lib/hecks/cli/present.rb +39 -0
  69. data/lib/hecks/cli/project_cli.rb +224 -32
  70. data/lib/hecks/cli/project_diagrams.rb +4 -3
  71. data/lib/hecks/cli/project_glossary.rb +44 -0
  72. data/lib/hecks/cli/reference.rb +46 -0
  73. data/lib/hecks/cli/refresh_projections.rb +44 -0
  74. data/lib/hecks/cli/refresh_rspec_runtime_baseline.rb +150 -0
  75. data/lib/hecks/cli/release.rb +70 -0
  76. data/lib/hecks/cli/release_gem.rb +59 -0
  77. data/lib/hecks/cli/rspec_io_parallel_files.rb +137 -0
  78. data/lib/hecks/cli/rspec_shard_files.rb +66 -0
  79. data/lib/hecks/cli/run.rb +3 -3
  80. data/lib/hecks/cli/seed_semantics_corpus.rb +71 -0
  81. data/lib/hecks/cli/serve_query_ir_mcp.rb +30 -0
  82. data/lib/hecks/cli/shape.rb +70 -0
  83. data/lib/hecks/cli/smoke_http.rb +230 -0
  84. data/lib/hecks/cli/smoke_test.rb +5 -3
  85. data/lib/hecks/cli/spec_example.rb +27 -0
  86. data/lib/hecks/cli/statements.rb +32 -0
  87. data/lib/hecks/cli/stores.rb +4 -5
  88. data/lib/hecks/cli/stress_concurrency_specs.rb +177 -0
  89. data/lib/hecks/cli.rb +201 -52
  90. data/lib/hecks/codemod.rb +324 -0
  91. data/lib/hecks/corpus.rb +423 -0
  92. data/lib/hecks/deploy/bluebook/deploy.bluebook +591 -23
  93. data/lib/hecks/deploy/bluebook/deploy.hecksagon +41 -4
  94. data/lib/hecks/deploy/oidc.json +82 -2
  95. data/lib/hecks/doc/reference.rb +351 -0
  96. data/lib/hecks/doors/cli_door.rb +196 -0
  97. data/lib/hecks/doors/cli_runner.rb +297 -0
  98. data/lib/hecks/{facade → doors}/command_request.rb +1 -1
  99. data/lib/hecks/{facade → doors}/handle.rb +2 -2
  100. data/lib/hecks/{facade → doors}/json_door.rb +4 -4
  101. data/lib/hecks/doors/launcher_options.rb +129 -0
  102. data/lib/hecks/{cli → doors}/mcp_door.rb +7 -7
  103. data/lib/hecks/doors/mcp_door_scope.rb +97 -0
  104. data/lib/hecks/{facade/surface → doors/ruby_door}/aggregate_door.rb +8 -3
  105. data/lib/hecks/{facade/surface → doors/ruby_door}/chapter.rb +3 -3
  106. data/lib/hecks/{facade/surface.rb → doors/ruby_door.rb} +36 -5
  107. data/lib/hecks/doors.rb +61 -0
  108. data/lib/hecks/embryonaut_bluebook/vendor_cli.rb +1 -1
  109. data/lib/hecks/embryonaut_bluebook.rb +1 -1
  110. data/lib/hecks/engine_agreement.rb +156 -0
  111. data/lib/hecks/facade.rb +24 -37
  112. data/lib/hecks/forms/app.rb +6 -6
  113. data/lib/hecks/forms/banking_presentation.rb +50 -0
  114. data/lib/hecks/forms/field_shape.rb +2 -1
  115. data/lib/hecks/forms/port_argument.rb +1 -1
  116. data/lib/hecks/fuzzing/bounded_exhaustive_expressions.rb +393 -0
  117. data/lib/hecks/fuzzing/combination_miner.rb +86 -0
  118. data/lib/hecks/fuzzing/concurrent_dispatch.rb +214 -0
  119. data/lib/hecks/fuzzing/coverage_campaign.rb +143 -0
  120. data/lib/hecks/fuzzing/differential.rb +156 -0
  121. data/lib/hecks/fuzzing/domain_generator.rb +615 -0
  122. data/lib/hecks/fuzzing/era_boundary.rb +71 -0
  123. data/lib/hecks/fuzzing/form_census.rb +136 -0
  124. data/lib/hecks/fuzzing/generated_domain_check.rb +93 -0
  125. data/lib/hecks/fuzzing/invalid_value_generator.rb +64 -0
  126. data/lib/hecks/fuzzing/isolated_boot.rb +301 -0
  127. data/lib/hecks/fuzzing/nondeterministic.rb +51 -0
  128. data/lib/hecks/fuzzing/outside_world.rb +45 -0
  129. data/lib/hecks/fuzzing/persistence_parity.rb +102 -0
  130. data/lib/hecks/fuzzing/properties/corrections.rb +88 -0
  131. data/lib/hecks/fuzzing/properties/dispatch_and_mutations.rb +314 -0
  132. data/lib/hecks/fuzzing/properties/guards.rb +190 -0
  133. data/lib/hecks/fuzzing/properties/invariants_and_aggregation.rb +300 -0
  134. data/lib/hecks/fuzzing/properties/lifecycle_and_replay.rb +93 -0
  135. data/lib/hecks/fuzzing/properties/outbox.rb +89 -0
  136. data/lib/hecks/fuzzing/properties/querying.rb +175 -0
  137. data/lib/hecks/fuzzing/properties.rb +162 -0
  138. data/lib/hecks/fuzzing/qa_settings.rb +123 -0
  139. data/lib/hecks/fuzzing/replay.rb +505 -0
  140. data/lib/hecks/fuzzing/rotation_priority.rb +48 -0
  141. data/lib/hecks/fuzzing/rust_gap_manifest.rb +108 -0
  142. data/lib/hecks/fuzzing/self_consistency.rb +339 -0
  143. data/lib/hecks/fuzzing/sequence_generator/adversary.rb +385 -0
  144. data/lib/hecks/fuzzing/sequence_generator/catalog.rb +132 -0
  145. data/lib/hecks/fuzzing/sequence_generator/outcome_tracker.rb +95 -0
  146. data/lib/hecks/fuzzing/sequence_generator/picker.rb +77 -0
  147. data/lib/hecks/fuzzing/sequence_generator/query_binding.rb +109 -0
  148. data/lib/hecks/fuzzing/sequence_generator/step_builder.rb +237 -0
  149. data/lib/hecks/fuzzing/sequence_generator.rb +189 -0
  150. data/lib/hecks/fuzzing/shrinker.rb +166 -0
  151. data/lib/hecks/fuzzing/structural_skips.rb +33 -0
  152. data/lib/hecks/fuzzing/sweep_depth.rb +43 -0
  153. data/lib/hecks/fuzzing/target_capabilities.rb +163 -0
  154. data/lib/hecks/fuzzing/value_generator.rb +216 -0
  155. data/lib/hecks/fuzzing.rb +23 -0
  156. data/lib/hecks/grammar/evolve.rb +336 -0
  157. data/lib/hecks/hecks/adapters/codebase/codemods.rb +45 -0
  158. data/lib/hecks/hecks/adapters/codebase/conformance.rb +71 -0
  159. data/lib/hecks/hecks/adapters/codebase/corpus_tasks.rb +202 -0
  160. data/lib/hecks/hecks/adapters/codebase/gem_registry.rb +80 -0
  161. data/lib/hecks/hecks/adapters/codebase/kernel_tables.rb +54 -0
  162. data/lib/hecks/hecks/adapters/codebase/language.rb +240 -0
  163. data/lib/hecks/hecks/adapters/codebase/npm_registry.rb +102 -0
  164. data/lib/hecks/hecks/adapters/codebase/publishing.rb +142 -0
  165. data/lib/hecks/hecks/adapters/codebase/regeneration.rb +67 -0
  166. data/lib/hecks/hecks/adapters/codebase/release_facts.rb +90 -0
  167. data/lib/hecks/hecks/adapters/codebase/ruby_child.rb +83 -0
  168. data/lib/hecks/hecks/adapters/codebase/secret_vault.rb +36 -0
  169. data/lib/hecks/hecks/adapters/codebase/source_tree.adapter +7 -0
  170. data/lib/hecks/hecks/adapters/codebase/source_tree.rb +189 -0
  171. data/lib/hecks/hecks/adapters/codebase/sqlite_fixture.rb +71 -0
  172. data/lib/hecks/hecks/adapters/codebase/style.rb +171 -0
  173. data/lib/hecks/hecks/adapters/codebase/test_runner.rb +55 -0
  174. data/lib/hecks/hecks/adapters/codebase/test_suite.rb +165 -0
  175. data/lib/hecks/hecks/adapters/codebase/tree.rb +111 -0
  176. data/lib/hecks/hecks/adapters/console_capture.rb +79 -0
  177. data/lib/hecks/hecks/adapters/deploy_toolchain.adapter +7 -0
  178. data/lib/hecks/hecks/adapters/deploy_toolchain.rb +108 -0
  179. data/lib/hecks/hecks/adapters/git.adapter +7 -0
  180. data/lib/hecks/hecks/adapters/git.rb +102 -0
  181. data/lib/hecks/hecks/adapters/host_http.adapter +7 -0
  182. data/lib/hecks/hecks/adapters/host_http.rb +65 -0
  183. data/lib/hecks/hecks/adapters/in_process_boot.adapter +7 -0
  184. data/lib/hecks/hecks/adapters/in_process_boot.rb +197 -0
  185. data/lib/hecks/hecks/adapters/in_process_operations.rb +202 -0
  186. data/lib/hecks/hecks/adapters/journal_store/changes.rb +143 -0
  187. data/lib/hecks/hecks/adapters/journal_store/compaction.rb +145 -0
  188. data/lib/hecks/hecks/adapters/journal_store/edge_audit.rb +132 -0
  189. data/lib/hecks/hecks/adapters/journal_store/examination.rb +135 -0
  190. data/lib/hecks/hecks/adapters/journal_store/held_domain.rb +163 -0
  191. data/lib/hecks/hecks/adapters/journal_store/readings.rb +187 -0
  192. data/lib/hecks/hecks/adapters/journal_store.adapter +7 -0
  193. data/lib/hecks/hecks/adapters/journal_store.rb +64 -0
  194. data/lib/hecks/hecks/adapters/local_files.adapter +7 -0
  195. data/lib/hecks/hecks/adapters/local_files.rb +46 -0
  196. data/lib/hecks/hecks/adapters/pg_admin.adapter +7 -0
  197. data/lib/hecks/hecks/adapters/pg_admin.rb +245 -0
  198. data/lib/hecks/hecks/adapters/process_pool.adapter +7 -0
  199. data/lib/hecks/hecks/adapters/process_pool.rb +119 -0
  200. data/lib/hecks/hecks/adapters/rust_toolchain.adapter +7 -0
  201. data/lib/hecks/hecks/adapters/rust_toolchain.rb +179 -0
  202. data/lib/hecks/hecks/adapters/rust_workspace.rb +150 -0
  203. data/lib/hecks/hecks/adapters/shell.adapter +7 -0
  204. data/lib/hecks/hecks/adapters/shell.rb +49 -0
  205. data/lib/hecks/hecks/adapters/terminal.adapter +7 -0
  206. data/lib/hecks/hecks/adapters/terminal.rb +74 -0
  207. data/lib/hecks/hecks/codebase.behaviors +172 -0
  208. data/lib/hecks/hecks/codebase.bluebook +2453 -0
  209. data/lib/hecks/hecks/context_map.hecksagon +13 -0
  210. data/lib/hecks/hecks/custodian.behaviors +179 -0
  211. data/lib/hecks/hecks/custodian.bluebook +1847 -0
  212. data/lib/hecks/hecks/deploy.behaviors +74 -0
  213. data/lib/hecks/hecks/deploy.world +12 -0
  214. data/lib/hecks/hecks/environments/memory.world +10 -0
  215. data/lib/hecks/hecks/governance.world +7 -0
  216. data/lib/hecks/hecks/hecks.behaviors +62 -0
  217. data/lib/hecks/hecks/hecks.bluebook +124 -0
  218. data/lib/hecks/hecks/hecks.hecksagon +390 -0
  219. data/lib/hecks/hecks/hecks.world +42 -0
  220. data/lib/hecks/kernel_capabilities.rb +194 -0
  221. data/lib/hecks/language/bluebook/bluebook.bluebook +11 -0
  222. data/lib/hecks/language/bluebook/query.bluebook +7 -0
  223. data/lib/hecks/language/bluebook/vocabulary.bluebook +4 -4
  224. data/lib/hecks/language/hecksagon/domain_port.bluebook +10 -0
  225. data/lib/hecks/language/hecksagon/hecksagon.bluebook +20 -0
  226. data/lib/hecks/mcp_stdio_guard.rb +2 -2
  227. data/lib/hecks/persistence_legacy_fixture/regenerate.rb +161 -0
  228. data/lib/hecks/persistence_legacy_fixture.rb +113 -0
  229. data/lib/hecks/ports/persistence/plugins/era/era_check.rb +8 -5
  230. data/lib/hecks/ports/persistence/plugins/era/era_guard.rb +4 -1
  231. data/lib/hecks/ports/persistence/plugins/era/expected_era.rb +15 -2
  232. data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/era_store.rb +1 -1
  233. data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage/tail_merge.rb +1 -1
  234. data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/merge_coordinator.rb +1 -1
  235. data/lib/hecks/ports/persistence/plugins/era/postgres_era/lineage_manager/minter.rb +32 -15
  236. data/lib/hecks/ports/persistence/plugins/era/postgres_era.rb +6 -3
  237. data/lib/hecks/ports/persistence/plugins/era/translation/approval_file.rb +227 -0
  238. data/lib/hecks/ports/persistence/plugins/era/translation/audit/approval_digest.rb +1 -1
  239. data/lib/hecks/ports/persistence/plugins/era/translation/reattest.rb +43 -24
  240. data/lib/hecks/ports/persistence/plugins/era/translation.rb +1 -0
  241. data/lib/hecks/ports/persistence/state_codec.rb +24 -5
  242. data/lib/hecks/projection_files.rb +285 -0
  243. data/lib/hecks/projections/bootstrap_table.rb +1 -1
  244. data/lib/hecks/projections/deploy/fargate.rb +5 -5
  245. data/lib/hecks/projections/deploy/lambda.rb +43 -32
  246. data/lib/hecks/projections/deploy/preview/preview.sh.erb +1 -1
  247. data/lib/hecks/projections/deploy/preview/template.rb +1 -1
  248. data/lib/hecks/projections/deploy/scripts/deploy-service.sh.tmpl +1 -1
  249. data/lib/hecks/projections/deploy/scripts/expected-era.header +1 -1
  250. data/lib/hecks/projections/deploy/scripts/hosting.mk.tmpl +3 -3
  251. data/lib/hecks/projections/deploy/scripts/smoke-after-deploy.sh.tmpl +1 -1
  252. data/lib/hecks/projections/deploy/shared.rb +1 -1
  253. data/lib/hecks/projections/diagrams.rb +3 -3
  254. data/lib/hecks/projections/model/deviations.rb +1 -1
  255. data/lib/hecks/projections/parser_table.rb +4 -4
  256. data/lib/hecks/projections/reference.rb +2 -3
  257. data/lib/hecks/projections/rust_vocabulary.rb +1 -1
  258. data/lib/hecks/projector/cli_projector.rb +106 -37
  259. data/lib/hecks/projector.rb +1 -1
  260. data/lib/hecks/quality_control/adapters/agent.adapter +7 -0
  261. data/lib/hecks/quality_control/adapters/agent.rb +58 -0
  262. data/lib/hecks/quality_control/adapters/angle_tools.adapter +7 -0
  263. data/lib/hecks/quality_control/adapters/angle_tools.rb +15 -0
  264. data/lib/hecks/quality_control/adapters/clearance_recorder.rb +36 -0
  265. data/lib/hecks/quality_control/adapters/clearance_tools.adapter +7 -0
  266. data/lib/hecks/quality_control/adapters/clearance_tools.rb +17 -0
  267. data/lib/hecks/quality_control/adapters/git_pr.adapter +7 -0
  268. data/lib/hecks/quality_control/adapters/git_pr.rb +226 -0
  269. data/lib/hecks/quality_control/adapters/github_checks.adapter +9 -0
  270. data/lib/hecks/quality_control/adapters/github_checks.rb +83 -0
  271. data/lib/hecks/quality_control/adapters/github_ci_webhook.rb +56 -0
  272. data/lib/hecks/quality_control/adapters/github_issues.adapter +7 -0
  273. data/lib/hecks/quality_control/adapters/github_issues.rb +49 -0
  274. data/lib/hecks/quality_control/adapters/qa_tool.rb +59 -0
  275. data/lib/hecks/quality_control/adapters/sweep_tools.adapter +7 -0
  276. data/lib/hecks/quality_control/adapters/sweep_tools.rb +51 -0
  277. data/lib/hecks/quality_control/adapters/target_tools.adapter +7 -0
  278. data/lib/hecks/quality_control/adapters/target_tools.rb +43 -0
  279. data/lib/hecks/quality_control/cli/child.rb +45 -0
  280. data/lib/hecks/quality_control/cli/qa_concurrency_racer.rb +45 -0
  281. data/lib/hecks/quality_control/cli/qa_discover_external_domains.rb +248 -0
  282. data/lib/hecks/quality_control/cli/qa_domain_novelty.rb +163 -0
  283. data/lib/hecks/quality_control/cli/qa_generated_domains.rb +450 -0
  284. data/lib/hecks/quality_control/cli/qa_log_bug.rb +195 -0
  285. data/lib/hecks/quality_control/cli/qa_mine_combinations.rb +220 -0
  286. data/lib/hecks/quality_control/cli/qa_open_pr.rb +305 -0
  287. data/lib/hecks/quality_control/cli/qa_postgres_migrate.rb +154 -0
  288. data/lib/hecks/quality_control/cli/qa_postgres_role.rb +159 -0
  289. data/lib/hecks/quality_control/cli/qa_pr_check.rb +232 -0
  290. data/lib/hecks/quality_control/cli/qa_seed_angles.rb +142 -0
  291. data/lib/hecks/quality_control/cli/qa_seed_targets.rb +69 -0
  292. data/lib/hecks/quality_control/cli/qa_sweep/all_mode.rb +280 -0
  293. data/lib/hecks/quality_control/cli/qa_sweep/checks.rb +329 -0
  294. data/lib/hecks/quality_control/cli/qa_sweep/dials.rb +92 -0
  295. data/lib/hecks/quality_control/cli/qa_sweep/finding_report.rb +117 -0
  296. data/lib/hecks/quality_control/cli/qa_sweep/parsing.rb +175 -0
  297. data/lib/hecks/quality_control/cli/qa_sweep/release_mode.rb +60 -0
  298. data/lib/hecks/quality_control/cli/qa_sweep.rb +611 -0
  299. data/lib/hecks/quality_control/cli/qa_tick.rb +274 -0
  300. data/lib/hecks/quality_control/quality_control.bluebook +2224 -0
  301. data/lib/hecks/quality_control/quality_control.hecksagon +13 -0
  302. data/lib/hecks/quality_control/quality_control.ports.hecksagon +54 -0
  303. data/lib/hecks/query_ir.rb +346 -0
  304. data/lib/hecks/query_ir_mcp.rb +198 -0
  305. data/lib/hecks/release/runner/ci_publisher.rb +2 -2
  306. data/lib/hecks/release/runner/clean_tree.rb +42 -0
  307. data/lib/hecks/release/runner/console.rb +6 -0
  308. data/lib/hecks/release/runner/gem_publisher.rb +14 -7
  309. data/lib/hecks/release/runner/npm_publisher.rb +6 -36
  310. data/lib/hecks/release/runner/preflight.rb +26 -2
  311. data/lib/hecks/release/runner/published.rb +8 -26
  312. data/lib/hecks/release/runner/tagger.rb +30 -15
  313. data/lib/hecks/release/runner.rb +57 -6
  314. data/lib/hecks/router/namespace_installer.rb +3 -3
  315. data/lib/hecks/runtime/adapter_lookup.rb +124 -0
  316. data/lib/hecks/runtime/command_interpreter/mutation_applier.rb +4 -0
  317. data/lib/hecks/runtime/dependency_planning.rb +20 -2
  318. data/lib/hecks/runtime/dispatcher.rb +53 -3
  319. data/lib/hecks/runtime/interpreting.rb +3 -0
  320. data/lib/hecks/runtime/loader.rb +65 -12
  321. data/lib/hecks/runtime/outbox.rb +1 -1
  322. data/lib/hecks/runtime/policy_interpreter.rb +5 -2
  323. data/lib/hecks/runtime/port_operation_interpreter.rb +2 -10
  324. data/lib/hecks/runtime/query_interpreter.rb +77 -0
  325. data/lib/hecks/runtime/reaction_outcome.rb +89 -0
  326. data/lib/hecks/runtime/refusal_wording.rb +23 -1
  327. data/lib/hecks/runtime/registry/verification.rb +163 -4
  328. data/lib/hecks/runtime/registry.rb +57 -3
  329. data/lib/hecks/runtime/remote_dispatcher.rb +31 -2
  330. data/lib/hecks/runtime/value/coercion.rb +23 -135
  331. data/lib/hecks/runtime/value/field_checks.rb +172 -0
  332. data/lib/hecks/runtime/value.rb +4 -1
  333. data/lib/hecks/runtime.rb +20 -6
  334. data/lib/hecks/rust_build/conformance.rb +158 -0
  335. data/lib/hecks/rust_build/conformance_fuzz.rb +71 -0
  336. data/lib/hecks/rust_build/coverage.rb +218 -0
  337. data/lib/hecks/rust_build/native_build.rb +124 -0
  338. data/lib/hecks/rust_build/project_rust/root_mod.rb +120 -0
  339. data/lib/hecks/rust_build/project_rust.rb +332 -0
  340. data/lib/hecks/rust_build/wasm.rb +105 -0
  341. data/lib/hecks/rust_build/wasm_browser.rb +113 -0
  342. data/lib/hecks/rust_build.rb +144 -0
  343. data/lib/hecks/storehouse.rb +16 -16
  344. data/lib/hecks/tenancy/bluebook/tenancy.bluebook +2 -2
  345. data/lib/hecks/tenancy/bluebook/tenancy.hecksagon +1 -1
  346. data/lib/hecks/three_zero/forms.yml +127 -0
  347. data/lib/hecks/three_zero.rb +12 -0
  348. data/lib/hecks/tools/argument_gate_matrix.rb +316 -0
  349. data/lib/hecks/tools/comment_style.rb +1070 -0
  350. data/lib/hecks/tools/corpus_report.rb +87 -0
  351. data/lib/hecks/tools/deploy_recipe.rb +255 -0
  352. data/lib/hecks/tools/deploy_recipe_lint.rb +282 -0
  353. data/lib/hecks/tools/drop_implicit_append_fields.rb +95 -0
  354. data/lib/hecks/tools/era_projection_backfill.rb +94 -0
  355. data/lib/hecks/tools/era_reattest.rb +146 -0
  356. data/lib/hecks/tools/evolve_run.rb +189 -0
  357. data/lib/hecks/tools/fuzz_sweep.rb +373 -0
  358. data/lib/hecks/tools/heki_compaction.rb +100 -0
  359. data/lib/hecks/tools/hoist_local_givens.rb +246 -0
  360. data/lib/hecks/tools/journal_compaction.rb +89 -0
  361. data/lib/hecks/tools/oidc_manifests.rb +70 -0
  362. data/lib/hecks/tools/query_ir_run.rb +81 -0
  363. data/lib/hecks/tools/regeneration_run.rb +166 -0
  364. data/lib/hecks/tools/rust_comment_style.rb +642 -0
  365. data/lib/hecks/tools/sequence_script.rb +62 -0
  366. data/lib/hecks/tools/tail_merge.rb +117 -0
  367. data/lib/hecks/tools/tenant_provisioning.rb +142 -0
  368. data/lib/hecks/tools/translation_audit.rb +208 -0
  369. data/lib/hecks/tools/translation_scaffold.rb +131 -0
  370. data/lib/hecks/tools.rb +86 -0
  371. data/lib/hecks/version.rb +1 -1
  372. data/lib/hecks.rb +32 -15
  373. data/qa/settings.yml +66 -0
  374. data/rust/.cargo/config.toml +6 -0
  375. data/rust/.gitignore +2 -0
  376. data/rust/Cargo.lock +54 -0
  377. data/rust/Cargo.toml +61 -0
  378. data/rust/build/.cargo/config.toml +3 -0
  379. data/rust/build/.gitignore +1 -0
  380. data/rust/build/Cargo.lock +7 -0
  381. data/rust/build/Cargo.toml +19 -0
  382. data/rust/build/src/build_artifact.rs +47 -0
  383. data/rust/build/src/cargo_sync.rs +248 -0
  384. data/rust/build/src/json.rs +421 -0
  385. data/rust/build/src/lineage_pass.rs +285 -0
  386. data/rust/build/src/main.rs +51 -0
  387. data/rust/build/src/optional_pass.rs +150 -0
  388. data/rust/build/src/pipeline.rs +264 -0
  389. data/rust/build/src/reserved_names.rs +76 -0
  390. data/rust/build/src/resolve.rs +124 -0
  391. data/rust/build/src/root.rs +25 -0
  392. data/rust/build/src/sidecars.rs +73 -0
  393. data/rust/build/src/subprocess.rs +51 -0
  394. data/rust/build/src/tmp.rs +31 -0
  395. data/rust/codegen/.cargo/config.toml +3 -0
  396. data/rust/codegen/.gitignore +1 -0
  397. data/rust/codegen/Cargo.lock +7 -0
  398. data/rust/codegen/Cargo.toml +20 -0
  399. data/rust/codegen/src/attr.rs +32 -0
  400. data/rust/codegen/src/bridging.rs +481 -0
  401. data/rust/codegen/src/commands.rs +1226 -0
  402. data/rust/codegen/src/constraints.rs +109 -0
  403. data/rust/codegen/src/dependency_planning.rs +209 -0
  404. data/rust/codegen/src/domain_generator.rs +1288 -0
  405. data/rust/codegen/src/exemplar.rs +230 -0
  406. data/rust/codegen/src/expr_emitter.rs +87 -0
  407. data/rust/codegen/src/fielded.rs +192 -0
  408. data/rust/codegen/src/hecks_naming.rs +33 -0
  409. data/rust/codegen/src/json.rs +335 -0
  410. data/rust/codegen/src/json_codec.rs +697 -0
  411. data/rust/codegen/src/literal.rs +207 -0
  412. data/rust/codegen/src/main.rs +290 -0
  413. data/rust/codegen/src/manifest.rs +227 -0
  414. data/rust/codegen/src/mutations.rs +784 -0
  415. data/rust/codegen/src/naming.rs +286 -0
  416. data/rust/codegen/src/ports.rs +208 -0
  417. data/rust/codegen/src/prelude.rs +116 -0
  418. data/rust/codegen/src/queries.rs +786 -0
  419. data/rust/codegen/src/reactions.rs +532 -0
  420. data/rust/codegen/src/read_models.rs +697 -0
  421. data/rust/codegen/src/reference_specs.rs +40 -0
  422. data/rust/codegen/src/registry.rs +966 -0
  423. data/rust/codegen/src/reserved_names.rs +76 -0
  424. data/rust/codegen/src/shared.rs +93 -0
  425. data/rust/codegen/src/skip_reason.rs +25 -0
  426. data/rust/codegen/src/types.rs +362 -0
  427. data/rust/host/.cargo/config.toml +3 -0
  428. data/rust/host/.gitignore +1 -0
  429. data/rust/host/Cargo.lock +4297 -0
  430. data/rust/host/Cargo.toml +61 -0
  431. data/rust/host/HECKS_RELEASE +1 -0
  432. data/rust/host/rds-ca-bundle.pem +2736 -0
  433. data/rust/host/src/api.rs +1596 -0
  434. data/rust/host/src/approval.rs +652 -0
  435. data/rust/host/src/auth.rs +1287 -0
  436. data/rust/host/src/bin/expr_harness.rs +46 -0
  437. data/rust/host/src/bin/lineage_harness.rs +119 -0
  438. data/rust/host/src/bin/mint_harness.rs +135 -0
  439. data/rust/host/src/checkout.rs +265 -0
  440. data/rust/host/src/dispatch.rs +1443 -0
  441. data/rust/host/src/expr_json.rs +1117 -0
  442. data/rust/host/src/field_hints.rs +52 -0
  443. data/rust/host/src/ir.rs +733 -0
  444. data/rust/host/src/journal.rs +874 -0
  445. data/rust/host/src/lambda_client.rs +378 -0
  446. data/rust/host/src/log.rs +147 -0
  447. data/rust/host/src/main.rs +474 -0
  448. data/rust/host/src/mint.rs +1865 -0
  449. data/rust/host/src/payments/keystore.rs +330 -0
  450. data/rust/host/src/payments/tests.rs +1400 -0
  451. data/rust/host/src/payments.rs +767 -0
  452. data/rust/host/src/presentation.rs +698 -0
  453. data/rust/host/src/presentation_write.rs +1431 -0
  454. data/rust/host/src/query_step.rs +149 -0
  455. data/rust/host/src/rate_limit.rs +904 -0
  456. data/rust/host/src/reference_transform.rs +241 -0
  457. data/rust/host/src/reference_validate.rs +338 -0
  458. data/rust/host/src/resend.rs +296 -0
  459. data/rust/host/src/secrets.rs +106 -0
  460. data/rust/host/src/server.rs +663 -0
  461. data/rust/host/src/storage_shape.rs +175 -0
  462. data/rust/host/src/test_pg.rs +40 -0
  463. data/rust/host/src/ui_schema.rs +1351 -0
  464. data/rust/host/src/wasm_runner.rs +191 -0
  465. data/rust/host/src/web/newsletter/cooldown.rs +126 -0
  466. data/rust/host/src/web/newsletter/tests.rs +104 -0
  467. data/rust/host/src/web/newsletter.rs +310 -0
  468. data/rust/host/src/web/newsletter_send.rs +357 -0
  469. data/rust/host/src/web/registrations.rs +1505 -0
  470. data/rust/host/src/web.rs +2937 -0
  471. data/rust/lsp/.gitignore +1 -0
  472. data/rust/lsp/Cargo.lock +7 -0
  473. data/rust/lsp/Cargo.toml +16 -0
  474. data/rust/lsp/README.md +133 -0
  475. data/rust/lsp/src/diagnostics.rs +165 -0
  476. data/rust/lsp/src/json.rs +385 -0
  477. data/rust/lsp/src/main.rs +399 -0
  478. data/rust/lsp/src/outline.rs +177 -0
  479. data/rust/lsp/src/rpc.rs +67 -0
  480. data/rust/parser/.cargo/config.toml +5 -0
  481. data/rust/parser/.gitignore +1 -0
  482. data/rust/parser/Cargo.lock +7 -0
  483. data/rust/parser/Cargo.toml +21 -0
  484. data/rust/parser/src/build/closed_sets.rs +27 -0
  485. data/rust/parser/src/build/identity.rs +276 -0
  486. data/rust/parser/src/build/mod.rs +12 -0
  487. data/rust/parser/src/build/naming.rs +141 -0
  488. data/rust/parser/src/build/pattern_subset.rs +161 -0
  489. data/rust/parser/src/build/query_derive.rs +72 -0
  490. data/rust/parser/src/build/query_inference.rs +269 -0
  491. data/rust/parser/src/build/query_options.rs +100 -0
  492. data/rust/parser/src/build/read_model.rs +94 -0
  493. data/rust/parser/src/build/references.rs +32 -0
  494. data/rust/parser/src/canonical.rs +114 -0
  495. data/rust/parser/src/diag.rs +55 -0
  496. data/rust/parser/src/emit.rs +953 -0
  497. data/rust/parser/src/expr/ast_json.rs +147 -0
  498. data/rust/parser/src/expr/evaluator.rs +81 -0
  499. data/rust/parser/src/expr/mod.rs +84 -0
  500. data/rust/parser/src/expr/resolver.rs +497 -0
  501. data/rust/parser/src/ir.rs +387 -0
  502. data/rust/parser/src/keywords.rs +585 -0
  503. data/rust/parser/src/lex.rs +662 -0
  504. data/rust/parser/src/main.rs +252 -0
  505. data/rust/parser/src/parse/aggregate.rs +612 -0
  506. data/rust/parser/src/parse/chapter.rs +517 -0
  507. data/rust/parser/src/parse/command.rs +637 -0
  508. data/rust/parser/src/parse/domain_port.rs +127 -0
  509. data/rust/parser/src/parse/entity.rs +527 -0
  510. data/rust/parser/src/parse/file.rs +67 -0
  511. data/rust/parser/src/parse/hecksagon.rs +231 -0
  512. data/rust/parser/src/parse/lifecycle.rs +162 -0
  513. data/rust/parser/src/parse/mod.rs +1262 -0
  514. data/rust/parser/src/parse/policy.rs +87 -0
  515. data/rust/parser/src/parse/process_manager.rs +305 -0
  516. data/rust/parser/src/parse/query.rs +100 -0
  517. data/rust/parser/src/parse/read_model.rs +214 -0
  518. data/rust/parser/src/parse/value_object.rs +250 -0
  519. data/rust/parser/src/ruby_value.rs +422 -0
  520. data/rust/project/bridging.rb +257 -0
  521. data/rust/project/commands.rb +877 -0
  522. data/rust/project/constraints.rb +86 -0
  523. data/rust/project/dependency_planning.rb +178 -0
  524. data/rust/project/domain_generator.rb +980 -0
  525. data/rust/project/exemplar.rb +148 -0
  526. data/rust/project/expr_emitter.rb +72 -0
  527. data/rust/project/fielded.rb +141 -0
  528. data/rust/project/json_codec.rb +641 -0
  529. data/rust/project/mutations.rb +721 -0
  530. data/rust/project/naming.rb +205 -0
  531. data/rust/project/ports.rb +65 -0
  532. data/rust/project/queries.rb +493 -0
  533. data/rust/project/reactions.rb +317 -0
  534. data/rust/project/read_models.rb +690 -0
  535. data/rust/project/reference_specs.rb +27 -0
  536. data/rust/project/registry.rb +396 -0
  537. data/rust/project/skip_reason.rb +29 -0
  538. data/rust/project/types.rb +225 -0
  539. data/rust/project/write_if_changed.rb +83 -0
  540. data/rust/project.rb +30 -0
  541. data/rust/project_rust_pipeline.rb +383 -0
  542. data/rust/src/exemplar/commands.rs +279 -0
  543. data/rust/src/exemplar/constraints.rs +18 -0
  544. data/rust/src/exemplar/fielded.rs +280 -0
  545. data/rust/src/exemplar/json.rs +277 -0
  546. data/rust/src/exemplar/mod.rs +17 -0
  547. data/rust/src/exemplar/mutations.rs +80 -0
  548. data/rust/src/exemplar/queries.rs +33 -0
  549. data/rust/src/exemplar/reactions.rs +88 -0
  550. data/rust/src/exemplar/read_models.rs +48 -0
  551. data/rust/src/exemplar/registry.rs +166 -0
  552. data/rust/src/exemplar/types.rs +44 -0
  553. data/rust/src/kernel/attribute_shapes/composite.rs +88 -0
  554. data/rust/src/kernel/attribute_shapes/list.rs +18 -0
  555. data/rust/src/kernel/attribute_shapes/mod.rs +44 -0
  556. data/rust/src/kernel/attribute_shapes/optional.rs +9 -0
  557. data/rust/src/kernel/attribute_shapes/scalar.rs +39 -0
  558. data/rust/src/kernel/cli.rs +585 -0
  559. data/rust/src/kernel/dispatch.rs +1090 -0
  560. data/rust/src/kernel/expr.rs +458 -0
  561. data/rust/src/kernel/expression_operators/arithmetic.rs +128 -0
  562. data/rust/src/kernel/expression_operators/comparison.rs +48 -0
  563. data/rust/src/kernel/expression_operators/enumeration.rs +232 -0
  564. data/rust/src/kernel/expression_operators/logical.rs +13 -0
  565. data/rust/src/kernel/expression_operators/membership.rs +18 -0
  566. data/rust/src/kernel/expression_operators/mod.rs +68 -0
  567. data/rust/src/kernel/expression_operators/pattern_match.rs +73 -0
  568. data/rust/src/kernel/expression_operators/positional.rs +126 -0
  569. data/rust/src/kernel/expression_operators/presence.rs +101 -0
  570. data/rust/src/kernel/expression_operators/sign_test.rs +16 -0
  571. data/rust/src/kernel/expression_operators/sized.rs +35 -0
  572. data/rust/src/kernel/expression_operators/text.rs +79 -0
  573. data/rust/src/kernel/expression_operators/to_string.rs +18 -0
  574. data/rust/src/kernel/json.rs +779 -0
  575. data/rust/src/kernel/mod.rs +133 -0
  576. data/rust/src/kernel/named_query.rs +219 -0
  577. data/rust/src/kernel/orchestrate.rs +1810 -0
  578. data/rust/src/kernel/pattern.rs +307 -0
  579. data/rust/src/kernel/query_comparators.rs +206 -0
  580. data/rust/src/kernel/query_ordering.rs +103 -0
  581. data/rust/src/kernel/read_model.rs +914 -0
  582. data/rust/src/kernel/reference_lookup.rs +149 -0
  583. data/rust/src/kernel/repository.rs +468 -0
  584. data/rust/src/kernel/routing.rs +612 -0
  585. data/rust/src/kernel/vocab/aggregate_dispatch_order.rs +118 -0
  586. data/rust/src/kernel/vocab/entity_dispatch_order.rs +114 -0
  587. data/rust/src/kernel/vocab/field_hint.rs +70 -0
  588. data/rust/src/kernel/vocab/mod.rs +20 -0
  589. data/rust/src/kernel/vocab/query_comparator.rs +65 -0
  590. data/rust/src/kernel/vocab/refusal_template.rs +1592 -0
  591. data/rust/src/lib.rs +8 -0
  592. data/rust/src/main.rs +16 -0
  593. data/rust/web/.gitignore +1 -0
  594. data/rust/web/Cargo.lock +119 -0
  595. data/rust/web/Cargo.toml +18 -0
  596. data/rust/web/src/lib.rs +8 -0
  597. metadata +477 -12
  598. data/lib/hecks/facade/cli_door.rb +0 -96
  599. data/lib/hecks/facade/cli_runner.rb +0 -127
  600. data/lib/hecks/mcp_door_scope.rb +0 -95
@@ -0,0 +1,2453 @@
1
+ Hecks.bluebook "Hecks" do
2
+ # Codebase: working on this repository. Each aggregate here is a concern only a maintainer of
3
+ # Hecks runs, and every one of them needs a hecks checkout (ADR 0080, section 2). A request
4
+ # follows the journaled-command shape of Custodian: it is recorded, the SourceTree port is asked
5
+ # to examine the tree, `Accept` holds the one rule every Codebase change shares (the working tree
6
+ # is a hecks checkout, hecks.gemspec beside lib/), and only an accepted request is carried out.
7
+ # A command that rewrites tracked files reports drift and writes only when it is confirmed.
8
+ #
9
+ # The records are named for the run, as ModelCheckRun is, because several of the table's
10
+ # concerns share a name with a module the gem already owns.
11
+
12
+ # The language: the tables the Bluebook chapter declares and everything projected from them. A
13
+ # projection reports drift from the committed files and writes only when it is confirmed; an
14
+ # evolution edits the syntax tables, regenerates the golden and holds the gates, and only when
15
+ # confirmed (without it, the edit is rehearsed in memory and nothing is written).
16
+ aggregate "LanguageRun" do
17
+ description "One change to the language's own tables, or one reading of where its words stand."
18
+
19
+ attribute :run, RunKey
20
+ attribute :operation, Operation, optional: true
21
+ attribute :confirm, Switch, optional: true
22
+ attribute :stdout, Switch, optional: true
23
+ attribute :word, Word, optional: true
24
+ attribute :context, Context, optional: true
25
+ attribute :body, Body, optional: true
26
+ attribute :inner, Fill, optional: true
27
+ attribute :opens, Fill, optional: true
28
+ attribute :fills, Fill, optional: true
29
+ attribute :new_name, Word, optional: true
30
+ attribute :kind, Kind, optional: true
31
+ attribute :required, Flag, optional: true
32
+ attribute :at, Position, optional: true
33
+ attribute :named, Fill, optional: true
34
+ attribute :pairs_shape, Shape, optional: true
35
+ attribute :checkout, Switch, optional: true
36
+ attribute :report, Report, optional: true
37
+ attribute :refusal, Report, optional: true
38
+ identified_by :run
39
+
40
+ value_object "RunKey" do
41
+ attribute :value, String, pattern: '[^ \t\n\r]'
42
+
43
+ invariant("a run is named") { !value.to_s.empty? }
44
+ end
45
+
46
+ value_object "Operation" do
47
+ attribute :value, String, pattern: '[^ \t\n\r]'
48
+ end
49
+
50
+ value_object "Switch" do
51
+ attribute :value, Boolean
52
+ end
53
+
54
+ value_object "Report" do
55
+ attribute :value, String
56
+ end
57
+
58
+ # A keyword of the language, or the keyword an argument belongs to.
59
+ value_object "Word" do
60
+ attribute :value, String, pattern: '[^ \t\n\r]'
61
+
62
+ invariant("a word is named") { !value.to_s.empty? }
63
+ end
64
+
65
+ # The part of the language a word is a word in.
66
+ value_object "Context" do
67
+ attribute :value, String, pattern: '^[A-Za-z][A-Za-z0-9_]*$'
68
+ end
69
+
70
+ # What a word's block holds.
71
+ value_object "Body" do
72
+ attribute :value, String, pattern: '^(none|keywords|source|rows)$'
73
+ end
74
+
75
+ # A cell of a table row; empty when the row leaves it blank.
76
+ value_object "Fill" do
77
+ attribute :value, String, pattern: '^[^\t\n\r]*$'
78
+ end
79
+
80
+ # What an argument is.
81
+ value_object "Kind" do
82
+ attribute :value, String, pattern: '^(text|symbol|number|flag|literal|constant|pairs|list)$'
83
+ end
84
+
85
+ # Whether an argument is required.
86
+ value_object "Flag" do
87
+ attribute :value, String, pattern: '^(true|false)$'
88
+ end
89
+
90
+ # An argument's place, counted from zero.
91
+ value_object "Position" do
92
+ attribute :value, String, pattern: '^[0-9]*$'
93
+ end
94
+
95
+ # How a pairs argument is read, such as verbatim.
96
+ value_object "Shape" do
97
+ attribute :value, String, pattern: '[^ \t\n\r]'
98
+ end
99
+
100
+ lifecycle :status, default: "requested" do
101
+ transition "Accept" => "accepted", from: "requested"
102
+ transition "Complete" => "completed", from: "accepted"
103
+ transition "Fault" => "faulted", from: %w[requested accepted]
104
+ end
105
+
106
+ command "ProjectModel" do
107
+ role "Maintainer"
108
+ goal "Project the model's holding half from the language that declares it"
109
+
110
+ attribute :run, RunKey
111
+ attribute :confirm, Switch, optional: true
112
+
113
+ sets :run
114
+ sets :confirm
115
+ sets :operation, to: "project_model"
116
+
117
+ emits ProjectModelRequested
118
+ end
119
+
120
+ command "ProjectVocabulary" do
121
+ role "Maintainer"
122
+ goal "Project the language's closed sets into the vocabulary"
123
+
124
+ attribute :run, RunKey
125
+ attribute :confirm, Switch, optional: true
126
+
127
+ sets :run
128
+ sets :confirm
129
+ sets :operation, to: "project_vocabulary"
130
+
131
+ emits ProjectVocabularyRequested
132
+ end
133
+
134
+ command "ProjectRustVocabulary" do
135
+ role "Maintainer"
136
+ goal "Project the vocabulary tables into the Rust kernel, one enum a table"
137
+
138
+ attribute :run, RunKey
139
+ attribute :confirm, Switch, optional: true
140
+
141
+ sets :run
142
+ sets :confirm
143
+ sets :operation, to: "project_rust_vocabulary"
144
+
145
+ emits ProjectRustVocabularyRequested
146
+ end
147
+
148
+ command "ProjectRefusalWording" do
149
+ role "Maintainer"
150
+ goal "Project the refusal template table, a second name of ProjectRustVocabulary"
151
+
152
+ attribute :run, RunKey
153
+ attribute :confirm, Switch, optional: true
154
+
155
+ sets :run
156
+ sets :confirm
157
+ sets :operation, to: "project_rust_vocabulary"
158
+
159
+ emits ProjectRefusalWordingRequested
160
+ end
161
+
162
+ command "ProjectReservedNames" do
163
+ role "Maintainer"
164
+ goal "Project the Rust and Cargo reserved words into the codegen and build crates"
165
+
166
+ attribute :run, RunKey
167
+ attribute :confirm, Switch, optional: true
168
+
169
+ sets :run
170
+ sets :confirm
171
+ sets :operation, to: "project_reserved_names"
172
+
173
+ emits ProjectReservedNamesRequested
174
+ end
175
+
176
+ command "ProjectParserTable" do
177
+ role "Maintainer"
178
+ goal "Project the Rust parser's keyword table"
179
+
180
+ attribute :run, RunKey
181
+ attribute :confirm, Switch, optional: true
182
+
183
+ sets :run
184
+ sets :confirm
185
+ sets :operation, to: "project_parser_table"
186
+
187
+ emits ProjectParserTableRequested
188
+ end
189
+
190
+ command "ProjectBootstrapTable" do
191
+ role "Maintainer"
192
+ goal "Project the DSL's bootstrap-window fallbacks from the keyword rows"
193
+
194
+ attribute :run, RunKey
195
+ attribute :confirm, Switch, optional: true
196
+
197
+ sets :run
198
+ sets :confirm
199
+ sets :operation, to: "project_bootstrap_table"
200
+
201
+ emits ProjectBootstrapTableRequested
202
+ end
203
+
204
+ command "ProjectFieldHints" do
205
+ role "Maintainer"
206
+ goal "Project the host's form-field hints"
207
+
208
+ attribute :run, RunKey
209
+ attribute :confirm, Switch, optional: true
210
+
211
+ sets :run
212
+ sets :confirm
213
+ sets :operation, to: "project_field_hints"
214
+
215
+ emits ProjectFieldHintsRequested
216
+ end
217
+
218
+ command "ProjectExpressionTables" do
219
+ role "Maintainer"
220
+ goal "Project the expression machinery's operator and normalisation tables"
221
+
222
+ attribute :stdout, Switch, optional: true
223
+ attribute :run, RunKey
224
+ attribute :confirm, Switch, optional: true
225
+
226
+ sets :stdout
227
+ sets :run
228
+ sets :confirm
229
+ sets :operation, to: "project_expression_tables"
230
+
231
+ emits ProjectExpressionTablesRequested
232
+ end
233
+
234
+ command "ProjectReference" do
235
+ role "Maintainer"
236
+ goal "Regenerate the DSL reference from the Syntax chapter, keeping the committed prose"
237
+
238
+ attribute :run, RunKey
239
+ attribute :confirm, Switch, optional: true
240
+
241
+ sets :run
242
+ sets :confirm
243
+ sets :operation, to: "project_reference"
244
+
245
+ emits ProjectReferenceRequested
246
+ end
247
+
248
+ command "Propose" do
249
+ role "Maintainer"
250
+ goal "Enter a keyword row, proposed: it reaches no projection until admitted"
251
+
252
+ attribute :word, Word
253
+ attribute :context, Context
254
+ attribute :body, Body, optional: true
255
+ attribute :inner, Fill, optional: true
256
+ attribute :opens, Fill, optional: true
257
+ attribute :fills, Fill, optional: true
258
+ attribute :run, RunKey
259
+ attribute :confirm, Switch, optional: true
260
+
261
+ sets :word
262
+ sets :context
263
+ sets :body
264
+ sets :inner
265
+ sets :opens
266
+ sets :fills
267
+ sets :run
268
+ sets :confirm
269
+ sets :operation, to: "propose"
270
+
271
+ emits ProposeRequested
272
+ end
273
+
274
+ command "Admit" do
275
+ role "Maintainer"
276
+ goal "Move a proposed keyword row to admitted"
277
+
278
+ attribute :word, Word
279
+ attribute :context, Context
280
+ attribute :run, RunKey
281
+ attribute :confirm, Switch, optional: true
282
+
283
+ sets :word
284
+ sets :context
285
+ sets :run
286
+ sets :confirm
287
+ sets :operation, to: "admit"
288
+
289
+ emits AdmitRequested
290
+ end
291
+
292
+ command "Deprecate" do
293
+ role "Maintainer"
294
+ goal "Move an admitted keyword row to deprecated"
295
+
296
+ attribute :word, Word
297
+ attribute :context, Context
298
+ attribute :run, RunKey
299
+ attribute :confirm, Switch, optional: true
300
+
301
+ sets :word
302
+ sets :context
303
+ sets :run
304
+ sets :confirm
305
+ sets :operation, to: "deprecate"
306
+
307
+ emits DeprecateRequested
308
+ end
309
+
310
+ command "Retire" do
311
+ role "Maintainer"
312
+ goal "Move a deprecated or admitted keyword row to retired"
313
+
314
+ attribute :word, Word
315
+ attribute :context, Context
316
+ attribute :run, RunKey
317
+ attribute :confirm, Switch, optional: true
318
+
319
+ sets :word
320
+ sets :context
321
+ sets :run
322
+ sets :confirm
323
+ sets :operation, to: "retire"
324
+
325
+ emits RetireRequested
326
+ end
327
+
328
+ command "Rename" do
329
+ role "Maintainer"
330
+ goal "Respell a keyword row; the old spelling keeps parsing"
331
+
332
+ attribute :word, Word
333
+ attribute :context, Context
334
+ attribute :new_name, Word
335
+ attribute :run, RunKey
336
+ attribute :confirm, Switch, optional: true
337
+
338
+ sets :word
339
+ sets :context
340
+ sets :new_name
341
+ sets :run
342
+ sets :confirm
343
+ sets :operation, to: "rename"
344
+
345
+ emits RenameRequested
346
+ end
347
+
348
+ command "ProposeArgument" do
349
+ role "Maintainer"
350
+ goal "Enter an argument row of a keyword, proposed"
351
+
352
+ attribute :word, Word
353
+ attribute :context, Context
354
+ attribute :kind, Kind
355
+ attribute :required, Flag, optional: true
356
+ attribute :at, Position, optional: true
357
+ attribute :named, Fill, optional: true
358
+ attribute :fills, Fill, optional: true
359
+ attribute :pairs_shape, Shape, optional: true
360
+ attribute :run, RunKey
361
+ attribute :confirm, Switch, optional: true
362
+
363
+ sets :word
364
+ sets :context
365
+ sets :kind
366
+ sets :required
367
+ sets :at
368
+ sets :named
369
+ sets :fills
370
+ sets :pairs_shape
371
+ sets :run
372
+ sets :confirm
373
+ sets :operation, to: "propose_argument"
374
+
375
+ emits ProposeArgumentRequested
376
+ end
377
+
378
+ command "AdmitArgument" do
379
+ role "Maintainer"
380
+ goal "Move a proposed argument row to admitted"
381
+
382
+ attribute :word, Word
383
+ attribute :context, Context
384
+ attribute :at, Position, optional: true
385
+ attribute :named, Fill, optional: true
386
+ attribute :run, RunKey
387
+ attribute :confirm, Switch, optional: true
388
+
389
+ sets :word
390
+ sets :context
391
+ sets :at
392
+ sets :named
393
+ sets :run
394
+ sets :confirm
395
+ sets :operation, to: "admit_argument"
396
+
397
+ emits AdmitArgumentRequested
398
+ end
399
+
400
+ command "DeprecateArgument" do
401
+ role "Maintainer"
402
+ goal "Move an admitted argument row to deprecated"
403
+
404
+ attribute :word, Word
405
+ attribute :context, Context
406
+ attribute :at, Position, optional: true
407
+ attribute :named, Fill, optional: true
408
+ attribute :run, RunKey
409
+ attribute :confirm, Switch, optional: true
410
+
411
+ sets :word
412
+ sets :context
413
+ sets :at
414
+ sets :named
415
+ sets :run
416
+ sets :confirm
417
+ sets :operation, to: "deprecate_argument"
418
+
419
+ emits DeprecateArgumentRequested
420
+ end
421
+
422
+ command "RetireArgument" do
423
+ role "Maintainer"
424
+ goal "Move a deprecated or admitted argument row to retired"
425
+
426
+ attribute :word, Word
427
+ attribute :context, Context
428
+ attribute :at, Position, optional: true
429
+ attribute :named, Fill, optional: true
430
+ attribute :run, RunKey
431
+ attribute :confirm, Switch, optional: true
432
+
433
+ sets :word
434
+ sets :context
435
+ sets :at
436
+ sets :named
437
+ sets :run
438
+ sets :confirm
439
+ sets :operation, to: "retire_argument"
440
+
441
+ emits RetireArgumentRequested
442
+ end
443
+
444
+ # What the tree reported about itself, held against every request: nothing here runs
445
+ # outside a hecks checkout (hecks.gemspec beside lib/).
446
+ command "Accept" do
447
+ role "System"
448
+ goal "Let a request through only when the working tree is a hecks checkout"
449
+
450
+ reference_to LanguageRun
451
+ attribute :checkout, Switch
452
+
453
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
454
+
455
+ sets :checkout
456
+
457
+ emits LanguageAccepted
458
+ end
459
+
460
+ command "Complete" do
461
+ role "System"
462
+ goal "Record that the request was carried out, and what it reported"
463
+
464
+ reference_to LanguageRun
465
+ attribute :report, Report
466
+
467
+ sets :report
468
+
469
+ emits LanguageCompleted
470
+ end
471
+
472
+ command "Fault" do
473
+ role "System"
474
+ goal "Record that the request was refused or could not be carried out, and why"
475
+
476
+ reference_to LanguageRun
477
+ attribute :refusal, Report
478
+
479
+ sets :refusal
480
+
481
+ emits LanguageFaulted
482
+ end
483
+
484
+ query "LanguageOutcome" do
485
+ description "How one request ended: its status, and what it reported or why it failed."
486
+ attribute :run, RunKey
487
+ where(run: :run)
488
+ order_by :run
489
+ end
490
+
491
+ query "LanguageFaulted" do
492
+ description "Every request that was refused or could not be carried out."
493
+ where(status: "faulted")
494
+ order_by :run
495
+ end
496
+
497
+ # An answer that is one document of text, exactly as the tool that produced it wrote it.
498
+ value_object "Document" do
499
+ attribute :text, String
500
+ end
501
+
502
+ query "WordStatus" do
503
+ description "Where every word of the language stands: the ones not simply admitted, and the renamed."
504
+ returns Document
505
+ end
506
+ end
507
+
508
+ policy "ExamineWhenProjectModelRequested" do
509
+ on "LanguageRun.ProjectModelRequested"
510
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
511
+ end
512
+
513
+ policy "ExamineWhenProjectVocabularyRequested" do
514
+ on "LanguageRun.ProjectVocabularyRequested"
515
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
516
+ end
517
+
518
+ policy "ExamineWhenProjectRustVocabularyRequested" do
519
+ on "LanguageRun.ProjectRustVocabularyRequested"
520
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
521
+ end
522
+
523
+ policy "ExamineWhenProjectRefusalWordingRequested" do
524
+ on "LanguageRun.ProjectRefusalWordingRequested"
525
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
526
+ end
527
+
528
+ policy "ExamineWhenProjectReservedNamesRequested" do
529
+ on "LanguageRun.ProjectReservedNamesRequested"
530
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
531
+ end
532
+
533
+ policy "ExamineWhenProjectParserTableRequested" do
534
+ on "LanguageRun.ProjectParserTableRequested"
535
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
536
+ end
537
+
538
+ policy "ExamineWhenProjectBootstrapTableRequested" do
539
+ on "LanguageRun.ProjectBootstrapTableRequested"
540
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
541
+ end
542
+
543
+ policy "ExamineWhenProjectFieldHintsRequested" do
544
+ on "LanguageRun.ProjectFieldHintsRequested"
545
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
546
+ end
547
+
548
+ policy "ExamineWhenProjectExpressionTablesRequested" do
549
+ on "LanguageRun.ProjectExpressionTablesRequested"
550
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
551
+ end
552
+
553
+ policy "ExamineWhenProjectReferenceRequested" do
554
+ on "LanguageRun.ProjectReferenceRequested"
555
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
556
+ end
557
+
558
+ policy "ExamineWhenProposeRequested" do
559
+ on "LanguageRun.ProposeRequested"
560
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
561
+ end
562
+
563
+ policy "ExamineWhenAdmitRequested" do
564
+ on "LanguageRun.AdmitRequested"
565
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
566
+ end
567
+
568
+ policy "ExamineWhenDeprecateRequested" do
569
+ on "LanguageRun.DeprecateRequested"
570
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
571
+ end
572
+
573
+ policy "ExamineWhenRetireRequested" do
574
+ on "LanguageRun.RetireRequested"
575
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
576
+ end
577
+
578
+ policy "ExamineWhenRenameRequested" do
579
+ on "LanguageRun.RenameRequested"
580
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
581
+ end
582
+
583
+ policy "ExamineWhenProposeArgumentRequested" do
584
+ on "LanguageRun.ProposeArgumentRequested"
585
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
586
+ end
587
+
588
+ policy "ExamineWhenAdmitArgumentRequested" do
589
+ on "LanguageRun.AdmitArgumentRequested"
590
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
591
+ end
592
+
593
+ policy "ExamineWhenDeprecateArgumentRequested" do
594
+ on "LanguageRun.DeprecateArgumentRequested"
595
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
596
+ end
597
+
598
+ policy "ExamineWhenRetireArgumentRequested" do
599
+ on "LanguageRun.RetireArgumentRequested"
600
+ trigger LanguageRun::SourceTree::Examine, with: { run: :run }
601
+ end
602
+
603
+ policy "AcceptLanguageWhenExamined" do
604
+ on "LanguageRun.LanguageExamined"
605
+ trigger LanguageRun::Accept, with: { checkout: :checkout }
606
+ end
607
+
608
+ policy "FaultLanguageWhenNotAccepted" do
609
+ on "LanguageRun.LanguageExamined"
610
+ where { !checkout.value }
611
+ trigger LanguageRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
612
+ end
613
+
614
+ policy "PerformLanguageWhenAccepted" do
615
+ on "LanguageRun.LanguageAccepted"
616
+ trigger LanguageRun::SourceTree::Perform, with: { run: :run }
617
+ end
618
+
619
+ policy "RecordLanguageOutcome" do
620
+ on "LanguageRun.LanguageAnswered"
621
+ trigger LanguageRun::Complete, with: { report: :report }
622
+ end
623
+
624
+ policy "RecordLanguageFault" do
625
+ on "LanguageRun.LanguageRefused"
626
+ trigger LanguageRun::Fault, with: { refusal: :refusal }
627
+ end
628
+
629
+ # The Rust kernel: the capability enums the hand-written kernel is matched against, and the check
630
+ # that every attribute shape and expression-operator category the grammar admits has its file.
631
+ aggregate "KernelRun" do
632
+ description "One projection of the Rust kernel's capability enums, or one measure of their coverage."
633
+
634
+ attribute :run, RunKey
635
+ attribute :operation, Operation, optional: true
636
+ attribute :confirm, Switch, optional: true
637
+ attribute :checkout, Switch, optional: true
638
+ attribute :report, Report, optional: true
639
+ attribute :refusal, Report, optional: true
640
+ identified_by :run
641
+
642
+ value_object "RunKey" do
643
+ attribute :value, String, pattern: '[^ \t\n\r]'
644
+
645
+ invariant("a run is named") { !value.to_s.empty? }
646
+ end
647
+
648
+ value_object "Operation" do
649
+ attribute :value, String, pattern: '[^ \t\n\r]'
650
+ end
651
+
652
+ value_object "Switch" do
653
+ attribute :value, Boolean
654
+ end
655
+
656
+ value_object "Report" do
657
+ attribute :value, String
658
+ end
659
+
660
+ lifecycle :status, default: "requested" do
661
+ transition "Accept" => "accepted", from: "requested"
662
+ transition "Complete" => "completed", from: "accepted"
663
+ transition "Fault" => "faulted", from: %w[requested accepted]
664
+ end
665
+
666
+ command "ProjectKernelCapabilities" do
667
+ role "Maintainer"
668
+ goal "Project the capability enums the hand-written Rust kernel is matched against"
669
+
670
+ attribute :run, RunKey
671
+ attribute :confirm, Switch, optional: true
672
+
673
+ sets :run
674
+ sets :confirm
675
+ sets :operation, to: "project_kernel_capabilities"
676
+
677
+ emits ProjectKernelCapabilitiesRequested
678
+ end
679
+
680
+ command "MeasureKernelCoverage" do
681
+ role "Maintainer"
682
+ goal "Check that every capability the grammar admits has its hand-written kernel file"
683
+
684
+ attribute :run, RunKey
685
+
686
+ sets :run
687
+ sets :operation, to: "measure_kernel_coverage"
688
+
689
+ emits MeasureKernelCoverageRequested
690
+ end
691
+
692
+ # What the tree reported about itself, held against every request: nothing here runs
693
+ # outside a hecks checkout (hecks.gemspec beside lib/).
694
+ command "Accept" do
695
+ role "System"
696
+ goal "Let a request through only when the working tree is a hecks checkout"
697
+
698
+ reference_to KernelRun
699
+ attribute :checkout, Switch
700
+
701
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
702
+
703
+ sets :checkout
704
+
705
+ emits KernelAccepted
706
+ end
707
+
708
+ command "Complete" do
709
+ role "System"
710
+ goal "Record that the request was carried out, and what it reported"
711
+
712
+ reference_to KernelRun
713
+ attribute :report, Report
714
+
715
+ sets :report
716
+
717
+ emits KernelCompleted
718
+ end
719
+
720
+ command "Fault" do
721
+ role "System"
722
+ goal "Record that the request was refused or could not be carried out, and why"
723
+
724
+ reference_to KernelRun
725
+ attribute :refusal, Report
726
+
727
+ sets :refusal
728
+
729
+ emits KernelFaulted
730
+ end
731
+
732
+ query "KernelOutcome" do
733
+ description "How one request ended: its status, and what it reported or why it failed."
734
+ attribute :run, RunKey
735
+ where(run: :run)
736
+ order_by :run
737
+ end
738
+
739
+ query "KernelFaulted" do
740
+ description "Every request that was refused or could not be carried out."
741
+ where(status: "faulted")
742
+ order_by :run
743
+ end
744
+ end
745
+
746
+ policy "ExamineWhenProjectKernelCapabilitiesRequested" do
747
+ on "KernelRun.ProjectKernelCapabilitiesRequested"
748
+ trigger KernelRun::SourceTree::Examine, with: { run: :run }
749
+ end
750
+
751
+ policy "ExamineWhenMeasureKernelCoverageRequested" do
752
+ on "KernelRun.MeasureKernelCoverageRequested"
753
+ trigger KernelRun::SourceTree::Examine, with: { run: :run }
754
+ end
755
+
756
+ policy "AcceptKernelWhenExamined" do
757
+ on "KernelRun.KernelExamined"
758
+ trigger KernelRun::Accept, with: { checkout: :checkout }
759
+ end
760
+
761
+ policy "FaultKernelWhenNotAccepted" do
762
+ on "KernelRun.KernelExamined"
763
+ where { !checkout.value }
764
+ trigger KernelRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
765
+ end
766
+
767
+ policy "PerformKernelWhenAccepted" do
768
+ on "KernelRun.KernelAccepted"
769
+ trigger KernelRun::SourceTree::Perform, with: { run: :run }
770
+ end
771
+
772
+ policy "RecordKernelOutcome" do
773
+ on "KernelRun.KernelAnswered"
774
+ trigger KernelRun::Complete, with: { report: :report }
775
+ end
776
+
777
+ policy "RecordKernelFault" do
778
+ on "KernelRun.KernelRefused"
779
+ trigger KernelRun::Fault, with: { refusal: :refusal }
780
+ end
781
+
782
+ # Conformance: the checks on the language itself. Each finds every disagreement and refuses with
783
+ # them all, so a check that fails is recorded as faulted with what it found. The argument-gate
784
+ # matrix rewrites a committed matrix and its fixtures, so it only reports unless it is confirmed.
785
+ aggregate "ConformanceRun" do
786
+ description "One check that the engines, the reference docs and the argument gates agree with the language."
787
+
788
+ attribute :run, RunKey
789
+ attribute :operation, Operation, optional: true
790
+ attribute :confirm, Switch, optional: true
791
+ attribute :checkout, Switch, optional: true
792
+ attribute :report, Report, optional: true
793
+ attribute :refusal, Report, optional: true
794
+ identified_by :run
795
+
796
+ value_object "RunKey" do
797
+ attribute :value, String, pattern: '[^ \t\n\r]'
798
+
799
+ invariant("a run is named") { !value.to_s.empty? }
800
+ end
801
+
802
+ value_object "Operation" do
803
+ attribute :value, String, pattern: '[^ \t\n\r]'
804
+ end
805
+
806
+ value_object "Switch" do
807
+ attribute :value, Boolean
808
+ end
809
+
810
+ value_object "Report" do
811
+ attribute :value, String
812
+ end
813
+
814
+ lifecycle :status, default: "requested" do
815
+ transition "Accept" => "accepted", from: "requested"
816
+ transition "Complete" => "completed", from: "accepted"
817
+ transition "Fault" => "faulted", from: %w[requested accepted]
818
+ end
819
+
820
+ command "CheckEngineAgreement" do
821
+ role "Maintainer"
822
+ goal "Check that the query engines route every comparator through the one shared implementation"
823
+
824
+ attribute :run, RunKey
825
+
826
+ sets :run
827
+ sets :operation, to: "check_engine_agreement"
828
+
829
+ emits CheckEngineAgreementRequested
830
+ end
831
+
832
+ command "MeasureDocCoverage" do
833
+ role "Maintainer"
834
+ goal "Check that every live word of the language has prose and a running example in the reference"
835
+
836
+ attribute :run, RunKey
837
+
838
+ sets :run
839
+ sets :operation, to: "measure_doc_coverage"
840
+
841
+ emits MeasureDocCoverageRequested
842
+ end
843
+
844
+ command "ArgumentGateMatrix" do
845
+ role "Maintainer"
846
+ goal "Generate the argument-gate ordering matrix; rewrite it and its fixtures only when confirmed"
847
+
848
+ attribute :run, RunKey
849
+ attribute :confirm, Switch, optional: true
850
+
851
+ sets :run
852
+ sets :confirm
853
+ sets :operation, to: "argument_gate_matrix"
854
+
855
+ emits ArgumentGateMatrixRequested
856
+ end
857
+
858
+ # What the tree reported about itself, held against every request: nothing here runs
859
+ # outside a hecks checkout (hecks.gemspec beside lib/).
860
+ command "Accept" do
861
+ role "System"
862
+ goal "Let a request through only when the working tree is a hecks checkout"
863
+
864
+ reference_to ConformanceRun
865
+ attribute :checkout, Switch
866
+
867
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
868
+
869
+ sets :checkout
870
+
871
+ emits ConformanceAccepted
872
+ end
873
+
874
+ command "Complete" do
875
+ role "System"
876
+ goal "Record that the request was carried out, and what it reported"
877
+
878
+ reference_to ConformanceRun
879
+ attribute :report, Report
880
+
881
+ sets :report
882
+
883
+ emits ConformanceCompleted
884
+ end
885
+
886
+ command "Fault" do
887
+ role "System"
888
+ goal "Record that the request was refused or could not be carried out, and why"
889
+
890
+ reference_to ConformanceRun
891
+ attribute :refusal, Report
892
+
893
+ sets :refusal
894
+
895
+ emits ConformanceFaulted
896
+ end
897
+
898
+ query "ConformanceOutcome" do
899
+ description "How one request ended: its status, and what it reported or why it failed."
900
+ attribute :run, RunKey
901
+ where(run: :run)
902
+ order_by :run
903
+ end
904
+
905
+ query "ConformanceFaulted" do
906
+ description "Every request that was refused or could not be carried out."
907
+ where(status: "faulted")
908
+ order_by :run
909
+ end
910
+ end
911
+
912
+ policy "ExamineWhenCheckEngineAgreementRequested" do
913
+ on "ConformanceRun.CheckEngineAgreementRequested"
914
+ trigger ConformanceRun::SourceTree::Examine, with: { run: :run }
915
+ end
916
+
917
+ policy "ExamineWhenMeasureDocCoverageRequested" do
918
+ on "ConformanceRun.MeasureDocCoverageRequested"
919
+ trigger ConformanceRun::SourceTree::Examine, with: { run: :run }
920
+ end
921
+
922
+ policy "ExamineWhenArgumentGateMatrixRequested" do
923
+ on "ConformanceRun.ArgumentGateMatrixRequested"
924
+ trigger ConformanceRun::SourceTree::Examine, with: { run: :run }
925
+ end
926
+
927
+ policy "AcceptConformanceWhenExamined" do
928
+ on "ConformanceRun.ConformanceExamined"
929
+ trigger ConformanceRun::Accept, with: { checkout: :checkout }
930
+ end
931
+
932
+ policy "FaultConformanceWhenNotAccepted" do
933
+ on "ConformanceRun.ConformanceExamined"
934
+ where { !checkout.value }
935
+ trigger ConformanceRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
936
+ end
937
+
938
+ policy "PerformConformanceWhenAccepted" do
939
+ on "ConformanceRun.ConformanceAccepted"
940
+ trigger ConformanceRun::SourceTree::Perform, with: { run: :run }
941
+ end
942
+
943
+ policy "RecordConformanceOutcome" do
944
+ on "ConformanceRun.ConformanceAnswered"
945
+ trigger ConformanceRun::Complete, with: { report: :report }
946
+ end
947
+
948
+ policy "RecordConformanceFault" do
949
+ on "ConformanceRun.ConformanceRefused"
950
+ trigger ConformanceRun::Fault, with: { refusal: :refusal }
951
+ end
952
+
953
+ # Regeneration: rebuilding every corpus domain's committed output, which only this repository has.
954
+ # A check projects into a scratch crate and never writes the tree; without --confirm the run is
955
+ # that check, so the tracked generated files change only when the regeneration is confirmed.
956
+ aggregate "RegenerationRun" do
957
+ description "One regeneration of every corpus domain's committed Rust output, or the check that it is current."
958
+
959
+ attribute :run, RunKey
960
+ attribute :operation, Operation, optional: true
961
+ attribute :confirm, Switch, optional: true
962
+ attribute :check, Switch, optional: true
963
+ attribute :checkout, Switch, optional: true
964
+ attribute :report, Report, optional: true
965
+ attribute :refusal, Report, optional: true
966
+ identified_by :run
967
+
968
+ value_object "RunKey" do
969
+ attribute :value, String, pattern: '[^ \t\n\r]'
970
+
971
+ invariant("a run is named") { !value.to_s.empty? }
972
+ end
973
+
974
+ value_object "Operation" do
975
+ attribute :value, String, pattern: '[^ \t\n\r]'
976
+ end
977
+
978
+ value_object "Switch" do
979
+ attribute :value, Boolean
980
+ end
981
+
982
+ value_object "Report" do
983
+ attribute :value, String
984
+ end
985
+
986
+ lifecycle :status, default: "requested" do
987
+ transition "Accept" => "accepted", from: "requested"
988
+ transition "Complete" => "completed", from: "accepted"
989
+ transition "Fault" => "faulted", from: %w[requested accepted]
990
+ end
991
+
992
+ command "RegenerateCorpus" do
993
+ role "Maintainer"
994
+ goal "Regenerate every corpus domain's Rust output, or with check only compare it with the tree"
995
+
996
+ attribute :check, Switch, optional: true
997
+ attribute :run, RunKey
998
+ attribute :confirm, Switch, optional: true
999
+
1000
+ sets :check
1001
+ sets :run
1002
+ sets :confirm
1003
+ sets :operation, to: "regenerate_corpus"
1004
+
1005
+ emits RegenerateCorpusRequested
1006
+ end
1007
+
1008
+ # What the tree reported about itself, held against every request: nothing here runs
1009
+ # outside a hecks checkout (hecks.gemspec beside lib/).
1010
+ command "Accept" do
1011
+ role "System"
1012
+ goal "Let a request through only when the working tree is a hecks checkout"
1013
+
1014
+ reference_to RegenerationRun
1015
+ attribute :checkout, Switch
1016
+
1017
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
1018
+
1019
+ sets :checkout
1020
+
1021
+ emits RegenerationAccepted
1022
+ end
1023
+
1024
+ command "Complete" do
1025
+ role "System"
1026
+ goal "Record that the request was carried out, and what it reported"
1027
+
1028
+ reference_to RegenerationRun
1029
+ attribute :report, Report
1030
+
1031
+ sets :report
1032
+
1033
+ emits RegenerationCompleted
1034
+ end
1035
+
1036
+ command "Fault" do
1037
+ role "System"
1038
+ goal "Record that the request was refused or could not be carried out, and why"
1039
+
1040
+ reference_to RegenerationRun
1041
+ attribute :refusal, Report
1042
+
1043
+ sets :refusal
1044
+
1045
+ emits RegenerationFaulted
1046
+ end
1047
+
1048
+ query "RegenerationOutcome" do
1049
+ description "How one request ended: its status, and what it reported or why it failed."
1050
+ attribute :run, RunKey
1051
+ where(run: :run)
1052
+ order_by :run
1053
+ end
1054
+
1055
+ query "RegenerationFaulted" do
1056
+ description "Every request that was refused or could not be carried out."
1057
+ where(status: "faulted")
1058
+ order_by :run
1059
+ end
1060
+ end
1061
+
1062
+ policy "ExamineWhenRegenerateCorpusRequested" do
1063
+ on "RegenerationRun.RegenerateCorpusRequested"
1064
+ trigger RegenerationRun::SourceTree::Examine, with: { run: :run }
1065
+ end
1066
+
1067
+ policy "AcceptRegenerationWhenExamined" do
1068
+ on "RegenerationRun.RegenerationExamined"
1069
+ trigger RegenerationRun::Accept, with: { checkout: :checkout }
1070
+ end
1071
+
1072
+ policy "FaultRegenerationWhenNotAccepted" do
1073
+ on "RegenerationRun.RegenerationExamined"
1074
+ where { !checkout.value }
1075
+ trigger RegenerationRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
1076
+ end
1077
+
1078
+ policy "PerformRegenerationWhenAccepted" do
1079
+ on "RegenerationRun.RegenerationAccepted"
1080
+ trigger RegenerationRun::SourceTree::Perform, with: { run: :run }
1081
+ end
1082
+
1083
+ policy "RecordRegenerationOutcome" do
1084
+ on "RegenerationRun.RegenerationAnswered"
1085
+ trigger RegenerationRun::Complete, with: { report: :report }
1086
+ end
1087
+
1088
+ policy "RecordRegenerationFault" do
1089
+ on "RegenerationRun.RegenerationRefused"
1090
+ trigger RegenerationRun::Fault, with: { refusal: :refusal }
1091
+ end
1092
+
1093
+ # Style: the comment style guides (Ruby and Rust) and the canonical form of a JSON document. A
1094
+ # check finds every violation; a fix rewrites files, so it lists what it would rewrite unless
1095
+ # it is confirmed. The baseline of tolerated long blocks is written only when confirmed.
1096
+ aggregate "StyleRun" do
1097
+ description "One check or fix of comment style, or one document written with its keys in order."
1098
+
1099
+ attribute :run, RunKey
1100
+ attribute :operation, Operation, optional: true
1101
+ attribute :confirm, Switch, optional: true
1102
+ attribute :paths, PathList, optional: true
1103
+ attribute :only, CategoryList, optional: true
1104
+ attribute :json, Switch, optional: true
1105
+ attribute :top, Top, optional: true
1106
+ attribute :ref, Ref, optional: true
1107
+ attribute :file, FilePath, optional: true
1108
+ attribute :checkout, Switch, optional: true
1109
+ attribute :report, Report, optional: true
1110
+ attribute :refusal, Report, optional: true
1111
+ identified_by :run
1112
+
1113
+ value_object "RunKey" do
1114
+ attribute :value, String, pattern: '[^ \t\n\r]'
1115
+
1116
+ invariant("a run is named") { !value.to_s.empty? }
1117
+ end
1118
+
1119
+ value_object "Operation" do
1120
+ attribute :value, String, pattern: '[^ \t\n\r]'
1121
+ end
1122
+
1123
+ value_object "Switch" do
1124
+ attribute :value, Boolean
1125
+ end
1126
+
1127
+ value_object "Report" do
1128
+ attribute :value, String
1129
+ end
1130
+
1131
+ # Files or directories, comma separated.
1132
+ value_object "PathList" do
1133
+ attribute :value, String, pattern: '^[^ \t\n\r,]+(,[^ \t\n\r,]+)*$'
1134
+ end
1135
+
1136
+ # Violation categories, comma separated.
1137
+ value_object "CategoryList" do
1138
+ attribute :value, String, pattern: '^[a-z_]+(,[a-z_]+)*$'
1139
+ end
1140
+
1141
+ # How many rows a report lists.
1142
+ value_object "Top" do
1143
+ attribute :value, Integer
1144
+
1145
+ invariant("a count is positive") { value > 0 }
1146
+ end
1147
+
1148
+ # A revision a code comparison is made against.
1149
+ value_object "Ref" do
1150
+ attribute :value, String, pattern: '^[^ \t\n\r]+$'
1151
+ end
1152
+
1153
+ # A JSON file.
1154
+ value_object "FilePath" do
1155
+ attribute :value, String, pattern: '[^\t\n\r]'
1156
+
1157
+ invariant("a file is named") { !value.to_s.empty? }
1158
+ end
1159
+
1160
+ lifecycle :status, default: "requested" do
1161
+ transition "Accept" => "accepted", from: "requested"
1162
+ transition "Complete" => "completed", from: "accepted"
1163
+ transition "Fault" => "faulted", from: %w[requested accepted]
1164
+ end
1165
+
1166
+ command "CheckComments" do
1167
+ role "Maintainer"
1168
+ goal "List every comment that breaks the Ruby style guide"
1169
+
1170
+ attribute :paths, PathList
1171
+ attribute :only, CategoryList, optional: true
1172
+ attribute :run, RunKey
1173
+
1174
+ sets :paths
1175
+ sets :only
1176
+ sets :run
1177
+ sets :operation, to: "check_comments"
1178
+
1179
+ emits CheckCommentsRequested
1180
+ end
1181
+
1182
+ command "FixComments" do
1183
+ role "Maintainer"
1184
+ goal "Rewrite the mechanical Ruby comment violations"
1185
+
1186
+ attribute :paths, PathList
1187
+ attribute :only, CategoryList, optional: true
1188
+ attribute :run, RunKey
1189
+ attribute :confirm, Switch, optional: true
1190
+
1191
+ sets :paths
1192
+ sets :only
1193
+ sets :run
1194
+ sets :confirm
1195
+ sets :operation, to: "fix_comments"
1196
+
1197
+ emits FixCommentsRequested
1198
+ end
1199
+
1200
+ command "WriteCommentBaseline" do
1201
+ role "Maintainer"
1202
+ goal "Record every long comment block as tolerated, for lib/hecks unless paths are named"
1203
+
1204
+ attribute :paths, PathList, optional: true
1205
+ attribute :run, RunKey
1206
+ attribute :confirm, Switch, optional: true
1207
+
1208
+ sets :paths
1209
+ sets :run
1210
+ sets :confirm
1211
+ sets :operation, to: "write_comment_baseline"
1212
+
1213
+ emits WriteCommentBaselineRequested
1214
+ end
1215
+
1216
+ command "CheckCommentsUnchanged" do
1217
+ role "Maintainer"
1218
+ goal "Prove an edit was comment-only: no file's code differs from the ref"
1219
+
1220
+ attribute :ref, Ref
1221
+ attribute :paths, PathList, optional: true
1222
+ attribute :run, RunKey
1223
+
1224
+ sets :ref
1225
+ sets :paths
1226
+ sets :run
1227
+ sets :operation, to: "check_comments_unchanged"
1228
+
1229
+ emits CheckCommentsUnchangedRequested
1230
+ end
1231
+
1232
+ command "CheckRustComments" do
1233
+ role "Maintainer"
1234
+ goal "List every comment that breaks the Rust style guide"
1235
+
1236
+ attribute :paths, PathList
1237
+ attribute :only, CategoryList, optional: true
1238
+ attribute :run, RunKey
1239
+
1240
+ sets :paths
1241
+ sets :only
1242
+ sets :run
1243
+ sets :operation, to: "check_rust_comments"
1244
+
1245
+ emits CheckRustCommentsRequested
1246
+ end
1247
+
1248
+ command "FixRustComments" do
1249
+ role "Maintainer"
1250
+ goal "Rewrite the mechanical Rust comment violations"
1251
+
1252
+ attribute :paths, PathList
1253
+ attribute :only, CategoryList, optional: true
1254
+ attribute :run, RunKey
1255
+ attribute :confirm, Switch, optional: true
1256
+
1257
+ sets :paths
1258
+ sets :only
1259
+ sets :run
1260
+ sets :confirm
1261
+ sets :operation, to: "fix_rust_comments"
1262
+
1263
+ emits FixRustCommentsRequested
1264
+ end
1265
+
1266
+ command "Canonicalise" do
1267
+ role "Maintainer"
1268
+ goal "Write a JSON document with every object's keys sorted"
1269
+
1270
+ attribute :file, FilePath
1271
+ attribute :run, RunKey
1272
+
1273
+ sets :file
1274
+ sets :run
1275
+ sets :operation, to: "canonicalise"
1276
+
1277
+ emits CanonicaliseRequested
1278
+ end
1279
+
1280
+ # What the tree reported about itself, held against every request: nothing here runs
1281
+ # outside a hecks checkout (hecks.gemspec beside lib/).
1282
+ command "Accept" do
1283
+ role "System"
1284
+ goal "Let a request through only when the working tree is a hecks checkout"
1285
+
1286
+ reference_to StyleRun
1287
+ attribute :checkout, Switch
1288
+
1289
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
1290
+
1291
+ sets :checkout
1292
+
1293
+ emits StyleAccepted
1294
+ end
1295
+
1296
+ command "Complete" do
1297
+ role "System"
1298
+ goal "Record that the request was carried out, and what it reported"
1299
+
1300
+ reference_to StyleRun
1301
+ attribute :report, Report
1302
+
1303
+ sets :report
1304
+
1305
+ emits StyleCompleted
1306
+ end
1307
+
1308
+ command "Fault" do
1309
+ role "System"
1310
+ goal "Record that the request was refused or could not be carried out, and why"
1311
+
1312
+ reference_to StyleRun
1313
+ attribute :refusal, Report
1314
+
1315
+ sets :refusal
1316
+
1317
+ emits StyleFaulted
1318
+ end
1319
+
1320
+ query "StyleOutcome" do
1321
+ description "How one request ended: its status, and what it reported or why it failed."
1322
+ attribute :run, RunKey
1323
+ where(run: :run)
1324
+ order_by :run
1325
+ end
1326
+
1327
+ query "StyleFaulted" do
1328
+ description "Every request that was refused or could not be carried out."
1329
+ where(status: "faulted")
1330
+ order_by :run
1331
+ end
1332
+
1333
+ # An answer that is one document of text, exactly as the tool that produced it wrote it.
1334
+ value_object "Document" do
1335
+ attribute :text, String
1336
+ end
1337
+
1338
+ query "ReportComments" do
1339
+ description "The Ruby comment violations, as summary tables, a list or JSON."
1340
+ attribute :paths, PathList
1341
+ attribute :only, CategoryList, optional: true
1342
+ attribute :json, Switch, optional: true
1343
+ attribute :top, Top, optional: true
1344
+ returns Document
1345
+ end
1346
+
1347
+ query "ReportRustComments" do
1348
+ description "The Rust comment violations, as summary tables, a list or JSON."
1349
+ attribute :paths, PathList
1350
+ attribute :only, CategoryList, optional: true
1351
+ attribute :json, Switch, optional: true
1352
+ attribute :top, Top, optional: true
1353
+ returns Document
1354
+ end
1355
+ end
1356
+
1357
+ policy "ExamineWhenCheckCommentsRequested" do
1358
+ on "StyleRun.CheckCommentsRequested"
1359
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1360
+ end
1361
+
1362
+ policy "ExamineWhenFixCommentsRequested" do
1363
+ on "StyleRun.FixCommentsRequested"
1364
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1365
+ end
1366
+
1367
+ policy "ExamineWhenWriteCommentBaselineRequested" do
1368
+ on "StyleRun.WriteCommentBaselineRequested"
1369
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1370
+ end
1371
+
1372
+ policy "ExamineWhenCheckCommentsUnchangedRequested" do
1373
+ on "StyleRun.CheckCommentsUnchangedRequested"
1374
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1375
+ end
1376
+
1377
+ policy "ExamineWhenCheckRustCommentsRequested" do
1378
+ on "StyleRun.CheckRustCommentsRequested"
1379
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1380
+ end
1381
+
1382
+ policy "ExamineWhenFixRustCommentsRequested" do
1383
+ on "StyleRun.FixRustCommentsRequested"
1384
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1385
+ end
1386
+
1387
+ policy "ExamineWhenCanonicaliseRequested" do
1388
+ on "StyleRun.CanonicaliseRequested"
1389
+ trigger StyleRun::SourceTree::Examine, with: { run: :run }
1390
+ end
1391
+
1392
+ policy "AcceptStyleWhenExamined" do
1393
+ on "StyleRun.StyleExamined"
1394
+ trigger StyleRun::Accept, with: { checkout: :checkout }
1395
+ end
1396
+
1397
+ policy "FaultStyleWhenNotAccepted" do
1398
+ on "StyleRun.StyleExamined"
1399
+ where { !checkout.value }
1400
+ trigger StyleRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
1401
+ end
1402
+
1403
+ policy "PerformStyleWhenAccepted" do
1404
+ on "StyleRun.StyleAccepted"
1405
+ trigger StyleRun::SourceTree::Perform, with: { run: :run }
1406
+ end
1407
+
1408
+ policy "RecordStyleOutcome" do
1409
+ on "StyleRun.StyleAnswered"
1410
+ trigger StyleRun::Complete, with: { report: :report }
1411
+ end
1412
+
1413
+ policy "RecordStyleFault" do
1414
+ on "StyleRun.StyleRefused"
1415
+ trigger StyleRun::Fault, with: { refusal: :refusal }
1416
+ end
1417
+
1418
+ # Codemod: the mechanical rewrites of the example bluebooks. Each one edits tracked files, so
1419
+ # unconfirmed it rehearses the edit (the script reboots every bluebook and puts the files back)
1420
+ # and reports what it would change; the files stay changed only when it is confirmed.
1421
+ aggregate "CodemodRun" do
1422
+ description "One rewrite of the example bluebooks by a codemod, or the rehearsal of it."
1423
+
1424
+ attribute :run, RunKey
1425
+ attribute :operation, Operation, optional: true
1426
+ attribute :confirm, Switch, optional: true
1427
+ attribute :checkout, Switch, optional: true
1428
+ attribute :report, Report, optional: true
1429
+ attribute :refusal, Report, optional: true
1430
+ identified_by :run
1431
+
1432
+ value_object "RunKey" do
1433
+ attribute :value, String, pattern: '[^ \t\n\r]'
1434
+
1435
+ invariant("a run is named") { !value.to_s.empty? }
1436
+ end
1437
+
1438
+ value_object "Operation" do
1439
+ attribute :value, String, pattern: '[^ \t\n\r]'
1440
+ end
1441
+
1442
+ value_object "Switch" do
1443
+ attribute :value, Boolean
1444
+ end
1445
+
1446
+ value_object "Report" do
1447
+ attribute :value, String
1448
+ end
1449
+
1450
+ lifecycle :status, default: "requested" do
1451
+ transition "Accept" => "accepted", from: "requested"
1452
+ transition "Complete" => "completed", from: "accepted"
1453
+ transition "Fault" => "faulted", from: %w[requested accepted]
1454
+ end
1455
+
1456
+ command "HoistLocalGivens" do
1457
+ role "Maintainer"
1458
+ goal "Hoist a given that several commands of one owner repeat into one owner-level given"
1459
+
1460
+ attribute :run, RunKey
1461
+ attribute :confirm, Switch, optional: true
1462
+
1463
+ sets :run
1464
+ sets :confirm
1465
+ sets :operation, to: "hoist_local_givens"
1466
+
1467
+ emits HoistLocalGivensRequested
1468
+ end
1469
+
1470
+ command "DropImplicitAppendFields" do
1471
+ role "Maintainer"
1472
+ goal "Drop an attribute line that only repeats what an append target element declares"
1473
+
1474
+ attribute :run, RunKey
1475
+ attribute :confirm, Switch, optional: true
1476
+
1477
+ sets :run
1478
+ sets :confirm
1479
+ sets :operation, to: "drop_implicit_append_fields"
1480
+
1481
+ emits DropImplicitAppendFieldsRequested
1482
+ end
1483
+
1484
+ # What the tree reported about itself, held against every request: nothing here runs
1485
+ # outside a hecks checkout (hecks.gemspec beside lib/).
1486
+ command "Accept" do
1487
+ role "System"
1488
+ goal "Let a request through only when the working tree is a hecks checkout"
1489
+
1490
+ reference_to CodemodRun
1491
+ attribute :checkout, Switch
1492
+
1493
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
1494
+
1495
+ sets :checkout
1496
+
1497
+ emits CodemodAccepted
1498
+ end
1499
+
1500
+ command "Complete" do
1501
+ role "System"
1502
+ goal "Record that the request was carried out, and what it reported"
1503
+
1504
+ reference_to CodemodRun
1505
+ attribute :report, Report
1506
+
1507
+ sets :report
1508
+
1509
+ emits CodemodCompleted
1510
+ end
1511
+
1512
+ command "Fault" do
1513
+ role "System"
1514
+ goal "Record that the request was refused or could not be carried out, and why"
1515
+
1516
+ reference_to CodemodRun
1517
+ attribute :refusal, Report
1518
+
1519
+ sets :refusal
1520
+
1521
+ emits CodemodFaulted
1522
+ end
1523
+
1524
+ query "CodemodOutcome" do
1525
+ description "How one request ended: its status, and what it reported or why it failed."
1526
+ attribute :run, RunKey
1527
+ where(run: :run)
1528
+ order_by :run
1529
+ end
1530
+
1531
+ query "CodemodFaulted" do
1532
+ description "Every request that was refused or could not be carried out."
1533
+ where(status: "faulted")
1534
+ order_by :run
1535
+ end
1536
+ end
1537
+
1538
+ policy "ExamineWhenHoistLocalGivensRequested" do
1539
+ on "CodemodRun.HoistLocalGivensRequested"
1540
+ trigger CodemodRun::SourceTree::Examine, with: { run: :run }
1541
+ end
1542
+
1543
+ policy "ExamineWhenDropImplicitAppendFieldsRequested" do
1544
+ on "CodemodRun.DropImplicitAppendFieldsRequested"
1545
+ trigger CodemodRun::SourceTree::Examine, with: { run: :run }
1546
+ end
1547
+
1548
+ policy "AcceptCodemodWhenExamined" do
1549
+ on "CodemodRun.CodemodExamined"
1550
+ trigger CodemodRun::Accept, with: { checkout: :checkout }
1551
+ end
1552
+
1553
+ policy "FaultCodemodWhenNotAccepted" do
1554
+ on "CodemodRun.CodemodExamined"
1555
+ where { !checkout.value }
1556
+ trigger CodemodRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
1557
+ end
1558
+
1559
+ policy "PerformCodemodWhenAccepted" do
1560
+ on "CodemodRun.CodemodAccepted"
1561
+ trigger CodemodRun::SourceTree::Perform, with: { run: :run }
1562
+ end
1563
+
1564
+ policy "RecordCodemodOutcome" do
1565
+ on "CodemodRun.CodemodAnswered"
1566
+ trigger CodemodRun::Complete, with: { report: :report }
1567
+ end
1568
+
1569
+ policy "RecordCodemodFault" do
1570
+ on "CodemodRun.CodemodRefused"
1571
+ trigger CodemodRun::Fault, with: { refusal: :refusal }
1572
+ end
1573
+
1574
+ # TestSuite: the tooling around this repository's specs. Listings of which files a shard or a
1575
+ # job runs are pure reads; refreshing the committed timings, rewriting the persistence fixtures
1576
+ # and writing the committed spec list change tracked files and need --confirm; a stress run
1577
+ # and a single example only run specs and write nothing tracked.
1578
+ aggregate "TestSuiteRun" do
1579
+ description "One piece of work on the test suite: a listing, a baseline, a run or a fixture rewrite."
1580
+
1581
+ attribute :run, RunKey
1582
+ attribute :operation, Operation, optional: true
1583
+ attribute :confirm, Switch, optional: true
1584
+ attribute :workers, Count, optional: true
1585
+ attribute :from_run, RunId, optional: true
1586
+ attribute :file, FilePath, optional: true
1587
+ attribute :example, ExampleText, optional: true
1588
+ attribute :runs, Count, optional: true
1589
+ attribute :parallel, Count, optional: true
1590
+ attribute :seed_start, Count, optional: true
1591
+ attribute :fixture, FixtureName, optional: true
1592
+ attribute :exclude, ExcludePattern, optional: true
1593
+ attribute :tags, TagArguments, optional: true
1594
+ attribute :write, FilePath, optional: true
1595
+ attribute :group, Count, optional: true
1596
+ attribute :groups, Count, optional: true
1597
+ attribute :runtime_log, FilePath, optional: true
1598
+ attribute :check, FilePath, optional: true
1599
+ attribute :checkout, Switch, optional: true
1600
+ attribute :report, Report, optional: true
1601
+ attribute :refusal, Report, optional: true
1602
+ identified_by :run
1603
+
1604
+ value_object "RunKey" do
1605
+ attribute :value, String, pattern: '[^ \t\n\r]'
1606
+
1607
+ invariant("a run is named") { !value.to_s.empty? }
1608
+ end
1609
+
1610
+ value_object "Operation" do
1611
+ attribute :value, String, pattern: '[^ \t\n\r]'
1612
+ end
1613
+
1614
+ value_object "Switch" do
1615
+ attribute :value, Boolean
1616
+ end
1617
+
1618
+ value_object "Report" do
1619
+ attribute :value, String
1620
+ end
1621
+
1622
+ # How many, always at least one.
1623
+ value_object "Count" do
1624
+ attribute :value, Integer
1625
+
1626
+ invariant("a count is positive") { value > 0 }
1627
+ end
1628
+
1629
+ # A CI run's number.
1630
+ value_object "RunId" do
1631
+ attribute :value, String, pattern: '^[0-9]+$'
1632
+ end
1633
+
1634
+ # A file, relative to the checkout or absolute.
1635
+ value_object "FilePath" do
1636
+ attribute :value, String, pattern: '[^\t\n\r]'
1637
+
1638
+ invariant("a file is named") { !value.to_s.empty? }
1639
+ end
1640
+
1641
+ # Part of an example's description.
1642
+ value_object "ExampleText" do
1643
+ attribute :value, String, pattern: '[^\t\n\r]'
1644
+
1645
+ invariant("an example is named") { !value.to_s.empty? }
1646
+ end
1647
+
1648
+ # The name of a semantics-corpus fixture.
1649
+ value_object "FixtureName" do
1650
+ attribute :value, String, pattern: '^[a-z0-9_]+$'
1651
+ end
1652
+
1653
+ # A regular expression naming the specs to leave out.
1654
+ value_object "ExcludePattern" do
1655
+ attribute :value, String, pattern: '[^\t\n\r]'
1656
+ end
1657
+
1658
+ # The tag filter, as the test runner spells it.
1659
+ value_object "TagArguments" do
1660
+ attribute :value, String, pattern: '^[^\t\n\r]+$'
1661
+ end
1662
+
1663
+ lifecycle :status, default: "requested" do
1664
+ transition "Accept" => "accepted", from: "requested"
1665
+ transition "Complete" => "completed", from: "accepted"
1666
+ transition "Fault" => "faulted", from: %w[requested accepted]
1667
+ end
1668
+
1669
+ command "RefreshRuntimeBaseline" do
1670
+ role "Maintainer"
1671
+ goal "Regenerate the committed runtime baselines the sharded jobs group from"
1672
+
1673
+ attribute :workers, Count, optional: true
1674
+ attribute :from_run, RunId, optional: true
1675
+ attribute :run, RunKey
1676
+ attribute :confirm, Switch, optional: true
1677
+
1678
+ sets :workers
1679
+ sets :from_run
1680
+ sets :run
1681
+ sets :confirm
1682
+ sets :operation, to: "refresh_runtime_baseline"
1683
+
1684
+ emits RefreshRuntimeBaselineRequested
1685
+ end
1686
+
1687
+ command "RunSpecExample" do
1688
+ role "Maintainer"
1689
+ goal "Run one spec file filtered to one example, through the test runner in this process"
1690
+
1691
+ attribute :file, FilePath
1692
+ attribute :example, ExampleText
1693
+ attribute :run, RunKey
1694
+
1695
+ sets :file
1696
+ sets :example
1697
+ sets :run
1698
+ sets :operation, to: "run_spec_example"
1699
+
1700
+ emits RunSpecExampleRequested
1701
+ end
1702
+
1703
+ command "StressConcurrency" do
1704
+ role "Maintainer"
1705
+ goal "Rerun the thread-safety specs under many seeds, several processes at a time"
1706
+
1707
+ attribute :runs, Count, optional: true
1708
+ attribute :parallel, Count, optional: true
1709
+ attribute :seed_start, Count, optional: true
1710
+ attribute :run, RunKey
1711
+
1712
+ sets :runs
1713
+ sets :parallel
1714
+ sets :seed_start
1715
+ sets :run
1716
+ sets :operation, to: "stress_concurrency"
1717
+
1718
+ emits StressConcurrencyRequested
1719
+ end
1720
+
1721
+ command "RegenerateLegacyFixtures" do
1722
+ role "Maintainer"
1723
+ goal "Regenerate the persistence legacy fixtures through the real adapters"
1724
+
1725
+ attribute :run, RunKey
1726
+ attribute :confirm, Switch, optional: true
1727
+
1728
+ sets :run
1729
+ sets :confirm
1730
+ sets :operation, to: "regenerate_legacy_fixtures"
1731
+
1732
+ emits RegenerateLegacyFixturesRequested
1733
+ end
1734
+
1735
+ command "SeedSemanticsCorpus" do
1736
+ role "Maintainer"
1737
+ goal "Fill the expected outcome of every semantics fixture that lacks one, or re-seed one"
1738
+
1739
+ attribute :fixture, FixtureName, optional: true
1740
+ attribute :run, RunKey
1741
+
1742
+ sets :fixture
1743
+ sets :run
1744
+ sets :operation, to: "seed_semantics_corpus"
1745
+
1746
+ emits SeedSemanticsCorpusRequested
1747
+ end
1748
+
1749
+ command "WriteIoParallelSpecList" do
1750
+ role "Maintainer"
1751
+ goal "Write the committed list of the spec files a tag filter selects"
1752
+
1753
+ attribute :exclude, ExcludePattern
1754
+ attribute :tags, TagArguments, optional: true
1755
+ attribute :write, FilePath
1756
+ attribute :run, RunKey
1757
+ attribute :confirm, Switch, optional: true
1758
+
1759
+ sets :exclude
1760
+ sets :tags
1761
+ sets :write
1762
+ sets :run
1763
+ sets :confirm
1764
+ sets :operation, to: "write_io_parallel_spec_list"
1765
+
1766
+ emits WriteIoParallelSpecListRequested
1767
+ end
1768
+
1769
+ # What the tree reported about itself, held against every request: nothing here runs
1770
+ # outside a hecks checkout (hecks.gemspec beside lib/).
1771
+ command "Accept" do
1772
+ role "System"
1773
+ goal "Let a request through only when the working tree is a hecks checkout"
1774
+
1775
+ reference_to TestSuiteRun
1776
+ attribute :checkout, Switch
1777
+
1778
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
1779
+
1780
+ sets :checkout
1781
+
1782
+ emits TestSuiteAccepted
1783
+ end
1784
+
1785
+ command "Complete" do
1786
+ role "System"
1787
+ goal "Record that the request was carried out, and what it reported"
1788
+
1789
+ reference_to TestSuiteRun
1790
+ attribute :report, Report
1791
+
1792
+ sets :report
1793
+
1794
+ emits TestSuiteCompleted
1795
+ end
1796
+
1797
+ command "Fault" do
1798
+ role "System"
1799
+ goal "Record that the request was refused or could not be carried out, and why"
1800
+
1801
+ reference_to TestSuiteRun
1802
+ attribute :refusal, Report
1803
+
1804
+ sets :refusal
1805
+
1806
+ emits TestSuiteFaulted
1807
+ end
1808
+
1809
+ query "TestSuiteOutcome" do
1810
+ description "How one request ended: its status, and what it reported or why it failed."
1811
+ attribute :run, RunKey
1812
+ where(run: :run)
1813
+ order_by :run
1814
+ end
1815
+
1816
+ query "TestSuiteFaulted" do
1817
+ description "Every request that was refused or could not be carried out."
1818
+ where(status: "faulted")
1819
+ order_by :run
1820
+ end
1821
+
1822
+ # An answer that is one document of text, exactly as the tool that produced it wrote it.
1823
+ value_object "Document" do
1824
+ attribute :text, String
1825
+ end
1826
+
1827
+ query "ShardSpecs" do
1828
+ description "The spec files one group of a runtime-balanced split runs."
1829
+ attribute :group, Count
1830
+ attribute :groups, Count
1831
+ attribute :runtime_log, FilePath, optional: true
1832
+ returns Document
1833
+ end
1834
+
1835
+ query "ListIoParallelSpecs" do
1836
+ description "The spec files with an example a tag filter selects."
1837
+ attribute :exclude, ExcludePattern
1838
+ attribute :tags, TagArguments, optional: true
1839
+ attribute :check, FilePath, optional: true
1840
+ returns Document
1841
+ end
1842
+
1843
+ query "RecordPatternCases" do
1844
+ description "The expected match results of the pattern cases, as JSON."
1845
+ returns Document
1846
+ end
1847
+ end
1848
+
1849
+ policy "ExamineWhenRefreshRuntimeBaselineRequested" do
1850
+ on "TestSuiteRun.RefreshRuntimeBaselineRequested"
1851
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1852
+ end
1853
+
1854
+ policy "ExamineWhenRunSpecExampleRequested" do
1855
+ on "TestSuiteRun.RunSpecExampleRequested"
1856
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1857
+ end
1858
+
1859
+ policy "ExamineWhenStressConcurrencyRequested" do
1860
+ on "TestSuiteRun.StressConcurrencyRequested"
1861
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1862
+ end
1863
+
1864
+ policy "ExamineWhenRegenerateLegacyFixturesRequested" do
1865
+ on "TestSuiteRun.RegenerateLegacyFixturesRequested"
1866
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1867
+ end
1868
+
1869
+ policy "ExamineWhenSeedSemanticsCorpusRequested" do
1870
+ on "TestSuiteRun.SeedSemanticsCorpusRequested"
1871
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1872
+ end
1873
+
1874
+ policy "ExamineWhenWriteIoParallelSpecListRequested" do
1875
+ on "TestSuiteRun.WriteIoParallelSpecListRequested"
1876
+ trigger TestSuiteRun::SourceTree::Examine, with: { run: :run }
1877
+ end
1878
+
1879
+ policy "AcceptTestSuiteWhenExamined" do
1880
+ on "TestSuiteRun.TestSuiteExamined"
1881
+ trigger TestSuiteRun::Accept, with: { checkout: :checkout }
1882
+ end
1883
+
1884
+ policy "FaultTestSuiteWhenNotAccepted" do
1885
+ on "TestSuiteRun.TestSuiteExamined"
1886
+ where { !checkout.value }
1887
+ trigger TestSuiteRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
1888
+ end
1889
+
1890
+ policy "PerformTestSuiteWhenAccepted" do
1891
+ on "TestSuiteRun.TestSuiteAccepted"
1892
+ trigger TestSuiteRun::SourceTree::Perform, with: { run: :run }
1893
+ end
1894
+
1895
+ policy "RecordTestSuiteOutcome" do
1896
+ on "TestSuiteRun.TestSuiteAnswered"
1897
+ trigger TestSuiteRun::Complete, with: { report: :report }
1898
+ end
1899
+
1900
+ policy "RecordTestSuiteFault" do
1901
+ on "TestSuiteRun.TestSuiteRefused"
1902
+ trigger TestSuiteRun::Fault, with: { refusal: :refusal }
1903
+ end
1904
+
1905
+ # Corpus: what this repository's committed domains are, and what the language's own IR holds.
1906
+ # Every question about them is a pure read, answered by the SourceTree port: which domains carry
1907
+ # a Rust feature, the order they regenerate in, whether each generated module is covered, and the
1908
+ # structural queries over the IR. Two commands open a long-running door: the query MCP server
1909
+ # on stdio and the forms app on a local port; each is recorded, runs until it is closed, and
1910
+ # answers when it ends.
1911
+ aggregate "CorpusRun" do
1912
+ description "One look at the corpus and the language's IR, or one server opened on them."
1913
+
1914
+ attribute :run, RunKey
1915
+ attribute :operation, Operation, optional: true
1916
+ attribute :confirm, Switch, optional: true
1917
+ attribute :names, NameList, optional: true
1918
+ attribute :domains, PathList, optional: true
1919
+ attribute :meta, Switch, optional: true
1920
+ attribute :name, ConstructName, optional: true
1921
+ attribute :field, FieldName, optional: true
1922
+ attribute :port, Port, optional: true
1923
+ attribute :checkout, Switch, optional: true
1924
+ attribute :report, Report, optional: true
1925
+ attribute :refusal, Report, optional: true
1926
+ identified_by :run
1927
+
1928
+ value_object "RunKey" do
1929
+ attribute :value, String, pattern: '[^ \t\n\r]'
1930
+
1931
+ invariant("a run is named") { !value.to_s.empty? }
1932
+ end
1933
+
1934
+ value_object "Operation" do
1935
+ attribute :value, String, pattern: '[^ \t\n\r]'
1936
+ end
1937
+
1938
+ value_object "Switch" do
1939
+ attribute :value, Boolean
1940
+ end
1941
+
1942
+ value_object "Report" do
1943
+ attribute :value, String
1944
+ end
1945
+
1946
+ # Construct names, comma separated.
1947
+ value_object "NameList" do
1948
+ attribute :value, String, pattern: '^[A-Za-z][A-Za-z0-9_]*(,[A-Za-z][A-Za-z0-9_]*)*$'
1949
+ end
1950
+
1951
+ # Domain directories, comma separated.
1952
+ value_object "PathList" do
1953
+ attribute :value, String, pattern: '^[^ \t\n\r,]+(,[^ \t\n\r,]+)*$'
1954
+ end
1955
+
1956
+ # The name of one IR construct.
1957
+ value_object "ConstructName" do
1958
+ attribute :value, String, pattern: '^[A-Za-z][A-Za-z0-9_]*$'
1959
+ end
1960
+
1961
+ # The name of one field of a construct.
1962
+ value_object "FieldName" do
1963
+ attribute :value, String, pattern: '^[a-z][a-z0-9_]*$'
1964
+ end
1965
+
1966
+ # A local port a server listens on.
1967
+ value_object "Port" do
1968
+ attribute :value, Integer
1969
+
1970
+ invariant("a port is 1 to 65535") { value >= 1 && value <= 65535 }
1971
+ end
1972
+
1973
+ lifecycle :status, default: "requested" do
1974
+ transition "Accept" => "accepted", from: "requested"
1975
+ transition "Complete" => "completed", from: "accepted"
1976
+ transition "Fault" => "faulted", from: %w[requested accepted]
1977
+ end
1978
+
1979
+ command "ServeQueryIrMcp" do
1980
+ role "Maintainer"
1981
+ goal "Serve the IR queries to an MCP client over stdio until it closes"
1982
+
1983
+ attribute :run, RunKey
1984
+
1985
+ sets :run
1986
+ sets :operation, to: "serve_query_ir_mcp"
1987
+
1988
+ emits ServeQueryIrMcpRequested
1989
+ end
1990
+
1991
+ command "Present" do
1992
+ role "Maintainer"
1993
+ goal "Serve the banking example's rendered forms and views on a local port until stopped"
1994
+
1995
+ attribute :port, Port, optional: true
1996
+ attribute :run, RunKey
1997
+
1998
+ sets :port
1999
+ sets :run
2000
+ sets :operation, to: "present"
2001
+
2002
+ emits PresentRequested
2003
+ end
2004
+
2005
+ # What the tree reported about itself, held against every request: nothing here runs
2006
+ # outside a hecks checkout (hecks.gemspec beside lib/).
2007
+ command "Accept" do
2008
+ role "System"
2009
+ goal "Let a request through only when the working tree is a hecks checkout"
2010
+
2011
+ reference_to CorpusRun
2012
+ attribute :checkout, Switch
2013
+
2014
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
2015
+
2016
+ sets :checkout
2017
+
2018
+ emits CorpusAccepted
2019
+ end
2020
+
2021
+ command "Complete" do
2022
+ role "System"
2023
+ goal "Record that the request was carried out, and what it reported"
2024
+
2025
+ reference_to CorpusRun
2026
+ attribute :report, Report
2027
+
2028
+ sets :report
2029
+
2030
+ emits CorpusCompleted
2031
+ end
2032
+
2033
+ command "Fault" do
2034
+ role "System"
2035
+ goal "Record that the request was refused or could not be carried out, and why"
2036
+
2037
+ reference_to CorpusRun
2038
+ attribute :refusal, Report
2039
+
2040
+ sets :refusal
2041
+
2042
+ emits CorpusFaulted
2043
+ end
2044
+
2045
+ query "CorpusOutcome" do
2046
+ description "How one request ended: its status, and what it reported or why it failed."
2047
+ attribute :run, RunKey
2048
+ where(run: :run)
2049
+ order_by :run
2050
+ end
2051
+
2052
+ query "CorpusFaulted" do
2053
+ description "Every request that was refused or could not be carried out."
2054
+ where(status: "faulted")
2055
+ order_by :run
2056
+ end
2057
+
2058
+ # An answer that is one document of text, exactly as the tool that produced it wrote it.
2059
+ value_object "Document" do
2060
+ attribute :text, String
2061
+ end
2062
+
2063
+ query "RustDomains" do
2064
+ description "The feature and directory of every domain with a Rust feature."
2065
+ returns Document
2066
+ end
2067
+
2068
+ query "RegenOrder" do
2069
+ description "The directories regeneration walks, in the order it walks them."
2070
+ returns Document
2071
+ end
2072
+
2073
+ query "CorpusRustCoverage" do
2074
+ description "Whether every generated Rust module is routed by its domain."
2075
+ returns Document
2076
+ end
2077
+
2078
+ query "IrConstructs" do
2079
+ description "The structural diff of each IR construct from its meta-domain."
2080
+ attribute :names, NameList, optional: true
2081
+ returns Document
2082
+ end
2083
+
2084
+ query "IrDuplicates" do
2085
+ description "The rules declared more than once across the corpus."
2086
+ attribute :domains, PathList, optional: true
2087
+ attribute :meta, Switch, optional: true
2088
+ returns Document
2089
+ end
2090
+
2091
+ query "IrImpact" do
2092
+ description "Which propagation touchpoints of a construct's field already show it."
2093
+ attribute :name, ConstructName
2094
+ attribute :field, FieldName
2095
+ returns Document
2096
+ end
2097
+ end
2098
+
2099
+ policy "ExamineWhenServeQueryIrMcpRequested" do
2100
+ on "CorpusRun.ServeQueryIrMcpRequested"
2101
+ trigger CorpusRun::SourceTree::Examine, with: { run: :run }
2102
+ end
2103
+
2104
+ policy "ExamineWhenPresentRequested" do
2105
+ on "CorpusRun.PresentRequested"
2106
+ trigger CorpusRun::SourceTree::Examine, with: { run: :run }
2107
+ end
2108
+
2109
+ policy "AcceptCorpusWhenExamined" do
2110
+ on "CorpusRun.CorpusExamined"
2111
+ trigger CorpusRun::Accept, with: { checkout: :checkout }
2112
+ end
2113
+
2114
+ policy "FaultCorpusWhenNotAccepted" do
2115
+ on "CorpusRun.CorpusExamined"
2116
+ where { !checkout.value }
2117
+ trigger CorpusRun::Fault, with: { refusal: "needs a hecks checkout: hecks.gemspec stands beside lib/" }
2118
+ end
2119
+
2120
+ policy "PerformCorpusWhenAccepted" do
2121
+ on "CorpusRun.CorpusAccepted"
2122
+ trigger CorpusRun::SourceTree::Perform, with: { run: :run }
2123
+ end
2124
+
2125
+ policy "RecordCorpusOutcome" do
2126
+ on "CorpusRun.CorpusAnswered"
2127
+ trigger CorpusRun::Complete, with: { report: :report }
2128
+ end
2129
+
2130
+ policy "RecordCorpusFault" do
2131
+ on "CorpusRun.CorpusRefused"
2132
+ trigger CorpusRun::Fault, with: { refusal: :refusal }
2133
+ end
2134
+
2135
+ # Publishing: cutting a release of this gem. The run holds the facts the Git adapter surveyed
2136
+ # (branch, tree, versions, changelog, tag), and `Accept` holds the rules that let a release go
2137
+ # ahead: the adapter supplies the facts and the givens decide. Only an accepted run is carried
2138
+ # out, and without --confirm it is the old dry run: every check and build, nothing tagged,
2139
+ # pushed or published. A real run advances the root Release: tagged, published, verified.
2140
+ aggregate "PublishingRun" do
2141
+ description "One release of the gem, or the rehearsal of it: judged by the facts, then carried out."
2142
+
2143
+ attribute :run, RunKey
2144
+ attribute :operation, Operation, optional: true
2145
+ attribute :confirm, Switch, optional: true
2146
+ attribute :gem_only, Switch, optional: true
2147
+ attribute :npm_only, Switch, optional: true
2148
+ attribute :npm_local, Switch, optional: true
2149
+ attribute :no_wait, Switch, optional: true
2150
+ attribute :checkout, Switch, optional: true
2151
+ attribute :branch, Word, optional: true
2152
+ attribute :on_origin, Switch, optional: true
2153
+ attribute :clean, Switch, optional: true
2154
+ attribute :version, Version, optional: true
2155
+ attribute :client_version, Version, optional: true
2156
+ attribute :changelog, Switch, optional: true
2157
+ attribute :tag_state, Word, optional: true
2158
+ attribute :head, Word, optional: true
2159
+ attribute :ir_version, Version, optional: true
2160
+ attribute :ships_from, Checkout, optional: true
2161
+ attribute :tagged, Switch, optional: true
2162
+ attribute :published, Switch, optional: true
2163
+ attribute :verified, Switch, optional: true
2164
+ attribute :report, Report, optional: true
2165
+ attribute :refusal, Report, optional: true
2166
+ identified_by :run
2167
+
2168
+ value_object "RunKey" do
2169
+ attribute :value, String, pattern: '[^ \t\n\r]'
2170
+
2171
+ invariant("a run is named") { !value.to_s.empty? }
2172
+ end
2173
+
2174
+ value_object "Operation" do
2175
+ attribute :value, String, pattern: '[^ \t\n\r]'
2176
+ end
2177
+
2178
+ value_object "Switch" do
2179
+ attribute :value, Boolean
2180
+ end
2181
+
2182
+ value_object "Report" do
2183
+ attribute :value, String
2184
+ end
2185
+
2186
+ # One word of a fact: a branch, a commit, whether a tag stands.
2187
+ value_object "Word" do
2188
+ attribute :value, String, pattern: '[^ \t\n\r]'
2189
+ end
2190
+
2191
+ value_object "Version" do
2192
+ attribute :value, String, pattern: '^[0-9]+[.][0-9]+[.][0-9]+'
2193
+ end
2194
+
2195
+ # The working tree the release is cut from.
2196
+ value_object "Checkout" do
2197
+ attribute :path, String
2198
+ end
2199
+
2200
+ lifecycle :status, default: "requested" do
2201
+ transition "Accept" => "accepted", from: "requested"
2202
+ transition "AcceptGem" => "accepted", from: "requested"
2203
+ transition "Complete" => "completed", from: "accepted"
2204
+ transition "Fault" => "faulted", from: %w[requested accepted]
2205
+ end
2206
+
2207
+ command "Publish" do
2208
+ role "Maintainer"
2209
+ goal "Tag the merged release commit, publish the gem, and get the client package published"
2210
+
2211
+ attribute :gem_only, Switch, optional: true
2212
+ attribute :npm_only, Switch, optional: true
2213
+ attribute :npm_local, Switch, optional: true
2214
+ attribute :no_wait, Switch, optional: true
2215
+ attribute :run, RunKey
2216
+ attribute :confirm, Switch, optional: true
2217
+
2218
+ sets :gem_only
2219
+ sets :npm_only
2220
+ sets :npm_local
2221
+ sets :no_wait
2222
+ sets :run
2223
+ sets :confirm
2224
+ sets :operation, to: "publish"
2225
+
2226
+ emits PublishRequested
2227
+ end
2228
+
2229
+ command "PublishGem" do
2230
+ role "Maintainer"
2231
+ goal "Build the gem and push it to the gem registry, with the key the vault holds"
2232
+
2233
+ attribute :run, RunKey
2234
+ attribute :confirm, Switch, optional: true
2235
+
2236
+ sets :run
2237
+ sets :confirm
2238
+ sets :operation, to: "publish_gem"
2239
+
2240
+ emits PublishGemRequested
2241
+ end
2242
+
2243
+ # What the tree reported about itself, and the facts the Git adapter surveyed, held against the
2244
+ # rules of a release. Nothing here runs outside a hecks checkout (hecks.gemspec beside lib/).
2245
+ command "Accept" do
2246
+ role "System"
2247
+ goal "Let a release go ahead only in a hecks checkout, and only when the facts satisfy every rule"
2248
+
2249
+ reference_to PublishingRun
2250
+ attribute :checkout, Switch
2251
+ attribute :branch, Word
2252
+ attribute :on_origin, Switch
2253
+ attribute :clean, Switch
2254
+ attribute :version, Version
2255
+ attribute :client_version, Version
2256
+ attribute :changelog, Switch
2257
+ attribute :tag_state, Word
2258
+ attribute :head, Word
2259
+ attribute :ir_version, Version
2260
+ attribute :ships_from, Checkout
2261
+
2262
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
2263
+ given("a release is cut from main: switch to main first") { branch.value == "main" }
2264
+ given("main is origin/main: merge the release PR, then pull") { on_origin.value }
2265
+ given("the working tree is clean: commit or discard changes first") { clean.value }
2266
+ given("the client package is at the gem's version: bump the package first") do
2267
+ client_version.value == version.value
2268
+ end
2269
+ given("CHANGELOG.md has a heading for the version: add the release entry") { changelog.value }
2270
+ given("a tag for the version points at the release commit, not elsewhere") do
2271
+ tag_state.value != "elsewhere"
2272
+ end
2273
+
2274
+ sets :checkout
2275
+ sets :branch
2276
+ sets :on_origin
2277
+ sets :clean
2278
+ sets :version
2279
+ sets :client_version
2280
+ sets :changelog
2281
+ sets :tag_state
2282
+ sets :head
2283
+ sets :ir_version
2284
+ sets :ships_from
2285
+
2286
+ emits PublishingAccepted
2287
+ end
2288
+
2289
+ # release_gem's one rule: the client package is released beside the gem at the same version.
2290
+ command "AcceptGem" do
2291
+ role "System"
2292
+ goal "Let a gem push go ahead only in a hecks checkout, with the client package at the gem's version"
2293
+
2294
+ reference_to PublishingRun
2295
+ attribute :checkout, Switch
2296
+ attribute :version, Version
2297
+ attribute :client_version, Version
2298
+ attribute :ir_version, Version
2299
+ attribute :ships_from, Checkout
2300
+
2301
+ given("needs a hecks checkout: hecks.gemspec stands beside lib/") { checkout.value }
2302
+ given("the client package is at the gem's version: bump the package first") do
2303
+ client_version.value == version.value
2304
+ end
2305
+
2306
+ sets :checkout
2307
+ sets :version
2308
+ sets :client_version
2309
+ sets :ir_version
2310
+ sets :ships_from
2311
+
2312
+ emits GemAccepted
2313
+ end
2314
+
2315
+ command "Complete" do
2316
+ role "System"
2317
+ goal "Record that the release was carried out, what it did, and what it reported"
2318
+
2319
+ reference_to PublishingRun
2320
+ attribute :report, Report
2321
+ attribute :tagged, Switch
2322
+ attribute :published, Switch
2323
+ attribute :verified, Switch
2324
+
2325
+ sets :report
2326
+ sets :tagged
2327
+ sets :published
2328
+ sets :verified
2329
+
2330
+ emits PublishingCompleted
2331
+ end
2332
+
2333
+ command "Fault" do
2334
+ role "System"
2335
+ goal "Record that the request was refused or could not be carried out, and why"
2336
+
2337
+ reference_to PublishingRun
2338
+ attribute :refusal, Report
2339
+
2340
+ sets :refusal
2341
+
2342
+ emits PublishingFaulted
2343
+ end
2344
+
2345
+ query "PublishingOutcome" do
2346
+ description "How one request ended: its status, and what it reported or why it failed."
2347
+ attribute :run, RunKey
2348
+ where(run: :run)
2349
+ order_by :run
2350
+ end
2351
+
2352
+ query "PublishingFaulted" do
2353
+ description "Every request that was refused or could not be carried out."
2354
+ where(status: "faulted")
2355
+ order_by :run
2356
+ end
2357
+ end
2358
+
2359
+ policy "ExaminePublishingWhenPublishRequested" do
2360
+ on "PublishingRun.PublishRequested"
2361
+ trigger PublishingRun::SourceTree::Examine, with: { run: :run }
2362
+ end
2363
+
2364
+ policy "ExaminePublishingWhenPublishGemRequested" do
2365
+ on "PublishingRun.PublishGemRequested"
2366
+ trigger PublishingRun::SourceTree::Examine, with: { run: :run }
2367
+ end
2368
+
2369
+ policy "AcceptTheReleaseWhenExamined" do
2370
+ on "PublishingRun.PublishingExamined"
2371
+ where { operation.value == "publish" }
2372
+ trigger PublishingRun::Accept, with: { checkout: :checkout, branch: :branch, on_origin: :on_origin,
2373
+ clean: :clean, version: :version, client_version: :client_version,
2374
+ changelog: :changelog, tag_state: :tag_state, head: :head,
2375
+ ir_version: :ir_version, ships_from: :ships_from }
2376
+ end
2377
+
2378
+ policy "AcceptTheGemWhenExamined" do
2379
+ on "PublishingRun.PublishingExamined"
2380
+ where { operation.value == "publish_gem" }
2381
+ trigger PublishingRun::AcceptGem, with: { checkout: :checkout, version: :version,
2382
+ client_version: :client_version, ir_version: :ir_version,
2383
+ ships_from: :ships_from }
2384
+ end
2385
+
2386
+ policy "FaultTheReleaseWhenNotAccepted" do
2387
+ on "PublishingRun.PublishingExamined"
2388
+ where do
2389
+ operation.value == "publish" &&
2390
+ (!checkout.value || branch.value != "main" || !on_origin.value || !clean.value ||
2391
+ client_version.value != version.value || !changelog.value || tag_state.value == "elsewhere")
2392
+ end
2393
+ trigger PublishingRun::Fault, with: { refusal: "a release rule is not met: check the branch, tree, versions, CHANGELOG and tag" }
2394
+ end
2395
+
2396
+ policy "FaultTheGemWhenNotAccepted" do
2397
+ on "PublishingRun.PublishingExamined"
2398
+ where do
2399
+ operation.value == "publish_gem" && (!checkout.value || client_version.value != version.value)
2400
+ end
2401
+ trigger PublishingRun::Fault, with: { refusal: "a gem push rule is not met: needs a checkout and the client at the gem's version" }
2402
+ end
2403
+
2404
+ policy "PerformPublishingWhenAccepted" do
2405
+ on "PublishingRun.PublishingAccepted"
2406
+ trigger PublishingRun::SourceTree::Perform, with: { run: :run }
2407
+ end
2408
+
2409
+ policy "PerformPublishingWhenGemAccepted" do
2410
+ on "PublishingRun.GemAccepted"
2411
+ trigger PublishingRun::SourceTree::Perform, with: { run: :run }
2412
+ end
2413
+
2414
+ # A real run advances the root Release: tagged when the tag was made, published when a registry
2415
+ # took the gem, verified when every registry in scope lists the version.
2416
+ policy "RecordTheTagWhenPublished" do
2417
+ on "PublishingRun.PublishingAnswered"
2418
+ where { tagged.value }
2419
+ trigger Release::Tag, with: { version: :version, ir_version: :ir_version, ships_from: :ships_from }
2420
+ end
2421
+
2422
+ policy "RecordThePublishingWhenPublished" do
2423
+ on "PublishingRun.PublishingAnswered"
2424
+ where { published.value }
2425
+ trigger Release::MarkPublished, with: { version: :version }
2426
+ end
2427
+
2428
+ policy "RecordTheVerificationWhenPublished" do
2429
+ on "PublishingRun.PublishingAnswered"
2430
+ where { verified.value }
2431
+ trigger Release::Verify, with: { version: :version }
2432
+ end
2433
+
2434
+ # A release that stopped after a real step (the tag pushed, the gem published) still records the
2435
+ # steps it took on the root Release, then ends as a fault carrying what the release said.
2436
+ policy "RecordPublishingOutcome" do
2437
+ on "PublishingRun.PublishingAnswered"
2438
+ where { succeeded.value }
2439
+ trigger PublishingRun::Complete, with: { report: :report, tagged: :tagged, published: :published,
2440
+ verified: :verified }
2441
+ end
2442
+
2443
+ policy "RecordPublishingShortfall" do
2444
+ on "PublishingRun.PublishingAnswered"
2445
+ where { succeeded.value == false }
2446
+ trigger PublishingRun::Fault, with: { refusal: :report }
2447
+ end
2448
+
2449
+ policy "RecordPublishingFault" do
2450
+ on "PublishingRun.PublishingRefused"
2451
+ trigger PublishingRun::Fault, with: { refusal: :refusal }
2452
+ end
2453
+ end