Class: RuboCop::Cop::Legion::Llm::TaxonomyEnum
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Llm::TaxonomyEnum
- Defined in:
- lib/rubocop/cop/legion/llm/taxonomy_enum.rb
Overview
Validates lane field literals against the LegionIO taxonomy enums. Flags ‘:tier`, `:type`, and `:circuit_state` literals that are not in the known-valid sets, catching typos at lint time.
Valid values (from Inventory::DEFAULT_PROVIDER_TIERS and the SSOT design):
tier: :local, :fleet, :cloud, :frontier, :direct
type: :inference, :embedding, :moderation, :rerank, :image
circuit_state: :closed, :open, :half_open
Constant Summary collapse
- VALID_TIERS =
%i[local fleet cloud frontier direct].freeze
- VALID_TYPES =
%i[inference embedding moderation rerank image].freeze
- VALID_CIRCUIT_STATES =
%i[closed open half_open].freeze
- MSG_TIER =
'Unknown tier `%<val>s`. Valid: %<valid>s.'- MSG_TYPE =
'Unknown type `%<val>s`. Valid: %<valid>s.'- MSG_CIRCUIT =
'Unknown circuit_state `%<val>s`. Valid: %<valid>s.'
Instance Method Summary collapse
Instance Method Details
#on_pair(node) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/rubocop/cop/legion/llm/taxonomy_enum.rb', line 33 def on_pair(node) key, value = node.children return unless key.sym_type? && value.sym_type? check_taxonomy(key.value, value, node) end |
#on_send(node) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/legion/llm/taxonomy_enum.rb', line 40 def on_send(node) # health[:circuit_state] = :bad_value return unless node.method_name == :[]= return unless node.arguments.size == 2 key_node, val_node = node.arguments return unless key_node.sym_type? && val_node.sym_type? check_taxonomy(key_node.value, val_node, node) end |