Skip to content

fix(simplefin): stop bare thank-you memos dropping purchases from spend - #180

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-finance-bugs-2025
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-finance-bugs-2025

Conversation

@cursor

@cursor cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes silent spend undercount when merchant memos contain thank you (for example THANK YOU FOR SHOPPING…). Those purchase debits were classified as Credit Card Payment and excluded via NON_SPEND_CATEGORIES.
  • Replaces the bare thank you pattern with payment-shaped substrings in the shared categorize_expense path so legitimate PAYMENT - THANK YOU credits/debits still classify correctly.
  • Link to related issue(s): Fixes bug: bare "thank you" categorization drops real card purchases from spend #179

Concrete trigger and impact

categorize_expense("THANK YOU FOR SHOPPING AT TARGET T-1234", -87.43, "Platinum Card")
# before: "Credit Card Payment" (non-spend) — purchase dollars vanish from spend totals
# after:  spend-eligible category (e.g. Uncategorized)

Same failure class as the bare credit card substring fixed in #176; introduced on main by #176.

Root cause and shared seam

CATEGORY_PATTERNS["Credit Card Payment"] matched bare "thank you" as a plain substring with no payment-shape requirement. All SimpleFIN expense sync callers go through categorize_expense, so the fix is at that shared pattern list.

Test Plan

  • Focused: uv run pytest tests/python/test_categorize.py -q --no-cov — 92 passed
  • All non-integration tests: uv run pytest -m "not integration" -q — 1188 passed, 1 skipped, coverage 83.41%
  • Lint: uv run ruff format --check + uv run ruff check on touched files — clean
  • Types: uv run mypy src/ — Success, 96 source files

Overlap check

Live open PRs at start and before open: none. Searched open/closed issues and PRs for thank you / categorize / Credit Card Payment; only related history is merged #176 (introducer). No open PR touches categorize.py.

Review Checklist

  • No secrets or PII committed
  • Documentation updated (if applicable) — N/A (skills docs are issues-only; Python path + regression test only)
  • Test coverage maintained or improved

Wiki impact

  • No Wiki update is required.
  • Wiki updated — affected pages and Wiki commit:

Generated with Cursor; I reviewed, ran the tests, and verified behavior before submitting.

Open in Web View Automation 

Replace the bare "thank you" Credit Card Payment substring with
payment-shaped patterns so merchant thank-you purchase debits stay in
spend totals. Fixes #179.

Co-authored-by: Ossie Irondi <AojdevStudio@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e55d6564-c31b-46cb-9840-95d54e2a37f7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

bug: bare "thank you" categorization drops real card purchases from spend

1 participant