From 5fd5c5f77c44a6706b3adef0a982429815d3f5c1 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sat, 14 Nov 2026 08:27:07 +0800 Subject: [PATCH] fix: bare rababa (no config) raises MapLogicError, not ArgumentError The grammar's funcall kwargs are optional, so a bare `rababa` directive parses everywhere - and ruby executed it into "ArgumentError: missing keyword: :config" (audit G11, probe funcall-rababa-bare). ts/py raise their named provisioning errors and rs rejects at load; ruby now fails named too: MapLogicError "rababa requires config:". rababa_reverse already defaulted config and is unchanged. TDD: rspec red (ArgumentError) -> green; full rake 422 examples, 0 failures, 11 pending (baseline shape). --- lib/interscript/stdlib/functions.rb | 7 ++++++- spec/stdlib_functions_spec.rb | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/interscript/stdlib/functions.rb b/lib/interscript/stdlib/functions.rb index 4580addc..4c0e4a12 100644 --- a/lib/interscript/stdlib/functions.rb +++ b/lib/interscript/stdlib/functions.rb @@ -59,7 +59,12 @@ def self.secryst(output, model:) SecrystAdapter.call(output, model: model) end - def self.rababa(output, config:) + # A bare `rababa` directive (no config:) is a map-logic error — the + # grammar's kwargs are optional, and a Ruby ArgumentError here is + # accidental (WO18 G11; ts/py raise their named errors, rs rejects + # at load). + def self.rababa(output, config: nil) + raise Interscript::MapLogicError, "rababa requires config:" unless config RababaAdapter.call(output, config: config) end diff --git a/spec/stdlib_functions_spec.rb b/spec/stdlib_functions_spec.rb index 88c8a2c1..4b3cd47f 100644 --- a/spec/stdlib_functions_spec.rb +++ b/spec/stdlib_functions_spec.rb @@ -135,3 +135,16 @@ end end end + +RSpec.describe Interscript::Stdlib::Functions do + # WO18 G11 (parity audit): a bare `rababa` directive (no config:) is a + # map-logic error, not a Ruby ArgumentError — ts/py raise their named + # provisioning errors, rs rejects at load; ruby must fail named too. + describe ".rababa without config" do + it "raises MapLogicError, not ArgumentError" do + expect { described_class.rababa("مرحبا") }.to raise_error( + Interscript::MapLogicError, /rababa requires config/ + ) + end + end +end