diff --git a/elasticgraph/spec/unit/elastic_graph/gem_spec.rb b/elasticgraph/spec/unit/elastic_graph/gem_spec.rb index 6d31c76fe..5dc67b3ec 100644 --- a/elasticgraph/spec/unit/elastic_graph/gem_spec.rb +++ b/elasticgraph/spec/unit/elastic_graph/gem_spec.rb @@ -9,6 +9,7 @@ require_relative "../../../../script/list_eg_gems" require "elastic_graph/support/json_schema/meta_schema_validator" require "elastic_graph/support/json_schema/validator" +require "yaml" module ElasticGraph RSpec.describe "ElasticGraph gems" do @@ -197,6 +198,24 @@ def with_load_paths(*paths) end end + # Every EG gem that ships RBS signatures (i.e. has a `sig` directory) must be listed in + # `rbs_collection.yaml` with `ignore: true`. Otherwise, `rbs collection install` pulls the + # gem's signatures in via bundler while those same signatures _also_ exist locally in this + # monorepo, and Steep fails with "declaration is duplicated" errors. The bootstrap gem + # `elasticgraph` (no dash) ships no signatures, so it is intentionally excluded. + it "ignores every EG gem that ships RBS signatures in `rbs_collection.yaml` to avoid Steep `declaration is duplicated` errors" do + eg_gems_with_sig = ::ElasticGraphGems.list.select do |gem_name| + ::File.directory?(::File.join(CommonSpecHelpers::REPO_ROOT, gem_name, "sig")) + end + + rbs_config = ::YAML.safe_load_file(::File.join(CommonSpecHelpers::REPO_ROOT, "rbs_collection.yaml")) + ignored_eg_gems = rbs_config.fetch("gems") + .select { |gem| gem.fetch("name").start_with?("elasticgraph") && gem["ignore"] == true } + .map { |gem| gem.fetch("name") } + + expect(ignored_eg_gems).to match_array(eg_gems_with_sig) + end + # We don't expect any variation in these gemspec attributes. %i[homepage license required_ruby_version version].each do |gemspec_attribute| it "has the same value for `#{gemspec_attribute}` in all ElasticGraph gemspecs" do diff --git a/rbs_collection.yaml b/rbs_collection.yaml index e6db4655f..e19fbb28d 100644 --- a/rbs_collection.yaml +++ b/rbs_collection.yaml @@ -74,6 +74,8 @@ gems: ignore: true - name: elasticgraph-indexer_lambda ignore: true + - name: elasticgraph-json_ingestion + ignore: true - name: elasticgraph-lambda_support ignore: true - name: elasticgraph-local