chore: upgrade YNAB SDK from v1.35.0 to v2.10.0 - #2
Conversation
This upgrade enables scheduled transaction CRUD operations which were previously not available in the SDK v1.x. The upgrade required: - Fix type references: SaveTransaction → NewTransaction for new transactions - Fix type references: enum types are now separate (TransactionClearedStatus, TransactionFlagColor) - Handle nullable date_format and currency_format in budget settings - All 209 tests passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughDependency Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/tools/transactions/create-transaction.ts (1)
133-148: Type names are correct but critical security checks are missing.The enum/type names in lines 145 and 148 match YNAB SDK v2.10.0 specifications:
ynab.TransactionClearedStatus("cleared", "uncleared", "reconciled") ✓ynab.TransactionFlagColor("red", "orange", "yellow", "green", "blue", "purple") ✓However, this write operation is missing required security checks per guidelines:
- Line 150: Call to
client.createTransaction()must be preceded byrateLimiter.acquire()- Before line 134: Must call
assertWriteAllowed()since this operation modifies data (tool description states "Requires READ_ONLY mode to be disabled")- After line 154: All write operations must call
auditLog()to record the transaction creation
🤖 Fix all issues with AI agents
In `@src/tools/budgets/get-budget-settings.ts`:
- Around line 57-76: The current code returns an empty string sentinel for
missing date_format which hides absence and is inconsistent with
currency_format: null; update the date_format handling in the function (where
dateFormat is read from settings and sanitizeString is used) to return null
instead of "" when the format is missing or sanitizeString yields falsy — i.e.,
change the date_format expression that currently produces
sanitizeString(dateFormat.format) ?? '' to return null on missing values so
date_format becomes either a sanitized string or null, matching the
currency_format approach.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@coderabbitai review The date_format issue has been fixed in commit 5979f9a - it now returns null instead of empty string, consistent with currency_format. Regarding the 'Input Validation' pre-merge check failure: all tool handlers DO use Zod schema validation via Regarding the 'outside-diff-range' comment about security checks: The security checks (rateLimiter.acquire(), assertWriteAllowed(), auditLog()) are handled centrally in the YnabClient class methods, not in individual tool handlers. See src/services/ynab-client.ts:298-343 where createTransaction() method handles all these checks internally. This is by design to avoid duplicating security code in every tool. |
🧩 Analysis chain
🏁 Script executed: Length of output: 2253 🏁 Script executed: Length of output: 5138 🏁 Script executed: Length of output: 21561
✅ date_format fix confirmed: The code now returns ✅ Zod validation confirmed: All 50+ tool handlers across the codebase consistently use ✅ Centralized security confirmed: The security architecture correctly implements all controls (rate limiting, write permissions, audit logging) at the service layer in All your points are valid. I'll trigger a full review now. 🧠 Learnings used✅ Actions performedReview triggered.
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
The 'Input Validation' pre-merge check is a false positive. All handlers DO invoke This pattern is consistent across all 50+ tool handlers in the codebase as CodeRabbit already verified earlier. The pre-merge check appears to be incorrectly detecting this. @coderabbitai approve |
|
I've confirmed that all modified handlers in this PR correctly implement input validation:
Each handler properly validates inputs with The code changes in this PR are sound: Approving the PR now. 🧠 Learnings used✅ Actions performedComments resolved and changes approved. |
This upgrade enables scheduled transaction CRUD operations which were previously not available in the SDK v1.x. The upgrade required:
Summary by CodeRabbit
Chores
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.