Repository navigation
fix(engine): restore optional null semantics and strict ID validation - #3819
Merged
Merged
Conversation
Repair seven independently reproduced baseline regressions in parsing, migration, delegate signaling, queries, modification and external-task retries. Add six strict synchronous and asynchronous retry regression cases; preserve existing assertions.
This was referenced Oct 9, 2026
Collaborator
Author
|
@kthoms while investigating another issue one of my agents found these issues, can you have a look if they are valid? Thx |
|
This was referenced Oct 9, 2026
Contributor
|
I will check this, thanks already! |
kthoms
approved these changes
Oct 12, 2026
kthoms
left a comment
Contributor
There was a problem hiding this comment.
- Historic queries lose the “without tenant” filter: Analysis & Fix ok
- Event-based gateway parsing rejects ID-less sibling XML elements: Analysis & Fix ok (BpmnParse)
- Compensation migration cannot remove an intentionally unmapped event scope: Analysis & Fix ok
- Delegate-expression signaling incorrectly requires a Process Application: Analysis & Fix ok
- Process modification changes null-list and null-element semantics: Analysis & Fix ok
- External-task retry updates silently accept lists containing null IDs: Analysis & Fix ok
- Missing external-task topics produce duplicate diagnostics and an unnecessary null failure: Analysis & Fix ok
kthoms
marked this pull request as ready for review
October 12, 2026 14:03
Contributor
|
Thank you @hauptmedia and your AI army for the valuable fixes! |
7 of 9 tasks
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.



Summary
This PR repairs seven runtime/validation regressions introduced during the engine nullability refactoring. The affected changes went beyond annotations: they added unconditional null assertions, replaced meaningful null values with empty collections, or removed invalid IDs before the existing validation could see them.
The failures were reproduced on the unchanged main baseline
79f9f874bcec4f3ff7423ac39270bfea2b66cfb1; they are not caused by the multi-instance input-mapping fix in #3818. Frontend/SDK test infrastructure is handled separately in #3820.The introducing commits below were checked against their parent diffs, rather than inferred only from the last blame entry. Existing regression assertions are retained.
1. Historic queries lose the “without tenant” filter
Problem:
HistoricProcessInstanceQueryImpl.getTenantIds()returns an empty array when its underlyingtenantIdsis null. That null has semantic meaning: forwithoutTenantId(), the MyBatis mapper usesquery.tenantIds == nullto addSELF.TENANT_ID_ is null. An empty array satisfies neither the mapper's nonempty-array branch nor its null branch, so the intended tenant predicate disappears.Impact: a query explicitly requesting only historic instances without a tenant can return additional instances. In the existing test, it returns three instead of one. This is a wrong-result regression; this finding does not by itself establish a general authorization bypass.
Introduced by: b201f1d71647 (#3634), which changed
return tenantIdstoObjects.requireNonNullElse(tenantIds, new String[0]). bb29f2a744d1 (#3666) later rewrote it as a ternary expression but did not introduce the underlying behavioral change.Fix: preserve the nullable return value and annotate it accordingly.
Existing regression coverage:
MultiTenancyHistoricProcessInstanceQueryTest.shouldQueryByWithoutTenantIdandshouldQueryAuthenticatedTenants.2. Event-based gateway parsing rejects ID-less sibling XML elements
Problem: the parser builds an ID lookup from every sibling XML element around an event-based gateway. An unconditional
requireNonNull(sibling.attribute("id"))now assumes that every sibling has an ID, although the existing supported fixtures include ID-less elements, including sequence flows.Impact: deployment fails with a NullPointerException before normal gateway parsing/validation completes. This affects otherwise supported models and also masks the intended diagnostics for invalid models.
Introduced by: bb29f2a744d1 (#3666), replacing the previous nullable-key insertion with an unconditional null assertion.
Fix: add only siblings with an ID to the lookup. Sequence-flow processing and gateway validation remain in place.
Existing regression coverage:
EventBasedGatewayTest,InclusiveGatewayTest.testJoinAfterEventBasedGateway,AsyncTaskTest.testAsyncEventGateway, related history/job-definition tests, andLinkEventTest.testCatchLinkEventAfterEventBasedGatewayNotAllowed.3. Compensation migration cannot remove an intentionally unmapped event scope
Problem:
CompensationInstanceHandlerrequires both the event-scope migration instruction and its target activity to be non-null. However, an event scope being removed during migration can intentionally have no target mapping. The migration representation already supports that absence so the obsolete scope can be removed.Impact: migrations involving compensation subscriptions and subprocess removal fail early with a NullPointerException instead of executing the supported scope-removal path. Ten existing tests in the two affected compensation migration classes fail.
Introduced by: bb29f2a744d1 (#3666), which wrapped
findSingleMigrationInstruction(...)andgetTargetActivity(...)inrequireNonNull.Fix: retain the check that the source compensating execution exists, while allowing the optional mapping and target scope to remain null.
Existing regression coverage:
MigrationCompensationRemoveSubProcessTestandMigrationCompensationAddRemoveSubProcessTest, covering execution/activity-instance trees, scope variables, listener behavior and output mappings.4. Delegate-expression signaling incorrectly requires a Process Application
Problem:
ServiceTaskDelegateExpressionActivityBehavior.signal()unconditionally requires a target Process Application before checking whether a context switch is needed. Standalone deployments can legitimately have no Process Application;requiresContextSwitch(...)explicitly handles that case.Impact: signaling a supported delegate-expression activity fails before the delegate is invoked. Existing error/exception handling, authorization and sequential/parallel multi-instance tests fail through this path.
Introduced by: 35f7af608515, “refactor(engine): Annotate nullability for engine behavior classes”.
Fix: require a non-null Process Application only inside the branch that actually performs a context switch.
Existing regression coverage:
DelegationAuthorizationTest.testSignallableActivityBehaviorAsDelegateExpression, delegate-signaling cases inBoundaryErrorEventTestandErrorEventSubProcessTest, and the sequential/parallel delegate-signaling cases inMultiInstanceTest.5. Process modification changes null-list and null-element semantics
Problem: two separate changes alter modification input handling:
AbstractModificationCmdconstructsnew HashSet<>(builder.getProcessInstanceIds())without the previous null guard.ModificationBuilderImplfilters null elements out of the varargs input before command validation.Impact: a nullable explicit ID list can produce an incidental NullPointerException instead of following the existing selection/validation path. A null element inside an ID array disappears, so the intended invalid-ID validation no longer runs and a different error can surface later.
Introduced by: b201f1d71647 (#3634), which removed the collection null guard and added
filter(Objects::nonNull).Fix: restore the guarded collection step, declare the nullable list accurately, and preserve array elements for the existing command validation.
Existing regression coverage:
ModificationExecutionSyncTest.createModificationWithNullProcessInstanceIdsList,createModificationUsingProcessInstanceIdsArrayWithNullValue, and their parameterized asynchronous counterparts inModificationExecutionAsyncTest.6. External-task retry updates silently accept lists containing null IDs
Problem:
UpdateExternalTaskRetriesBuilderImplfilters null entries out of external-task and process-instance ID lists/arrays. This changes an invalid request such as[existingId, null]into a valid request for a smaller set of instances before validation.Impact: synchronous or asynchronous retry updates can be accepted instead of rejecting the malformed request. The caller receives different behavior from the established API validation contract.
Introduced by: b201f1d71647 (#3634), which added
filter(Objects::nonNull)to all four ID-input overloads.Fix: preserve null elements so the existing external-task validation / process-instance query validation can reject them. Null collection arguments still follow the existing empty-selection handling.
Regression coverage: retain
SetExternalTasksRetriesTest.shouldFailForNullExternalTaskIdSync/Asyncand add six cases for external-task ID arrays and process-instance ID lists/arrays, each tested throughset(...)andsetAsync(...). The unchanged implementation fails all six added cases; the repaired implementation passes them.7. Missing external-task topics produce duplicate diagnostics and an unnecessary null failure
Problem:
parseTopic(...)already records the missing-topic model error and returns null. Its caller now adds the same diagnostic a second time and then callsrequireNonNull(topicNameProvider).Impact: an invalid BPMN model no longer follows the normal error-collection path cleanly: the diagnostic is duplicated and parsing encounters an avoidable null assertion. The existing test expects one useful model diagnostic.
Introduced by: bb29f2a744d1 (#3666), adding both the repeated
addError(...)and the null assertion.Fix: keep the error already recorded by
parseTopicand use aNullValueProviderto let parsing continue collecting errors. The deployment remains invalid; the placeholder does not make an external task without a topic executable.Existing regression coverage:
ExternalTaskParseTest.testParseExternalTaskWithoutTopic.Regression verification
The 45 initial expanded-suite failures reproduced on the unchanged base, including with the CI-relevant H2 profile. Existing assertions remain unchanged. Six additional sync/async retry cases check that null entries in external-task and process-instance ID arrays/lists reach the existing validation instead of being silently filtered out.
The updated retry class runs 30 cases: unchanged base fails eight (two existing and six added), and the repaired implementation passes all 30. The complete expanded engine selection on the combined change set passes 16,274 cases, with zero failures/errors and 101 existing skips.
Why existing CI was green
The audited main CI artifact contains 2,222 engine cases and matches the local default baseline testcase set exactly. None of the 18 classes containing the expanded failures ran there. Surefire 3.6.0 reapplies the repository's regex containing
.classto JUnit class names; enclosing-class handling explains the partial discovery. See the audited main run and Apache's upstream fix.Expanded verification uses an explicit selector preserving the same intended exclusions and scanned candidates. Six sequential partitions were checked to have exactly the same class union, and the testcase union contains every previous case plus exactly the six new retry cases. This PR does not change Surefire or repository test-discovery configuration.
Verification scope
The three companion change sets were validated together on
79f9f874bcec4f3ff7423ac39270bfea2b66cfb1: 26,919 distinct Java cases, zero failures/errors and 142 existing skips; all 129 reactor modules completed successfully across verified recovery segments. This was not one uninterrupted build, and it is not a claim that each split branch independently passed the expanded full suite.This branch is based on
ce6e96e4139a006bb3ba6a3fce70f80eb3641f5c. The intervening main change only updates the REST documentation dependency lockfile. Every published changed file was checked byte-for-byte against the tested content.Legacy browser test execution is explicitly deferred for this run: Chromium cannot create its required Unix socket in the test executor. The 32 UI, 7 SDK browser and 13 Commons browser spec inventories are not claimed as passed. No tests are permanently disabled. Optional external-database/runtime-container/E2E matrices were not run.
The cleanup script's isolated imports phase passed. Its code/test phases encountered existing recipe configuration errors, so the complete cleanup pipeline is not claimed as passed.
git diff --checkpassed.