Skip to content

fix: preserve Amazon authentication cookies#72

Merged
eshaffer321 merged 2 commits into
mainfrom
codex/fix-amazon-auth-cookie-persistence
Jul 17, 2026
Merged

fix: preserve Amazon authentication cookies#72
eshaffer321 merged 2 commits into
mainfrom
codex/fix-amazon-auth-cookie-persistence

Conversation

@eshaffer321

Copy link
Copy Markdown
Owner

Summary

  • fix Amazon setup validation so a fresh browser login reaches the real auth check instead of parsing an empty temporary JSON file
  • prevent failed Amazon health checks from overwriting saved account cookies with sign-in response cookies
  • continue persisting legitimate cookie refreshes after successful order and order-detail fetches
  • add regression coverage and document the incident

Root cause

The setup validator created an empty temporary file, then passed that existing file to amazon-go, whose cookie store tried to parse it as JSON. Separately, the provider used amazon-go's default auto-save behavior during health checks, so Amazon's sign-in response could replace saved session cookies before the health check returned an authentication error.

Impact

Users can complete itemize amazon setup -account <name> normally, and an authentication failure is now read-only. Successful Amazon operations still persist refreshed cookies.

Validation

  • go test ./...
  • go test ./... -race
  • go build -o <temp>/itemize ./cmd/itemize/
  • pre-commit golangci-lint, go vet, and full tests
  • real Amazon browser-profile import using a copied profile and temporary cookie destination: auth check passed
  • isolated amazon -dry-run -days 14 -max 1 fetched one order successfully and made no Monarch writes

The branch was fetched and rebased onto origin/main immediately before push.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.10%. Comparing base (b01acb1) to head (e786221).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
+ Coverage   61.81%   62.10%   +0.28%     
==========================================
  Files          46       46              
  Lines        6021     6040      +19     
==========================================
+ Hits         3722     3751      +29     
+ Misses       2046     2035      -11     
- Partials      253      254       +1     
Flag Coverage Δ
unittests 62.10% <100.00%> (+0.28%) ⬆️

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

Files with missing lines Coverage Δ
internal/adapters/providers/amazon/provider.go 85.39% <100.00%> (+6.32%) ⬆️

... and 1 file with indirect coverage changes

🚀 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 July 17, 2026 13:06
@eshaffer321
eshaffer321 merged commit ba770cd into main Jul 17, 2026
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