Skip to content

Rb to clear#136

Merged
cuzzo merged 100 commits into
masterfrom
rb-to-clear
Jul 1, 2026
Merged

Rb to clear#136
cuzzo merged 100 commits into
masterfrom
rb-to-clear

Conversation

@cuzzo

@cuzzo cuzzo commented Jun 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Branchrb-to-clear
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
Benchmarkleak-build-msMeasure (units) x 1e3leak-countMeasure (units)leak-run-msMeasure (units)
benchmarks/concurrent/01_socket_throughput/bench📈 view plot
⚠️ NO THRESHOLD
5.14 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
6.68 units
benchmarks/concurrent/06_dynamic_spawn/bench📈 view plot
⚠️ NO THRESHOLD
5.11 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
40.08 units
benchmarks/concurrent/11_parallel_aggregation/bench📈 view plot
⚠️ NO THRESHOLD
5.23 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
13.01 units
benchmarks/concurrent/18_atomic_counter/bench📈 view plot
⚠️ NO THRESHOLD
5.19 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
5.13 units
benchmarks/inter-clear/04_concurrent_mvcc_fat_struct/bench📈 view plot
⚠️ NO THRESHOLD
5.31 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
193.50 units
benchmarks/sequential/03_alloc_throughput/bench📈 view plot
⚠️ NO THRESHOLD
5.00 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
17.30 units
benchmarks/sequential/08_sort/bench📈 view plot
⚠️ NO THRESHOLD
5.17 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
4.17 units
benchmarks/sequential/13_soa_layout/bench📈 view plot
⚠️ NO THRESHOLD
5.00 units x 1e3📈 view plot
⚠️ NO THRESHOLD
0.00 units📈 view plot
⚠️ NO THRESHOLD
549.62 units
🐰 View full continuous benchmarking report in Bencher

Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread src/mir/fsm_transform/liveness.rb Fixed
Comment thread src/mir/hoist.rb Fixed
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Diff Coverage Buckets

Diff base: origin/master...HEAD

bucket files additions deletions line cov additions branch cov additions
total 245 30144 9408
src/**/*.rb public functions 17 278 125 98.9% 88.9%
src/**/*.rb private functions 25 395 57 100.0% 87.3%
src/**/*.rb OTHER 65 421 134 100.0% N/A
zig/**/*.zig prod 0 0 0
spec/ 12 519 18 not tracked not tracked
transpile-tests/ 3 57 0
tools/ 17 940 441 not tracked not tracked
gems/ 118 17364 6993
zig/**/*-test.zig + vopr/loom harness 0 0 0
*.md 12 1501 9
other 8 8669 1631

Src Ruby Visibility Breakdown

Scope: src/**/*.rb

Files: 164

Counts are nonblank, non-comment Ruby source lines. Protected methods are grouped into OTHER.

bucket lines share
public functions 23793 29.6%
private functions 35938 44.7%
OTHER 20751 25.8%
total 80482 100.0%

Zig Special Coverage Alerts

No added production Zig lines require missing Loom/VOPR/wait-loop coverage alerts.

Comment thread gems/ruby-to-clear/coverage_stats.rb Fixed
Comment thread gems/ruby-to-clear/coverage_stats.rb Fixed
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment thread gems/ruby-to-clear/spec/transpiler_spec.rb Fixed
Comment thread gems/ruby-to-clear/spec/transpiler_spec.rb Fixed

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SlopCop found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread gems/nil-kill/lib/nil_kill/tree_sitter_adapter.rb Dismissed
Comment on lines +12 to +21
def initialize(source, raise_on_error: true)
@source = source
@raise_on_error = raise_on_error
@indent_level = 0
@declared_locals = Set.new
@struct_fields = {}
@current_class = nil
@renames = {}
@mutable_params = nil
end
Comment on lines +50 to +56
def with_renames(new_renames)
old_renames = @renames.dup
@renames.merge!(new_renames.compact)
yield
ensure
@renames = old_renames
end
Comment on lines +58 to +68
def raise_unsupported(message, node)
loc = node.location
source_loc = "#{@source[0...loc.start_offset].count("\n") + 1}:#{loc.start_column}"
err_msg = "Unsupported Ruby syntax: #{message} at line #{source_loc}\nSource: #{loc.slice.strip}"

if @raise_on_error
raise TranspilationError, err_msg
else
"# [UNSUPPORTED: #{node.class.name.split('::').last}]\n# #{loc.slice.gsub("\n", "\n# ")}"
end
end
Comment on lines +190 to +195
def with_indent
@indent_level += 1
yield
ensure
@indent_level -= 1
end
Comment on lines +377 to +387
def visit_local_variable_and_write_node(node)
name = node.name.to_s
name = @renames[name] || name
val = visit(node.value)
if @declared_locals.include?(name)
"#{name} = (#{name} && #{val})"
else
@declared_locals << name
"MUTABLE #{name} = #{val}"
end
end
Comment on lines +425 to +429
def visit_required_parameter_node(node)
prefix = (@mutable_params && @mutable_params.include?(node.name.to_s)) ? "MUTABLE " : ""
type = (@param_types && @param_types[node.name.to_s]) || "Auto"
"#{prefix}#{node.name}: #{type}"
end
Comment on lines +437 to +442
def visit_optional_parameter_node(node)
prefix = (@mutable_params && @mutable_params.include?(node.name.to_s)) ? "MUTABLE " : ""
type = (@param_types && @param_types[node.name.to_s]) || "Auto"
default_val = visit(node.value)
"#{prefix}#{node.name} = #{default_val}: #{type}"
end
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
Comment on lines +680 to +693
def visit_class_node(node)
old_class = @current_class
@current_class = node.constant_path.location.slice.strip

ivar_names = collect_instance_variables(node)
struct_fields = ivar_names.map { |name| " #{name}: Auto" }.join(",\n")
struct_code = "STRUCT #{@current_class} {\n#{struct_fields}\n}"

body_code = visit(node.body)

@current_class = old_class

"#{struct_code}\n\n#{body_code}"
end
end

def source
@binary_source ||= @source.b
class TranspilationError < StandardError; end

def initialize(source, raise_on_error: true)
@source = source

def initialize(source, raise_on_error: true)
@source = source
@raise_on_error = raise_on_error
def initialize(source, raise_on_error: true)
@source = source
@raise_on_error = raise_on_error
@indent_level = 0
Comment thread gems/ruby-to-clear/lib/ruby_to_clear/transpiler.rb Fixed
mocks.verify_partial_doubles = true
end

config.shared_context_metadata_behavior = :apply_to_host_groups

config.shared_context_metadata_behavior = :apply_to_host_groups
config.filter_run_when_matching :focus
config.example_status_persistence_file_path = "spec/examples.txt"
config.filter_run_when_matching :focus
config.example_status_persistence_file_path = "spec/examples.txt"
config.disable_monkey_patching!
config.warnings = true
config.warnings = true

if config.files_to_run.one?
config.default_formatter = "doc"
config.default_formatter = "doc"
end

config.order = :random
end

sig { params(spec_files: T.untyped).returns(T::Hash[T.untyped, T.untyped]) }
sig { params(spec_files: T.untyped).returns(T::Hash[Symbol, T::Hash[Symbol, T.untyped]]) }
Comment thread src/ast/error_registry.rb Fixed
# Public entry point. Parses each spec file once, memoises results.
# Returns a hash { CODE_SYM => { bad:, fix:, good:, file:, line: } }.
sig { returns(T.untyped) }
sig { returns(T::Hash[Symbol, T::Hash[Symbol, T.untyped]]) }
Comment thread src/ast/error_registry.rb
# { existing_kind:, given_kind:, first_site:, is_stdlib: }
# or nil when registration succeeded (or was a no-op re-use).
sig { params(type_sym: Symbol, kind_sym: Symbol, site_token: T.untyped).returns(T::Array[T.untyped]) }
sig { params(type_sym: Symbol, kind_sym: Symbol, site_token: T.nilable(T.any(Lexer::Token, Object))).returns([T::Boolean, T.nilable(T::Hash[Symbol, T.untyped])]) }
Comment thread gems/nil-kill/lib/nil_kill/inference/z3_solver.rb Fixed
end

sig { params(node: AST::WithBlock, body_mir: T::Array[T.untyped], with_label: T.nilable(String)).returns(T::Array[T.untyped]) }
sig { params(node: AST::WithBlock, body_mir: T::Array[T.untyped], with_label: T.nilable(String)).returns(T::Array[MIR::Node]) }
Comment thread gems/nil-kill/lib/nil_kill/infer.rb Fixed
Comment thread gems/nil-kill/spec/oracle_spec.rb Fixed
end

it "scans string literals with escapes" do
idx, val = audit.send(:scan_string_literal, '"hello \\"world\\""', 0)
idx, val = audit.send(:scan_string_literal, '"hello \\"world\\""', 0)
expect(val).to eq('hello \\"world\\"')

idx, val = audit.send(:scan_string_literal, '"unclosed \\"', 0)

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Espalier found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.


// Test Set
m.returns = vec!["Set".to_string()];
m.return_elem_shapes = vec![json!({ "kind": "class", "name": "Float" })];
assert_eq!(super::runtime_return_type_candidate(&m), "T::Hash[String, Integer]");

// Test Set
m.returns = vec!["Set".to_string()];
Comment thread gems/nil-kill/src/actions.rs Fixed
Comment thread gems/nil-kill/src/actions.rs Fixed
Comment thread gems/nil-kill/src/actions.rs Fixed
output_data = JSON.parse(File.read(temp_out.path))
@store.actions.concat(output_data["actions"] || [])
if output_data["diagnostics"]
output_data["diagnostics"].each { |k, v| @store.diagnostics[k] = v }
cuzzo and others added 14 commits June 30, 2026 22:03
…egration tests

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
…nspiling parser.rb with >95% node conversion

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
- Raise TranspilationError on regular expressions, rescue blocks, keyword arguments/parameters, and sub method calls.
- Enforce block scoping inside function defs by pre-declaring reassigned variables at the top of the function.
- Mark method parameters as MUTABLE in signatures if they are reassigned in the body.
- Implement MultiWriteNode destructuring for array literal swaps.
- Bubbles up unsupported expressions to statement level.
- Fix string interpolation logic and nested block statement indentation.
- Add exhaustive unit/integration specs covering all of these behaviors.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
- Add desugaring/visitors for local/instance variable operator, or, and and write nodes (e.g. +=, ||=, etc.).
- Add visitor support for OptionalParameterNode and update visit_parameters_node.
- Add specs verifying these new transpilation features.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
…y methods

Ignore parameter list signature extraction fallback when a language behavior supports parameter normalization.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
Inject 770+ verified type declarations to target files via nil-kill and auto-type bisection loops.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
…m.transform

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
…s report

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
- Fix signatures and redundant/incorrect T.must calls in src/ast/parser.rb, pipe_analysis.rb, and import_resolution.rb.
- Fix missing nil-checks and block return types in liveness.rb and hoist.rb.
- Prune redundant and duplicate top-level class definitions from ast-struct-fields.rbi that conflicted with T::Struct declarations.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
Hook into T::Struct#initialize and T::Props::ClassMethods#prop/const to trace property initialization values and dynamic mutations of Sorbet struct properties, eliminating the NoEvidence gap for T::Struct subclasses.

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
…g intermediate def

Co-authored-by: gemini-cli <218195315+gemini-cli@users.noreply.github.com>
cuzzo and others added 12 commits June 30, 2026 22:04
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
cuzzo and others added 9 commits June 30, 2026 22:28
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Rb to clear improv

Co-authored-by: OpenAI Codex <codex@openai.com>
temp_in.write(JSON.generate(input_data))
temp_in.flush
bin_path = rust_binary_path
out, err, status = Open3.capture3(bin_path, temp_in.path, temp_out.path)
when "Symbol" then "String@symbol"
when "NilClass" then "Void"
when "Boolean" then "Bool"
when "TrueClass", "FalseClass" then "Bool"
Comment on lines +220 to +222
elsif receiver_name == "T::Enumerable" || receiver_name == "Enumerable"
inner = convert_sorbet_type(node.arguments&.arguments&.first)
return "#{inner}[]"
@@ -1492,6 +1492,25 @@
cause: "The value being assigned to an existing binding doesn't match the binding's declared type. Coercion was tried and failed.",
fix_hint: "Either change the value, change the declared type at the binding's declaration site, or use CAST for an explicit conversion.",
},
DESTRUCTURE_REQUIRES_FIXED_SHAPE: {
@@ -1492,6 +1492,25 @@
cause: "The value being assigned to an existing binding doesn't match the binding's declared type. Coercion was tried and failed.",
fix_hint: "Either change the value, change the declared type at the binding's declaration site, or use CAST for an explicit conversion.",
},
DESTRUCTURE_REQUIRES_FIXED_SHAPE: {
severity: :error, category: :type,
template: "Destructuring assignment requires a fixed-size RHS, got %{got}",
cause: "`a, b = value` must know exactly how many slots `value` contains at compile time. Dynamic arrays, streams, and unknown call results cannot be destructured safely.",
fix_hint: "Use a fixed-size array or tuple-like value, or assign through explicit indexing after checking the shape.",
},
DESTRUCTURE_ARITY_MISMATCH: {
},
DESTRUCTURE_ARITY_MISMATCH: {
severity: :error, category: :type,
template: "Destructuring target count %{targets} does not match RHS size %{values}",
template: "Destructuring target count %{targets} does not match RHS size %{values}",
summary: "The number of destructuring targets must match the RHS fixed size.",
},
DESTRUCTURE_REQUIRES_COPYABLE_RHS: {
},
DESTRUCTURE_REQUIRES_COPYABLE_RHS: {
severity: :error, category: :type,
template: "Destructuring assignment currently requires a copyable RHS, got %{got}",
Comment thread src/mir/mir.rb
FsmStructure = Struct.new(
:captures, :state_fields, :steps, :finalize_cleanups, :ctx_id,
:result_aliases_finalized
) do
extend T::Sig
include Emittable

sig { params(args: T.untyped).void }
def initialize(*args)
Comment thread src/mir/mir_lowering.rb
sig { params(stmt: LowerableStmt).returns(T::Boolean) }
def discard_expr_stmt?(stmt)
sig { params(stmt: LowerableStmt, mir: T.untyped).returns(T::Boolean) }
def discard_expr_stmt?(stmt, mir)
Co-authored-by: OpenAI Codex <codex@openai.com>
@@ -0,0 +1,186 @@
require "spec_helper"
Comment thread gems/nil-kill/src/main.rs
@@ -0,0 +1,36 @@
mod actions;
@@ -0,0 +1,833 @@
# frozen_string_literal: true
@@ -0,0 +1,1332 @@
# frozen_string_literal: true
@@ -0,0 +1,999 @@
# frozen_string_literal: true
Co-authored-by: OpenAI Codex <codex@openai.com>

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nil-Kill found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@cuzzo cuzzo merged commit 233e1dc into master Jul 1, 2026
93 of 94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants