GAZ-346: Fix ClassCastException reading id process variables in delegates - #77
Open
kanishksingh23 wants to merge 1 commit into
Open
kanishksingh23 wants to merge 1 commit into
kanishksingh23 wants to merge 1 commit into
Conversation
Contributor
Author
|
Hey @IOhacker, please take a look when you have a moment. |
tdaly61
added a commit
to openMF/mifos-gazelle
that referenced
this pull request
Aug 27, 2026
## Summary Makes the Workflow Engine module demo-able end-to-end. - Pin the fixed image `kanishksingh23/mifos-workflow:21082026`. It includes the delegate ID cast fix ([openMF/mifos-workflow#77](openMF/mifos-workflow#77)); the previous `07082026` image threw a `ClassCastException` at the assign-staff step, so a client onboarding could start but never complete. - Add `src/utils/demo-workflow.sh`, a one-command end-to-end demo: authenticate → ensure a loan officer exists → start onboarding → approve the verify task (assign staff + activate) → confirm the client is Active in Fineract. Reaches the service via `kubectl port-forward`, so no domain setup is needed. - Document it in `docs/MIFOSX.md` (Workflow Engine section): the one-command demo plus how to complete a task by hand. Verified on k3s: `./src/utils/demo-workflow.sh` onboards a client all the way to `Active`. ## Note - The image is a personal-namespace tag for now (`kanishksingh23/…`), same as the module's existing pin swap to `openmf/mifos-workflow` once[ #77](openMF/mifos-workflow#77) is merged and the image is republished under the org. - Greenbank ships no staff, so the demo creates a loan officer if none exists (assign-staff needs one).
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes a
ClassCastExceptionthat stops multi-step workflows (e.g. client onboarding) from completing. The delegates read ID process variables with a hard(Long)cast; this replaces those with the existingProcessVariableUtil.getLong(...)helper, which already handlesInteger/Long/String/Number.Why
Variables set from an untyped task-completion body (
Map<String, Object>) deserialise JSON numbers asInteger, notLong. When a delegate then doesLong clientId = (Long) execution.getVariable("clientId")it throws:Reproduced end-to-end:
POST /workflow/client-onboarding/startcreates the client fine (typed DTO path →Long), but completing the verify task (.../tasks/{id}/completewith{"approved": true, "clientId":.., "staffId":..}) fails with500 STAFF_ASSIGNMENT_FAILED, root cause the cast above.StaffAssignmentDelegatealready coercedstaffIdsafely viaProcessVariableUtil.getLongone line below this just applies the same treatment consistently.Scope
Systemic: the same unsafe pattern appeared in 13 delegates (16 casts): client onboarding/activation/rejection/transfer/closure, account verification, and the loan approval/disbursement/rejection/status delegates. All switched to
ProcessVariableUtil.getLong(...); import added where missing. No behavioural change beyond acceptingInteger-typed IDs.Testing
Built the image and ran a full onboarding against Fineract: authenticate → start → approve the verify task → assign staff → activate, and confirmed the client reaches Active in Fineract. Previously, this failed at the assign-staff step.