Skip to content

fix: remove erroneous len guard that broke multi globalAssetId filtering#546

Open
algojogacor wants to merge 1 commit into
eclipse-basyx:mainfrom
algojogacor:fix/global-asset-id-multi-filter
Open

fix: remove erroneous len guard that broke multi globalAssetId filtering#546
algojogacor wants to merge 1 commit into
eclipse-basyx:mainfrom
algojogacor:fix/global-asset-id-multi-filter

Conversation

@algojogacor
Copy link
Copy Markdown

Summary

Fixes a bug where GET /shells?assetIds with 2+ globalAssetId query parameters silently returns an empty 200 response instead of correctly filtered results.

Root Cause

In server/app/interfaces/repository.py:273, the lambda filter had a guard condition len(global_asset_ids) <= 1 that short-circuits the entire AND clause to False when 2+ globalAssetId parameters are provided. This causes every shell to be rejected before the in membership check can execute.

Solution

Remove the len(global_asset_ids) <= 1 guard. The in operator already handles zero, one, or many IDs correctly — matching the same pattern used for specific_asset_ids filtering on lines 271-272.

Before

(len(global_asset_ids) <= 1 and
    (not global_asset_ids or shell.asset_information.global_asset_id in global_asset_ids))

After

(not global_asset_ids or shell.asset_information.global_asset_id in global_asset_ids)

Testing

  • Verified logic: 0 IDs → all pass; 1 ID → filters correctly; 2+ IDs → now filters correctly (was broken)
  • Behavior is now consistent with the adjacent specific_asset_ids filtering pattern

Fixes #500

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
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.

GET /shells?assetIds with 2+ globalAssetId entries silently returns empty results

1 participant