Skip to content

fix: empty segment listing#994

Open
ferhatelmas wants to merge 1 commit intomasterfrom
ferhat/empty-segment-listing
Open

fix: empty segment listing#994
ferhatelmas wants to merge 1 commit intomasterfrom
ferhat/empty-segment-listing

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Repeated / segments in object keys make list misidentify children by producing blank folders or blank names.

What is the new behavior?

Skip empty path segments and derive the first real child name instead.

Additional context

Validate prefix/key alignment before deriving child paths.
Make non-name sorting deterministic with explicit folder-first ordering.

Copilot AI review requested due to automatic review settings April 8, 2026 20:06
@ferhatelmas ferhatelmas requested a review from a team as a code owner April 8, 2026 20:06
@ferhatelmas ferhatelmas force-pushed the ferhat/empty-segment-listing branch from 6124bc8 to b8a7143 Compare April 8, 2026 20:10
Copy link
Copy Markdown

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

Fixes object listing edge-cases where repeated / delimiters in keys produce empty folder names / incorrect child derivation, and makes non-name sorting deterministic with folders-first ordering.

Changes:

  • Add a shared getNextCommonPrefix() helper and use it in listObjectsV2() to skip empty segments and validate prefix/key alignment.
  • Update tenant DB migration to adjust prefix-derivation helpers and storage.search() to handle empty segments and enforce stable folders-first ordering for non-name sorts.
  • Extend test coverage for list-v1 and list-v2 repeated-delimiter behaviors and stable ordering.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/object.test.ts Adds list-v1 regression tests + refactors shared Knex transaction cleanup in tests.
src/test/object-list-v2.test.ts Adds list-v2 repeated-delimiter regression tests and unit tests for getNextCommonPrefix().
src/storage/object.ts Introduces getNextCommonPrefix() and uses it for delimiter grouping in listObjectsV2().
src/internal/database/migrations/types.ts Registers new tenant migration fix-common-prefix-empty-segments as version 59.
migrations/tenant/0059-fix-common-prefix-empty-segments.sql Updates SQL helper functions and storage.search() to skip empty path segments and apply deterministic folders-first ordering for non-name sorts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blacksmith-sh

This comment has been minimized.

@ferhatelmas ferhatelmas force-pushed the ferhat/empty-segment-listing branch from b8a7143 to 46e527d Compare April 8, 2026 20:38
@ferhatelmas ferhatelmas requested a review from Copilot April 8, 2026 20:38
@ferhatelmas ferhatelmas force-pushed the ferhat/empty-segment-listing branch from 46e527d to 0e99200 Compare April 8, 2026 20:40
Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ferhatelmas ferhatelmas force-pushed the ferhat/empty-segment-listing branch from 0e99200 to 8ec6761 Compare April 9, 2026 11:02
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24186761058

Coverage increased (+0.02%) to 80.84%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 33 of 33 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37249
Covered Lines: 30291
Line Coverage: 81.32%
Relevant Branches: 4145
Covered Branches: 3172
Branch Coverage: 76.53%
Branches in Coverage %: Yes
Coverage Strength: 327.6 hits per line

💛 - Coveralls

@fenos
Copy link
Copy Markdown
Contributor

fenos commented Apr 9, 2026

Awesome change! however i'm wondering if the original index now is useless and we need to create a new index because of the function use?

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.

4 participants