Skip to content
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

Handle partial name matches in ls method #298

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Handle partial name matches in ls method #298

merged 3 commits into from
Dec 20, 2024

Conversation

AdrianoKF
Copy link
Contributor

@AdrianoKF AdrianoKF commented Dec 16, 2024

This PR fixes the ls implementation to exclude partial (prefix-only) matches when listing objects in a repository.

The previous behavior would incorrectly include files with names that are a prefix of the path passed to ls, e.g., a file named foo/bar_1 would be included when listing foo/bar (a directory).

The root cause is that the GET /repositories/{repository}/refs/{ref}/objects/ls lakeFS API call returns objects based on their prefix, not full name matches, so we have to perform additional filtering in our ls method.

A regression test has been added based on the issue description.

Issue: #297

This commit fixes the ls command to exclude partial (prefix-only)
matches when listing objects in a repository.

The previous behavior would incorrectly include files with names that
are a prefix of the path passed to `ls`, e.g., a file named `foo/bar_1`
would be included when listing `foo/bar` (a directory).

A regression test has been added based on the issue description.

Issue: #297
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.78%. Comparing base (06134be) to head (83a9255).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #298      +/-   ##
==========================================
- Coverage   95.26%   94.78%   -0.48%     
==========================================
  Files           5        5              
  Lines         401      403       +2     
  Branches       90       91       +1     
==========================================
  Hits          382      382              
- Misses         14       15       +1     
- Partials        5        6       +1     
Flag Coverage Δ
3.10 94.29% <100.00%> (-0.48%) ⬇️
3.11 94.29% <100.00%> (-0.48%) ⬇️
3.12 94.29% <100.00%> (-0.48%) ⬇️
3.13 94.29% <100.00%> (-0.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@AdrianoKF AdrianoKF changed the title Issue-297 Fix partial name matches in ls method Dec 16, 2024
@AdrianoKF AdrianoKF changed the title Fix partial name matches in ls method Handle partial name matches in ls method Dec 16, 2024
@AdrianoKF AdrianoKF linked an issue Dec 16, 2024 that may be closed by this pull request
@AdrianoKF AdrianoKF self-assigned this Dec 16, 2024
src/lakefs_spec/spec.py Outdated Show resolved Hide resolved
@nicholasjng nicholasjng merged commit f5b5192 into main Dec 20, 2024
14 checks passed
@nicholasjng nicholasjng deleted the issue-297 branch December 20, 2024 10:35
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.

Strange behavior with files containing __
2 participants