Skip to content

fix: recover transient sync timeouts#76

Merged
eshaffer321 merged 2 commits into
mainfrom
codex/recover-transient-sync-timeouts
Jul 23, 2026
Merged

fix: recover transient sync timeouts#76
eshaffer321 merged 2 commits into
mainfrom
codex/recover-transient-sync-timeouts

Conversation

@eshaffer321

@eshaffer321 eshaffer321 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • retry Walmart ledger reads and idempotent Monarch consolidation updates once after network timeouts
  • recognize and safely resume a consolidation whose Monarch update landed despite a timed-out response
  • preserve the original multi-delivery audit note while deleting leftover component transactions
  • report production runs with nonzero errors as completed with errors instead of successful
  • upgrade golang.org/x/text to the version fixing reachable GO-2026-5970
  • add regression coverage and document both incidents

Root cause

Walmart's upstream client retries rate limits but not HTTP client timeouts. The sync also made a single Monarch update attempt and treated an ambiguous timeout as a definitive failure, even though the mutation could have landed. On a later run, the aggregate matcher could select that enlarged primary transaction without cleaning up an undeleted component. Separately, summary wording only checked whether any order was processed.

While validating the PR, govulncheck found a reachable infinite-loop vulnerability in the selected golang.org/x/text v0.37.0; upstream fixes it in v0.39.0.

Impact

Transient provider timeouts no longer immediately fail recoverable orders. If a Monarch consolidation update landed without a response, Itemize resumes only when the primary amount and exact original charge note prove the interrupted state, then removes the matched leftovers before applying splits. Production summaries no longer claim full success when orders failed, and the reachable text-processing vulnerability is removed.

Validation

  • make pre-commit-local
  • go test ./... -race
  • go build -o itemize ./cmd/itemize/
  • go run golang.org/x/vuln/cmd/govulncheck@v1.3.0 ./...
  • live Walmart/Monarch dry-run reproduced the interrupted consolidation recovery
  • authorized production repair completed both affected orders
  • direct Monarch read-back confirmed both primary totals and split counts, with all component transactions deleted

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.53%. Comparing base (8cb5ee9) to head (c568ea7).

Files with missing lines Patch % Lines
internal/adapters/providers/walmart/order.go 52.38% 7 Missing and 3 partials ⚠️
internal/application/sync/handlers/walmart.go 81.81% 3 Missing and 3 partials ⚠️
internal/application/sync/consolidator.go 84.61% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
+ Coverage   64.34%   64.53%   +0.18%     
==========================================
  Files          49       49              
  Lines        6575     6644      +69     
==========================================
+ Hits         4231     4288      +57     
- Misses       2037     2041       +4     
- Partials      307      315       +8     
Flag Coverage Δ
unittests 64.53% <75.00%> (+0.18%) ⬆️

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

Files with missing lines Coverage Δ
internal/application/sync/consolidator.go 84.11% <84.61%> (-0.55%) ⬇️
internal/application/sync/handlers/walmart.go 60.78% <81.81%> (+1.52%) ⬆️
internal/adapters/providers/walmart/order.go 73.96% <52.38%> (+1.41%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eshaffer321
eshaffer321 merged commit 989b9db into main Jul 23, 2026
14 checks passed
@eshaffer321
eshaffer321 deleted the codex/recover-transient-sync-timeouts branch July 23, 2026 02:59
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