fix(lint): read an action activity's error handling from the action - #1203
Open
tgolembiewski wants to merge 1 commit into
Open
tgolembiewski wants to merge 1 commit into
tgolembiewski wants to merge 1 commit into
Conversation
CONV013 reported "uses '' error handling instead of Custom" on every Java
action, REST and web service call, including ones with `on error { ... }`,
and CONV014 never reported `on error continue` on an action. Mendix stores
error handling on the action (Microflows$*Action.ErrorHandlingType) and the
reader puts it there; both rules read the activity-level field, which the
reader leaves empty. DESCRIBE was right because getActionErrorHandlingType
reads the action (the reflection lookup from mendixlabs#1078).
Move that lookup into sdk/microflows as ActionActivity.ErrorHandling() and
ActionErrorHandlingType(), and use it in both rules and in the describer, so
the two cannot drift apart again. DESCRIBE output is unchanged.
Measured on a blank 11.12.1 app with four Java calls
(mdl-examples/bug-tests/lint-action-error-handling.mdl): before, CONV013 on
all four with '' and no CONV014; after, CONV013 on the unhandled (Rollback)
and continue calls only, and CONV014 on the continue call.
mendixlabs#1202
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove the PR. The change is correct, minimal, well-tested, and addresses the exact issue described. The minor concern about test file relocation is outweighed by the benefits of better test organization and preservation of all test coverage. No changes are needed before merging. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
This branch has not been deployed
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.
Closes #1202
What
CONV013andCONV014read an action activity's error handling from the activity-level field, which the reader leaves empty. Mendix stores error handling on the action (Microflows$*Action.ErrorHandlingType), and the reader puts it there. So:uses '' error handling instead of Customon every Java/REST/web service call, including handled ones;on error continueon an action.describewas right all along, becausegetActionErrorHandlingTypereads the action (the reflection lookup from #1078).The fix moves that lookup into
sdk/microflowsso the describer and the linter share it:ActionActivity.ErrorHandling()returns the action's handling, falling back to the activity field for action types that have none.ActionErrorHandlingType(action)is the existing reflection lookup, moved unchanged frommdl/executor.getActionErrorHandlingTypekeeps its one exclusion (RestOperationCallAction, CE6035) and then callsErrorHandling(), so DESCRIBE output does not change.ErrorHandling(). CONV013's message now names the stored value ('Rollback','Continue') instead of''.Measured on a blank Mendix 11.12.1 app with
mdl-examples/bug-tests/lint-action-error-handling.mdl(four Java calls):MF_Handled(on error { … })''→ noneMF_HandledNoRollback''→ noneMF_Unhandled(no clause)''→'Rollback'MF_Continue(on error continue)''→'Continue'mx check: 0 errors.describeoutput for the four microflows is unchanged.Changes
sdk/microflows/error_handling.go: new,ActionActivity.ErrorHandling()andActionErrorHandlingType().sdk/microflows/error_handling_test.go: new. The lookup test moved here frommdl/executor, plus cases for the action winning, the activity fallback and nil.mdl/linter/rules/conv_error_handling.go: both rules readErrorHandling().mdl/linter/rules/conv_error_handling_test.go: two new tests with the handling on the action, the way the reader stores it. The existing tests put it on the activity, which is why they passed.mdl/executor/cmd_microflows_show_helpers.go:getActionErrorHandlingTypecalls the shared accessor, and the local copy of the lookup is removed. Its two test references now use the moved function.mdl-examples/bug-tests/lint-action-error-handling.mdl: the repro.CHANGELOG.md([Unreleased]/ Fixed), and one line in.claude/skills/fix-issue/findings/mdl-other.jsonl.Tests
Each new test fails with its fix reverted:
TestFindUnhandledCalls_HandlingOnTheActionandTestFindContinueErrorHandling_ContinueOnTheAction;ErrorHandling()return the activity field failsTestActionActivityErrorHandling.The existing tests pass unchanged: the rule tests, and the executor's
getActionErrorHandlingTypeand roundtrip for microflow with error handler does not work - MDL is not complete #1078 round-trip tests.The whole of
push-test.ymlran locally on macOS:make test;mx11.12.1;All green.