Skip to content

fix: reconcile pending Monarch transactions - #83

Merged
eshaffer321 merged 1 commit into
mainfrom
agent/pending-transaction-reconciliation
Aug 11, 2026
Merged

fix: reconcile pending Monarch transactions#83
eshaffer321 merged 1 commit into
mainfrom
agent/pending-transaction-reconciliation

Conversation

@eshaffer321

Copy link
Copy Markdown
Owner

What changed

  • Reconcile cached categorized orders when Monarch replaces a pending transaction with its posted transaction.
  • Reapply cached category, notes, and splits without rerunning AI categorization.
  • Mark writes against pending transactions as provisional and finalize them after posting.
  • Avoid unsafe Amazon/Walmart multi-charge consolidation while any matched transaction is pending.
  • Add regression coverage and document the incident.

Root cause

Monarch can replace a pending transaction with a new posted transaction ID. The sync recorded the old pending ID as successfully categorized, so later runs treated the order as complete and never reapplied the category/splits to the replacement transaction.

Validation

  • go test ./...
  • go vet ./...
  • golangci-lint run --timeout=5m
  • Live Amazon dry-run confirmed the affected air-filter order resolves to the posted replacement and would reapply cached state without a Monarch write.

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.88889% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.70%. Comparing base (687e971) to head (44fb6c4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
internal/application/sync/reconciliation.go 54.27% 68 Missing and 23 partials ⚠️
internal/application/sync/types.go 54.54% 10 Missing ⚠️
internal/application/sync/orchestrator.go 72.22% 4 Missing and 1 partial ⚠️
internal/application/sync/handlers/walmart.go 75.00% 2 Missing and 2 partials ⚠️
internal/infrastructure/storage/mock.go 80.00% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (58.88%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
- Coverage   64.70%   64.70%   -0.01%     
==========================================
  Files          49       50       +1     
  Lines        6715     6969     +254     
==========================================
+ Hits         4345     4509     +164     
- Misses       2050     2118      +68     
- Partials      320      342      +22     
Flag Coverage Δ
unittests 64.70% <58.88%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/application/sync/handlers/amazon.go 66.26% <100.00%> (+0.97%) ⬆️
internal/application/sync/recording.go 40.58% <100.00%> (+10.82%) ⬆️
internal/infrastructure/storage/sqlite.go 76.16% <100.00%> (ø)
internal/infrastructure/storage/mock.go 52.75% <80.00%> (+0.50%) ⬆️
internal/application/sync/handlers/walmart.go 61.23% <75.00%> (+0.45%) ⬆️
internal/application/sync/orchestrator.go 39.39% <72.22%> (+6.06%) ⬆️
internal/application/sync/types.go 30.40% <54.54%> (-1.47%) ⬇️
internal/application/sync/reconciliation.go 54.27% <54.27%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eshaffer321
eshaffer321 marked this pull request as ready for review August 11, 2026 11:42
@eshaffer321
eshaffer321 merged commit d2bda66 into main Aug 11, 2026
13 of 14 checks passed
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.

1 participant