foobara 0.6.1 → 0.6.2

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: 658b5aeee49a2c42d53b1c27a1bfc1464a62a3688e66e4c074f47c0932cbccd3
4
- data.tar.gz: 75e152204e15cf5b6359276533cb0d690c49f729f94bec9bb59f2faac5d99885
3
+ metadata.gz: 82cde9f69a93f602dfc7c64ae307642920cd755c0406a549e7247e47992982a4
4
+ data.tar.gz: dd875dcf264ab47d1bc4af1ae08cd391e2bac8771fde7681f213402c3a8ad269
5
5
  SHA512:
6
- metadata.gz: baaf7fa9a61c7d3cd588a4b9580ea7e8543ee3651ed38cd64dc58389039b21724b2f78c0b2af1fcc5a6199184c15c5205022cc21a4892388629b1e9602c40cec
7
- data.tar.gz: 125a737bd0dee217a4f08137f12ed78f8849c7d2392f8948e60d5f7221051f6d149a4f203df4ce3a16a93190ee8e26b3c26136856fd1171c57934f8e15fa5291
6
+ metadata.gz: b37ae22e17b00b133153a71924c1657b0d64f37c141a48ea0d05309f8316a6afe5387627052d83dadc2b58c09b1906190b4633921615420a26c449d3e660c75c
7
+ data.tar.gz: 5887b2e59372917e3b2535dd1b918cedf49c5fd7011e241036ace90b0a45478753d394f93f4f5d473079443ad3092ee4bf3865d42a0dadda66fbadf3e68065d6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # [0.6.2] - 2026-08-24
2
+
3
+ - Eliminate all direct uses of Foobara.manifest in the test suite and deprecate it
4
+ - Fix bug preventing other combinations an Error missing parent/domain from getting fixed
5
+
1
6
  # [0.6.1] - 2026-08-08
2
7
 
3
8
  - Reduce gem size by excluding non-production code/artifacts from sub-projects
@@ -66,8 +66,14 @@ module Foobara
66
66
  unless o.foobara_root_namespace == command_registry
67
67
  next
68
68
  end
69
- elsif o.is_a?(::Class) && o < Foobara::Command
70
- next
69
+ elsif o.is_a?(::Class)
70
+ if o < Foobara::Command
71
+ next
72
+ elsif o < Foobara::Value::Processor
73
+ full_domain_name = o.foobara_domain.scoped_full_name
74
+ exposed_domain = command_registry.create_exposed_domain_if_needed(full_domain_name)
75
+ additional_to_include << exposed_domain
76
+ end
71
77
  end
72
78
  elsif o.is_a?(Types::Type)
73
79
  if o.sensitive?
@@ -77,7 +83,6 @@ module Foobara
77
83
  "Make sure these are not included."
78
84
  # simplecov:enable
79
85
  else
80
-
81
86
  mode = Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
82
87
  domain_name = o.foobara_domain.scoped_full_name
83
88
 
@@ -154,26 +159,67 @@ module Foobara
154
159
  root_manifest = Manifest::RootManifest.new(manifest_hash)
155
160
 
156
161
  error_category = {}
162
+ reference_to_category = {}
163
+
164
+ # The only thing we can scope to an org is a domain so leaving :organization out
165
+ [
166
+ :command,
167
+ :domain,
168
+ :type,
169
+ :error,
170
+ :processor,
171
+ :processor_class
172
+ ].each do |category|
173
+ root_manifest.relevant_manifest[category]&.each_key do |key|
174
+ reference_to_category[key.to_s] = category
175
+ end
176
+ end
157
177
 
158
178
  root_manifest.errors.each do |error|
159
- error_manifest = if (error.parent_category == :command || error.parent_category == :organization) &&
160
- !root_manifest.contains?(error.parent_name, error.parent_category)
161
- domain = error.domain
162
- index = domain.scoped_full_path.size
179
+ # TODO: let's deprecate parent_name and use parent_path instead.
180
+ error_manifest = if root_manifest.contains?(error.parent_name, error.parent_category) &&
181
+ root_manifest.contains?(error[:domain], :domain) &&
182
+ root_manifest.contains?(error.parent[:domain], :domain)
183
+
184
+ error.relevant_manifest
185
+ else
186
+ parent = nil
187
+
188
+ fixed_scoped_path = error.scoped_path.dup
189
+ parent_path = error.scoped_full_path[..-(fixed_scoped_path.size + 1)]
190
+
191
+ loop do
192
+ fixed_scoped_path.unshift(parent_path.pop)
193
+ parent_name = parent_path.join("::")
194
+
195
+ if parent_path.empty?
196
+ parent = root_manifest.global_domain
197
+ break
198
+ elsif reference_to_category.include?(parent_name)
199
+ possible_parent = root_manifest.lookup(parent_name)
200
+
201
+ if root_manifest.contains?(possible_parent[:domain], :domain)
202
+ parent = possible_parent
203
+ break
204
+ end
205
+ end
206
+ end
207
+
208
+ fixed_parent = parent.manifest_path
209
+ fixed_domain = parent[:domain]
210
+ fixed_organization = parent[:organization]
163
211
 
164
- fixed_scoped_path = error.scoped_full_path[index..]
165
- fixed_scoped_name = fixed_scoped_path.join("::")
166
212
  fixed_scoped_prefix = fixed_scoped_path[..-2]
167
- fixed_parent = [:domain, domain.reference]
213
+ fixed_scoped_name = fixed_scoped_path.join("::")
168
214
 
169
215
  error.relevant_manifest.merge(
170
216
  parent: fixed_parent,
171
217
  scoped_path: fixed_scoped_path,
172
218
  scoped_name: fixed_scoped_name,
173
- scoped_prefix: fixed_scoped_prefix
219
+ scoped_prefix: fixed_scoped_prefix,
220
+ domain: fixed_domain,
221
+ organization: fixed_organization
174
222
  )
175
- else
176
- error.relevant_manifest
177
223
  end
178
224
 
179
225
  error_category[error.scoped_full_name.to_sym] = error_manifest
@@ -204,13 +204,19 @@ module Foobara
204
204
  end
205
205
  end
206
206
 
207
+ # Why are we calling this _name instead of _reference??
208
+ def create_exposed_domain_if_needed(full_domain_name)
209
+ foobara_lookup_domain(
210
+ full_domain_name,
211
+ mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
212
+ ) || build_and_register_exposed_domain(full_domain_name)
213
+ end
214
+
207
215
  private
208
216
 
209
217
  def create_exposed_command(command_class, **opts)
210
218
  full_domain_name = command_class.domain.scoped_full_name
211
- exposed_domain = foobara_lookup_domain(full_domain_name,
212
- mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) ||
213
- build_and_register_exposed_domain(full_domain_name)
219
+ exposed_domain = create_exposed_domain_if_needed(full_domain_name)
214
220
 
215
221
  if !opts.key?(:allowed_rule) && allow&.key?(command_class)
216
222
  opts = opts.merge(allowed_rule: allow[command_class])
@@ -2,6 +2,7 @@ require "foobara/type_declarations"
2
2
 
3
3
  require "date"
4
4
  require "time"
5
+ # TODO: get this out of here
5
6
  require "bigdecimal"
6
7
 
7
8
  module Foobara
@@ -1,6 +1,14 @@
1
1
  module Foobara
2
2
  class << self
3
3
  def manifest
4
+ # simplecov:disable
5
+ warn "Foobara.manifest is deprecated in favor of CommandConnector#foobara_manifest" \
6
+ "\nIf this breaks a legit use case for Foobara.manifest please let us know and we will consider keeping it!"
7
+ debug_manifest
8
+ # simplecov:enable
9
+ end
10
+
11
+ private def debug_manifest
4
12
  to_include = Namespace.global.foobara_all_organization.to_set
5
13
 
6
14
  TypeDeclarations.with_manifest_context(to_include:) do
@@ -1,5 +1,3 @@
1
- require "singleton"
2
-
3
1
  module Foobara
4
2
  module Types
5
3
  class << self
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Foobara
2
2
  module Version
3
- VERSION = "0.6.1".freeze
3
+ VERSION = "0.6.2".freeze
4
4
  MINIMUM_RUBY_VERSION = [">= 3.4.0", "< 4.1"].freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi