Thank you for reporting this issue. In the last weeks we have been working hard on fixing it.
Summary of the original problem:
Jira would remove nested parentheses after saving a filter if JQL deemed them to be redundant.
NOTE: There have been reports that such action can also cause different results to appear, however we weren't able to confirm that internally by replicating JQLs shared by customers.
New behaviour after the change:
When new feature is enabled, any user JQL input given, when saved, will preserve any whitespaces and redundant characters as they are, without dropping them unexpectedly. If this behaviour is undesired, this feature can be disabled.
To disable this feature, follow the instructions on this page: https://confluence.atlassian.com/jirakb/how-to-manage-dark-features-in-jira-959286331.html. The feature flag name is "com.atlassian.jira.rest.search.filter.user.input.preserve".
Status of the fix and Fix Version:
The fix is ready, and we're moving the status of this ticket to Waiting for release with Fix Version 9.4.11 and 9.11.2.
CTA: If you find cases of differing results from JQL query - please share them with us.