Skip to content

handlers: fix panic in search, fix #300 #301

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

Merged
merged 1 commit into from
Apr 29, 2025
Merged

Conversation

roman-khimov
Copy link
Member

706d7d4 made this logic (that tried to deduplicate requested attributes) completely irrelevant.

@roman-khimov roman-khimov added this to the v0.12.0 milestone Apr 29, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a panic in the search functionality by removing redundant deduplication logic for requested attributes.

  • Removed code that created a deduplicated attribute list (searchHeader)
  • Updated calls and loops to use searchFilters.Attributes directly
Comments suppressed due to low confidence (1)

handlers/objects.go:477

  • The removal of the deduplication code (using searchHeader) appears intentional per the commit message; please confirm that passing searchFilters.Attributes directly meets the API's requirements for attribute ordering and uniqueness.
searchHeader = filters[0].Header()

@carpawell
Copy link
Member

What is wrong with the tests?

This logic adds an implicit first attribute if it's missing from the original
request. It assumes that there is always at least one filter present which is
no longer true after 706d7d4. Now the code is
adjusted for that.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a panic in the search functionality by revising how attributes are processed and ensuring proper initialization. Key changes include:

  • Initializing returningAttributes with additional capacity.
  • Declaring and assigning searchHeader only when filters are available.
  • Adjusting how attributes are appended to returningAttributes.

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 9.00%. Comparing base (8652071) to head (283de8f).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
handlers/objects.go 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #301      +/-   ##
=========================================
- Coverage    9.01%   9.00%   -0.01%     
=========================================
  Files          22      22              
  Lines        5593    5597       +4     
=========================================
  Hits          504     504              
- Misses       5054    5058       +4     
  Partials       35      35              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roman-khimov roman-khimov merged commit 74ed048 into master Apr 29, 2025
11 of 14 checks passed
@roman-khimov roman-khimov deleted the panic-search branch April 29, 2025 20:22
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