Enum Class TagAiDrift

java.lang.Object
java.lang.Enum<TagAiDrift>
org.egothor.methodatlas.TagAiDrift
All Implemented Interfaces:
Serializable, Comparable<TagAiDrift>, Constable

public enum TagAiDrift extends Enum<TagAiDrift>
Describes the agreement between a source-level @Tag("security") annotation and the AI classification of the same test method.

Both the static annotation and the AI judgment are independent sources of truth. When they disagree the discrepancy is called drift:

  • TAG_ONLY — the method carries @Tag("security") in source but the AI considers it non-security-relevant. The annotation may be stale, inaccurate, or applied to the wrong method. Tag-based CI gates and audit dashboards over-count security coverage.
  • AI_ONLY — the AI classifies the method as security-relevant but no @Tag("security") is present in source. Coverage dashboards and tag-based CI gates silently miss this test.
  • NONE — both sources agree; no action needed.

Drift detection requires an active AI classification. When no AiMethodSuggestion is available (AI disabled, class too large, etc.) compute(java.util.List<java.lang.String>, org.egothor.methodatlas.ai.AiMethodSuggestion) returns null.

See Also:
  • Enum Constant Details

    • NONE

      public static final TagAiDrift NONE
      Both sources agree — either both say security-relevant or neither does.
    • TAG_ONLY

      public static final TagAiDrift TAG_ONLY
      Source code carries @Tag("security") but the AI disagrees. The annotation may be stale, inaccurate, or applied to the wrong method.
    • AI_ONLY

      public static final TagAiDrift AI_ONLY
      AI classifies the method as security-relevant but no @Tag("security") is present in source. Coverage dashboards and tag-based CI gates will miss it.
  • Method Details

    • values

      public static TagAiDrift[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TagAiDrift valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • compute

      public static TagAiDrift compute(List<String> sourceTags, AiMethodSuggestion suggestion)
      Computes the drift between source-level security tags and the AI classification.
      Parameters:
      sourceTags - JUnit @Tag values extracted from the method
      suggestion - AI classification for the method, or null when AI is disabled or unavailable
      Returns:
      computed drift value, or null when suggestion is null (drift cannot be determined without AI classification)
    • toValue

      public String toValue()
      Returns the lowercase hyphenated string representation used in CSV and SARIF output.
      Returns:
      "none", "tag-only", or "ai-only"