Skip to content

Conversation

@yellowbean yellowbean changed the title Aug25 Release Sep25 Release Aug 26, 2025
@yellowbean yellowbean requested a review from Copilot August 28, 2025 04:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive "Sep25 Release" for Hastructure, involving significant API modernization and enhanced error handling. The release introduces strong typing through new type classes and refactors core payment and calculation logic to use monadic error handling instead of runtime exceptions.

  • Major API restructuring with new type classes (Payable, Drawable, Accruable) and improved error handling patterns
  • Separation of deal collection logic into dedicated module with enhanced type safety
  • Updated test suites to align with new API patterns and data structures

Reviewed Changes

Copilot reviewed 56 out of 59 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/UT/UtilTest.hs Updated bond transaction tests to use new payment API with DuePrincipal and proper interest rates
test/UT/StmtTest.hs Replaced Just with ByAvailAmount in support transaction constructors
test/UT/RateHedgeTest.hs Updated import path for accrueRC function
test/UT/DealTest*.hs Updated collection rules to use new CollectionRule constructors and support availability types
test/UT/CeTest.hs Modernized liquidity facility tests with ByAvailAmount wrapper
test/UT/BondTest.hs Updated bond payment and pricing tests to use new monadic API patterns
test/UT/AssetTest.hs Disabled delinquency tests and updated pool run function calls
test/MainTest.hs Commented out delinquency test execution
swagger.json Updated API schema to reflect new data structures and version bump
src/Waterfall.hs Removed CollectionRule type and moved to dedicated module
src/Util.hs Enhanced utility functions with monadic error handling and new lookup operations
src/Types.hs Major expansion with new type classes, data types, and enhanced error handling patterns
src/Triggers.hs Updated import for CollectionRule from new module
src/Stmt.hs Enhanced statement handling with new support availability types
src/Reports.hs Code cleanup and removal of unused comments
src/Pool.hs Added comprehensive runPool function for asset pool execution
src/Lib.hs Enhanced date handling and added decimal conversion utilities
src/Liability.hs Complete rewrite implementing new Payable, Drawable, and HasStmt type classes
src/InterestRate.hs Enhanced interest rate calculations and renamed methods for consistency
src/Expense.hs Implemented new Payable and Accruable type classes for fee management
src/Deal/ modules New modular structure separating collection, validation, and query logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@yellowbean yellowbean requested a review from Copilot September 15, 2025 15:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 59 out of 62 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

| ExpTxn Date Balance Amount Balance TxnComment -- ^ expense transaction record
| SupportTxn Date (Maybe Balance) Balance DueInt DuePremium Cash TxnComment -- ^ liquidity provider transaction record
| ExpTxn Date FeeDue Amount FeeArrears TxnComment -- ^ expense transaction record
| SupportTxn Date SupportAvailType Balance DueInt DuePremium Cash TxnComment -- ^ liquidity provider transaction record
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The transaction record constructors have many parameters which makes them hard to maintain. Consider using record syntax or breaking them into smaller, more focused types.

Suggested change
| SupportTxn Date SupportAvailType Balance DueInt DuePremium Cash TxnComment -- ^ liquidity provider transaction record
| SupportTxn { supportTxnDate :: Date
, supportTxnAvailType :: SupportAvailType
, supportTxnBalance :: Balance
, supportTxnDueInt :: DueInt
, supportTxnDuePremium :: DuePremium
, supportTxnCash :: Cash
, supportTxnComment :: TxnComment
} -- ^ liquidity provider transaction record

Copilot uses AI. Check for mistakes.
Comment on lines +498 to +499
writeOff d (DueInterest Nothing) amt b@(Bond {bndDueInt = dueInt, bndStmt = mStmt})
| amt > dueInt = Left $ "Cannot write off interest "++ show amt ++ " which is greater than due interest "++ show dueInt ++ " bond name "++ show (bndName b)
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message concatenation creates inconsistent spacing. Consider using proper string formatting or template functions for better readability and consistency.

Copilot uses AI. Check for mistakes.
@yellowbean yellowbean merged commit b4f1e97 into master Sep 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants