-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(scanner): add Scanner.FollowSymlinks option #4061
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to 4c93d48 in 1 minute and 1 seconds. Click for details.
- Reviewed
309
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
2
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scanner/walk_dir_tree.go:114
- Draft comment:
Remove extra whitespace in the structured log key (' path' → 'path') for consistency. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. scanner/walk_dir_tree.go:285
- Draft comment:
Pass the context to log.Warn in isDirReadable for consistent structured logging. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_0e2bBxRK70OhwRQx
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
… methods Signed-off-by: Deluan <deluan@navidrome.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 2bff15a in 1 minute and 58 seconds. Click for details.
- Reviewed
89
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
3
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scanner/walk_dir_tree_test.go:38
- Draft comment:
The test now uses the Data field in MapFS to define the symlink target instead of a separate symlinks map. This simplifies the mock but relies on m.FS being a fstest.MapFS. Consider adding a comment or type‐check to clarify this assumption. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment identifies a real potential issue - the code assumes m.FS is a MapFS but this isn't obvious. However, this is a test file and the mock is only used for testing. The code already has a comment explaining what mockMusicFS is for. The suggested inline comment would make the code more cluttered without adding much value. The comment raises a valid point about making assumptions explicit. Test code should still be maintainable and clear. While documentation is good, the existing type comment on mockMusicFS already explains its purpose. An additional inline comment would be redundant. Delete the comment. The code's purpose is already documented by the type comment, and adding more inline comments would add clutter without significant benefit.
2. scanner/walk_dir_tree_test.go:300
- Draft comment:
The Open method in mockMusicFS now always follows symlinks unconditionally. Ensure that the higher-level scanning logic (e.g. isDirOrSymlinkToDir) correctly respects the FollowSymlinks configuration so that in disabled mode these symlinks are skipped. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment is asking the author to ensure that the higher-level logic respects a configuration setting. It is not making a specific code suggestion or pointing out a specific issue with the code. It violates the rule against asking the author to ensure behavior is intended.
3. scanner/walk_dir_tree_test.go:293
- Draft comment:
Removal of the symlinks map in mockMusicFS cleans up the implementation. Verify that all tests (and production code, if applicable) now rely solely on the Data field for symlink targets, ensuring consistent behavior. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
Workflow ID: wflow_JttcPHSpTr2ILISE
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
…cleanup Signed-off-by: Deluan <deluan@navidrome.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed 600d1ad in 1 minute and 28 seconds. Click for details.
- Reviewed
253
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
3
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scanner/walk_dir_tree_test.go:55
- Draft comment:
Clarify that the helper getFolders intentionally includes the '.' and 'root' entries (hence the +2 in the length check). A short comment would help future maintainers understand this. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The comment points out something that could be confusing - why there's a +2 in the length check. However, there's already a comment on line 76 that explains this: "// +2 for.
androot
". Adding another comment in getFolders() would be redundant. The existing comment is in a more appropriate place - right next to where the +2 is actually used. Maybe having the explanation in both places would make the code more maintainable since someone reading getFolders() might miss the comment in the test case? The explanation is already clearly documented where it matters - at the point where the +2 is used. Adding redundant documentation would violate DRY principles and could lead to maintenance issues if one comment is updated but not the other. The comment should be deleted since the behavior is already documented appropriately where the +2 is used.
2. scanner/walk_dir_tree_test.go:94
- Draft comment:
Consider defining repeated magic strings like 'root/e/symlink' as constants for better maintainability, especially since file names are used in multiple places. - Reason this comment was not posted:
Comment was on unchanged code.
3. scanner/walk_dir_tree_test.go:71
- Draft comment:
The table-driven tests are clear, but consider adding additional cases (e.g. for broken or circular symlinks) to further strengthen the test coverage of the new FollowSymlinks option. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_UrMhkqGWAbKHHcsC
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Fixes #4060
This PR adds a new configuration option
Scanner.FollowSymlinks
(default: true) to control whether the filesystem scanner should follow symbolic links when scanning directories.Changes:
Scanner.FollowSymlinks
(default: true)isDirOrSymlinkToDir
to respect this optionDescribeTable
for better maintainabilityThe option can be configured in
navidrome.toml
:Or via environment variable: