fix(intent): task-form button action wins over a stale model action (approve-as-reject) - #6349
Merged
Merged
Conversation
…approve-as-reject)
In a multi-step flow (submit -> approve), the second task's form completed down
the wrong branch: a prior task set an 'action' process variable, form.js
preloaded it into the model on open, and the completion handler's
Object.assign({ action }, $scope.model) let that stale model 'action' overwrite
the clicked button -> the decision gateway (${action == 'approve'}) saw 'submit'
and took the reject branch. Both Approve and Reject effectively sent 'submit',
so a manager could never approve.
Two coordinated fixes:
- FormIntentGenerator: rebuild the COMPLETE payload explicitly - copy the model
MINUS 'action' and control vars (__*, which are locators, not entity data),
then set 'action' LAST so the button wins.
- form.js.template: never preload the bare 'action' process variable into the
model (the __* locators still load - the runtime reads them).
The bug lives in emitted client JS (the browser builds the payload), so the
HTTP ITs - which build the payload themselves - cannot exercise it; IntentEngineIT
gains an emission assertion that the generated form code rebuilds the payload
with the button action winning and no longer uses the buggy Object.assign. The
runtime proof is a browser submit->approve flow (verified via the KF vacations
regen, which was blocked on exactly this).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
In a multi-step
submit -> approveflow, the second task's form completed down the reject branch no matter which button was clicked.Cause (two spots): a prior task set an
actionprocess variable;form.js.templatepreloaded all process vars (incl.action='submit') into the model on open; andFormIntentGenerator's completion handler didObject.assign({ action: action }, $scope.model)— model last, so the staleactionoverwrote the clicked button. The${action == 'approve'}gateway then sawsubmit→ reject. Both buttons effectively sentsubmit; approve was impossible.Fix:
FormIntentGenerator: rebuild the COMPLETE payload — copy the model minusactionand control vars (__*, which are locators not entity data), then setactionlast (button wins).form.js.template: don't preload the bareactionprocess var into the model (the__*locators still load — the runtime uses them).Test: the bug is in emitted client JS (the browser builds the payload), so the HTTP-only ITs — which construct the payload themselves — can't reach it.
IntentEngineIT.assertFormnow asserts the generated form code rebuilds the payload with the button action winning and no longer uses the buggyObject.assign. Runtime proof is a browsersubmit→approveflow (this bug was blocking the KF vacations approve path — verified on regeneration there).Surfaced by a KeyFolders module review (vacations approve completing as reject).
🤖 Generated with Claude Code