KRYSTALM7 opened a new issue, #157:
URL: https://github.com/apache/fineract-loan-origination/issues/157

   ## Problem
   
   The mock Fineract adapter generates loan IDs using an in-memory counter.
   
   The counter resets whenever the application restarts.
   
   As a result, different mock disbursements can generate the same Fineract 
loan ID across application restarts.
   
   ## Root Cause
   
   `MockFineractLoanApiClient` initializes its counter from a fixed value such 
as:
   
   `100000`
   
   Because the counter is JVM-local, restarting LOS resets it.
   
   The database does not currently enforce uniqueness on `fineract_loan_id`.
   
   ## Impact
   
   Multiple LOS applications can reference the same simulated Fineract loan ID.
   
   This makes integration state ambiguous and can hide bugs in retry/recovery 
logic.
   
   ## Proposed Fix
   
   - Add a uniqueness constraint/index for `fineract_loan_id`.
   - Ensure mock IDs cannot collide across application restarts.
   - Use a persisted sequence, UUID-based identifier, or another 
collision-resistant mechanism.
   
   ## Acceptance Criteria
   
   - [ ] Two applications cannot persist the same Fineract loan ID.
   - [ ] Restarting LOS does not cause mock loan ID collisions.
   - [ ] Existing mock integration tests continue to pass.
   
   ## Regression Tests
   
   - [ ] Generate multiple mock loans.
   - [ ] Restart application.
   - [ ] Generate another mock loan.
   - [ ] Verify all IDs are unique.
   
   ## Dependencies 
   
   None 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to