Skip to content

Targeted router cleanup and regression coverage for contract path routing#1

Merged
oscarzamora merged 1 commit into
masterfrom
copilot/check-code-quality
May 19, 2026
Merged

Targeted router cleanup and regression coverage for contract path routing#1
oscarzamora merged 1 commit into
masterfrom
copilot/check-code-quality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

This PR performs a scoped cleanup in routing logic and adds regression coverage for a contract-routing edge case. The goal is to reduce dead logic in DocumentRouter while locking expected path behavior for contract-like credit-card documents.

  • Routing logic cleanup

    • Removed unused locals in build_route_path() (contract_keywords, _text_lower read) that did not affect control flow or output.
    • Kept contract-path behavior intact: for Credit Card / Bank contract-like docs (amount absent), routing drops the {year} segment and resolves to issuer root.
  • Regression test coverage

    • Added tests/test_router.py with a focused test asserting issuer-root routing for contract-like credit card input.
    • Test guards against future regressions that reintroduce year-segment routing for this case.
path = router.build_route_path(
    "Credit Card Statements",
    {"issuer": "AMEX (OZ)", "amount": "", "date": "2024-01-10"},
)

assert path == "Credit Card Statements\\AMEX (OZ)"

@oscarzamora oscarzamora marked this pull request as ready for review May 19, 2026 06:11
@oscarzamora oscarzamora merged commit 9e96501 into master May 19, 2026
1 check passed
oscarzamora added a commit that referenced this pull request May 26, 2026
Targeted router cleanup and regression coverage for contract path routing
oscarzamora pushed a commit that referenced this pull request May 26, 2026
Targeted router cleanup and regression coverage for contract path routing
oscarzamora pushed a commit that referenced this pull request May 26, 2026
Targeted router cleanup and regression coverage for contract path routing
@oscarzamora oscarzamora deleted the copilot/check-code-quality branch May 26, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants