From 22528b336971f67e05568a9812b136524b9178d5 Mon Sep 17 00:00:00 2001 From: Todd Kummer Date: Sun, 30 Aug 2026 17:58:18 -0700 Subject: [PATCH] Handle Provider class method display_name This adds an Appraisal file for the main branch. Main includes references to `provider.class.display_name`, which breaks the encapsulation of the SimpleDelegator around the provider. The base Provider class already has an instance method `name` which does the same delegation (to `self.class.display_name`). If that was used instead of the direct call to `class`, then the delegation would hold. It might be worth asking about that. There are a small number of methods on Provider that defer back to `self.class`: slug, capabilities, configuration_requirements, and protocols. The name -> display_name is unique in that it is the only one that maps the method name, but the pattern is there. For now, this is handled by returning the dummy value "TestProvider". --- Appraisals | 4 ++++ gemfiles/ruby_llm_1.10.gemfile | 1 + gemfiles/ruby_llm_1.13.gemfile | 1 + gemfiles/ruby_llm_1.14.gemfile | 1 + gemfiles/ruby_llm_1.5.gemfile | 1 + gemfiles/ruby_llm_1.6.gemfile | 1 + gemfiles/ruby_llm_current.gemfile | 1 + gemfiles/ruby_llm_main.gemfile | 18 ++++++++++++++++++ lib/ruby_llm/test/test_provider.rb | 6 ++++++ 9 files changed, 34 insertions(+) create mode 100644 gemfiles/ruby_llm_main.gemfile diff --git a/Appraisals b/Appraisals index 6fc69a7..e1d18f1 100644 --- a/Appraisals +++ b/Appraisals @@ -23,3 +23,7 @@ end appraise "ruby_llm-current" do gem "ruby_llm" end + +appraise "ruby_llm-main" do + gem "ruby_llm", github: "crmne/ruby_llm", branch: "main" +end diff --git a/gemfiles/ruby_llm_1.10.gemfile b/gemfiles/ruby_llm_1.10.gemfile index 17d757e..b2d5ac6 100644 --- a/gemfiles/ruby_llm_1.10.gemfile +++ b/gemfiles/ruby_llm_1.10.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_1.13.gemfile b/gemfiles/ruby_llm_1.13.gemfile index 3b2b964..a985670 100644 --- a/gemfiles/ruby_llm_1.13.gemfile +++ b/gemfiles/ruby_llm_1.13.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_1.14.gemfile b/gemfiles/ruby_llm_1.14.gemfile index 43d02b8..e3659b7 100644 --- a/gemfiles/ruby_llm_1.14.gemfile +++ b/gemfiles/ruby_llm_1.14.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_1.5.gemfile b/gemfiles/ruby_llm_1.5.gemfile index 2abcb89..51a70b8 100644 --- a/gemfiles/ruby_llm_1.5.gemfile +++ b/gemfiles/ruby_llm_1.5.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_1.6.gemfile b/gemfiles/ruby_llm_1.6.gemfile index 3b9c757..d5b0e73 100644 --- a/gemfiles/ruby_llm_1.6.gemfile +++ b/gemfiles/ruby_llm_1.6.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_current.gemfile b/gemfiles/ruby_llm_current.gemfile index 3c45106..ce31b8d 100644 --- a/gemfiles/ruby_llm_current.gemfile +++ b/gemfiles/ruby_llm_current.gemfile @@ -11,6 +11,7 @@ group :development, :test do gem "rake", "~> 13.0" gem "rubocop", "~> 1.86" gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" gem "simplecov", "~> 0.22" end diff --git a/gemfiles/ruby_llm_main.gemfile b/gemfiles/ruby_llm_main.gemfile new file mode 100644 index 0000000..93e8a0f --- /dev/null +++ b/gemfiles/ruby_llm_main.gemfile @@ -0,0 +1,18 @@ +# This file was generated by Appraisal + +source "https://gem.coop" + +gem "ruby_llm", branch: "main", git: "https://github.com/crmne/ruby_llm" + +group :development, :test do + gem "appraisal", "~> 2.5" + gem "minitest", "~> 6.0" + gem "minitest-mock", "~> 5.27" + gem "rake", "~> 13.0" + gem "rubocop", "~> 1.86" + gem "rubocop-minitest", "~> 0.39" + gem "ruby-lsp", "~> 0.26" + gem "simplecov", "~> 0.22" +end + +gemspec path: "../" diff --git a/lib/ruby_llm/test/test_provider.rb b/lib/ruby_llm/test/test_provider.rb index 6207117..23db4fa 100644 --- a/lib/ruby_llm/test/test_provider.rb +++ b/lib/ruby_llm/test/test_provider.rb @@ -11,6 +11,12 @@ def initialize(provider, test_harness) @test_harness = test_harness end + # There are a number of cases that access `provider.class.display_name`, which avoids the delegation. Adding + # dummy stub for this. TBD if this needs to be more sophisticated in the future. + def self.display_name + "TestProvider" + end + def complete(...) parameters = CompleteParameters.capture_from(__getobj__, ...) @test_harness.record_request(parameters)