Skip to content

refactor: remove legacy outline placeholders#2702

Merged
HerringtonDarkholme merged 1 commit into
mainfrom
outline-core-model
Jun 11, 2026
Merged

refactor: remove legacy outline placeholders#2702
HerringtonDarkholme merged 1 commit into
mainfrom
outline-core-model

Conversation

@HerringtonDarkholme

@HerringtonDarkholme HerringtonDarkholme commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • remove the premature outline model placeholder based on definition/import/export role flags
  • remove the premature outline rule schema placeholder
  • keep the merged outline CLI shell intact so the replacement model can land in a separate PR

Test

  • cargo fmt --check
  • cargo test -p ast-grep --lib test_cli
  • cargo check -p ast-grep
  • cargo clippy -p ast-grep --all-targets -- -D warnings

Summary by CodeRabbit

  • Refactor

    • Restructured the outline model to provide richer entry data and improved serialization for outline output.
  • Breaking Changes

    • Removed several public types and methods previously used for outline role management and item construction.
    • Outline extraction rules and related functionality have been deferred to a future release.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aa78b2d3-9e8b-4c9b-a688-15584cbb5ecc

📥 Commits

Reviewing files that changed from the base of the PR and between 3669daa and 89a0ffb.

📒 Files selected for processing (3)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/model.rs
  • crates/cli/src/outline/rule.rs
💤 Files with no reviewable changes (3)
  • crates/cli/src/outline.rs
  • crates/cli/src/outline/rule.rs
  • crates/cli/src/outline/model.rs

📝 Walkthrough

Walkthrough

Refactors the outline model from role-flag types to a serializable outline-tree schema (EntryRole, SourcePosition/Range, OutlineEntry/Item/Member) and removes/de-scopes outline rule extraction and module wiring.

Changes

Outline Model Architecture and Rule De-scoping

Layer / File(s) Summary
Outline model schema and serialization update
crates/cli/src/outline/model.rs
SymbolType visibility changed to pub(super) and derives Serialize/Deserialize with camelCase. Removed old OutlineRole/OutlineRoles and role-flag-based OutlineItem<'a>. Added EntryRole, SourcePosition (byte offsets + start/end positions), SourceRange, OutlineEntry, OutlineItem (import/export flags, optional target/alias, nested members), and OutlineMember (is_public). Tests updated to assert JSON field names and omission of optional fields.
Rule module de-scoping
crates/cli/src/outline.rs, crates/cli/src/outline/rule.rs
Removed mod model;/mod rule; declarations and cleared rule implementation in outline/rule.rs; rule extraction logic, normalization, and associated tests were removed and left as a deferred/placeholder implementation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • ast-grep/ast-grep#2690: Refactors the outline model schema, replacing role-flag designs with the new item/member schema.
  • ast-grep/ast-grep#2695: Updates outline design/docs to match the new item/member-based extraction/output schema implemented here.
  • ast-grep/ast-grep#2687: Also simplifies crates/cli/src/outline.rs wiring and stubs run_outline, overlapping at the command-level.

Poem

🐰 I hop through code and tidy seeds,
New trees of outline grow from deeds,
Byte-precise ranges snug in a row,
Members nested, ready to show,
Rules postponed — I'll dig them next spring.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor: remove legacy outline placeholders' accurately describes the main change: removing the old role-bitflag outline model. However, the PR also adds a new serializable outline model (item/member entry schema), which is a significant addition not captured in the title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch outline-core-model

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.43%. Comparing base (fa8fe4c) to head (89a0ffb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2702      +/-   ##
==========================================
- Coverage   86.51%   86.43%   -0.08%     
==========================================
  Files         119      117       -2     
  Lines       20367    20212     -155     
==========================================
- Hits        17621    17471     -150     
+ Misses       2746     2741       -5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 184-186: The with_alias setter currently unconditionally sets
alias; change it to normalize away duplicates by only setting self.alias =
Some(alias.into()) when the provided alias is neither equal to self.name nor
equal to self.target (i.e., skip assigning alias if alias == name || alias ==
target). Update the corresponding other setter/constructor at the 239-257 region
the same way so the model never stores an alias that duplicates name or target
and tests should not expect alias to be present in those duplicate cases.
- Around line 52-76: The serialized shape must match the documented outline
contract: modify SourcePosition and SourceRange so range.start and range.end
include a `byte` field and `line`/`column` are serialized one-based (internally
can remain zero-based), and stop using `byte_offset` as the external byte
location; update the structs SourcePosition (add pub(super) byte: usize) and
SourceRange (remove or convert pub(super) byte_offset: Range<usize> into bytes
on start/end) and implement custom serde (Serialize/Deserialize) or serde
helpers to translate line/column + byte during (de)serialization so callers of
SourcePosition::new and SourceRange still use zero-based values internally but
the JSON matches the contract.
🪄 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: 86fa8f6d-429f-41ec-97df-3e40b958965a

📥 Commits

Reviewing files that changed from the base of the PR and between fa8fe4c and 3669daa.

📒 Files selected for processing (2)
  • crates/cli/src/outline/model.rs
  • crates/cli/src/outline/rule.rs

Comment thread crates/cli/src/outline/model.rs Outdated
Comment thread crates/cli/src/outline/model.rs Outdated
@HerringtonDarkholme HerringtonDarkholme changed the title feat: add outline core model refactor: remove legacy outline placeholders Jun 11, 2026
@HerringtonDarkholme
HerringtonDarkholme added this pull request to the merge queue Jun 11, 2026
Merged via the queue into main with commit fa4d9e3 Jun 11, 2026
5 of 6 checks passed
@HerringtonDarkholme
HerringtonDarkholme deleted the outline-core-model branch June 11, 2026 22:20
@coderabbitai coderabbitai Bot mentioned this pull request Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant