Labels: refactor, good first issue, correctness
Priority: P1
Blocked by: #4 (plugin ABC refactor will touch these same files)
Context
Per TAX_LAW_AUDIT.md Issue #1: pit38/plugins/stock/revolut/transaction_row_parser.py:31 returns OperationType.BUY but Transaction expects Action.BUY. The code works only because both enums have the same .value = "BUY". This is fragile — any change to either enum breaks silently without a type error.
Good first issue for a Python developer because:
- Scope is narrow (two enums, handful of files)
- No tax-logic understanding needed
- Clear success criterion (mypy passes, tests pass)
Acceptance Criteria
Technical Approach
Preferred: one enum. Look for all uses of OperationType and Action via grep -r "OperationType\|Action" pit38/. If the two enums have identical values, delete one and update all imports.
Alternative if semantics differ:
# pit38/domain/transactions/action.py
from enum import Enum
class Action(str, Enum):
BUY = "BUY"
SELL = "SELL"
DIVIDEND = "DIVIDEND"
# ... all values
# pit38/plugins/stock/revolut/transaction_row_parser.py
# Before: returns OperationType.BUY (wrong type, works by accident)
# After:
def _operation_type(row) -> Action:
return Action[row["Type"].upper()] # explicit parse
Related
Labels:
refactor,good first issue,correctnessPriority: P1
Blocked by: #4 (plugin ABC refactor will touch these same files)
Context
Per
TAX_LAW_AUDIT.mdIssue #1:pit38/plugins/stock/revolut/transaction_row_parser.py:31returnsOperationType.BUYbutTransactionexpectsAction.BUY. The code works only because both enums have the same.value = "BUY". This is fragile — any change to either enum breaks silently without a type error.Good first issue for a Python developer because:
Acceptance Criteria
OperationTypeandActioninto a single enum used by both parsers and domain objectsTAX_LAW_AUDIT.mdupdated: mark Issue Create a service for business logic of stock transactions #1 as resolvedTechnical Approach
Preferred: one enum. Look for all uses of
OperationTypeandActionviagrep -r "OperationType\|Action" pit38/. If the two enums have identical values, delete one and update all imports.Alternative if semantics differ:
Related
TAX_LAW_AUDIT.mdIssue Create a service for business logic of stock transactions #1