Class: Textus::Doctor::Check::PolicyAmbiguity

Inherits:
Textus::Doctor::Check show all
Defined in:
lib/textus/doctor/check/policy_ambiguity.rb

Overview

Flags entries whose key is matched by two or more policy blocks of the SAME specificity in the same slot (refresh / handler_allowlist / promote). Ties are non-deterministic in the parser’s pick step, so they’re a configuration smell — surface them.

Constant Summary collapse

SLOTS =
%i[refresh handler_allowlist promote].freeze

Instance Method Summary collapse

Methods inherited from Textus::Doctor::Check

#initialize, name_key

Constructor Details

This class inherits a constructor from Textus::Doctor::Check

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/textus/doctor/check/policy_ambiguity.rb', line 11

def call
  out = []
  policies = store.manifest.policies
  store.manifest.entries.each do |mentry|
    matches = policies.explain(mentry.key)
    next if matches.length < 2

    SLOTS.each { |slot| out.concat(ambiguities_for(mentry, slot, matches)) }
  end
  out
end