refactor: reorganize nar and narinfo helper logic into dedicated packages#821
refactor: reorganize nar and narinfo helper logic into dedicated packages#821
Conversation
…ages Move NAR and NarInfo helper functions (file path generation and hash validation) from the generic pkg/helper package to specialized pkg/nar and pkg/narinfo packages. This change improves the internal architecture by co-locating logic with the data types they operate on, making the codebase more discoverable and maintainable. Key changes: - Created pkg/nar package with FilePath and ValidateHash logic. - Created pkg/narinfo package with FilePath and ValidateHash logic. - Updated pkg/storage/local and pkg/storage/s3 to use these new packages. - Simplified pkg/helper to only contain the generic FilePathWithSharding logic. - Migrated all relevant tests and updated import paths across the project.
Summary of ChangesHello @kalbasit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the codebase by reorganizing helper functions related to NAR and NarInfo file path generation and hash validation. Previously located in a general Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great refactoring that improves the project's architecture by moving NAR and NarInfo helper functions into their own dedicated packages. This co-location of logic with the data types they operate on makes the codebase more modular and maintainable.
I've added a couple of suggestions to further improve the changes by strengthening the hash validation logic. The current validation is quite broad, and since this refactoring is already touching this code, it's a good opportunity to make it more specific to valid Nix hash formats.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This reverts commit d5b2e19.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #821 +/- ##
=======================================
Coverage 85.41% 85.41%
=======================================
Files 2 2
Lines 480 480
=======================================
Hits 410 410
Misses 65 65
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-0.8
git worktree add -d .worktree/backport-821-to-release-0.8 origin/release-0.8
cd .worktree/backport-821-to-release-0.8
git switch --create backport-821-to-release-0.8
git cherry-pick -x f1a147977549bc5e9e2d264a4e6a6bbe3dd52586 |
…ages (#821) Move NAR and NarInfo helper functions (file path generation and hash validation) from the generic pkg/helper package to specialized pkg/nar and pkg/narinfo packages. This change improves the internal architecture by co-locating logic with the data types they operate on, making the codebase more discoverable and maintainable. Key changes: - Created pkg/nar package with FilePath and ValidateHash logic. - Created pkg/narinfo package with FilePath and ValidateHash logic. - Updated pkg/storage/local and pkg/storage/s3 to use these new packages. - Simplified pkg/helper to only contain the generic FilePathWithSharding logic. - Migrated all relevant tests and updated import paths across the project. (cherry picked from commit f1a1479)
…ages [backport #821] (#825) Move NAR and NarInfo helper functions (file path generation and hash validation) from the generic pkg/helper package to specialized pkg/nar and pkg/narinfo packages. This change improves the internal architecture by co-locating logic with the data types they operate on, making the codebase more discoverable and maintainable. Key changes: - Created pkg/nar package with FilePath and ValidateHash logic. - Created pkg/narinfo package with FilePath and ValidateHash logic. - Updated pkg/storage/local and pkg/storage/s3 to use these new packages. - Simplified pkg/helper to only contain the generic FilePathWithSharding logic. - Migrated all relevant tests and updated import paths across the project. (cherry picked from commit f1a1479)

Move NAR and NarInfo helper functions (file path generation and hash validation) from the generic pkg/helper package to specialized pkg/nar and pkg/narinfo packages. This change improves the internal architecture by co-locating logic with the data types they operate on, making the codebase more discoverable and maintainable.
Key changes: