Skip to content

Fix bug where search IDP permissions chunking code was unreachable; fine-tune urlLimit for COMS API calls#249

Merged
norrisng-bc merged 1 commit into
masterfrom
bug/get-idp-perms-chunking
Apr 16, 2026
Merged

Fix bug where search IDP permissions chunking code was unreachable; fine-tune urlLimit for COMS API calls#249
norrisng-bc merged 1 commit into
masterfrom
bug/get-idp-perms-chunking

Conversation

@norrisng-bc
Copy link
Copy Markdown
Member

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 urlLimit before chunking is required has now been fine-tuned. It now accounts for the length of every idp and permCode that 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

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

N/A

@github-actions
Copy link
Copy Markdown

Coverage Report (Application)

Totals Coverage
Statements: 70.67% ( 53 / 75 )
Methods: 62.5% ( 5 / 8 )
Lines: 81.63% ( 40 / 49 )
Branches: 44.44% ( 8 / 18 )

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

Coverage Report (Frontend)

Totals Coverage
Statements: 14.67% ( 869 / 5925 )
Methods: 14.94% ( 162 / 1084 )
Lines: 18.08% ( 575 / 3181 )
Branches: 7.95% ( 132 / 1660 )

Comment thread frontend/src/services/permissionService.ts Outdated
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.
@norrisng-bc norrisng-bc force-pushed the bug/get-idp-perms-chunking branch from 8069c7f to 4b2b19a Compare April 16, 2026 23:05
@norrisng-bc norrisng-bc merged commit 5bbc55b into master Apr 16, 2026
17 of 18 checks passed
@norrisng-bc norrisng-bc deleted the bug/get-idp-perms-chunking branch April 17, 2026 00:00
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