🐛 Fix jsonl format ignoring -@ and -e flags#2588
Conversation
📝 WalkthroughWalkthroughMake Changes
Sequence Diagram(s)(Skipped — changes are localized to CLI data serialization and test expectations and do not introduce a multi-component sequential flow requiring visualization.) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @ChanTsune, 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 addresses an inconsistency in the Highlights
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 correctly fixes a bug where acl and xattr fields were always present in the jsonl output, even when not requested. By making these fields optional and using serde(skip_serializing_if = "Option::is_none"), their behavior is now consistent with the fflags field, and they are only included in the output when the corresponding -e or -@ flags are used. The implementation is clean and idiomatic, and the existing tests have been updated to reflect the corrected output. I've added one suggestion to improve test coverage for the new behavior.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cli/tests/cli/list/option_format_jsonl.rs (1)
176-195: LGTM! Encrypted archive test updated correctly.The test expectations are updated consistently. Note that the provided tests validate that
aclandxattrare omitted when flags are not used, but there don't appear to be tests in this file that verify these fields ARE included when-@or-eflags are provided.Consider adding positive test cases to verify that
aclandxattrfields appear in the JSON output when-@and-eflags are provided, respectively.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
cli/src/command/list.rscli/tests/cli/list/option_format_jsonl.rscli/tests/cli/list/option_show_fflags.rs
🔇 Additional comments (9)
cli/tests/cli/list/option_format_jsonl.rs (4)
24-43: LGTM! Test expectations correctly updated.The expected JSON output now correctly omits
aclandxattrfields when the-@and-eflags are not provided, consistent with the PR objective.
67-86: LGTM! Solid archive test updated correctly.The test expectations properly validate that
aclandxattrfields are omitted from solid archive listings when flags are not provided.
111-116: LGTM! Filtered listing test updated correctly.
144-151: LGTM! Directory filter test updated correctly.cli/tests/cli/list/option_show_fflags.rs (2)
107-116: LGTM! Conditional field inclusion working correctly.The test correctly validates that
fflagsis included when-Ois provided, whileaclandxattrare omitted when-eand-@are not provided, demonstrating the proper conditional serialization behavior.
138-147: LGTM! All conditional fields correctly omitted.The test properly validates that when none of the optional flags (
-O,-@,-e) are provided, all corresponding fields (fflags,acl,xattr) are omitted from the JSON output.cli/src/command/list.rs (3)
1124-1129: LGTM! Struct fields correctly updated for conditional serialization.The
aclandxattrfields are properly changed toOptiontypes withskip_serializing_if = "Option::is_none", following the same pattern as the existingfflagsfield. This enables clean omission of these fields from JSON output when not requested.
1149-1151: LGTM! Flag variables properly initialized.The
show_aclandshow_xattrflags are correctly extracted fromoptionsfor use within the parallel iterator closure, following the same pattern as the existingshow_fflags.
1187-1205: LGTM! Conditional field population implemented correctly.The logic properly uses
show_fflags.then(),show_acl.then(), andshow_xattr.then()to conditionally populate the optional fields. When a flag isfalse,then()returnsNone, which combined withskip_serializing_ifcauses the field to be omitted from the JSON output. The transformation logic for ACL and xattr data is correct.
95b845c to
f8e987d
Compare
The jsonl format was always outputting `acl` and `xattr` fields as empty arrays regardless of whether -e (acl) or -@ (xattr) flags were specified. This was inconsistent with the `fflags` field behavior. Now these fields use `skip_serializing_if` to omit them entirely when not requested, matching the expected behavior. Also added tests to verify that: - `-e` flag includes acl field in jsonl output - `-@` flag includes xattr field in jsonl output
f8e987d to
91f6da3
Compare
The jsonl format was always outputting
aclandxattrfields as empty arrays regardless of whether -e (acl) or -@ (xattr) flags were specified. This was inconsistent with thefflagsfield behavior.Now these fields use
skip_serializing_ifto omit them entirely when not requested, matching the expected behavior.Summary by CodeRabbit
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.