Skip to content

NIFI-16114 Fix version change bug when controller service property has a parameter reference - #11432

Merged
pvillard31 merged 1 commit into
apache:mainfrom
esecules:NIFI-16114-fix
Jul 29, 2026
Merged

NIFI-16114 Fix version change bug when controller service property has a parameter reference#11432
pvillard31 merged 1 commit into
apache:mainfrom
esecules:NIFI-16114-fix

Conversation

@esecules

@esecules esecules commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-16114 Fix version change bug that caused the controller service properties which have parameter values to have those parameters dereferenced leading to immediate "local changes" in my versioned flow.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@esecules
esecules force-pushed the NIFI-16114-fix branch 2 times, most recently from 233d128 to 493021a Compare July 14, 2026 22:49

@pvillard31 pvillard31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure that commit/PR follows the rules for the checks to execute properly? Also, did you consider a system test for it?

@esecules esecules changed the title [NIFI-16114] Fix version change bug when controller service property has a parameter reference NIFI-16114 Fix version change bug when controller service property has a parameter reference Jul 16, 2026
@esecules

Copy link
Copy Markdown
Contributor Author

Can you make sure that commit/PR follows the rules for the checks to execute properly? Also, did you consider a system test for it?

@pvillard31 thanks for having a look. I've added a system test and I fixed up the commit message and PR title to match the rules.


final String proposedValue = proposedProperties.get(propertyName);
final ParameterParser parameterParser = new ExpressionLanguageAgnosticParameterParser();
final boolean proposedReferencingParameter = parameterParser.parseTokens(proposedValue).iterator().hasNext();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proposedReferencingParameter is only read inside the referencesService branch. Could the parseTokens call move into that branch so non controller service properties are not parsed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it so that proposedReferencingParameter is a function call and its last in the && chain so it will be short circuited if its non-service parameter. I organized it this way so that there is just one default else case where we assign proposedValue to value


final String proposedValue = proposedProperties.get(propertyName);
final ParameterParser parameterParser = new ExpressionLanguageAgnosticParameterParser();
final boolean proposedReferencingParameter = parameterParser.parseTokens(proposedValue).iterator().hasNext();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would toReferenceList().isEmpty() be more precise here than iterator().hasNext(), since the iterator also returns true for escape only tokens such as ##?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for going MIA, I am back now. Im not opposed to either of the methods that return the list, I just wanted to clarify whether one could be empty while the other isnt. toList returns the token list while toReferencList returns the referenceList.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like toReferenceList is the one I want anyway, It will filter out tokens that are not a parameter reference.

}

@Test
@SuppressWarnings("unchecked")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test class already has a shared type safe propertiesCaptor field built with ArgumentCaptor.captor(). Could the new tests reuse it (or use captor()) so the @SuppressWarnings(unchecked) is not needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I remove the annotation I get a warning about ArgumentCaptor.forClass(Map.class);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the clean fix is to replace ArgumentCaptor.forClass(Map.class) with the type-safe ArgumentCaptor.captor() (already used in the class).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks for the hint.

@esecules
esecules force-pushed the NIFI-16114-fix branch 2 times, most recently from 525ac67 to 7d15d0b Compare July 28, 2026 23:53
@esecules
esecules requested a review from pvillard31 July 28, 2026 23:54
@esecules

Copy link
Copy Markdown
Contributor Author

@pvillard31 I responded to your comments and resolved a merge conflict with a similar test you added on the IT file. Looks like you resolved a bug in a similar area but it doesn't override this fix right?

@esecules
esecules force-pushed the NIFI-16114-fix branch 3 times, most recently from bd42f55 to 9e3c251 Compare July 29, 2026 16:50
@esecules

esecules commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Im seeing IT test failures that I think popped up after I rebased onto main which are failing on main itself while the new IT i added is passing. Would you expect ExternalControllerServiceVersioningIT to run in the GH actions? I don't think i am seeing it.

Mac OS with ARM Java 25 & Java 21:
image

However they all pass on my linux machine.

…arameter dereference during version upgrade and fix typing in a unit test to remove @SuppressWarnings(unchecked)
@pvillard31
pvillard31 merged commit 22a071f into apache:main Jul 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants