rigortype 0.4.8 → 0.4.9
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/handbook/01-getting-started.md +1 -1
- data/docs/handbook/04-tuples-and-shapes.md +6 -1
- data/docs/handbook/12-lightweight-hkt.md +1 -1
- data/docs/handbook/appendix-typescript.md +28 -17
- data/docs/manual/02-cli-reference.md +10 -0
- data/docs/manual/03-configuration.md +1 -1
- data/docs/manual/04-diagnostics.md +1 -1
- data/docs/manual/10-mcp-server.md +122 -10
- data/docs/manual/plugins/rigor-activerecord.md +7 -0
- data/lib/rigor/analysis/check_rules/always_raises.rb +95 -0
- data/lib/rigor/analysis/check_rules/always_truthy_condition_collector.rb +32 -2
- data/lib/rigor/analysis/check_rules/argument_type.rb +802 -0
- data/lib/rigor/analysis/check_rules/call_facts.rb +2 -2
- data/lib/rigor/analysis/check_rules/dead_assignment_collector.rb +30 -1
- data/lib/rigor/analysis/check_rules/declaration_sourced_guard.rb +4 -5
- data/lib/rigor/analysis/check_rules/duplicate_hash_key_collector.rb +34 -0
- data/lib/rigor/analysis/check_rules/ivar_write_collector.rb +131 -4
- data/lib/rigor/analysis/check_rules/nil_receiver.rb +195 -0
- data/lib/rigor/analysis/check_rules/override_param_narrowed.rb +111 -0
- data/lib/rigor/analysis/check_rules/override_return_widened.rb +88 -0
- data/lib/rigor/analysis/check_rules/override_support.rb +246 -0
- data/lib/rigor/analysis/check_rules/override_visibility.rb +135 -0
- data/lib/rigor/analysis/check_rules/published_constant_guard.rb +75 -31
- data/lib/rigor/analysis/check_rules/raise_non_exception.rb +198 -0
- data/lib/rigor/analysis/check_rules/receiver_predicates.rb +576 -0
- data/lib/rigor/analysis/check_rules/return_in_ensure_collector.rb +52 -4
- data/lib/rigor/analysis/check_rules/return_type.rb +225 -0
- data/lib/rigor/analysis/check_rules/rigor_testing.rb +119 -0
- data/lib/rigor/analysis/check_rules/rule_ids.rb +7 -7
- data/lib/rigor/analysis/check_rules/rule_walk.rb +4 -3
- data/lib/rigor/analysis/check_rules/self_closedness_scanner.rb +2 -0
- data/lib/rigor/analysis/check_rules/self_undefined_method.rb +165 -0
- data/lib/rigor/analysis/check_rules/shadowed_rescue_collector.rb +34 -0
- data/lib/rigor/analysis/check_rules/source_arity.rb +2 -2
- data/lib/rigor/analysis/check_rules/special_global_write.rb +256 -0
- data/lib/rigor/analysis/check_rules/suppression.rb +275 -0
- data/lib/rigor/analysis/check_rules/undefined_method.rb +882 -0
- data/lib/rigor/analysis/check_rules/unreachable_branch.rb +97 -0
- data/lib/rigor/analysis/check_rules/unreachable_clause_collector.rb +42 -0
- data/lib/rigor/analysis/check_rules/unresolved_toplevel.rb +140 -0
- data/lib/rigor/analysis/check_rules/visibility_mismatch.rb +252 -0
- data/lib/rigor/analysis/check_rules/void_value_use_collector.rb +27 -0
- data/lib/rigor/analysis/check_rules/wrong_arity.rb +303 -0
- data/lib/rigor/analysis/check_rules.rb +66 -4931
- data/lib/rigor/analysis/dependency_recorder.rb +1 -1
- data/lib/rigor/analysis/dependency_source_inference/builder.rb +2 -4
- data/lib/rigor/analysis/dependency_source_inference/gem_resolver.rb +1 -2
- data/lib/rigor/analysis/dependency_source_inference/walker.rb +15 -15
- data/lib/rigor/analysis/incremental_session.rb +4 -4
- data/lib/rigor/analysis/path_expansion.rb +1 -1
- data/lib/rigor/analysis/plugin_fact_fingerprint.rb +5 -5
- data/lib/rigor/analysis/reachability/graph.rb +2 -3
- data/lib/rigor/analysis/reachability/plugin_roots.rb +2 -2
- data/lib/rigor/analysis/reachability/scan.rb +2 -2
- data/lib/rigor/analysis/rule_catalog.rb +2 -1
- data/lib/rigor/analysis/run_cache_key.rb +9 -8
- data/lib/rigor/analysis/runner/buffer_pool_dispatcher.rb +2 -2
- data/lib/rigor/analysis/runner/dependency_rows.rb +206 -0
- data/lib/rigor/analysis/runner/diagnostic_aggregator.rb +24 -22
- data/lib/rigor/analysis/runner/effect_cache_entries.rb +69 -0
- data/lib/rigor/analysis/runner/pool_coordinator.rb +6 -8
- data/lib/rigor/analysis/runner/project_pre_passes.rb +3 -5
- data/lib/rigor/analysis/runner/scope_seed.rb +144 -0
- data/lib/rigor/analysis/runner.rb +49 -296
- data/lib/rigor/analysis/template_unit_collector.rb +1 -1
- data/lib/rigor/analysis/template_units.rb +10 -10
- data/lib/rigor/analysis/worker_session.rb +7 -7
- data/lib/rigor/bleeding_edge.rb +3 -2
- data/lib/rigor/builtins/hkt_builtins.rb +17 -17
- data/lib/rigor/builtins/imported_refinements.rb +8 -16
- data/lib/rigor/builtins/regex_refinement.rb +3 -3
- data/lib/rigor/builtins/static_return_refinements.rb +143 -19
- data/lib/rigor/cache/incremental_snapshot.rb +21 -8
- data/lib/rigor/cache/rbs_descriptor.rb +18 -1
- data/lib/rigor/cli/coverage_renderer.rb +15 -1
- data/lib/rigor/cli/coverage_report.rb +19 -1
- data/lib/rigor/cli/diagnostic_formats.rb +3 -2
- data/lib/rigor/cli/docs_command.rb +5 -5
- data/lib/rigor/cli/effects_command.rb +7 -6
- data/lib/rigor/cli/fused_protection_report.rb +7 -7
- data/lib/rigor/cli/lsp_command.rb +1 -1
- data/lib/rigor/cli/mcp_command.rb +5 -2
- data/lib/rigor/cli/options.rb +4 -0
- data/lib/rigor/cli/plugins_command.rb +1 -1
- data/lib/rigor/cli/sig_gen_command.rb +1 -1
- data/lib/rigor/cli/skill_command.rb +5 -4
- data/lib/rigor/cli/triage_renderer.rb +3 -2
- data/lib/rigor/cli/unused_command.rb +4 -4
- data/lib/rigor/cli.rb +14 -0
- data/lib/rigor/configuration/coercion.rb +418 -0
- data/lib/rigor/configuration/defaults.rb +248 -0
- data/lib/rigor/configuration/dependencies.rb +1 -1
- data/lib/rigor/configuration/loader.rb +354 -0
- data/lib/rigor/configuration/severity_profile.rb +4 -4
- data/lib/rigor/configuration.rb +51 -860
- data/lib/rigor/effects/attribution.rb +1 -1
- data/lib/rigor/effects/effect_table.rb +1 -1
- data/lib/rigor/effects/identity.rb +3 -3
- data/lib/rigor/effects/local_ownership.rb +2 -2
- data/lib/rigor/effects/snapshot.rb +1 -1
- data/lib/rigor/effects/summary.rb +5 -4
- data/lib/rigor/environment/member_consistency.rb +10 -0
- data/lib/rigor/environment/rbs_loader.rb +19 -22
- data/lib/rigor/environment/reflection.rb +1 -1
- data/lib/rigor/environment/unreadable_signature.rb +21 -0
- data/lib/rigor/environment.rb +8 -8
- data/lib/rigor/flow_contribution/merger.rb +1 -0
- data/lib/rigor/hashing/xxh3.rb +1 -1
- data/lib/rigor/inference/acceptance.rb +23 -2
- data/lib/rigor/inference/alias_mutation_floor/site_collector.rb +5 -0
- data/lib/rigor/inference/alias_mutation_floor.rb +0 -5
- data/lib/rigor/inference/anonymous_meta_class.rb +2 -2
- data/lib/rigor/inference/block_call_timing.rb +6 -0
- data/lib/rigor/inference/budget_trace.rb +3 -2
- data/lib/rigor/inference/builtins/date_catalog.rb +3 -3
- data/lib/rigor/inference/builtins/method_catalog.rb +3 -3
- data/lib/rigor/inference/builtins/time_catalog.rb +3 -3
- data/lib/rigor/inference/call_ladder/literal_send.rb +98 -0
- data/lib/rigor/inference/call_ladder/overriding_def.rb +98 -0
- data/lib/rigor/inference/call_ladder/project_singleton.rb +362 -0
- data/lib/rigor/inference/call_ladder/refined.rb +212 -0
- data/lib/rigor/inference/call_ladder/top_level_def.rb +222 -0
- data/lib/rigor/inference/call_ladder/user_method.rb +247 -0
- data/lib/rigor/inference/call_ladder.rb +219 -0
- data/lib/rigor/inference/callee_write_census.rb +2 -2
- data/lib/rigor/inference/captured_locals.rb +2 -2
- data/lib/rigor/inference/clause_widening.rb +63 -1
- data/lib/rigor/inference/declaration_walk/context.rb +12 -12
- data/lib/rigor/inference/declaration_walk/rules.rb +750 -0
- data/lib/rigor/inference/declaration_walk/traversal.rb +9 -8
- data/lib/rigor/inference/declaration_walk.rb +4 -3
- data/lib/rigor/inference/def_node_resolver.rb +2 -2
- data/lib/rigor/inference/def_return_typer.rb +14 -6
- data/lib/rigor/inference/deferred_mutation.rb +120 -0
- data/lib/rigor/inference/define_method_block_self.rb +1 -1
- data/lib/rigor/inference/definer_resolution.rb +4 -4
- data/lib/rigor/inference/error_info.rb +8 -8
- data/lib/rigor/inference/expression_typer/composites.rb +348 -0
- data/lib/rigor/inference/expression_typer/per_element_assemblers.rb +233 -0
- data/lib/rigor/inference/expression_typer/writes.rb +218 -0
- data/lib/rigor/inference/expression_typer.rb +275 -1825
- data/lib/rigor/inference/external_ancestor_resolution.rb +2 -2
- data/lib/rigor/inference/fallback.rb +1 -0
- data/lib/rigor/inference/for_yield_slots.rb +126 -0
- data/lib/rigor/inference/genuine_send.rb +92 -0
- data/lib/rigor/inference/global_write_census.rb +2 -2
- data/lib/rigor/inference/hkt_body.rb +2 -0
- data/lib/rigor/inference/in_effect_refinements/walk.rb +2 -2
- data/lib/rigor/inference/index_write_widening.rb +4 -4
- data/lib/rigor/inference/indexed_narrowing.rb +1 -1
- data/lib/rigor/inference/intervening_ivar_reset.rb +46 -9
- data/lib/rigor/inference/ivar_writer_census.rb +1 -1
- data/lib/rigor/inference/loop_store_sites.rb +239 -0
- data/lib/rigor/inference/macro_block_self_type.rb +4 -3
- data/lib/rigor/inference/method_dispatcher/block_folding.rb +3 -2
- data/lib/rigor/inference/method_dispatcher/call_context.rb +84 -14
- data/lib/rigor/inference/method_dispatcher/composite_receiver.rb +144 -0
- data/lib/rigor/inference/method_dispatcher/constant_folding.rb +7 -5
- data/lib/rigor/inference/method_dispatcher/declared_constructor.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/dependency_source.rb +90 -0
- data/lib/rigor/inference/method_dispatcher/discovered_method.rb +78 -0
- data/lib/rigor/inference/method_dispatcher/file_folding.rb +2 -2
- data/lib/rigor/inference/method_dispatcher/hkt_builtin_return.rb +40 -0
- data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +1 -6
- data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +4 -2
- data/lib/rigor/inference/method_dispatcher/match_data_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/meta_introspection.rb +506 -0
- data/lib/rigor/inference/method_dispatcher/overload_selector.rb +2 -0
- data/lib/rigor/inference/method_dispatcher/plugin_contribution.rb +134 -0
- data/lib/rigor/inference/method_dispatcher/project_patched.rb +134 -0
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +125 -43
- data/lib/rigor/inference/method_dispatcher/reduce_folding.rb +3 -4
- data/lib/rigor/inference/method_dispatcher/regexp_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/set_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +19 -6
- data/lib/rigor/inference/method_dispatcher/singleton_folding.rb +3 -3
- data/lib/rigor/inference/method_dispatcher/singleton_mixin_dispatch.rb +7 -4
- data/lib/rigor/inference/method_dispatcher/static_refinement.rb +106 -0
- data/lib/rigor/inference/method_dispatcher/synthesized_stub.rb +41 -0
- data/lib/rigor/inference/method_dispatcher/synthetic_method_dispatch.rb +133 -0
- data/lib/rigor/inference/method_dispatcher/universal_object_dispatch.rb +2 -1
- data/lib/rigor/inference/method_dispatcher/user_class_fallback.rb +216 -0
- data/lib/rigor/inference/method_dispatcher.rb +175 -1361
- data/lib/rigor/inference/method_parameter_binder.rb +18 -18
- data/lib/rigor/inference/module_function_state.rb +5 -4
- data/lib/rigor/inference/mutation_widening.rb +20 -7
- data/lib/rigor/inference/narrowing/case_literals.rb +58 -0
- data/lib/rigor/inference/narrowing/class_dispatch.rb +302 -0
- data/lib/rigor/inference/narrowing/complements.rb +322 -0
- data/lib/rigor/inference/narrowing/presence_predicates.rb +205 -0
- data/lib/rigor/inference/narrowing/regex_match.rb +499 -0
- data/lib/rigor/inference/narrowing.rb +86 -1269
- data/lib/rigor/inference/object_mixins.rb +2 -2
- data/lib/rigor/inference/opaque_mutation.rb +214 -0
- data/lib/rigor/inference/optimistic_origin.rb +52 -14
- data/lib/rigor/inference/parameter_inference_collector.rb +1 -1
- data/lib/rigor/inference/pre_eval_constants.rb +11 -9
- data/lib/rigor/inference/precision_scanner.rb +27 -2
- data/lib/rigor/inference/project_patched_methods.rb +3 -3
- data/lib/rigor/inference/range_constant.rb +3 -3
- data/lib/rigor/inference/rbs_type_translator.rb +2 -2
- data/lib/rigor/inference/refine_self.rb +8 -7
- data/lib/rigor/inference/refined_dispatch.rb +2 -2
- data/lib/rigor/inference/return_barrier.rb +24 -9
- data/lib/rigor/inference/scope_indexer/alias_def_nodes.rb +311 -0
- data/lib/rigor/inference/scope_indexer/census_scope.rb +47 -0
- data/lib/rigor/inference/scope_indexer/certainty.rb +2 -2
- data/lib/rigor/inference/scope_indexer/class_cvar_census.rb +282 -0
- data/lib/rigor/inference/scope_indexer/class_cvars_collector.rb +12 -5
- data/lib/rigor/inference/scope_indexer/class_declarations.rb +228 -0
- data/lib/rigor/inference/scope_indexer/class_ivar_index.rb +2028 -0
- data/lib/rigor/inference/scope_indexer/constant_ivar_value.rb +4 -3
- data/lib/rigor/inference/scope_indexer/constant_tables.rb +844 -0
- data/lib/rigor/inference/scope_indexer/cvar_hierarchy.rb +159 -0
- data/lib/rigor/inference/scope_indexer/declaration_artifacts.rb +219 -0
- data/lib/rigor/inference/scope_indexer/declaration_signature.rb +212 -0
- data/lib/rigor/inference/scope_indexer/def_nestings_collector.rb +2 -2
- data/lib/rigor/inference/scope_indexer/factory_call_resolver.rb +53 -0
- data/lib/rigor/inference/scope_indexer/literal_receiver_mutations.rb +266 -0
- data/lib/rigor/inference/scope_indexer/member_layouts_collector.rb +8 -7
- data/lib/rigor/inference/scope_indexer/mixin_accumulator.rb +1 -1
- data/lib/rigor/inference/scope_indexer/mixin_effects.rb +470 -0
- data/lib/rigor/inference/scope_indexer/mixin_tables.rb +388 -0
- data/lib/rigor/inference/scope_indexer/mutated_carrier_widening.rb +163 -0
- data/lib/rigor/inference/scope_indexer/mutated_element_census.rb +211 -0
- data/lib/rigor/inference/scope_indexer/node_propagation.rb +520 -0
- data/lib/rigor/inference/scope_indexer/program_globals.rb +154 -0
- data/lib/rigor/inference/scope_indexer/published_constant_cvars.rb +146 -0
- data/lib/rigor/inference/scope_indexer/published_constant_ivars.rb +181 -0
- data/lib/rigor/inference/scope_indexer/shared_walk_tables.rb +823 -0
- data/lib/rigor/inference/scope_indexer/singleton_class_sources.rb +85 -0
- data/lib/rigor/inference/scope_indexer/superclasses_collector.rb +5 -5
- data/lib/rigor/inference/scope_indexer.rb +2657 -9558
- data/lib/rigor/inference/self_call_ivar_writes.rb +22 -3
- data/lib/rigor/inference/set_mutation.rb +2 -2
- data/lib/rigor/inference/singleton_hook_definers.rb +185 -0
- data/lib/rigor/inference/statement_evaluator/def_arguments_and_assertions.rb +365 -0
- data/lib/rigor/inference/statement_evaluator/pattern_bindings.rb +581 -0
- data/lib/rigor/inference/statement_evaluator.rb +201 -1008
- data/lib/rigor/inference/synthetic_method_scanner.rb +0 -3
- data/lib/rigor/language_server/completion_provider.rb +8 -8
- data/lib/rigor/language_server/diagnostic_publisher.rb +6 -7
- data/lib/rigor/language_server/document_symbol_provider.rb +4 -6
- data/lib/rigor/language_server/folding_range_provider.rb +3 -3
- data/lib/rigor/language_server/hover_provider.rb +2 -2
- data/lib/rigor/language_server/loop.rb +2 -2
- data/lib/rigor/language_server/server.rb +3 -2
- data/lib/rigor/language_server/signature_help_provider.rb +7 -9
- data/lib/rigor/lens/document.rb +10 -1
- data/lib/rigor/lens/file_reader.rb +2 -1
- data/lib/rigor/mcp/loop.rb +48 -6
- data/lib/rigor/mcp/server.rb +248 -23
- data/lib/rigor/mcp/skill_catalog.rb +157 -0
- data/lib/rigor/plugin/base.rb +22 -4
- data/lib/rigor/plugin/effect_attribution.rb +1 -1
- data/lib/rigor/plugin/inflector.rb +2 -2
- data/lib/rigor/plugin/io_boundary.rb +1 -1
- data/lib/rigor/plugin/loader.rb +4 -4
- data/lib/rigor/plugin/macro/heredoc_template.rb +4 -3
- data/lib/rigor/plugin/optimistic_return.rb +20 -0
- data/lib/rigor/plugin/registry.rb +2 -2
- data/lib/rigor/plugin/template_unit.rb +4 -2
- data/lib/rigor/plugin/trust_policy.rb +2 -1
- data/lib/rigor/plugin.rb +1 -1
- data/lib/rigor/protection/mutator.rb +8 -9
- data/lib/rigor/rbs_extended/reporter.rb +2 -2
- data/lib/rigor/rbs_extended.rb +2 -2
- data/lib/rigor/reflection/constant_ancestors.rb +1 -1
- data/lib/rigor/reflection/project_method.rb +2 -2
- data/lib/rigor/reflection.rb +4 -4
- data/lib/rigor/scope/discovery_index.rb +15 -10
- data/lib/rigor/scope/resolution_chain.rb +29 -6
- data/lib/rigor/scope.rb +89 -32
- data/lib/rigor/sig_gen/generator.rb +5 -4
- data/lib/rigor/sig_gen/renderer.rb +3 -3
- data/lib/rigor/sig_gen/writer.rb +8 -6
- data/lib/rigor/source/parameter_envelope.rb +1 -1
- data/lib/rigor/triage/catalogue.rb +4 -4
- data/lib/rigor/type/combinator.rb +2 -2
- data/lib/rigor/type/data_instance.rb +2 -2
- data/lib/rigor/type/struct_instance.rb +3 -3
- data/lib/rigor/type_node/generic.rb +2 -1
- data/lib/rigor/type_of_memo.rb +2 -1
- data/lib/rigor/typing_state.rb +3 -2
- data/lib/rigor/version.rb +1 -1
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/analyzer.rb +2 -2
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/channel_discoverer.rb +1 -1
- data/plugins/rigor-actionmailer/lib/rigor/plugin/actionmailer/mailer_discoverer.rb +4 -4
- data/plugins/rigor-actionmailer/lib/rigor/plugin/actionmailer.rb +1 -1
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/controller_discoverer.rb +4 -3
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/effects.rb +7 -5
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/erb_compiler.rb +4 -2
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/render_locals.rb +1 -1
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/view_assigns.rb +3 -2
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack.rb +7 -7
- data/plugins/rigor-activejob/lib/rigor/plugin/activejob/job_discoverer.rb +1 -1
- data/plugins/rigor-activejob/lib/rigor/plugin/activejob.rb +2 -2
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/model_discoverer.rb +9 -8
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/model_index.rb +3 -2
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/schema_parser.rb +15 -7
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/schema_table.rb +10 -3
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/structure_sql_parser.rb +12 -1
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord.rb +20 -5
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage/attachment_discoverer.rb +1 -1
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage.rb +3 -2
- data/plugins/rigor-activesupport-core-ext/lib/rigor/plugin/activesupport_core_ext/effects.rb +1 -1
- data/plugins/rigor-activesupport-core-ext/lib/rigor/plugin/activesupport_core_ext.rb +8 -7
- data/plugins/rigor-dry-schema/lib/rigor/plugin/dry_schema.rb +1 -1
- data/plugins/rigor-dry-types/lib/rigor/plugin/dry_types/alias_scanner.rb +1 -1
- data/plugins/rigor-dry-types/lib/rigor/plugin/dry_types.rb +6 -7
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot/factory_discoverer.rb +3 -2
- data/plugins/rigor-graphql/lib/rigor/plugin/graphql/type_scanner.rb +4 -3
- data/plugins/rigor-hanami/lib/rigor/plugin/hanami.rb +4 -2
- data/plugins/rigor-minitest/lib/rigor/plugin/minitest.rb +1 -1
- data/plugins/rigor-pundit/lib/rigor/plugin/pundit.rb +1 -1
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n/analyzer.rb +5 -3
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n.rb +1 -1
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/devise_routes.rb +4 -5
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/doorkeeper_routes.rb +2 -2
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/helper_discoverer.rb +5 -4
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/helper_table.rb +3 -2
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/routes_parser.rb +30 -31
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes.rb +13 -15
- data/plugins/rigor-rbnacl/lib/rigor/plugin/rbnacl.rb +1 -1
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/let_scope_index.rb +4 -3
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/matcher_analyzer.rb +16 -13
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/scope_walker.rb +3 -2
- data/plugins/rigor-shoulda-matchers/lib/rigor/plugin/shoulda_matchers/analyzer.rb +6 -6
- data/plugins/rigor-sidekiq/lib/rigor/plugin/sidekiq/analyzer.rb +3 -3
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/assertion_recognizer.rb +2 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/catalog.rb +3 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/catalog_walker.rb +6 -5
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sig_parser.rb +2 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sigil_detector.rb +4 -5
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/type_translator.rb +1 -1
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet.rb +3 -4
- data/sig/rigor/analysis/check_rules/suppression.rbs +9 -0
- data/sig/rigor/analysis/dependency_recorder.rbs +9 -0
- data/sig/rigor/inference.rbs +275 -11
- data/sig/rigor/plugin/base.rbs +14 -5
- data/sig/rigor/plugin/optimistic_return.rbs +16 -0
- data/sig/rigor/scope.rbs +7 -1
- data/sig/rigor/source.rbs +4 -0
- data/skills/rigor-mcp-setup/SKILL.md +20 -6
- data/skills/rigor-plugin-review/SKILL.md +3 -3
- data/skills/rigor-type-oracle/references/01-oracle-commands.md +1 -1
- metadata +90 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1ae98395382b6f91018779ac73a4731b769b7f7a0dfdba1ee491e60b725602b
|
|
4
|
+
data.tar.gz: b6fa26b7b8f4d22cb8d67eb64ffdc467c0c9cea65958ddc6046f43e30ca503fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fab91afddd1feb047ba5172d885ae71f87873a75ebf7193114ba9e1844db328467ca974cda6d1255a5111fd63abe61fd2248e2f9bdfffa0e053673e563b05a76
|
|
7
|
+
data.tar.gz: 2f0afadec8c2c1360a3096298607a26c405b35097f50b8743c5981338fce9bbb5a74d2f2edeb8c2f9ff4baa3abcbc7d5127813f9d55e1c9ca4f06a9f42e164df
|
data/README.md
CHANGED
|
@@ -234,7 +234,7 @@ rigor docs --list # list every bundled page
|
|
|
234
234
|
|
|
235
235
|
## Status
|
|
236
236
|
|
|
237
|
-
Current release: **`v0.4.
|
|
237
|
+
Current release: **`v0.4.9`** (2026-12-01) — on the
|
|
238
238
|
`0.4.x` line, continuing the evaluation era opened by `v0.2.0`, the first
|
|
239
239
|
publicly-announced (general / evaluation) release. The line publishes
|
|
240
240
|
an enumerated [compatibility surface](docs/compatibility.md) as a
|
|
@@ -198,7 +198,7 @@ def kind(x)
|
|
|
198
198
|
when String then :str
|
|
199
199
|
end
|
|
200
200
|
end
|
|
201
|
-
assert_type(":int | :str
|
|
201
|
+
assert_type(":int | :str", kind(7)) # union of the case branches; the clauses cover 7, so no nil
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
```ruby
|
|
@@ -45,9 +45,14 @@ arr = [1, "two", :three]
|
|
|
45
45
|
arr[0] # Constant<1>
|
|
46
46
|
arr[1] # Constant<"two">
|
|
47
47
|
arr[-1] # Constant<:three>
|
|
48
|
-
arr[5] # Constant<
|
|
48
|
+
arr[5] # Constant<"two"> | Constant<1> | Constant<:three> — out of bounds
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
An out-of-range index is not read as `nil` today: Rigor answers
|
|
52
|
+
the union of the tuple's elements, as it would for an
|
|
53
|
+
`Array[...]` read, although Ruby returns `nil` there
|
|
54
|
+
([#3333](https://github.com/rigortype/rigor/issues/3333)).
|
|
55
|
+
|
|
51
56
|
Slicing with `[start, length]` or `[range]` produces a tuple
|
|
52
57
|
of the matching elements:
|
|
53
58
|
|
|
@@ -303,7 +303,7 @@ menu names the slice that addresses it.
|
|
|
303
303
|
| Body-string grammar parser | [`lib/rigor/inference/hkt_body_parser.rb`](../../lib/rigor/inference/hkt_body_parser.rb) |
|
|
304
304
|
| Directive parser (`hkt_register` / `hkt_define`) | [`lib/rigor/rbs_extended/hkt_directives.rb`](../../lib/rigor/rbs_extended/hkt_directives.rb) |
|
|
305
305
|
| Bundled `json::value` + `METHOD_RETURN_OVERRIDES` | [`lib/rigor/builtins/hkt_builtins.rb`](../../lib/rigor/builtins/hkt_builtins.rb) |
|
|
306
|
-
| Dispatcher tier | [`lib/rigor/inference/method_dispatcher.rb`](../../lib/rigor/inference/method_dispatcher.rb) (`
|
|
306
|
+
| Dispatcher tier | [`lib/rigor/inference/method_dispatcher/hkt_builtin_return.rb`](../../lib/rigor/inference/method_dispatcher/hkt_builtin_return.rb) (`HktBuiltinReturn.try_dispatch`) |
|
|
307
307
|
| Environment integration | [`lib/rigor/environment.rb`](../../lib/rigor/environment.rb) (`#hkt_registry` + `HktRegistryHolder`) |
|
|
308
308
|
| RBS scan | [`lib/rigor/environment/rbs_loader.rb`](../../lib/rigor/environment/rbs_loader.rb) (`each_class_decl_annotation`) |
|
|
309
309
|
|
|
@@ -16,18 +16,21 @@ TypeScript reflexes will mislead you.
|
|
|
16
16
|
| --- | --- | --- |
|
|
17
17
|
| Where do annotations live? | In source (`x: number`) | In `.rbs` files alongside `.rb` |
|
|
18
18
|
| Who writes them? | The author of the code | The author OR inference |
|
|
19
|
-
| What is the default? | `any`
|
|
19
|
+
| What is the default? | `any` for an unannotated parameter; `noImplicitAny` (part of `strict`, on by default since TypeScript 6.0) reports it | Inferred precisely or `Dynamic[top]` |
|
|
20
20
|
| Identity of types | Structural | Nominal + structural facets |
|
|
21
21
|
| Cost of "I do not know yet" | A red squiggle until annotated | Silence — `Dynamic[top]` produces no diagnostic |
|
|
22
|
-
| When do diagnostics fire? |
|
|
22
|
+
| When do diagnostics fire? | When its checker finds a type error under its own rules, which are deliberately not sound | Only when Rigor can **prove** the unsoundness |
|
|
23
23
|
|
|
24
24
|
The two systems share their goal — flag bugs before the program
|
|
25
|
-
runs — and disagree on the path to it. TypeScript
|
|
26
|
-
soundness
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
runs — and disagree on the path to it. TypeScript trades
|
|
26
|
+
soundness for productivity: its
|
|
27
|
+
[Design Goals](https://github.com/microsoft/TypeScript/wiki/TypeScript-Design-Goals)
|
|
28
|
+
list a sound type system as a non-goal, and it accepts some
|
|
29
|
+
unsound code by design. Under `strict` (the default since
|
|
30
|
+
TypeScript 6.0) it reports a parameter it cannot infer as
|
|
31
|
+
implicitly `any`. Rigor prefers no-false-positives inference (the checker
|
|
32
|
+
stays silent on anything it cannot prove and asks for `.rbs` only
|
|
33
|
+
where inference cannot see further).
|
|
31
34
|
|
|
32
35
|
## Type vocabulary mapping
|
|
33
36
|
|
|
@@ -133,12 +136,19 @@ def classify(n)
|
|
|
133
136
|
:negative
|
|
134
137
|
end
|
|
135
138
|
|
|
136
|
-
result = classify(7)
|
|
139
|
+
result = classify(7) # Rigor: :negative | :positive
|
|
137
140
|
```
|
|
138
141
|
|
|
139
|
-
Both checkers infer the same
|
|
140
|
-
version
|
|
141
|
-
|
|
142
|
+
Both checkers infer the same union for `classify`'s return
|
|
143
|
+
type. The TypeScript version needs the parameter annotation
|
|
144
|
+
(without it, `noImplicitAny` reports the parameter). Its return
|
|
145
|
+
annotation is optional for this `const` binding: `tsc` keeps the
|
|
146
|
+
full union, but a `let` binding widens it to `string`. The Rigor
|
|
147
|
+
version requires neither. At the call site the two differ.
|
|
148
|
+
TypeScript types `result` as the full union. Rigor, which knows
|
|
149
|
+
the argument is the literal `7`, drops `:zero`, but it keeps
|
|
150
|
+
`:negative`, so `:negative | :positive` is a superset of the exact
|
|
151
|
+
answer (`:positive`).
|
|
142
152
|
|
|
143
153
|
When you DO need to write a sig — at module boundaries, when
|
|
144
154
|
the body is too dynamic, when you want to enforce parameter
|
|
@@ -196,8 +206,8 @@ function length(s: string | null): number {
|
|
|
196
206
|
|
|
197
207
|
| TypeScript | Rigor |
|
|
198
208
|
| --- | --- |
|
|
199
|
-
| `tsconfig.json` `strict: true` | `severity_profile: strict` |
|
|
200
|
-
| `tsconfig.json` `noImplicitAny` | (no analogue — Rigor never demands annotations) |
|
|
209
|
+
| `tsconfig.json` `strict: true` (the default since TypeScript 6.0) | `severity_profile: strict` |
|
|
210
|
+
| `tsconfig.json` `noImplicitAny` (on under `strict`) | (no analogue — Rigor never demands annotations) |
|
|
201
211
|
| `tsconfig.json` `strictNullChecks` | Always-on in Rigor |
|
|
202
212
|
| `// @ts-ignore` | `# rigor:disable <rule>` |
|
|
203
213
|
| `// @ts-expect-error` | (no analogue today) |
|
|
@@ -230,8 +240,8 @@ Be honest about what you give up:
|
|
|
230
240
|
RBS-declared methods bind their callers to the declared
|
|
231
241
|
return — a deliberate boundary-discipline choice (see ADR-5,
|
|
232
242
|
the robustness principle).
|
|
233
|
-
- **Editor IntelliSense parity.** TypeScript's tooling has
|
|
234
|
-
|
|
243
|
+
- **Editor IntelliSense parity.** TypeScript's tooling has more
|
|
244
|
+
than a decade of investment behind it. Rigor's editor integration is
|
|
235
245
|
younger: `rigor lsp` ships an in-process Language Server
|
|
236
246
|
(diagnostics, hover-to-type, outline, type-aware completion;
|
|
237
247
|
see the manual's editor-integration chapter), but its
|
|
@@ -257,7 +267,8 @@ The other direction:
|
|
|
257
267
|
every file you skip is `Dynamic[top]` at the boundary, not a
|
|
258
268
|
diagnostic.
|
|
259
269
|
- **Severity-aware adoption.** TypeScript's "all or nothing"
|
|
260
|
-
feel (
|
|
270
|
+
feel (a project that turns `strict` on, or upgrades to TypeScript 6
|
|
271
|
+
where it is the default, sees a thousand errors appear) is
|
|
261
272
|
smoothed by Rigor's `lenient` / `balanced` / `strict`
|
|
262
273
|
profiles plus per-rule overrides plus baseline diffing.
|
|
263
274
|
|
|
@@ -1114,6 +1114,16 @@ as [`rigor check`](#rigor-check).
|
|
|
1114
1114
|
exits `1` when the precision ratio falls below `RATIO`
|
|
1115
1115
|
(`0.0`–`1.0`), making it a CI gate.
|
|
1116
1116
|
|
|
1117
|
+
The precision report also counts **call sites**: every method call
|
|
1118
|
+
node (`recv.m(...)`, `m(...)`, operators, index reads and attribute
|
|
1119
|
+
writes; compound writes such as `a.b += 1` or `a[i] ||= x`, `super`
|
|
1120
|
+
and `yield` are not counted), and of those the ones whose result is
|
|
1121
|
+
`Dynamic`, either the whole type or the worst member of a union. Text output prints both counts
|
|
1122
|
+
in the summary. `--format=json` carries `call_sites`,
|
|
1123
|
+
`dynamic_call_count` and `dynamic_call_ratio` in `summary`, and
|
|
1124
|
+
`call_sites` and `dynamic_call_count` in each `by_file` row.
|
|
1125
|
+
`--threshold` does not read them.
|
|
1126
|
+
|
|
1117
1127
|
`--protection` switches to **type-protection coverage**: it
|
|
1118
1128
|
reports "if I introduce a bug, would Rigor catch it" rather than
|
|
1119
1129
|
"how precise are my types". Each dispatch site (a call with an
|
|
@@ -70,7 +70,7 @@ cache:
|
|
|
70
70
|
| `test_paths` | Array | `nil` | The project's test roots: the directories (or files) holding its tests. Relative entries resolve against the config file's directory. Unset auto-detects whichever of `spec/` and `test/` exist in the config file's directory, or in the working directory when the config file's directory has neither or no config file is used; `[]` declares none. `rigor sig-gen --params=observed` reads call sites there to type parameters, and names on stderr a declared root that does not exist. Test roots are not analysed unless `paths:` also lists them, and changing them invalidates no cache. |
|
|
71
71
|
| `includes` | Array | `[]` | Other config files to layer underneath this one. |
|
|
72
72
|
| `fold_platform_specific_paths` | Boolean | `false` | Resolve Ruby-version-conditional load paths when discovering sources. |
|
|
73
|
-
| `parameter_inference` | Boolean | `false` | Opt-in call-site parameter type inference on the `check` walk ([ADR-67](../adr/67-parameter-type-inference.md) WD6). When `true`, an undeclared `def` / `initialize` / setter parameter is typed to the union of its resolved call-site argument types, sharpening downstream ivar reads, folds, and protection coverage. Precision-additive only — the negative rules never fire against an inferred parameter.
|
|
73
|
+
| `parameter_inference` | Boolean | `false` | Opt-in call-site parameter type inference on the `check` walk ([ADR-67](../adr/67-parameter-type-inference.md) WD6). When `true`, an undeclared `def` / `initialize` / setter parameter is typed to the union of its resolved call-site argument types, sharpening downstream ivar reads, folds, and protection coverage. Precision-additive only — the negative rules never fire against an inferred parameter. Composes with `--incremental`: the pre-pass re-runs on each recheck and a callee whose inferred parameter types changed is re-analysed ([ADR-67](../adr/67-parameter-type-inference.md) WD6c). |
|
|
74
74
|
|
|
75
75
|
### Type sources
|
|
76
76
|
|
|
@@ -64,7 +64,7 @@ carries no `documentation_url`.
|
|
|
64
64
|
| <a id="rule-flow-dead-assignment"></a>`flow.dead-assignment` | A local is written but never read in the same method. | medium |
|
|
65
65
|
| <a id="rule-flow-unreachable-clause"></a>`flow.unreachable-clause` | A `case`/`when` or `case`/`in` clause is statically dead — its subject type is disjoint with the pattern, or a prior clause already exhausted the subject. | medium |
|
|
66
66
|
| <a id="rule-flow-duplicate-hash-key"></a>`flow.duplicate-hash-key` | A Hash literal repeats a literal key (symbol, plain string, integer, float, `true`/`false`/`nil`) — the last entry silently overwrites the earlier one at runtime. Literal keys only; symbol vs string and `1` vs `1.0` never collide, and interpolated / constant / computed keys are never compared. A `**splat` between two identical literal keys does not rescue the pair. | high |
|
|
67
|
-
| <a id="rule-flow-return-in-ensure"></a>`flow.return-in-ensure` | An explicit `return` inside an `ensure` clause — it overrides the method's in-flight return value and silently swallows any in-flight exception. A `return` in a nested `def`, lambda, or `define_method` block inside the `ensure` does not fire (it exits that inner frame). | high |
|
|
67
|
+
| <a id="rule-flow-return-in-ensure"></a>`flow.return-in-ensure` | An explicit `return` inside an `ensure` clause — it overrides the method's in-flight return value and silently swallows any in-flight exception. A `return` in a nested `def`, lambda, or `define_method` block (also `send(:define_method, …)` with a literal name) inside the `ensure` does not fire (it exits that inner frame). | high |
|
|
68
68
|
| <a id="rule-flow-shadowed-rescue-clause"></a>`flow.shadowed-rescue-clause` | A `rescue` clause can never run because an earlier clause of the same chain already catches a superclass (or the same class) of every exception class it names. | high |
|
|
69
69
|
| <a id="rule-def-return-type-mismatch"></a>`def.return-type-mismatch` | The method body's result violates its declared RBS return type. | medium |
|
|
70
70
|
| <a id="rule-def-ivar-write-mismatch"></a>`def.ivar-write-mismatch` | An instance variable is written with a type disagreeing with its first write, unless its RBS declaration (`@x: T` or an `attr_*` member) admits both writes. A write in a block whose `self` is provably another object (`Other.new.instance_eval { @x = 1 }`, `Class.new { … }`, `X.class_eval { … }`, a `class << obj` body) sets that object's variable and is not compared. With `rigor-actionpack` or `rigor-actionmailer` loaded, writes in two different actions of a controller or mailer are not compared, since Rails runs one action per instance. A write in a private or protected helper, `initialize` or the same action still is, and so is one in a callback target or `helper_method` that a macro in the same file names. A public method named only by a macro in another file or a concern, or reached through a lambda callback, counts as an action, and so does an action another action calls. | high |
|
|
@@ -59,7 +59,7 @@ tool, not a library. See
|
|
|
59
59
|
## CLI
|
|
60
60
|
|
|
61
61
|
```sh
|
|
62
|
-
rigor mcp [--transport=stdio] [--config=PATH]
|
|
62
|
+
rigor mcp [--transport=stdio] [--config=PATH] [--no-skills]
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
- `--transport=stdio` — default; only value accepted in v1. HTTP
|
|
@@ -70,6 +70,9 @@ rigor mcp [--transport=stdio] [--config=PATH]
|
|
|
70
70
|
defaults, for the session default and for a per-call `config` alike:
|
|
71
71
|
the call returns `isError: true`. Without either, `Configuration.discover` walks `.rigor.yml` /
|
|
72
72
|
`.rigor.dist.yml` from the working directory.
|
|
73
|
+
- `--no-skills` — do not serve the bundled skills (see
|
|
74
|
+
[Bundled skills over MCP](#bundled-skills-over-mcp)); the server then
|
|
75
|
+
offers its tools only.
|
|
73
76
|
|
|
74
77
|
Exit codes: 0 (clean shutdown — stdin EOF), 64 (unknown
|
|
75
78
|
`--transport`).
|
|
@@ -109,8 +112,15 @@ specific project config:
|
|
|
109
112
|
|
|
110
113
|
### Claude Code CLI
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
Register the server with `claude mcp add`. User scope makes it available
|
|
116
|
+
in every project:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
claude mcp add --scope user rigor -- rigor mcp
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
To share it with a team instead, commit a `.mcp.json` in the project
|
|
123
|
+
root:
|
|
114
124
|
|
|
115
125
|
```json
|
|
116
126
|
{
|
|
@@ -123,11 +133,11 @@ settings. Add to `.claude/settings.json` in your project root:
|
|
|
123
133
|
}
|
|
124
134
|
```
|
|
125
135
|
|
|
126
|
-
|
|
127
|
-
available in every project. Once registered, Claude Code can call
|
|
136
|
+
Once registered, Claude Code can call
|
|
128
137
|
`rigor_check` on files it is about to edit, use `rigor_type_of` to
|
|
129
138
|
ground a suggestion, and run `rigor_triage` to understand a project's
|
|
130
|
-
diagnostic shape before proposing a cleanup plan.
|
|
139
|
+
diagnostic shape before proposing a cleanup plan. It also loads Rigor's
|
|
140
|
+
bundled skills from the server; see the next section.
|
|
131
141
|
|
|
132
142
|
### Cursor
|
|
133
143
|
|
|
@@ -175,10 +185,48 @@ Or add directly to Cline's `cline_mcp_settings.json`:
|
|
|
175
185
|
|
|
176
186
|
### Generic / custom MCP client
|
|
177
187
|
|
|
178
|
-
`rigor mcp` speaks the [MCP stdio transport](https://
|
|
188
|
+
`rigor mcp` speaks the [MCP stdio transport](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio):
|
|
179
189
|
one JSON-RPC 2.0 message per line, `\n`-terminated, no
|
|
180
190
|
`Content-Length` framing. Any client that follows this convention
|
|
181
|
-
works.
|
|
191
|
+
works.
|
|
192
|
+
|
|
193
|
+
The binding description of everything below — the eras, methods,
|
|
194
|
+
error codes, tool argv and result blocks — is
|
|
195
|
+
[`docs/internal-spec/mcp.md`](../internal-spec/mcp.md); this section is
|
|
196
|
+
the walkthrough.
|
|
197
|
+
|
|
198
|
+
The server speaks two protocol eras and picks one per request, from
|
|
199
|
+
the request alone:
|
|
200
|
+
|
|
201
|
+
- **Revision 2026-07-28** (stateless). There is no handshake. Every
|
|
202
|
+
request carries `params._meta["io.modelcontextprotocol/protocolVersion"]`
|
|
203
|
+
and `params._meta["io.modelcontextprotocol/clientCapabilities"]`, and
|
|
204
|
+
every result carries `resultType: "complete"`. `server/discover`
|
|
205
|
+
returns the supported versions (`["2026-07-28"]`), the capabilities,
|
|
206
|
+
and the server info under `_meta["io.modelcontextprotocol/serverInfo"]`.
|
|
207
|
+
Every result also carries the server info under that `_meta` key.
|
|
208
|
+
A version the server does not speak gets error `-32022` with
|
|
209
|
+
`data.supported` and `data.requested`; `server/discover` without a
|
|
210
|
+
version, or a versioned request without `clientCapabilities`, gets
|
|
211
|
+
`-32602`. Claude Code probes with
|
|
212
|
+
`server/discover` first and falls back to the legacy handshake when
|
|
213
|
+
the answer does not come in time. A launch that boots slowly, such as
|
|
214
|
+
one wrapped in `nix develop`, can land on the legacy protocol; the
|
|
215
|
+
tools work the same on either.
|
|
216
|
+
- **Legacy** (`initialize`, answered with `2024-11-05`). Any other
|
|
217
|
+
request without the `_meta` version field is answered exactly as
|
|
218
|
+
before this revision existed, so older clients see no change.
|
|
219
|
+
|
|
220
|
+
A 2026-07-28 exchange:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
→ {"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
|
|
224
|
+
← {"jsonrpc":"2.0","id":1,"result":{"resultType":"complete","supportedVersions":["2026-07-28"],"capabilities":{"tools":{"listChanged":false}},"ttlMs":3600000,"cacheScope":"public","_meta":{"io.modelcontextprotocol/serverInfo":{"name":"rigor","version":"0.2.1"}}}}
|
|
225
|
+
→ {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}
|
|
226
|
+
← {"jsonrpc":"2.0","id":2,"result":{"resultType":"complete","tools":[...],"ttlMs":3600000,"cacheScope":"public","_meta":{"io.modelcontextprotocol/serverInfo":{"name":"rigor","version":"0.2.1"}}}}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
The legacy initialization sequence:
|
|
182
230
|
|
|
183
231
|
```
|
|
184
232
|
→ {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"my-agent","version":"1.0"}}}
|
|
@@ -191,6 +239,54 @@ works. The initialization sequence:
|
|
|
191
239
|
All messages except `notifications/*` require a response.
|
|
192
240
|
`notifications/*` carry no `id` and are silently consumed.
|
|
193
241
|
|
|
242
|
+
## Bundled skills over MCP
|
|
243
|
+
|
|
244
|
+
Rigor ships its Agent Skills inside the gem: the `skills/` that
|
|
245
|
+
`rigor skill` lists. `rigor mcp` also serves them over the MCP Skills
|
|
246
|
+
extension (`io.modelcontextprotocol/skills`). A client that implements
|
|
247
|
+
the extension loads a skill from the same `rigor` binary that runs the
|
|
248
|
+
tools, so a skill never describes a different Rigor version than the
|
|
249
|
+
one installed, and there is nothing extra to install or update.
|
|
250
|
+
|
|
251
|
+
In Claude Code (v2.1.331 or later, where MCP skills are enabled), the
|
|
252
|
+
skills appear as `rigor:<skill>`, for example `/rigor:rigor-next-steps`.
|
|
253
|
+
They are offered in terminal sessions, in JetBrains IDEs and in local
|
|
254
|
+
Desktop sessions. They are not offered in cloud sessions, `claude -p`,
|
|
255
|
+
`claude remote-control` server mode, GitHub Actions or the Agent SDK.
|
|
256
|
+
Claude Code also limits them by plan, login, model and connection (for
|
|
257
|
+
example, Team and Enterprise organisations turn them on, and a custom
|
|
258
|
+
`ANTHROPIC_BASE_URL` or a cloud provider does not get them); its
|
|
259
|
+
[requirements for MCP skills](https://code.claude.com/docs/en/mcp#use-skills-from-mcp-servers)
|
|
260
|
+
are the authority.
|
|
261
|
+
|
|
262
|
+
Requirements and controls:
|
|
263
|
+
|
|
264
|
+
- **Launch the installed `rigor` directly.** Claude Code only asks a
|
|
265
|
+
stdio server for the newer protocol revision, which skills need, when
|
|
266
|
+
the server starts quickly; it advises staying under 3 seconds. Do not
|
|
267
|
+
start the server through `bundle exec`, `nix develop` or `npx`. After
|
|
268
|
+
a slow start, Claude Code connects with the older protocol and may not
|
|
269
|
+
ask again for 7 days. To check, open `/mcp` and look for a
|
|
270
|
+
**Protocol** row on the `rigor` server. To ask again sooner, start
|
|
271
|
+
Claude Code with `MCP_PROTOCOL_NEGOTIATION=auto` and select
|
|
272
|
+
**Reconnect**.
|
|
273
|
+
- **Turning skills off.** `rigor mcp --no-skills` serves the tools only.
|
|
274
|
+
In Claude Code you can also deny the permission rule
|
|
275
|
+
`Skill(mcp__rigor__*)`.
|
|
276
|
+
- **Skills installed locally as well.** If you also installed the skills
|
|
277
|
+
into your agent's skill directory (for example with `npx skills`),
|
|
278
|
+
Claude Code lists each one twice: `rigor-next-steps` and
|
|
279
|
+
`rigor:rigor-next-steps`. Where Claude Code offers MCP skills, keep the
|
|
280
|
+
`rigor:` copy and remove the local one, because the `rigor:` copy
|
|
281
|
+
always matches the installed binary. Keep the local install for other
|
|
282
|
+
agents, and for the Claude Code surfaces listed above that do not
|
|
283
|
+
offer MCP skills.
|
|
284
|
+
|
|
285
|
+
The server serves only the skills' `SKILL.md` and `references/*.md`
|
|
286
|
+
files, each with the SHA-256 digest and size the client checks before
|
|
287
|
+
using it. The binding contract is the internal spec,
|
|
288
|
+
[`docs/internal-spec/mcp.md`](../internal-spec/mcp.md).
|
|
289
|
+
|
|
194
290
|
## Tool reference
|
|
195
291
|
|
|
196
292
|
Every tool that takes a `config` argument reports the configuration's
|
|
@@ -224,7 +320,7 @@ undefined methods, arity mismatches, and nil-receiver risks.
|
|
|
224
320
|
|
|
225
321
|
| Argument | Type | Required | Default |
|
|
226
322
|
|---|---|---|---|
|
|
227
|
-
| `paths` | `string[]` |
|
|
323
|
+
| `paths` | `string[]` | no | configured paths |
|
|
228
324
|
| `config` | `string` | no | session default |
|
|
229
325
|
|
|
230
326
|
**Returns:** JSON — the same structure as `rigor check --format json`.
|
|
@@ -508,7 +604,7 @@ as `Constant` / `Nominal` / shaped / refined (precise) versus
|
|
|
508
604
|
|
|
509
605
|
| Argument | Type | Required |
|
|
510
606
|
|---|---|---|
|
|
511
|
-
| `paths` | `string[]` |
|
|
607
|
+
| `paths` | `string[]` | no |
|
|
512
608
|
| `config` | `string` | no |
|
|
513
609
|
|
|
514
610
|
**Returns:** JSON — the same as `rigor coverage --format json`.
|
|
@@ -562,6 +658,22 @@ You should get a JSON response. If you get nothing or a shell error,
|
|
|
562
658
|
`rigor` is not on your `PATH` — fix the install path first (see
|
|
563
659
|
[Installing Rigor](01-installation.md)).
|
|
564
660
|
|
|
661
|
+
**Claude Code shows the `rigor_*` tools but no `rigor:` skills.**
|
|
662
|
+
|
|
663
|
+
Check, in this order:
|
|
664
|
+
|
|
665
|
+
- `claude --version` is 2.1.331 or later, and MCP skills are on for your
|
|
666
|
+
plan, login, model and session. They are not offered in `claude -p` or
|
|
667
|
+
cloud sessions; Claude Code's
|
|
668
|
+
[requirements for MCP skills](https://code.claude.com/docs/en/mcp#use-skills-from-mcp-servers)
|
|
669
|
+
list the rest.
|
|
670
|
+
- `/mcp` shows a **Protocol** row for `rigor`. If it does not, the
|
|
671
|
+
client fell back to the older protocol, usually after a slow start.
|
|
672
|
+
Launch the installed `rigor` directly, then reconnect with
|
|
673
|
+
`MCP_PROTOCOL_NEGOTIATION=auto` (see
|
|
674
|
+
[Bundled skills over MCP](#bundled-skills-over-mcp)).
|
|
675
|
+
- The server was not started with `--no-skills`.
|
|
676
|
+
|
|
565
677
|
**`rigor_check` / `rigor_triage` return an empty diagnostics array on a project that has errors, or `rigor_lens` reports every file `outside_project`.**
|
|
566
678
|
|
|
567
679
|
The tool uses `Configuration.discover` from the working directory the
|
|
@@ -84,6 +84,13 @@ Instance-side: a column read (`user.name`) narrows to the
|
|
|
84
84
|
column's value type, `user.admin?` to `bool`, and a singular
|
|
85
85
|
association (`post.user`) to the target model.
|
|
86
86
|
|
|
87
|
+
A column read is typed without `nil` even when the column can hold
|
|
88
|
+
`NULL`, so `user.email.downcase` stays quiet. When the schema does
|
|
89
|
+
not prove the column non-null (`null: false`, a primary key, or
|
|
90
|
+
`NOT NULL` in `structure.sql`), Rigor also does not treat a check on
|
|
91
|
+
the value as always true or always false: `if user.completed_at.present?`,
|
|
92
|
+
`.blank?`, `.nil?` or a bare `if user.completed_at` reports nothing.
|
|
93
|
+
|
|
87
94
|
Relation-returning call sites — `User.where(...)`, `User.all`,
|
|
88
95
|
`User.order(...)`, a `has_many` / `has_and_belongs_to_many`
|
|
89
96
|
accessor (`user.posts`), and user-declared `scope`s
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../type"
|
|
4
|
+
require_relative "../diagnostic"
|
|
5
|
+
require_relative "receiver_predicates"
|
|
6
|
+
|
|
7
|
+
module Rigor
|
|
8
|
+
module Analysis
|
|
9
|
+
module CheckRules
|
|
10
|
+
# ADR-116 WD1 — `flow.always-raises`: a call that raises on every run, today the Integer division and
|
|
11
|
+
# modulo family by a literal zero.
|
|
12
|
+
#
|
|
13
|
+
# The one entry point is {.diagnostic}, called by `CheckRules.call_node_diagnostics`. It reads
|
|
14
|
+
# {ReceiverPredicates}; the `raise_shield` ({AlwaysRaisesShield}) it consults is handed in. It calls nothing
|
|
15
|
+
# else in `CheckRules`.
|
|
16
|
+
module AlwaysRaises
|
|
17
|
+
module_function
|
|
18
|
+
|
|
19
|
+
# Diagnoses calls that the analyzer can prove will always raise. Today the only triggering shape is
|
|
20
|
+
# integer division/modulo by a literal zero divisor:
|
|
21
|
+
#
|
|
22
|
+
# 5 / 0 # => ZeroDivisionError
|
|
23
|
+
# x.modulo(0) # => ZeroDivisionError when x: Integer
|
|
24
|
+
# xs.size % 0 # same — non_negative_int / Constant[0]
|
|
25
|
+
#
|
|
26
|
+
# Float divmod by zero returns Infinity/NaN at runtime, so the rule restricts to Integer-rooted
|
|
27
|
+
# receivers (`Constant`, `IntegerRange`, `Nominal[Integer]`). The argument MUST be a
|
|
28
|
+
# `Constant<Integer>` whose value is exactly zero — a `Union[Constant[0], Constant[2]]` divisor
|
|
29
|
+
# "may" raise, which we surface separately (future slice).
|
|
30
|
+
INTEGER_RAISING_OPERATORS = %i[/ % div modulo divmod].freeze
|
|
31
|
+
private_constant :INTEGER_RAISING_OPERATORS
|
|
32
|
+
|
|
33
|
+
def diagnostic(path, call_node, facts, lexical_sites = nil, raise_shield = nil)
|
|
34
|
+
return nil unless integer_zero_division?(call_node, facts)
|
|
35
|
+
|
|
36
|
+
# ADR-121 WD7 — a refinement of `Integer`'s operator (or one Rigor cannot read) in effect may not raise.
|
|
37
|
+
return nil if ReceiverPredicates.refined_method_in_effect?("Integer", call_node, facts.scope, :instance,
|
|
38
|
+
lexical_sites)
|
|
39
|
+
|
|
40
|
+
# Issue #3036 — a raise an enclosing `begin` / `def … rescue` catches flows to the handler.
|
|
41
|
+
return nil if raise_shield&.rescued?(call_node, facts.scope)
|
|
42
|
+
|
|
43
|
+
build_always_raises_diagnostic(path, call_node)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def integer_zero_division?(call_node, facts)
|
|
47
|
+
return false unless raising_call_shape?(call_node)
|
|
48
|
+
|
|
49
|
+
scope = facts.scope
|
|
50
|
+
return false if scope.nil?
|
|
51
|
+
return false unless integer_rooted_for_diagnostic?(facts.receiver_type)
|
|
52
|
+
|
|
53
|
+
arg = single_argument(call_node)
|
|
54
|
+
arg && integer_zero_constant?(scope.type_of(arg))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def raising_call_shape?(call_node)
|
|
58
|
+
!call_node.receiver.nil? && INTEGER_RAISING_OPERATORS.include?(call_node.name)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def single_argument(call_node)
|
|
62
|
+
args = call_node.arguments&.arguments || []
|
|
63
|
+
args.size == 1 ? args.first : nil
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def integer_rooted_for_diagnostic?(type)
|
|
67
|
+
case type
|
|
68
|
+
when Type::Constant then type.value.is_a?(Integer)
|
|
69
|
+
when Type::IntegerRange then true
|
|
70
|
+
when Type::Nominal then type.class_name == "Integer" && type.type_args.empty?
|
|
71
|
+
else false
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def integer_zero_constant?(type)
|
|
76
|
+
type.is_a?(Type::Constant) && type.value.is_a?(Integer) && type.value.zero?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def build_always_raises_diagnostic(path, call_node)
|
|
80
|
+
Diagnostic.from_message_loc(
|
|
81
|
+
call_node,
|
|
82
|
+
rule: RULE_ALWAYS_RAISES,
|
|
83
|
+
path: path,
|
|
84
|
+
message: "always raises ZeroDivisionError: `#{call_node.name}' by zero on Integer receiver",
|
|
85
|
+
severity: :error
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
private_class_method :integer_zero_division?, :raising_call_shape?, :single_argument,
|
|
90
|
+
:integer_rooted_for_diagnostic?, :integer_zero_constant?,
|
|
91
|
+
:build_always_raises_diagnostic
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -6,6 +6,8 @@ require_relative "../../source/node_children"
|
|
|
6
6
|
require_relative "../../inference/optimistic_origin"
|
|
7
7
|
require_relative "inferred_param_guard"
|
|
8
8
|
require_relative "published_constant_guard"
|
|
9
|
+
require_relative "../diagnostic"
|
|
10
|
+
require_relative "rule_ids"
|
|
9
11
|
|
|
10
12
|
module Rigor
|
|
11
13
|
module Analysis
|
|
@@ -27,8 +29,8 @@ module Rigor
|
|
|
27
29
|
# `.respond_to?`. These read like the user explicitly checking for a runtime condition that the type
|
|
28
30
|
# system already proves can't happen — Rigor's strict-on-returns RBS often disagrees with the user's
|
|
29
31
|
# defensive check (e.g. `Module#name` returns `String` per RBS but anonymous classes really do return
|
|
30
|
-
# `nil`). Skipping
|
|
31
|
-
#
|
|
32
|
+
# `nil`). Skipping these forms keeps the rule useful for genuine logic errors without faulting defensive
|
|
33
|
+
# code.
|
|
32
34
|
#
|
|
33
35
|
# Also skipped (so the literal-only `unreachable-branch` rule doesn't double-fire alongside this one):
|
|
34
36
|
#
|
|
@@ -77,6 +79,34 @@ module Rigor
|
|
|
77
79
|
@results.freeze
|
|
78
80
|
end
|
|
79
81
|
|
|
82
|
+
# ADR-116 WD1 — the message builder for this collector's results, moved here from `CheckRules`.
|
|
83
|
+
# {.diagnostics} is called by `CheckRules.diagnose` through its collector table; the rest is private to it.
|
|
84
|
+
|
|
85
|
+
# v0.1.2 — `flow.always-truthy-condition`. Fires on
|
|
86
|
+
# `if` / `unless` / ternary predicates whose inferred
|
|
87
|
+
# type is a `Type::Constant` AND that don't fall in
|
|
88
|
+
# the literal-only / inside-loop-or-block / defensive-
|
|
89
|
+
# predicate skip envelope (see
|
|
90
|
+
# `Analysis::CheckRules::AlwaysTruthyConditionCollector`
|
|
91
|
+
# for the full triage rationale).
|
|
92
|
+
def self.diagnostics(path, results)
|
|
93
|
+
results.map do |result|
|
|
94
|
+
build_always_truthy_condition_diagnostic(path, result.node, result.polarity)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.build_always_truthy_condition_diagnostic(path, predicate_node, polarity)
|
|
99
|
+
Diagnostic.from_node(
|
|
100
|
+
predicate_node,
|
|
101
|
+
rule: RULE_ALWAYS_TRUTHY_CONDITION,
|
|
102
|
+
path: path,
|
|
103
|
+
message: "condition is always #{polarity} (the surrounding flow proves it folds to a constant)",
|
|
104
|
+
severity: :warning
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
private_class_method :build_always_truthy_condition_diagnostic
|
|
109
|
+
|
|
80
110
|
private
|
|
81
111
|
|
|
82
112
|
def walk(node, in_loop_or_block:)
|