Skip to content

policy(rust): drop the cargo doc / rustdoc CI lane — agents read source, not rendered docs #116

Description

@zackees

Proposal

Remove the cargo doc / rustdoc lane from the fleet PR gate. Code in the fleet is increasingly read by AI agents that work from source, not by people browsing rendered rustdoc. A PR job that builds HTML docs (typically RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps) spends runner minutes on an artifact that nobody consumes. Agents read doc comments straight from the .rs files.

Measured cost: FastLED/fbuild docs.yml

The job (.github/workflows/docs.yml, "Documentation") runs on pull_request and on push to main. It uses one ubuntu-latest job with RUSTDOCFLAGS: "-D warnings", setup-soldr with build/target cache, and then soldr cargo doc --workspace --no-deps. The output is not uploaded or published anywhere.

Eight most recent successful PR runs (2026-09-29):

Run ID Job wall time Build docs step
36530429770 5m43s 5m33s
36528338039 5m02s 4m34s
36527717856 5m49s 5m28s
36527641741 6m07s 5m48s
36525554151 4m16s 4m00s
36525258721 4m45s 4m23s
36522564568 4m53s 4m39s
36519171733 5m50s 5m41s

What stays

  • Doc comments. They are still valuable, because agents read them in source. This issue does not propose dropping them.
  • Doctests. They are real tests. A repo that relies on them keeps running them with cargo test --doc, or through the normal cargo test run, which includes doctests for library crates. That path does not build HTML. This issue does not propose dropping doctests.
  • Publishing repos. A repo that actually publishes rendered docs (docs.rs, GitHub Pages) can keep a doc build, ideally on the publish/release path rather than on every PR.

Accepted trade-off

A rustdoc build with -D warnings catches broken intra-doc links (rustdoc::broken_intra_doc_links) and malformed doc markup. Without the lane, those can land. This is the accepted trade-off: a broken [Foo] link in source still names the right symbol for a reader grepping the code, and it only matters to a rendered-HTML consumer, which this policy assumes does not exist unless the repo declares one.

Current policy text

A search of docs/policy-rust.md, docs/policy-general.md, docs/ci-toml.md and ci_lint/ found no rule that requires a doc/rustdoc lane. The only related mentions are:

  • docs/ci-toml.md L649, TOOL-002: "A dependency-resolving cargo subcommand (build/test/check/clippy/doc/run/nextest) without --locked." This lists doc only so that a doc job, if one exists, must pass --locked.
  • docs/policy-rust.md RUST-006 and docs/policy-general.md CACHE-007 mention "doctest product" as a class of content that must not be cached. Both are unaffected.

So the lane exists in repos like fbuild by convention, not because policy requires it. The change is therefore an addition, not an edit:

  1. Add a Rust rule to docs/policy-rust.md, for example RUST-0xx: "A PR-gate job runs cargo doc / rustdoc (or sets RUSTDOCFLAGS) and the repository does not declare that it publishes rendered docs." Status: candidate.
  2. Once the rule lands, optionally drop doc from the TOOL-002 subcommand list, or keep it for the allow-listed publishing repos.

Proposed ci_lint check (candidate)

A static precheck that flags any job reachable from the PR entrypoint (pull_request trigger or ci.yml workflow_call graph) whose steps run cargo doc / soldr cargo doc / rustdoc, or that sets RUSTDOCFLAGS in job or step env. It passes when ci.toml carries an explicit allow entry declaring where the docs are published, for example:

[rust.docs]
publishes = "docs.rs"   # or "pages"; required reason for keeping a doc build

cargo test --doc must not trigger the check.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions