Skip to content

Return all matching rules from categorizer (prep for secondary categorization) #44

@michaelbeutler

Description

@michaelbeutler

Currently categorize() in matcher.rs returns only the first matching rule (highest priority). Refactor it to return all matching rules, ordered by priority. The pipeline will still use the first match as primary — this is prep work for secondary categorization.

Implementation

  • File: crates/paporg/src/categorizer/matcher.rs

  • Change categorize() (line ~71) return type from Option<CategorizationResult> to Vec<CategorizationResult> (or a struct with primary + secondary fields)

  • Iterate through all rules instead of returning on first match

  • Collect all matches, keep sorted by priority

  • File: crates/paporg/src/pipeline/runner.rs

  • Update step_categorize() to use the first result from the vec as the primary match (preserving current behavior)

  • Ignore secondary results for now (next issue)

Acceptance Criteria

  • categorize() returns all matching rules
  • Results are ordered by priority (descending)
  • Pipeline still uses first match as primary (no behavior change)
  • Existing tests pass without modification
  • New tests verify multiple matches are returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions