foobara 0.0.91 → 0.0.92

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afa85ac4f9b3b8a144859108c7d4273fc290449bcf831cc6a3ff6c9445530f10
4
- data.tar.gz: 918c40b8fd082cc4982d984716b7f7e0fbaac6f2110d445bc248d4985dfa2726
3
+ metadata.gz: ad04851e6936963ef7ad60f1d6e7ab34241993abb2107b14a26d8cbc8d73663e
4
+ data.tar.gz: 178614a7f7b288a13ca290a14f702348e47d43e4d675611c7953bcdd033bdf5f
5
5
  SHA512:
6
- metadata.gz: 2aca63aa3477913c4289896d64b62a53065951da6d7c24982fa7ec8569a97bfc490320ffa002a1f219b97ee205dc2230bd3c5a66def92932da42df133a600ced
7
- data.tar.gz: 26546b93d55db31c3c88a322dcc1cd472ab2be4392b8410f1a1206a25f060f86b3be2db2628d2cf3897c0b461844acff52bd063a299ab917c0c05c22119cb4ac
6
+ metadata.gz: 13112e8c68e48a51e442ce485c5fbcc89ab5974df3f1349012e2e646cecdf1742096bc5d42a9edb4c5dd825b06adabca6302f8a4c9ec44857c98338c8cc4b210
7
+ data.tar.gz: a48dcd6f4ec1f36feba216fab63711ea37a2378f819cc450a8e08bb15ea62a4f4463970f666b7d61fabd7aee871e01112abe2afceb915fbd0bc2cade4994b4b3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # [0.0.92] - 2025-04-01
2
+
3
+ - Improve error call stacks in calls like #run!
4
+ - Fix bug preventing first call to CommandConnector#foobara_manifest from returning all its domains
5
+
1
6
  # [0.0.91] - 2025-03-31
2
7
 
3
8
  - Fix bug that was including removed types in command manifest's inputs_types_depended_on
@@ -16,7 +21,7 @@
16
21
  - Implement response mutator concept
17
22
  - Break up #request_to_response for easier overriding/extension
18
23
  - Add AttributesTransformers::Reject
19
- - Fix problem causing downcase/regex processors to explode on allows_nil types
24
+ - Fix problem causing downcase/regex processors to explode on allow_nil types
20
25
 
21
26
  # [0.0.87] - 2025-03-26
22
27
 
@@ -271,7 +276,7 @@
271
276
 
272
277
  ## [0.0.13] - 2024-11-13
273
278
 
274
- - Do not fail :one_of if it is nil and :allows_nil
279
+ - Do not fail :one_of if it is nil and :allow_nil
275
280
 
276
281
  ## [0.0.12] - 2024-10-30
277
282
 
@@ -73,7 +73,7 @@ module Foobara
73
73
 
74
74
  Util.make_class(class_name, ValidatorBase) do
75
75
  define_method :applicable? do |value|
76
- # TODO: hmmm, I wonder how we can short-circuit these checks if :allows_nil matches??
76
+ # TODO: hmmm, I wonder how we can short-circuit these checks if :allow_nil matches??
77
77
  value.is_a?(::String)
78
78
  end
79
79
 
@@ -181,11 +181,11 @@ module Foobara
181
181
  end
182
182
 
183
183
  def inputs_types_depended_on
184
- inputs_type&.types_depended_on || []
184
+ inputs_type_for_manifest&.types_depended_on || []
185
185
  end
186
186
 
187
187
  def result_types_depended_on(remove_sensitive: true)
188
- result_type&.types_depended_on(remove_sensitive:) || []
188
+ result_type_for_manifest&.types_depended_on(remove_sensitive:) || []
189
189
  end
190
190
 
191
191
  def types_depended_on(remove_sensitive: true)
@@ -266,6 +266,8 @@ module Foobara
266
266
  result_types_depended_on = self.result_types_depended_on(remove_sensitive:).map(&:foobara_manifest_reference)
267
267
  result_types_depended_on = result_types_depended_on.sort
268
268
 
269
+ # TODO: Do NOT defer to command_class.foobara_manifest because it might process types that
270
+ # might not have an exposed command and might not need one due to transformers/mutators/remove_sensitive flag
269
271
  command_class.foobara_manifest(to_include:, remove_sensitive:).merge(
270
272
  Util.remove_blank(
271
273
  inputs_types_depended_on:,
@@ -449,9 +449,17 @@ module Foobara
449
449
  domain_name = o.foobara_domain.scoped_full_name
450
450
 
451
451
  unless command_registry.foobara_registered?(domain_name)
452
- domain = command_registry.build_and_register_exposed_domain(domain_name)
453
- additional_to_include << domain
454
- additional_to_include << domain.foobara_organization
452
+ command_registry.build_and_register_exposed_domain(domain_name)
453
+
454
+ # Since we don't know which other domains/orgs creating this domain might have created,
455
+ # we will just add them all to be included just in case
456
+ command_registry.foobara_all_domain.each do |exposed_domain|
457
+ additional_to_include << exposed_domain
458
+ end
459
+
460
+ command_registry.foobara_all_organization.each do |exposed_organization|
461
+ additional_to_include << exposed_organization
462
+ end
455
463
  end
456
464
  end
457
465
  end
@@ -86,6 +86,15 @@ module Foobara
86
86
  exposed_organization.foobara_register(exposed_domain)
87
87
  exposed_domain.foobara_parent_namespace = exposed_organization
88
88
 
89
+ domain_module.foobara_depends_on.each do |domain_name|
90
+ # TODO: test this code path!!
91
+ # :nocov:
92
+ unless foobara_organization_registered?(domain_name)
93
+ build_and_register_exposed_domain(domain_name)
94
+ end
95
+ # :nocov:
96
+ end
97
+
89
98
  exposed_domain
90
99
  end
91
100
 
@@ -5,7 +5,7 @@ module Foobara
5
5
  include Manifestable
6
6
 
7
7
  # TODO: rename :path to data_path
8
- attr_accessor :error_key, :message, :context, :is_fatal
8
+ attr_accessor :error_key, :message, :context, :is_fatal, :backtrace_when_initialized, :backtrace_when_raised
9
9
 
10
10
  # Need to do this early so doing it here... not sure if this is OK as it couples namespaces and errors
11
11
 
@@ -219,6 +219,30 @@ module Foobara
219
219
  # :nocov:
220
220
  end
221
221
 
222
+ backtrace_when_initialized = caller[1..]
223
+ index = 1
224
+
225
+ has_build_error = false
226
+
227
+ 1.upto(10) do |i|
228
+ if backtrace_when_initialized[i].end_with?("#build_error'")
229
+ index = i + 1
230
+ has_build_error = true
231
+ break
232
+ end
233
+ end
234
+
235
+ if has_build_error
236
+ index.upto(10) do |i|
237
+ unless backtrace_when_initialized[i].end_with?("#build_error'")
238
+ index = i
239
+ break
240
+ end
241
+ end
242
+ end
243
+
244
+ self.backtrace_when_initialized = backtrace_when_initialized[index..]
245
+
222
246
  super(message)
223
247
  end
224
248
 
@@ -1,7 +1,7 @@
1
1
  module Foobara
2
2
  class Outcome
3
3
  class UnsuccessfulOutcomeError < StandardError
4
- attr_accessor :errors
4
+ attr_accessor :errors, :backtrace_when_raised
5
5
 
6
6
  def initialize(errors)
7
7
  self.errors = errors
@@ -74,11 +74,17 @@ module Foobara
74
74
  def raise!
75
75
  return if success?
76
76
 
77
- if errors.size == 1
78
- raise errors.first
79
- else
80
- raise UnsuccessfulOutcomeError, errors
77
+ error = errors.first
78
+ original_backtrace = error.backtrace_when_initialized
79
+
80
+ if errors.size > 1
81
+ error = UnsuccessfulOutcomeError.new(errors)
81
82
  end
83
+
84
+ error.set_backtrace(original_backtrace)
85
+ error.backtrace_when_raised = caller
86
+
87
+ raise error
82
88
  end
83
89
 
84
90
  def result!
@@ -8,9 +8,15 @@ module Foobara
8
8
  associations = Foobara::DetachedEntity.construct_deep_associations(from_type)
9
9
 
10
10
  associations&.values&.reverse&.each do |entity_type|
11
+ next if entity_type.sensitive?
12
+ next unless entity_type.has_sensitive_types?
13
+
11
14
  declaration = entity_type.declaration_data
12
15
  sanitized_type_declaration = TypeDeclarations.remove_sensitive_types(declaration)
13
16
 
17
+ # We want to make sure that any types that change due to having sensitive types
18
+ # has a corresponding registered type in the command registry domain if needed
19
+ # TODO: this all feels so messy and brittle.
14
20
  Domain.current.foobara_type_from_declaration(sanitized_type_declaration)
15
21
  end
16
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.91
4
+ version: 0.0.92
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-31 00:00:00.000000000 Z
10
+ date: 2025-04-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal