feat: add outline entry model#2703
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a private ChangesOutline Data Model
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cli/src/outline/model.rs`:
- Around line 52-66: SourcePosition is missing the required byte offset field;
add a pub(super) byte: usize field to the struct, update the doc comment to
mention zero-based byte offset, and modify the impl SourcePosition::new
signature to accept and set the byte value; ensure the serde rename_all remains
camelCase so "byte" serializes correctly and then update any call sites that
construct SourcePosition (e.g., usages of SourcePosition::new or direct struct
literals) to provide the byte argument.
- Around line 285-312: The test serializes_outline_contract is missing
assertions that the OutlineItem.range serializes to the expected
SourceRange/SourcePosition JSON shape; update the test
(serializes_outline_contract) to assert the structure and values of
json["range"] (and nested start/end positions) to match the spec used by
SourcePosition and SourceRange after their update—locate the test and add
assertions verifying keys and numeric fields (e.g., start.line, start.character,
end.line, end.character) and their expected values consistent with test_range().
- Around line 68-86: The JSON shape is wrong: currently SourceRange serializes
byte_offset as an object while the contract expects each position to include its
byte offset. Update the model so SourcePosition includes a byte: usize field
(and derive Serialize/Deserialize), remove the SourceRange.byte_offset field,
and adjust SourceRange::new signature to accept start/end SourcePosition
(containing their byte values); ensure serde rename_all stays camelCase so
range.start.byte and range.end.byte match the documented shape and update any
callers constructing SourceRange accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eddc71c0-b928-4778-bc85-d0d8f4cdf07c
📒 Files selected for processing (2)
crates/cli/src/outline.rscrates/cli/src/outline/model.rs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2703 +/- ##
==========================================
+ Coverage 86.43% 86.52% +0.08%
==========================================
Files 117 118 +1
Lines 20212 20330 +118
==========================================
+ Hits 17471 17590 +119
+ Misses 2741 2740 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e425084 to
1afc4a4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cli/src/outline/model.rs`:
- Around line 201-205: OutlineMember should preserve an unknown/undetermined
publicness instead of always emitting false; change the field in the
OutlineMember struct from "is_public: bool" to "is_public: Option<bool>" and
annotate it with serde(skip_serializing_if = "Option::is_none") (and keep
#[serde(flatten)] on entry). Update any code that constructs OutlineMember
(e.g., places creating OutlineMember instances or tests) to pass
Some(true)/Some(false) when known or None when unknown, and update any
deserialization/usage sites to handle Option<bool> instead of bool.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2040e11c-1f6d-4374-a548-e73b827cf33f
📒 Files selected for processing (2)
crates/cli/src/outline.rscrates/cli/src/outline/model.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/cli/src/outline.rs
18f7902 to
07acb5c
Compare
07acb5c to
f07fbf1
Compare
Summary
Test
Summary by CodeRabbit
New Features
Chores
Tests