Cocoa-Puffs commented on PR #6363:
URL: https://github.com/apache/fineract/pull/6363#issuecomment-5542797021

   I've addressed all 3 concerns.
   
   **1. `resetEventRecording()` zeroing instead of decrementing**
   
   This was a legitimate concern that is fixed. However the solution became a 
bit more complex, as making only the counter symmetric leaves another hole: 
`recordedEvents` is a single shared buffer, so `recordedEvents.remove()` wipes 
the enclosing window's already recorded events too.
   
   The method is now renamed `abandonExternalEventRecording(int)` (it no longer 
resets) and unwinds precisely one level, discarding only what that window 
recorded:
   
       private void abandonExternalEventRecording(final int 
recordedBeforeThisWindow) {
           int remainingDepth = eventRecordingDepth.get() - 1;
           if (remainingDepth > 0) {
               eventRecordingDepth.set(remainingDepth);
               List<BusinessEvent<?>> recorded = recordedEvents.get();
               recorded.subList(recordedBeforeThisWindow, 
recorded.size()).clear();
               return;
           }
           // Removed rather than zeroed so nothing is left behind on a pooled 
thread.
           eventRecordingDepth.remove();
           recordedEvents.remove();
       }
   
   Added `testEnclosingWindowShouldSurviveANestedWindowWhoseFailureIsCaught`: 
an inner window throws, an intermediate frame swallows it and carries on, and 
the enclosing bulk must still post its own two events and not the abandoned one.
   
   **2. Stale comment** corrected. The filter's stated reason is now the real 
one: it keeps the `Bulk`-category event out of the "escaped" list. Also notes 
that the bulk's contents are asserted separately via `bulkEventItemTypes`.
   
   **3. Overstated test names** renamed to 
`testGivenBulkEventEnabledWhenCOBRunExceptionThenTheChainStillRanInsideARecordingWindow`
 and 
`testGivenBulkEventDisabledWhenCOBRunExceptionThenNoRecordingWindowIsOpened`. I 
left the Cucumber step text as-is: "with verification" doesn't promise anything 
about resetting, so I don't think its misleading.


-- 
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