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

fix: files meta only return currrent files and sub directory #687

Merged
merged 1 commit into from
May 19, 2024

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented May 18, 2024

closes #680

Summary by CodeRabbit

  • Bug Fixes

    • Improved file and directory handling to ensure accurate listing and filtering of package version files.
  • Tests

    • Updated test cases to reflect the new logic for file and directory handling, ensuring more reliable and accurate test results.

@fengmk2 fengmk2 added bug Something isn't working enhancement New feature or request labels May 18, 2024
@fengmk2 fengmk2 requested a review from elrrrrrrr May 18, 2024 16:31
@fengmk2 fengmk2 self-assigned this May 18, 2024
Copy link
Contributor

coderabbitai bot commented May 18, 2024

Walkthrough

The changes streamline the handling of files and directories in the PackageVersionFileController and optimize the SQL queries for listing package version files in the PackageVersionFileRepository. This involves restructuring how files and directories are processed and improving the performance of queries involving large datasets.

Changes

File Path Change Summary
app/port/controller/PackageVersionFileController.ts Refactored #listFilesByDirectory to handle files and directories more efficiently.
app/repository/PackageVersionFileRepository.ts Improved SQL query performance by distinguishing root directories and optimizing file filtering.
test/port/controller/PackageVersionFileController/... Updated tests to reflect changes in file and directory handling logic.

Assessment against linked issues

Objective Addressed Explanation
Performance Improvement (#680)
Optimization of Large Queries (#680)
Scalability: Efficient handling of many dist_id values (#680)

In code we trust, with files we play,
Refactoring paths in a digital ballet.
Queries optimized, performance in sight,
Scaling new heights, in the code's soft light.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.82%. Comparing base (0530116) to head (5829f41).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #687   +/-   ##
=======================================
  Coverage   96.81%   96.82%           
=======================================
  Files         181      181           
  Lines       17982    17993   +11     
  Branches     2348     2340    -8     
=======================================
+ Hits        17410    17421   +11     
  Misses        572      572           

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Out of diff range and nitpick comments (1)
app/repository/PackageVersionFileRepository.ts (1)

39-68: Ensure proper indexing on packageVersionId and directory fields for performance.

Given the changes and the focus on performance, especially for large datasets, ensure that the packageVersionId and directory fields in the database are properly indexed. This will help in efficiently filtering records based on these fields, which is critical given the SQL query structure introduced here.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8a927fc and 5829f41.
Files selected for processing (4)
  • app/port/controller/PackageVersionFileController.ts (1 hunks)
  • app/repository/PackageVersionFileRepository.ts (1 hunks)
  • test/port/controller/PackageVersionFileController/listFiles.test.ts (2 hunks)
  • test/port/controller/PackageVersionFileController/raw.test.ts (3 hunks)
Additional comments not posted (2)
test/port/controller/PackageVersionFileController/raw.test.ts (1)

Line range hint 340-367: Update assertions to reflect the new logic for handling directories.

The updated assertions correctly reflect the changes made in the handling of files and directories. This ensures that the tests are aligned with the new functionality.

Also applies to: 429-429

test/port/controller/PackageVersionFileController/listFiles.test.ts (1)

551-551: This test case correctly checks for a 404 status when a non-existent subdirectory is requested.

@fengmk2 fengmk2 merged commit e442580 into master May 19, 2024
13 checks passed
@fengmk2 fengmk2 deleted the fix-files-meta branch May 19, 2024 01:58
fengmk2 pushed a commit that referenced this pull request May 19, 2024
[skip ci]

## [3.59.1](v3.59.0...v3.59.1) (2024-05-19)

### Bug Fixes

* files meta only return currrent files and sub directory ([#687](#687)) ([e442580](e442580))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

perf: 超大 dists 查询 sql
1 participant