Fix bug where search IDP permissions chunking code was unreachable; fine-tune urlLimit for COMS API calls#249
Merged
Conversation
TimCsaky
approved these changes
Apr 16, 2026
When searching IDP permissions, the code that decides whether to chunk COMS API calls will only run if there are multiple bucketId's. However, this code was unreachable due to a hardcoded condition that always resolves to False. Additionally, the calculation of the urlLimit before chunking is required has now been fine-tuned. It now accounts for the the length of every `idp` and `permCode` in the URL.
8069c7f to
4b2b19a
Compare
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.
Description
When searching IDP permissions, the code that decides whether to chunk COMS API calls runs only if there are multiple bucketId's. However, this code was unreachable due to a hardcoded condition that always resolves to False. This has been fixed in this PR.
Additionally, the calculation of the
urlLimitbefore chunking is required has now been fine-tuned. It now accounts for the length of everyidpandpermCodethat is actually present in the URL.Without this fix, BCBox makes giant API calls with 999
bucketId[]'s, which confuses COMS and causes an error where it doesn't send the appropriate CORS headers, which in turn causes BCBox to fail.Such massive query arrays were prevoiusly blocked by Joi, but bcgov/common-object-management-service#318 removed a hidden 20-item limit, so implementing that PR had the effect of exposing the error that this PR addresses.
https://apps.nrs.gov.bc.ca/int/jira/browse/SHOWCASE-4279
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist
Further comments
N/A