You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Cocoa-Puffs (via GitHub)" <gi...@apache.org> on 2026/09/18 12:03:03 UTC

[PR] FINERACT-2455: Fix WorkingCapitalPeriodPaymentRate.feature long cob runs, attempt to fix flaky CobPartitioningTest [fineract]

Cocoa-Puffs opened a new pull request, #6479:
URL: https://github.com/apache/fineract/pull/6479

   ## Description
   
   CobPartitioningTest.testLoanCOBPartitioningQuery() frequently fails in Github Actions runs with:
   
   Exception Description: Syntax error parsing [SELECT lt.typeOf AS transactionType, ... ]. The select item is missing from the result variable declaration. SELECT lt.typeOf  [ AS transactionType ] ... The SELECT clause has 'lt.typeOf' and 'AS transactionType' that are not separated by a comma. 
   
   The culprit is the query: findTransactionDataForForeclosureIncome() in LoanTransactionRepository. It uses "AS <alias>" in the select clause which are in practice JPQL result-variables. The parse error is EclipseLink's Hermes parser reporting that the grammar singleton it consulted has no result-variable rule registered, likely because another thread is still initializing it. My proposed fix is to bypass result-variables by using a constructor expression, that every other query uses too.
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   - [ ] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made.
   - [ ] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   - [ ] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute).
   - [ ] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.
   - [ ] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy).
   
   Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide).
   


-- 
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: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2455: Fix WorkingCapitalPeriodPaymentRate.feature long cob runs, attempt to fix flaky CobPartitioningTest [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #6479:
URL: https://github.com/apache/fineract/pull/6479


-- 
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: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2455: Fix WorkingCapitalPeriodPaymentRate.feature long cob runs, attempt to fix flaky CobPartitioningTest [fineract]

Posted by "Cocoa-Puffs (via GitHub)" <gi...@apache.org>.
Cocoa-Puffs commented on PR #6479:
URL: https://github.com/apache/fineract/pull/6479#issuecomment-5815774578

   Restored coverage to the two mentioned scenarios.
   
   ## UC23, restored to original date
   
   I put the date back to 01 February 2026 entirely, because the change was buying nothing: the scenario runs no COB. No reason to trade any margin.
   
   ## C89816, took the suggestion
   
   Rate change → 06 Jan, repayments on 08 Jan and a backdated 07 Jan. Five settled rows now sit ahead of the change instead of one.
   
   I believe the two changes are related, the failing integration test and the feature-file work are the same effort to get this suite running reliably and quickly.
   
   ## What was failing
   CobPartitioningTest.testLoanCOBPartitioningQuery() failed intermittently on CI with a 403 from POST /loans/{id}/transactions?command=foreclosure, carrying this validation error:
   
   Exception Description: Syntax error parsing [SELECT lt.typeOf AS transactionType, lt.interestPortion AS interestPortion,
   lt.feeChargesPortion AS feeChargesPortion, lt.penaltyChargesPortion AS penaltyChargesPortion FROM LoanTransaction lt WHERE lt.loan = :loan AND lt.reversed = false AND lt.dateOf <= :tillDate AND lt.typeOf NOT IN (...) ORDER BY lt.dateOf]. [17, 17] The select item is missing from the result variable declaration. (SELECT lt.typeOf  [ AS transactionType ] ...
   
   The error names the query verbatim. It is a JPQL parse failure inside EclipseLink, raised before any SQL is generated — which is why it is database-independent, and why it surfaces as a grammar error rather than a timeout.
   
   ## Why it is intermittent
   The test drives five concurrent foreclosures. The failure appears when several threads reach this query's first parse at once. CobPartitioningTest already carries two hand-rolled warm-up calls for exactly this, added previously by someone who hit the same thing:
   
   ```
   // Warm up (EclipseLink sometimes fails if JPQL cache is not warm up but concurrent queries are executed)
   ```
   It reduces failures, but doesn't eliminate them.
   
   The concurrency explanation for the intermittency remains a hypothesis; we have no standalone reproduction of the race itself. What is not a hypothesis is which query fails and why it is rejected, the stack trace states both.
   
   ## Compatibility concerns
   
   TransactionPortionsForForeclosure is public, so this is a source-incompatible change for anyone who implemented the interface themselves. In practice a Spring Data projection interface is implemented by the framework, never by hand, and the type is not part of the REST API.


-- 
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: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2455: Fix WorkingCapitalPeriodPaymentRate.feature long cob runs, attempt to fix flaky CobPartitioningTest [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on PR #6479:
URL: https://github.com/apache/fineract/pull/6479#issuecomment-5832431567

   > Restored coverage to the two mentioned scenarios.
   > 
   > ## UC23, restored to original date
   > I put the date back to 01 February 2026 entirely, because the change was buying nothing: the scenario runs no COB. No reason to trade any margin.
   > 
   > ## C89816, took the suggestion
   > Rate change → 06 Jan, repayments on 08 Jan and a backdated 07 Jan. Five settled rows now sit ahead of the change instead of one.
   > 
   > I believe the two changes are related, the failing integration test and the feature-file work are the same effort to get this suite running reliably and quickly.
   > 
   > ## What was failing
   > CobPartitioningTest.testLoanCOBPartitioningQuery() failed intermittently on CI with a 403 from POST /loans/{id}/transactions?command=foreclosure, carrying this validation error:
   > 
   > Exception Description: Syntax error parsing [SELECT lt.typeOf AS transactionType, lt.interestPortion AS interestPortion, lt.feeChargesPortion AS feeChargesPortion, lt.penaltyChargesPortion AS penaltyChargesPortion FROM LoanTransaction lt WHERE lt.loan = :loan AND lt.reversed = false AND lt.dateOf <= :tillDate AND lt.typeOf NOT IN (...) ORDER BY lt.dateOf]. [17, 17] The select item is missing from the result variable declaration. (SELECT lt.typeOf [ AS transactionType ] ...
   > 
   > The error names the query verbatim. It is a JPQL parse failure inside EclipseLink, raised before any SQL is generated — which is why it is database-independent, and why it surfaces as a grammar error rather than a timeout.
   > 
   > ## Why it is intermittent
   > The test drives five concurrent foreclosures. The failure appears when several threads reach this query's first parse at once. CobPartitioningTest already carries two hand-rolled warm-up calls for exactly this, added previously by someone who hit the same thing:
   > 
   > ```
   > // Warm up (EclipseLink sometimes fails if JPQL cache is not warm up but concurrent queries are executed)
   > ```
   > 
   > It reduces failures, but doesn't eliminate them.
   > 
   > The concurrency explanation for the intermittency remains a hypothesis; we have no standalone reproduction of the race itself. What is not a hypothesis is which query fails and why it is rejected, the stack trace states both.
   > 
   > ## Compatibility concerns
   > TransactionPortionsForForeclosure is public, so this is a source-incompatible change for anyone who implemented the interface themselves. In practice a Spring Data projection interface is implemented by the framework, never by hand, and the type is not part of the REST API.
   
   Funny thing: I have just fixed those issues in EclipseLink and latest versions already ship them ;) 


-- 
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: issues-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org