Repository navigation
fix: require USD accounts for Ads launch and monitoring - #400
hamitarsln wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The guards consistently stop unsafe flows and have focused coverage for launch, monitoring, and read failures.
0 open findings
What changed in this PR
Adds USD currency validation to prevent Google Ads budgets and costs from being misinterpreted.
Changes:
- Blocks launch and monitoring unless the account confirms USD.
- Preserves account-read failure reasons.
- Adds currency guard tests and documentation.
| File | Description |
|---|---|
src/tin_lite/paid_ads_launch.py |
Adds the unsupported-currency launch outcome. |
src/tin_lite/paid_ads_monitor_activities.py |
Validates currency before monitoring. |
tests/test_paid_ads_currency.py |
Tests unsupported and unavailable currencies. |
tests/test_paid_ads_monitor_activities.py |
Adds account fixtures and updates read counts. |
docs/paid-ads-launch-implementation.md |
Documents the USD requirement. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Closing in favour of #402, which supports other account currencies instead of requiring USD: one ECB rate is pinned at launch and amounts are converted onto Google's minimum unit, and currencies Tin cannot price stop with a named reason. It does not include this PR's account-read failure reasons in the monitor's final message; that can follow separately if still wanted. |
What and why
Launch and monitor use USD budgets and costs, while Google Ads uses the account's currency. Require a confirmed USD account before campaign drafting or monitoring. Other or missing currencies stop the flow.
The first account read also saves its failure reason for the final message. A billing refusal stops without retrying; an unconfirmed provider result keeps its existing retry behavior.
Google's budget field reference defines the amount in the account's currency.
Verification
The missing currency guard was reproduced twice. Three follow-up checks also failed because account-read causes disappeared from the final message.
After the fix, 141 related tests passed with a disposable database, no skips. Both PRs #394 and #400 passed 185 tests together, including one-attempt replay, no model calls or campaign changes on a refused account read. Their combined code merges without conflict.
Ruff, formatting and diff checks passed.
Limits
Synthetic providers only; no live Ads account was used. USD is the supported currency. No exchange-rate conversion is added. Live account access and production deployment still need a separate check.