Skip to content

refactor(symbol_analysis): split graph.rs + fix rustdoc broken link#474

Merged
zackees merged 1 commit into
mainfrom
fix/split-graph-rs
Jun 7, 2026
Merged

refactor(symbol_analysis): split graph.rs + fix rustdoc broken link#474
zackees merged 1 commit into
mainfrom
fix/split-graph-rs

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Jun 7, 2026

Restores two failing CI gates that have been red on `main` since #468 / #470:

  • `Reject .rs files over 1000 LOC` — was failing on
    `crates/fbuild-core/src/symbol_analysis/graph.rs` at 1744 LOC.
  • `Documentation` — was failing on an unresolved rustdoc
    intra-doc link (`unresolved link to `build``).

What changed

`symbol_analysis/graph.rs` → `symbol_analysis/graph/` directory with
three files, each well under the 1000-LOC limit:

File LOC Contents
`graph/mod.rs` 698 Public types + `BackrefGraph::build*` + `to_dot()` + dot helpers
`graph/walker.rs` 361 Walker internals + `rank_callees_dual` (re-exported)
`graph/tests.rs` 715 Full `#[cfg(test)]` body

Doc link fix: `[`build`]` → `[`Self::build`]` so rustdoc resolves it under `-D rustdoc::broken_intra_doc_links`.

Why

  • Content-preserving refactor — no public-API change. Existing
    consumer (`fbuild_build::symbol_analyzer`) still imports
    `fbuild_core::symbol_analysis::graph::{rank_callees_dual, Direction}`
    unchanged thanks to a re-export in `mod.rs`.
  • Same shape as the existing `symbol_analysis/` parent (cref.rs +
    tests.rs siblings under a `mod.rs`) — no new convention.

Test plan

  • `soldr cargo check -p fbuild-core --all-targets`
  • `soldr cargo clippy -p fbuild-core --all-targets -- -D warnings`
  • `soldr cargo test -p fbuild-core --lib symbol_analysis` — 66 passed, 0 failed (all 20 `graph::tests::*` migrated and green)
  • `soldr cargo fmt --all -- --check`
  • `RUSTDOCFLAGS="-D warnings" soldr cargo doc -p fbuild-core --no-deps` — clean, broken link gone
  • `wc -l crates/fbuild-core/src/symbol_analysis/graph/*.rs` → all under 1000

Follow-up

`crates/fbuild-build/src/symbol_analyzer.rs` (1609 LOC) still trips the
LOC gate; same treatment in a separate PR.

🤖 Generated with Claude Code

…dule

`graph.rs` was 1744 LOC and tripped the "Reject .rs files over 1000
LOC" CI gate. Also fixes the `Documentation` gate which was failing
on an unresolved rustdoc intra-doc link.

Restructure: `symbol_analysis/graph.rs` → `symbol_analysis/graph/`
with three files, each well under the 1000-LOC limit:

- `mod.rs` (698) — public types (`GraphConfig`, `GraphNode`,
  `EdgeDirection`, `GraphEdge`, `BackrefGraph`), the
  `BackrefGraph::build*` entry points, `to_dot()` rendering, and the
  small dot-helpers (`node_color`, `node_width`, `format_*_label`,
  `sanitize_id`, `sanitize_filename`, `escape_dot_label`).
- `walker.rs` (361) — internal walker (`CappedReferencer`,
  `rank_and_cap_referencers`, `push_edge_dedup`, `walk_forward`,
  `CalleeCandidate`, `format_callee_label`) plus the public
  `rank_callees_dual` / `CalleeRanked` API, re-exported from
  `mod.rs` so the existing path
  `fbuild_core::symbol_analysis::graph::rank_callees_dual` keeps
  resolving for `fbuild_build::symbol_analyzer`.
- `tests.rs` (715) — the entire `#[cfg(test)] mod tests` body.

Also fixes the rustdoc broken-link warning that failed the
`Documentation` job: `[`build`]` → `[`Self::build`]` so the
intra-doc resolver finds it (`-D rustdoc::broken_intra_doc_links`
under `-D warnings`).

No public API change. Content-preserving refactor; only visibility
adjustments (`pub(super)` where the parent calls into the new
walker module).

Verified clean: `check`, `clippy --all-targets -- -D warnings`,
`test -p fbuild-core --lib symbol_analysis` (66 passed including
all 20 `graph::tests::*`), `fmt --check`, and
`RUSTDOCFLAGS="-D warnings" cargo doc -p fbuild-core --no-deps`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 7, 2026

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 20 minutes and 22 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6059161f-70b8-498a-afe0-d3b611718166

📥 Commits

Reviewing files that changed from the base of the PR and between 6dcb3ae and 8979432.

📒 Files selected for processing (5)
  • crates/fbuild-core/src/symbol_analysis/graph.rs
  • crates/fbuild-core/src/symbol_analysis/graph/README.md
  • crates/fbuild-core/src/symbol_analysis/graph/mod.rs
  • crates/fbuild-core/src/symbol_analysis/graph/tests.rs
  • crates/fbuild-core/src/symbol_analysis/graph/walker.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/split-graph-rs

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant