-
Notifications
You must be signed in to change notification settings - Fork 543
Allow for duplicate search parameters #3790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8d40931
to
5ed7eb5
Compare
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
catch (Exception exp) | ||
{ | ||
_output.WriteLine($"Attempt {retryCount} of {MaxRetryCount}: CustomSearchParameter test experienced issue attempted to clean up SearchParameter {searchParam.Url}. The exception is {exp}"); | ||
if (exp is FhirClientException fhirException && fhirException.OperationOutcome?.Issue != null) | ||
{ | ||
foreach (OperationOutcome.IssueComponent issueComponent in fhirException.OperationOutcome.Issue) | ||
{ | ||
_output.WriteLine("FhirException OperationOutome message from trying to delete SearchParameter is CustomSearchParam test: {0}", issueComponent.Diagnostics); | ||
} | ||
} | ||
|
||
success = false; | ||
await Task.Delay(TimeSpan.FromSeconds(10)); | ||
} |
Check notice
Code scanning / CodeQL
Generic catch clause Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the problem, we should replace the generic catch (Exception exp)
clause with more specific exception types that are expected to occur in this context. This will help ensure that only relevant exceptions are caught and handled appropriately, while other exceptions can propagate and be handled elsewhere or cause the program to fail, which can be useful for debugging.
- Identify the specific exceptions that are likely to occur in the
try
block. - Replace the generic
catch (Exception exp)
clause with specific catch clauses for those exceptions. - Ensure that any logging or retry logic is preserved in the new catch clauses.
-
Copy modified line R167 -
Copy modified lines R169-R170 -
Copy modified lines R179-R190
@@ -166,6 +166,6 @@ | ||
} | ||
catch (Exception exp) | ||
catch (FhirClientException fhirException) | ||
{ | ||
_output.WriteLine($"Attempt {retryCount} of {MaxRetryCount}: CustomSearchParameter test experienced issue attempted to clean up SearchParameter {searchParam.Url}. The exception is {exp}"); | ||
if (exp is FhirClientException fhirException && fhirException.OperationOutcome?.Issue != null) | ||
_output.WriteLine($"Attempt {retryCount} of {MaxRetryCount}: CustomSearchParameter test experienced issue attempted to clean up SearchParameter {searchParam.Url}. The exception is {fhirException}"); | ||
if (fhirException.OperationOutcome?.Issue != null) | ||
{ | ||
@@ -178,2 +178,14 @@ | ||
success = false; | ||
await Task.Delay(TimeSpan.FromSeconds(10)); | ||
} | ||
catch (HttpRequestException httpRequestException) | ||
{ | ||
_output.WriteLine($"Attempt {retryCount} of {MaxRetryCount}: CustomSearchParameter test experienced issue attempted to clean up SearchParameter {searchParam.Url}. The exception is {httpRequestException}"); | ||
success = false; | ||
await Task.Delay(TimeSpan.FromSeconds(10)); | ||
} | ||
catch (TaskCanceledException taskCanceledException) | ||
{ | ||
_output.WriteLine($"Attempt {retryCount} of {MaxRetryCount}: CustomSearchParameter test experienced issue attempted to clean up SearchParameter {searchParam.Url}. The exception is {taskCanceledException}"); | ||
success = false; | ||
await Task.Delay(TimeSpan.FromSeconds(10)); |
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Fixed
Show fixed
Hide fixed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Dismissed
Show dismissed
Hide dismissed
...ealth.Fhir.Shared.Core/Features/Search/Parameters/SearchParameterConflictingCodeValidator.cs
Dismissed
Show dismissed
Hide dismissed
// for the search parameter/reindex updates to propagate to all instances. Hence we are | ||
// adding some retries below to account for that delay. | ||
int retryCount = 0; | ||
bool success = true; |
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning test
success
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the problem, we should remove the redundant assignment to the success
variable on line 153. This will clean up the code and eliminate the unnecessary assignment without changing the existing functionality.
-
Copy modified line R153
@@ -152,3 +152,3 @@ | ||
int retryCount = 0; | ||
bool success = true; | ||
bool success; | ||
do |
} | ||
if (!supportedResult.Supported) | ||
{ | ||
throw new SearchParameterNotSupportedException(searchParameterInfo.Url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Customer sees this message "The search parameter with definition URL '{0}' is not supported.". I know this change is not related to this PR but in this scenario, error is thrown if definition has any issues. Do you think we can use better error message to indicate customer that something is wrong with the definition they have sent?
await _searchParameterStatusManager.AddSearchParameterStatusAsync( | ||
new List<string> { searchParameterWrapper.Url }, | ||
cancellationToken, | ||
duplicateSearchParameter ? SearchParameterStatus.Duplicate : SearchParameterStatus.Supported); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are introducing a new status Duplicate here. How is it going to impact reindex and $status operation?
Description
There are published IG's with Search Parameters that have identical code values and expression as existing Search Parameters. We want to allow these parameters without causing any reindexing or ambiguous behaviors when searching using the duplicated code values.
This PR also blocks the addition of any Search Parameter resource with a conflicting code value that has a different expression. As this is a bug that currently puts the service into an unstable state.
Related issues
Addresses [issue AB#117004].
Testing
Unit tests are added.
Manual testing using UploadFIG with USCore is done, and all SearchParameters succeeded.
Still TBD: E2E test to check reindex impact.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)