Here's the PR body:
## Summary
Checkout called the FX provider on every cart render. During Friday's sale that went over the provider's 1,000 requests/minute limit, and checkout started returning 429 errors. `get_rate` now keeps each rate in memory for 5 minutes.
```diff
get_rate(base, quote)
+ if base:quote was fetched less than 300s ago
+ return the saved rate
GET api.example-fx.com/latest
raise on HTTP error
+ save rate for base:quote with time.monotonic()
return rate
Evidence
-
Before:
pytestshows 14 passed. Everyget_ratecall makes its own HTTP request.
After:pytestshows 15 passed. Addedtest_get_rate_uses_cache_within_ttl:get_rate("USD", "EUR") get_rate("USD", "EUR") assert provider was called once
Merge Danger
Door: two-way
The cache only lives in memory, with nothing persisted and no schema change. To roll back, revert the commit.
Blast Radius: checkout
- Stale rates: prices can use a rate up to 5 minutes old. Confirm that's acceptable for checkout pricing.
- Per-process cache: each worker keeps its own cache. Provider calls per 5 minutes are roughly workers × currency pairs, so the limit could still be reached with many workers.
- No size limit or eviction: this is fine for a fixed set of currency pairs.
- No locking: two requests that miss the cache at the same moment can both call the provider. The only cost is an extra request.
- Test isolation:
_cacheis module-level, so it carries over between tests unless a fixture clears it.
- **No `GLOSSARY.md`:** the repo doesn't have one, so I used the wording from your context and the code.
- **Check this before merging:** `test_get_rate_returns_quote` already caches `USD:EUR`. If nothing clears `_cache` between tests, the new test should see 0 provider calls and fail. Since it passes, the `mock_get` fixture probably resets the cache, but I couldn't see the fixture to confirm. If it doesn't, the test result depends on the order tests run in, and I'd add an autouse fixture that calls `_cache.clear()`.
Real run recorded with claude-code / claude-opus-5-5. Output is shown verbatim, unmodified. The only change: the trial machine's temp-folder path was replaced with a generic placeholder.
できること
レビュアーがすばやく読める Pull Request の説明を、3 つの部分で書きます。
仕組み
- Summary: 要点が伝わる最小の図。擬似コード、呼び出しツリー、コンポーネントツリー、ファイルツリー、Mermaid 図、diff のスケッチのいずれかを、それを補う短い文章の隣に置きます。
- Evidence: 具体的な変更前後。見た目の変更ならスクリーンショットが最良で、そうでなければ失敗から成功に変わったテストそのものを示します。
- Merge Danger: 変更が一方通行か双方向(元に戻せるか)か、そして影響範囲(レイアウトのずれ、利用側の破損など)。
- 前置きを省いて簡潔に書き、リポジトリに
GLOSSARY.mdがあればその用語を使います。
向いている場面
レビュアーに、何が変わり、どれだけ危険かを見せたい Pull Request。
知っておきたいこと
私たちの試用では、diff だけでは確かめられないリスク(テスト間の分離の問題)も、隠さずに指摘しました。
指示だけのファイルで、スクリプトはなく、ネットワーク接続も行いません。 Summary 節の図の選択肢は、Dex Horthy 氏(HumanLayer、MIT ライセンス)の show-me skill を改変したものです。パッケージにはそのライセンスを LICENSE-show-me として、説明を CREDITS.md として同梱しています。 テキストを書くだけで、git の実行や Pull Request の作成は行いません。 パッケージには元リポジトリの MIT ライセンス(LICENSE)と agents/openai.yaml(Codex 用の表示名)も含まれます。