Repository navigation
fix: match Amazon card charges and anchor Monarch discovery to the order - #99
Merged
Merged
Conversation
- Count only non-nil multi-charge matches (fixes 'expected 2, found 2'). - Treat a partial multi-charge match as payment pending instead of an error. - When card charges exceed the order total, match them directly before falling back to discovery. - Require discovered subsets to include a charge Amazon reported for the order, so unrelated orders' charges cannot be combined to fill the total.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 64.99% 65.37% +0.38%
==========================================
Files 51 51
Lines 6990 7036 +46
==========================================
+ Hits 4543 4600 +57
+ Misses 2108 2094 -14
- Partials 339 342 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two Amazon sync errors and a latent wrong-match bug found while tracing them.
What was wrong
112-3421348-5157859could not find all transactions: expected 2, found 2nilplaceholders inMultiMatchResult.Matchesas matches, and reported a partial match as an error.112-7815140-3755432bank charges ($59.36) exceed expected ($55.31)112-7815140-3755432, synced aloneFindSubsetByTotalaccepts any subset that sums to the total. The only thing preventing this in the full run was which orders happened to claim those transactions first.Changes
payment pendingrather than an error.Matcher.FindSubsetByTotalIncluding: discovery must include at least one charge Amazon reported for the order. Walmart and the simple handler keep the oldFindSubsetByTotalbehavior.Testing
docs/bug-fixes.md); each failed againstmainfor the reason above.go test ./... -raceandgolangci-lintpass. Coverage: matcher 83.4% → 91.0%, handlers 74.0% → 75.0%.itemize amazon -account wife -dry-run: Errors 2 → 0.112-3421348-5157859is pending (expected=2 found=1), and112-7815140-3755432matches the $59.36 transaction.