fix: remove erroneous len guard that broke multi globalAssetId filtering#546
Open
algojogacor wants to merge 1 commit into
Open
fix: remove erroneous len guard that broke multi globalAssetId filtering#546algojogacor wants to merge 1 commit into
algojogacor wants to merge 1 commit into
Conversation
The lambda filter in the AAS repository had a guard condition `len(global_asset_ids) <= 1` that caused GET /shells?assetIds queries with 2+ globalAssetId parameters to silently return empty results. The guard evaluated False for every shell, short-circuiting the entire filter clause before the `in` membership check could run. Fix removes the guard — the `in` operator already handles zero, one, or many IDs correctly, matching the same pattern used for specific_asset_ids filtering above. Fixes eclipse-basyx#500
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.
Summary
Fixes a bug where
GET /shells?assetIdswith 2+globalAssetIdquery parameters silently returns an empty200response instead of correctly filtered results.Root Cause
In
server/app/interfaces/repository.py:273, the lambda filter had a guard conditionlen(global_asset_ids) <= 1that short-circuits the entire AND clause toFalsewhen 2+globalAssetIdparameters are provided. This causes every shell to be rejected before theinmembership check can execute.Solution
Remove the
len(global_asset_ids) <= 1guard. Theinoperator already handles zero, one, or many IDs correctly — matching the same pattern used forspecific_asset_idsfiltering on lines 271-272.Before
After
Testing
specific_asset_idsfiltering patternFixes #500