sorbet-runtime 0.6.12527 → 0.6.12544
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/types/private/abstract/data.rb +1 -1
- data/lib/types/private/methods/signature_validation.rb +2 -2
- data/lib/types/private/sealed.rb +1 -1
- data/lib/types/props/decorator.rb +9 -36
- data/lib/types/props/has_lazily_specialized_methods.rb +1 -1
- data/lib/types/props/serializable.rb +4 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee113a3cd21e2a9e34722bee3ea8be288df38a05ba062bdd01fa57c243cad4b4
|
4
|
+
data.tar.gz: '0498ec7e9e48f862c6662d8808d3d0d0195edcaf596f3eb6aa43f421b4fc91b1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2958534c3904db734059d82f46626db095cd9f7e4121b248b914c6f38bf7f13362eb6807fa2f635ccfd3f7c2e98329281b4945234959458cd5317ea4ee44aeb
|
7
|
+
data.tar.gz: 99a36c45086fe9db4e45874df7acce8cf9da8d389b42fca310e91437b027ecb62d9075b6be288e26a04130381384bc8f7f58a82880289790c711a76ba37f1cfd
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# modules that override the `hash` method with something completely broken.
|
13
13
|
module T::Private::Abstract::Data
|
14
14
|
def self.get(mod, key)
|
15
|
-
mod.instance_variable_get("@opus_abstract__#{key}")
|
15
|
+
mod.instance_variable_get("@opus_abstract__#{key}")
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.set(mod, key, value)
|
@@ -277,7 +277,7 @@ module T::Private::Methods::SignatureValidation
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
ALLOW_INCOMPATIBLE_VISIBILITY = [:visibility, true]
|
280
|
+
ALLOW_INCOMPATIBLE_VISIBILITY = [:visibility, true].freeze
|
281
281
|
private_constant :ALLOW_INCOMPATIBLE_VISIBILITY
|
282
282
|
|
283
283
|
def self.validate_override_visibility(signature, super_signature)
|
@@ -308,7 +308,7 @@ module T::Private::Methods::SignatureValidation
|
|
308
308
|
end
|
309
309
|
|
310
310
|
# Higher = more restrictive.
|
311
|
-
METHOD_VISIBILITIES = %i[public protected private]
|
311
|
+
METHOD_VISIBILITIES = %i[public protected private].freeze
|
312
312
|
private_constant :METHOD_VISIBILITIES
|
313
313
|
|
314
314
|
private_class_method def self.visibility_strength(vis)
|
data/lib/types/private/sealed.rb
CHANGED
@@ -70,7 +70,7 @@ module T::Private::Sealed
|
|
70
70
|
|
71
71
|
def self.validate_inheritance(caller_loc, parent, child, verb)
|
72
72
|
this_file = caller_loc&.path
|
73
|
-
decl_file = parent.instance_variable_get(:@sorbet_sealed_module_decl_file)
|
73
|
+
decl_file = parent.instance_variable_get(:@sorbet_sealed_module_decl_file)
|
74
74
|
|
75
75
|
if !this_file
|
76
76
|
raise "Could not use backtrace to determine file for #{verb} child #{child}"
|
@@ -174,7 +174,9 @@ class T::Props::Decorator
|
|
174
174
|
.checked(:never)
|
175
175
|
end
|
176
176
|
def prop_get(instance, prop, rules=prop_rules(prop))
|
177
|
-
|
177
|
+
# `instance_variable_get` will return nil if the variable doesn't exist
|
178
|
+
# which is what we want to have happen for the logic below.
|
179
|
+
val = instance.instance_variable_get(rules[:accessor_key])
|
178
180
|
if !val.nil?
|
179
181
|
val
|
180
182
|
elsif (d = rules[:ifunset])
|
@@ -194,7 +196,9 @@ class T::Props::Decorator
|
|
194
196
|
.checked(:never)
|
195
197
|
end
|
196
198
|
def prop_get_if_set(instance, prop, rules=prop_rules(prop))
|
197
|
-
|
199
|
+
# `instance_variable_get` will return nil if the variable doesn't exist
|
200
|
+
# which is what we want to have happen for the return value here.
|
201
|
+
instance.instance_variable_get(rules[:accessor_key])
|
198
202
|
end
|
199
203
|
alias_method :get, :prop_get_if_set # Alias for backwards compatibility
|
200
204
|
|
@@ -323,9 +327,9 @@ class T::Props::Decorator
|
|
323
327
|
sig(:final) { params(name: Symbol).returns(T::Boolean).checked(:never) }
|
324
328
|
private def method_defined_on_ancestor?(name)
|
325
329
|
(@class.method_defined?(name) || @class.private_method_defined?(name)) &&
|
326
|
-
|
327
|
-
|
328
|
-
|
330
|
+
# Unfortunately, older versions of ruby don't allow the second parameter on
|
331
|
+
# `private_method_defined?`.
|
332
|
+
(!@class.method_defined?(name, false) && !@class.private_method_defined?(name, false))
|
329
333
|
end
|
330
334
|
|
331
335
|
sig(:final) { params(name: Symbol, rules: Rules).void.checked(:never) }
|
@@ -406,8 +410,6 @@ class T::Props::Decorator
|
|
406
410
|
|
407
411
|
# extra arbitrary metadata attached by the code defining this property
|
408
412
|
|
409
|
-
validate_not_missing_sensitivity(name, rules)
|
410
|
-
|
411
413
|
# for backcompat (the `:array` key is deprecated but because the name is
|
412
414
|
# so generic it's really hard to be sure it's not being relied on anymore)
|
413
415
|
if type.is_a?(T::Types::TypedArray)
|
@@ -483,35 +485,6 @@ class T::Props::Decorator
|
|
483
485
|
end
|
484
486
|
end
|
485
487
|
|
486
|
-
# checked(:never) - Rules hash is expensive to check
|
487
|
-
sig { params(prop_name: Symbol, rules: Rules).void.checked(:never) }
|
488
|
-
private def validate_not_missing_sensitivity(prop_name, rules)
|
489
|
-
if rules[:sensitivity].nil?
|
490
|
-
if rules[:redaction]
|
491
|
-
T::Configuration.hard_assert_handler(
|
492
|
-
"#{@class}##{prop_name} has a 'redaction:' annotation but no " \
|
493
|
-
"'sensitivity:' annotation. This is probably wrong, because if a " \
|
494
|
-
"prop needs redaction then it is probably sensitive. Add a " \
|
495
|
-
"sensitivity annotation like 'sensitivity: Opus::Sensitivity::PII." \
|
496
|
-
"whatever', or explicitly override this check with 'sensitivity: []'."
|
497
|
-
)
|
498
|
-
end
|
499
|
-
# TODO(PRIVACYENG-982) Ideally we'd also check for 'password' and possibly
|
500
|
-
# other terms, but this interacts badly with ProtoDefinedDocument because
|
501
|
-
# the proto syntax currently can't declare "sensitivity: []"
|
502
|
-
if /\bsecret\b/.match?(prop_name)
|
503
|
-
T::Configuration.hard_assert_handler(
|
504
|
-
"#{@class}##{prop_name} has the word 'secret' in its name, but no " \
|
505
|
-
"'sensitivity:' annotation. This is probably wrong, because if a " \
|
506
|
-
"prop is named 'secret' then it is probably sensitive. Add a " \
|
507
|
-
"sensitivity annotation like 'sensitivity: Opus::Sensitivity::NonPII." \
|
508
|
-
"security_token', or explicitly override this check with " \
|
509
|
-
"'sensitivity: []'."
|
510
|
-
)
|
511
|
-
end
|
512
|
-
end
|
513
|
-
end
|
514
|
-
|
515
488
|
# Create `#{prop_name}_redacted` method
|
516
489
|
sig do
|
517
490
|
params(
|
@@ -121,8 +121,8 @@ module T::Props::Serializable
|
|
121
121
|
private def with_existing_hash(changed_props, existing_hash:)
|
122
122
|
serialized = existing_hash
|
123
123
|
new_val = self.class.from_hash(serialized.merge(recursive_stringify_keys(changed_props)))
|
124
|
-
old_extra = self.instance_variable_get(:@_extra_props)
|
125
|
-
new_extra = new_val.instance_variable_get(:@_extra_props)
|
124
|
+
old_extra = self.instance_variable_get(:@_extra_props)
|
125
|
+
new_extra = new_val.instance_variable_get(:@_extra_props)
|
126
126
|
if old_extra != new_extra
|
127
127
|
difference =
|
128
128
|
if old_extra
|
@@ -137,8 +137,7 @@ module T::Props::Serializable
|
|
137
137
|
|
138
138
|
# Asserts if this property is missing during strict serialize
|
139
139
|
private def required_prop_missing_from_serialize(prop)
|
140
|
-
if
|
141
|
-
@_required_props_missing_from_deserialize&.include?(prop)
|
140
|
+
if @_required_props_missing_from_deserialize&.include?(prop)
|
142
141
|
# If the prop was already missing during deserialization, that means the application
|
143
142
|
# code already had to deal with a nil value, which means we wouldn't be accomplishing
|
144
143
|
# much by raising here (other than causing an unnecessary breakage).
|
@@ -353,11 +352,7 @@ module T::Props::Serializable::DecoratorMethods
|
|
353
352
|
private_constant :EMPTY_EXTRA_PROPS
|
354
353
|
|
355
354
|
def extra_props(instance)
|
356
|
-
|
357
|
-
instance.instance_variable_get(:@_extra_props) || EMPTY_EXTRA_PROPS
|
358
|
-
else
|
359
|
-
EMPTY_EXTRA_PROPS
|
360
|
-
end
|
355
|
+
instance.instance_variable_get(:@_extra_props) || EMPTY_EXTRA_PROPS
|
361
356
|
end
|
362
357
|
|
363
358
|
# adds to the default result of T::Props::PrettyPrintable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.12544
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|