Skip to content

enhancement(license-detection): add DiscardReason annotation to LicenseMatch for filter transparency #661

@abraemer

Description

@abraemer

Summary

--license-diagnostics emits a detection_log but doesn't annotate individual matches with why they were discarded. When a match disappears between raw output and final detections, the reason must be inferred.

Proposal

Add a DiscardReason enum (variants: Contained, Overlapping, BelowMinCoverage, Spurious, TooShort, FalsePositive, etc.) and an Option<DiscardReason> field on LicenseMatch. Set it at each filter boundary. When --license-diagnostics is enabled, include the discard reason in the detection log output.

Benefits

  • At-a-glance understanding of why a match was dropped
  • Makes filter debugging transparent without needing stage-by-stage checkpoints
  • Complementary to the filter stage pipeline restructuring — works whether or not the pipeline is restructured
  • Low risk: additive field, no behavioral change

When

Next time the filter pipeline is touched, or when --license-diagnostics output needs to be more informative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions