Multiple converter fixes#303
Conversation
WalkthroughUpdates for release 0.34.1 across converters and models: BuxConverter expands parsed numeric fields (asset, transaction, dividend, cash amounts), treats "general corporate action" as a buy, reclassifies some buys to sells or cash-debit, broadens ignored record types, and switches quantity/price sources to assetQuantity/assetPrice. SchwabConverter now recognizes "cash in lieu" as a dividend. TradeRepublicConverter.processHeaders signature now accepts a delimiter and appends extra headers when actual columns exceed known headers. BuxRecord adds transaction/dividend fields and removes trade-focused fields. Tests updated to reflect activity count and callback signatures. Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/converters/tradeRepublicConverter.ts (1)
163-184:⚠️ Potential issue | 🟠 MajorFix signature compatibility: make
splitCharparameter optional with a default value.The
processHeadersoverride in TradeRepublic has a more restrictive signature than the base classAbstractConverter. The base class definessplitCharas optional with a default value (splitChar = ","), but the override makes it required. This violates the Liskov Substitution Principle — calling the method through anAbstractConverterreference with a single argument would fail for TradeRepublic.While the current call site always passes both arguments, the signature should be:
protected processHeaders(header: string, splitChar: string = ";"): string[] {This preserves the optional parameter pattern from the base class while setting the appropriate default for Trade Republic's semicolon delimiter.
🤖 Fix all issues with AI agents
In `@src/converters/buxConverter.ts`:
- Around line 57-67: The numeric parsing block in src/converters/buxConverter.ts
that checks context.column for fields like
"transactionAmount","assetQuantity","assetPrice","dividendGrossAmount", etc.,
calls parseFloat(columnValue) directly which yields NaN for empty strings;
update the parsing to default empty/undefined columnValue to "0" (e.g.,
parseFloat(columnValue || "0")) so empty cells produce 0 and do not corrupt
downstream calculations (refer to the same numeric fields in this if-check and
any callers that rely on those parsed values such as the unitPrice
calculations).
- Around line 78-86: The reclassification order causes cash_debit records to be
misclassified because the positive-amount buy->sell check runs before the
cash_debit check; update the logic around
record.transactionType/transferType/transactionAmount so cash_debit is handled
first or make the second check mutually exclusive (e.g., change the second if to
an else if) so that when record.transferType?.toLocaleLowerCase() ===
"cash_debit" you set record.transactionType = "cash debit" before or instead of
applying the buy->sell positive-amount transformation; ensure isIgnoredRecord
will then catch cash_debit records properly.
🧹 Nitpick comments (1)
src/converters/buxConverter.test.ts (1)
145-148: Inconsistent error-callback pattern across tests.This test now uses
done(error)while all other tests in this file still usedone.fail(...)(lines 40, 52, 70, 90, 113, 160). Both work, butdone(error)is arguably better sincedone.failis deprecated in newer Jest versions. Consider aligning the rest of the file for consistency in a follow-up.
|


Added
Fixes
Checklist
Added relevant changes to README (if applicable)Related issue (if applicable)
Fixes #287 #297 #298