Skip to content

Commit 2bcae65

Browse files
committed
Fix type check for rbs 4.0.3 -> 4.2.0 bump
rbs 4.2 retypes Hash#[]/#fetch/Hash.new's block key param as `_Key` (hash+eql? only) instead of `K`, breaking type checks wherever custom interfaces (_Client, _Operation, SupportsFilteringAndAggregation) are used as hash keys, since those interfaces don't declare hash/eql?. - Bump steep to ~> 2.1.0 (fixes rbs 4.2's Hash#to_h `_Pair` block sig). - Add `client`/`operation`/`filterableAndAggregatableType` aliases (interface & ::Object) and use them wherever these values flow into hash keys, since every real implementer is a Ruby object. - Reassign-with-annotation inside `Hash.new { |h, key| ... }` blocks where the key param's type isn't tied to any generic.
1 parent 66d280f commit 2bcae65

30 files changed

Lines changed: 94 additions & 74 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ group :development do
3737
gem "simplecov", "~> 1.0", ">= 1.0.3"
3838
gem "simplecov-console", "~> 0.9", ">= 0.9.5"
3939
gem "standard", "~> 1.56.0"
40-
gem "steep", "~> 2.0.0", platforms: :ruby
40+
gem "steep", "~> 2.1.0", platforms: :ruby
4141
gem "super_diff", "~> 0.19"
4242
gem "vcr", "~> 6.4"
4343
end

Gemfile.lock

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ GEM
603603
standard-performance (1.9.0)
604604
lint_roller (~> 1.1)
605605
rubocop-performance (~> 1.26.0)
606-
steep (2.0.0)
606+
steep (2.1.0)
607607
concurrent-ruby (>= 1.1.10)
608608
csv (>= 3.0.9)
609609
fileutils (>= 1.1.0)
@@ -614,7 +614,7 @@ GEM
614614
parser (>= 3.2)
615615
prism (>= 0.25.0)
616616
rainbow (>= 2.2.2, < 4.0)
617-
rbs (~> 4.0)
617+
rbs (~> 4.2)
618618
securerandom (>= 0.1)
619619
strscan (>= 1.0.0)
620620
terminal-table (>= 2, < 5)
@@ -722,7 +722,7 @@ DEPENDENCIES
722722
simplecov (~> 1.0, >= 1.0.3)
723723
simplecov-console (~> 0.9, >= 0.9.5)
724724
standard (~> 1.56.0)
725-
steep (~> 2.0.0)
725+
steep (~> 2.1.0)
726726
super_diff (~> 0.19)
727727
vcr (~> 6.4)
728728
yard (~> 0.9, >= 0.9.45)
@@ -754,7 +754,6 @@ CHECKSUMS
754754
benchmark-ips (2.15.1) sha256=07a1a9f3c6105ecaf68c174fc3fbcddd71a0e9ada6236ae03093a0dcfd812d59
755755
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
756756
bigdecimal (4.1.2-java) sha256=ccc836eab720a525529f70ed0de26a206fdbc9a9e8ac67b3b4ac7318b03e114d
757-
bundler (4.0.13) sha256=19f08be7f27022cf0b89f27da0b044ae075e8270a9ef44ad248a932614e1ca3b
758757
coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
759758
colorator (1.1.0) sha256=e2f85daf57af47d740db2a32191d1bdfb0f6503a0dfbc8327d0c9154d5ddfc38
760759
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
@@ -926,7 +925,7 @@ CHECKSUMS
926925
standard (1.56.0) sha256=ae2af4d9669589162ac69ed5ef59dcf9f346d4afc81f7e62b84339310dfcb787
927926
standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
928927
standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
929-
steep (2.0.0) sha256=6eb0ecc09637bbb54f0a5f2cf63daea6d3208ccace64b4f1107d976333605c30
928+
steep (2.1.0) sha256=1daf53573283b0e6d404a7273cca41fe5c15b14ece05167934f5ffc179e171d9
930929
strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e
931930
strscan (3.1.8-java) sha256=07c9fb169931fc7327e9ae64b27999e355c2eadd0eaae4ed0f1e7d4e05a2b429
932931
super_diff (0.19.0) sha256=c35fc1c0daa223d67b203fe3fb49a6cfd67850a53920319565c3c654e03ec902

elasticgraph-admin/sig/elastic_graph/admin/cluster_configurator.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module ElasticGraph
22
class Admin
33
class ClusterConfigurator
44
def initialize: (
5-
datastore_clients_by_name: ::Hash[::String, DatastoreCore::_Client],
5+
datastore_clients_by_name: ::Hash[::String, DatastoreCore::client],
66
index_defs: ::Array[DatastoreCore::indexDefinition],
77
index_configurations_by_name: ::Hash[::String, untyped],
88
index_template_configurations_by_name: ::Hash[::String, untyped],
@@ -18,7 +18,7 @@ module ElasticGraph
1818

1919
private
2020

21-
@datastore_clients_by_name: ::Hash[::String, DatastoreCore::_Client]
21+
@datastore_clients_by_name: ::Hash[::String, DatastoreCore::client]
2222
@index_defs: ::Array[DatastoreCore::indexDefinition]
2323
@index_configurations_by_name: DatastoreCore::indexConfigHash
2424
@scripts_by_id: datastoreScriptsByIdHash

elasticgraph-admin/sig/elastic_graph/admin/cluster_configurator/cluster_settings_manager.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module ElasticGraph
55
type clusterSpec = ::String | :all_clusters
66

77
def initialize: (
8-
datastore_clients_by_name: ::Hash[::String, DatastoreCore::_Client],
8+
datastore_clients_by_name: ::Hash[::String, DatastoreCore::client],
99
datastore_config: DatastoreCore::Config,
1010
logger: ::Logger) -> void
1111

@@ -15,12 +15,12 @@ module ElasticGraph
1515

1616
private
1717

18-
@datastore_clients_by_name: ::Hash[::String, DatastoreCore::_Client]
18+
@datastore_clients_by_name: ::Hash[::String, DatastoreCore::client]
1919
@datastore_config: DatastoreCore::Config
2020
@logger: ::Logger
2121

2222
def desired_cluster_settings: (::String, ?auto_create_index_patterns: ::Array[::String]) -> ::Hash[::String, untyped]
23-
def datastore_client_named: (::String) -> DatastoreCore::_Client
23+
def datastore_client_named: (::String) -> DatastoreCore::client
2424
def cluster_names_for: (clusterSpec) -> ::Array[::String]
2525
end
2626
end

elasticgraph-admin/sig/elastic_graph/admin/cluster_configurator/script_configurator.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module ElasticGraph
33
class ClusterConfigurator
44
class ScriptConfigurator
55
def initialize: (
6-
datastore_client: DatastoreCore::_Client,
6+
datastore_client: DatastoreCore::client,
77
script_context: datastoreScriptContext,
88
script_id: ::String,
99
script: datastoreScriptScriptHash,
@@ -14,7 +14,7 @@ module ElasticGraph
1414

1515
private
1616

17-
@datastore_client: DatastoreCore::_Client
17+
@datastore_client: DatastoreCore::client
1818
@script_context: datastoreScriptContext
1919
@script_id: ::String
2020
@script: datastoreScriptScriptHash

elasticgraph-admin/sig/elastic_graph/admin/datastore_client_dry_run_decorator.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module ElasticGraph
22
class Admin
33
class DatastoreClientDryRunDecorator
44
include DatastoreCore::_Client
5-
def initialize: (DatastoreCore::_Client) -> void
5+
def initialize: (DatastoreCore::client) -> void
66
end
77
end
88
end

elasticgraph-admin/sig/elastic_graph/admin/index_definition_configurator.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module ElasticGraph
44

55
module IndexDefinitionConfigurator
66
def self.new: (
7-
DatastoreCore::_Client,
7+
DatastoreCore::client,
88
DatastoreCore::indexDefinition,
99
::Hash[::String, untyped],
1010
io,

elasticgraph-admin/sig/elastic_graph/admin/index_definition_configurator/for_index.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module ElasticGraph
55
attr_reader index: DatastoreCore::IndexDefinition::Index
66

77
def initialize: (
8-
DatastoreCore::_Client,
8+
DatastoreCore::client,
99
DatastoreCore::IndexDefinition::Index,
1010
::Hash[::String, untyped],
1111
io
@@ -16,7 +16,7 @@ module ElasticGraph
1616

1717
private
1818

19-
@datastore_client: DatastoreCore::_Client
19+
@datastore_client: DatastoreCore::client
2020
@index: DatastoreCore::IndexDefinition::Index
2121
@env_agnostic_index_config: ::Hash[::String, untyped]
2222
@reporter: ClusterConfigurator::ActionReporter

elasticgraph-admin/sig/elastic_graph/admin/index_definition_configurator/for_index_template.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module ElasticGraph
55
attr_reader index_template: DatastoreCore::IndexDefinition::RolloverIndexTemplate
66

77
def initialize: (
8-
DatastoreCore::_Client,
8+
DatastoreCore::client,
99
DatastoreCore::IndexDefinition::RolloverIndexTemplate,
1010
::Hash[::String, untyped],
1111
io,
@@ -17,7 +17,7 @@ module ElasticGraph
1717

1818
private
1919

20-
@datastore_client: DatastoreCore::_Client
20+
@datastore_client: DatastoreCore::client
2121
@index_template: DatastoreCore::IndexDefinition::RolloverIndexTemplate
2222
@env_agnostic_index_config_parent: ::Hash[::String, untyped]
2323
@env_agnostic_index_config: ::Hash[::String, untyped]

elasticgraph-datastore_core/sig/elastic_graph/datastore_core.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module ElasticGraph
1212
config: Config,
1313
logger: ::Logger,
1414
schema_artifacts: schemaArtifacts,
15-
?clients_by_name: ::Hash[::String, _Client]?,
15+
?clients_by_name: ::Hash[::String, client]?,
1616
?client_customization_block: (^(untyped) -> void)?
1717
) -> void
1818

@@ -22,8 +22,8 @@ module ElasticGraph
2222
@index_definitions_by_graphql_type: ::Hash[::String, ::Array[indexDefinition]]?
2323
def index_definitions_by_graphql_type: () -> ::Hash[::String, ::Array[indexDefinition]]
2424

25-
@clients_by_name: ::Hash[::String, _Client]?
26-
def clients_by_name: () -> ::Hash[::String, _Client]
25+
@clients_by_name: ::Hash[::String, client]?
26+
def clients_by_name: () -> ::Hash[::String, client]
2727

2828
private
2929

0 commit comments

Comments
 (0)