Skip to content

fix(scripts): document private items in the pre-push doc check - #13838

Merged
zkochan merged 1 commit into
mainfrom
pre-push-doc-flags
Aug 11, 2026
Merged

zkochan merged 1 commit into
mainfrom
pre-push-doc-flags

Conversation

@zkochan

@zkochan zkochan commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

Summary

The Rust CI / Doc job runs

RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --workspace --document-private-items

and pnpm/scripts/pre-push-rust.sh ran the same thing without --document-private-items. Nearly every item in these crates is private or pub(super), and rustdoc only resolves the doc links of the items it documents — so a link to a renamed or deleted private item passes the local check and fails CI.

Reproduced by pointing one doc comment at a name that does not exist ([fn@walk_node_children_renamed]), with target/doc removed before each run:

command result
cargo doc --no-deps --workspace --all-features (before) passes, reports nothing
cargo doc --no-deps --workspace --all-features --document-private-items (after) error: unresolved link to 'walk_node_children_renamed'

--all-features stays, so the local gate remains a superset of CI's.

Found the slow way: two red Rust CI / Doc runs on #13835, where deleting a private function left doc links to it behind and the pre-push check waved them through both times.

No changeset — this touches a developer script, not a published package.

Squash Commit Body

The "Rust CI / Doc" job runs `cargo doc` with `--document-private-items`
and the pre-push check did not. Nearly every item in these crates is
private or `pub(super)`, and rustdoc only resolves the doc links of the
items it documents, so a link to a renamed or deleted private item
passed the local check and failed CI.

Reproduced by pointing one doc comment at a name that does not exist:
the old command reports nothing, the CI command reports `unresolved
link`. Caught after two red `Rust CI / Doc` runs on pnpm/pnpm#13835.

Checklist

  • Added or updated tests.

The check is its own test: running the updated script against a deliberately broken doc link fails, and against main passes end to end (fmt, clippy, doc, dylint, typos, taplo).


Written by an agent (Claude Code, claude-opus-5[1m]).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Updated Rust documentation checks to validate links for private items, aligning local pre-push checks with CI validation.

The "Rust CI / Doc" job runs `cargo doc` with `--document-private-items`
and the pre-push check did not. Nearly every item in these crates is
private or `pub(super)`, and rustdoc only resolves the doc links of the
items it documents, so a link to a renamed or deleted private item
passed the local check and failed CI.

Reproduced by pointing one doc comment at a name that does not exist:
the old command reports nothing, the CI command reports `unresolved
link`. Caught after two red `Rust CI / Doc` runs on #13835.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 11, 2026 22:20

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Align pre-push Rust docs check with CI by documenting private items

🐞 Bug fix ⚙️ Configuration changes 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add --document-private-items to the pre-push cargo doc gate to match CI.
• Prevent unresolved doc links to private items from passing locally but failing in CI.
• Document why the flag is required for these mostly-private Rust crates.
Diagram

graph TD
  dev["Developer"] --> script["pre-push-rust.sh"] --> cargo["cargo doc (+private items)"] --> rustdoc["rustdoc link resolution"]
  ci["Rust CI / Doc job"] --> cargo
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralize rustdoc flags in one shared CI/local config
  • ➕ Eliminates drift between CI and developer scripts over time
  • ➕ Makes future flag changes single-source-of-truth
  • ➖ Requires introducing shared config plumbing (YAML parsing, env injection, or wrapper script)
  • ➖ Higher complexity than warranted for a one-flag mismatch
2. Run the exact CI doc command via a local 'ci-doc' wrapper target
  • ➕ Developers can reproduce CI exactly with a single entrypoint
  • ➕ Encourages consistent local debugging
  • ➖ Adds another script/target to maintain
  • ➖ Still needs care to keep wrapper in sync with CI definition

Recommendation: The PR’s approach is the right tradeoff: directly add --document-private-items to the existing pre-push cargo doc invocation and explain why. It fixes a concrete CI/local mismatch with minimal additional maintenance surface; more elaborate flag centralization can be deferred unless further drift appears.

Files changed (1) +7 / -2

Bug fix (1) +7 / -2
pre-push-rust.shMatch CI rustdoc flags by enabling private-item documentation +7/-2

Match CI rustdoc flags by enabling private-item documentation

• Updates the pre-push docs check to run 'cargo doc' with '--document-private-items' (and keeps '--all-features'). Adds inline comments explaining that rustdoc only resolves links for documented items, which previously allowed broken links to private items to slip past local checks.

pnpm/scripts/pre-push-rust.sh

@coderabbitai

coderabbitai Bot commented Aug 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cf0bfc5e-1d4d-4eea-8370-89339d2fd8c2

📥 Commits

Reviewing files that changed from the base of the PR and between e9a3ca3 and 756c02e.

📒 Files selected for processing (1)
  • pnpm/scripts/pre-push-rust.sh

📝 Walkthrough

Walkthrough

The pre-push Rust documentation check now passes --document-private-items to cargo doc. It retains warnings-as-errors, workspace, all-features, and no-dependencies settings, and documents alignment with CI.

Changes

Rust documentation validation

Layer / File(s) Summary
Private-item documentation validation
pnpm/scripts/pre-push-rust.sh
The pre-push cargo doc command now includes --document-private-items and comments explain its alignment with CI and private-item link validation.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: product: pacquet

✨ 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 pre-push-doc-flags

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.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge because the local documentation command now exercises the same private-item rustdoc validation used by CI.

The added flag is supported by the pinned Rust toolchain, matches the CI documentation job, and no changed-code-triggered failure remains.

Reviews (1): Last reviewed commit: "fix(scripts): document private items in ..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 11, 2026
@zkochan
zkochan merged commit fa55a3b into main Aug 11, 2026
28 checks passed
@zkochan
zkochan deleted the pre-push-doc-flags branch August 11, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants