Skip to content

refactor(rs)!: ban doc(hidden); document, delete, or privatize each use - #8392

Merged
kixelated merged 7 commits into
mainfrom
quest/m2/api-shape/doc-hidden
Nov 10, 2026
Merged

kixelated merged 7 commits into
mainfrom
quest/m2/api-shape/doc-hidden

Conversation

@kixelated

@kixelated kixelated commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m2/api-shape/doc-hidden.md.

Problem

#[doc(hidden)] left public Rust items in the API with no documentation, so callers could depend on them without knowing what they were. The maintainer asked to ban it after moq-dev/moq#8369, which removed the hides on moq-net's route stream.

Approach

  • sh/text.sh (just check's check:text, which runs on every branch) now rejects doc(hidden) in any tracked *.rs file, vendored code included. It also matches cfg_attr(..., doc(hidden)) and spacing variants. The em dash scan and the new scan share one forbid helper, and both are reported in a single run. sh/text.test.py covers it.
  • Each existing use is now private, deleted, or documented, following the quest's recorded decisions:
    • Vendored WebRTC code (rs/moq-webrtc/src/vendor, 34 attributes): deleted. Those modules are private, so the attribute hid nothing.
    • Test support stays pub behind its feature, and its doc line now says it is test support and names the feature: fuzz in moq-net, moq-quic, moq-mux, and moq-rtmp; sim in moq-quic, moq-tokio, and moq_tokio::quic::driver::sim; moq_json::bench; moq_stats::produce::bench; and moq_quic::connection::BenchSentPackets. Each module doc also says it tracks the crate's internals and can change in any release. Items that missing_docs now reaches (fuzz::CanonicalStorage::{new, size} and sim::Bottleneck::stats) are documented.
    • moq_tokio::settings: documented public API, because moq-relay and moq-bench read it.
    • moq_webrtc::p2p: documented public API, because moq-cli --p2p (quest/m4/p2p/cli.md) is a planned consumer.
    • moq-quic mux: now reachable only at moq_quic::connection::mux. The duplicate moq_quic::mux re-export is gone, and qmux imports the module from connection::mux.
  • Comments, READMEs, and Cargo feature notes that described these modules as "hidden" are updated. So are quest/m4/wire-fuzz-coverage.md and quest/m4/quic-sim.md.

Impact

  • Breaking (moq-quic): the moq_quic::mux re-export is removed. Use moq_quic::connection::mux instead (noted in rs/moq-quic/MIGRATE.md under Unreleased).
  • Newly documented, not breaking: moq_tokio::settings and moq_webrtc::p2p (feature p2p), plus the feature-gated test support listed above, in moq-net, moq-quic, moq-mux, moq-rtmp, moq-json, moq-stats, and moq-tokio. Default-feature builds expose no new items.
  • Wire: none.

Choices made without asking

  • I kept connection::mux and dropped the root mux re-export instead of the other way round. The module lives under connection and borrows that module's internals, and keeping only one path means no #[path] workaround.
  • The test-support docs say that the module "can change in any release". This tells callers that dropping the hide does not make it stable API.

Alternatives

  • Exclude vendored code from the ban. The quest rejected this.
  • Make the test support private by moving bench and fuzz bodies into each crate. The quest rejected this as well.

Validation

  • On head e48e10a (origin/main ac3cb8c merged in), just check passes every module on Linux, including check rs, test rs, test gh, and check text.
  • bash sh/text.sh passes, and python3 sh/text.test.py passes (8 tests).
  • cargo clippy --all-targets --all-features -- -D warnings passes on moq-net, moq-quic, moq-mux, moq-rtmp, moq-json, moq-stats, moq-tokio, moq-webrtc, qmux, moq-relay, and moq-net-tests.
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features passes on moq-net, moq-quic, moq-mux, moq-rtmp, moq-json, moq-stats, moq-tokio, moq-webrtc, and qmux.
  • quest check: ok.
  • just check: every module passes except check rs and test gh, and both of those fail the same way on origin/main. With bridge (moq-carla-bridge) left out, I reran the remaining check rs lint steps: cargo doc -D warnings over every selected crate, cargo shear, cargo sort --check, and cargo hakari generate --diff. They all pass.
  • Two failures also happen on a clean origin/main checkout (7e50202) on this macOS host, so this PR did not cause them:
    • test gh: python3 sh/version.test.py fails test_cut_promotes_only_published_library_dependencies_and_preserves_exemptions ('0.0.1' != '0.22.0') and test_release_plz_keeps_manual_cut_despite_breaking_commits, with release-plz 0.3.149.
    • check rs: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p moq-carla-bridge reports unresolved links to Bridge, Source, and protocol in demo/carla/bridge/src/lib.rs.
  • Also off Linux, cargo clippy -p moq-bench --all-targets --all-features reports an unfulfilled expect(dead_code) at rs/moq-bench/src/host.rs:43. This PR does not touch that file.
  • Not run locally: the Rust test suites and just ci. Only visibility and docs changed, and every affected crate compiles with --all-targets --all-features.

Follow-ups

  • sh/version.test.py fails locally on main with release-plz 0.3.149, and moq-carla-bridge's docs fail -D warnings on macOS (see Validation). No open PR fixes either one yet.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, unknown effort
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, M)

Review feedback

  • Pullfrog: sh/text.sh now matches hidden anywhere inside doc(...), so #[doc(alias = "Old", hidden)] fails too; sh/text.test.py covers it.
  • Pullfrog: both sim modules in moq-tokio now say they track the crate's internals and can change in any release, like their fuzz siblings.

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, medium effort
  • Session: 01a1c38d-23cb-7a21-bed1-5024db1bb9c7, round 1
  • Head: e48e10a
  • Base: origin/main at ac3cb8c
  • Score: 9/10, The documentation/API cleanup and text-check changes appear sound from source inspection, with no actionable defects found; builds and tests were not run, as instructed.
  • Findings: none

kixelated and others added 5 commits November 9, 2026 15:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Ban doc(hidden) in Rust refactor(rs)!: ban doc(hidden); document, delete, or privatize each use Nov 10, 2026
@kixelated
kixelated marked this pull request as ready for review November 10, 2026 00:36
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93b989a5-0c5e-4474-a001-e307b67ecc3f
Commits

Reviewing files that changed from the base of the PR and between ac3cb8c and e48e10a.

Files selected for processing: 69

  • bench/README.md
  • quest/m2/api-shape/README.md
  • quest/m2/api-shape/doc-hidden.md
  • quest/m4/quic-sim.md
  • quest/m4/wire-fuzz-coverage.md
  • rs/moq-json/Cargo.toml
  • rs/moq-json/src/lib.rs
  • rs/moq-mux/Cargo.toml
  • rs/moq-mux/fuzz/Cargo.toml
  • rs/moq-mux/fuzz/README.md
  • rs/moq-mux/src/fuzz.rs
  • rs/moq-mux/src/lib.rs
  • rs/moq-net-tests/Cargo.toml
  • rs/moq-net-tests/tests/integration/hop_limit.rs
  • rs/moq-net-tests/tests/integration/ietf_conformance.rs
  • rs/moq-net-tests/tests/integration/main.rs
  • rs/moq-net-tests/tests/integration/restart.rs
  • rs/moq-net-tests/tests/integration/wide_hop.rs
  • rs/moq-net/Cargo.toml
  • rs/moq-net/benches/interests.rs
  • rs/moq-net/benches/origin.rs
  • rs/moq-net/benches/routes.rs
  • rs/moq-net/benches/synced.rs
  • rs/moq-net/benches/viewers.rs
  • rs/moq-net/fuzz/Cargo.toml
  • rs/moq-net/fuzz/README.md
  • rs/moq-net/src/fuzz.rs
  • rs/moq-net/src/lib.rs
  • rs/moq-net/src/stats.rs
  • rs/moq-net/tests/integration/main.rs
  • rs/moq-quic/Cargo.toml
  • rs/moq-quic/MIGRATE.md
  • rs/moq-quic/README.md
  • rs/moq-quic/benches/common/mod.rs
  • rs/moq-quic/fuzz/Cargo.toml
  • rs/moq-quic/fuzz/README.md
  • rs/moq-quic/src/connection/mod.rs
  • rs/moq-quic/src/connection/sent_packets.rs
  • rs/moq-quic/src/fuzz.rs
  • rs/moq-quic/src/lib.rs
  • rs/moq-quic/src/sim.rs
  • rs/moq-relay/Cargo.toml
  • rs/moq-rtmp/Cargo.toml
  • rs/moq-rtmp/fuzz/Cargo.toml
  • rs/moq-rtmp/fuzz/README.md
  • rs/moq-rtmp/src/fuzz.rs
  • rs/moq-rtmp/src/lib.rs
  • rs/moq-stats/Cargo.toml
  • rs/moq-stats/src/produce.rs
  • rs/moq-stats/src/produce_bench.rs
  • rs/moq-tokio/src/lib.rs
  • rs/moq-tokio/src/quic/driver/mod.rs
  • rs/moq-tokio/src/quic/driver/sim.rs
  • rs/moq-tokio/src/settings.rs
  • rs/moq-tokio/src/sim.rs
  • rs/moq-webrtc/src/lib.rs
  • rs/moq-webrtc/src/vendor/is/candidate.rs
  • rs/moq-webrtc/src/vendor/is/stun.rs
  • rs/moq-webrtc/src/vendor/sctp_proto/config.rs
  • rs/moq-webrtc/src/vendor/sctp_proto/shared.rs
  • rs/moq-webrtc/src/vendor/str0m/format/codec.rs
  • rs/moq-webrtc/src/vendor/str0m/lib.rs
  • rs/moq-webrtc/src/vendor/str0m/rtp/ext.rs
  • rs/moq-webrtc/src/vendor/str0m/sdp/data.rs
  • rs/qmux/src/config.rs
  • rs/qmux/src/lib.rs
  • rs/qmux/src/session.rs
  • sh/text.sh
  • sh/text.test.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed head: e0c2c12

[P2] Match hidden after other doc options (sh/text.sh:37-38). Rust accepts #[doc(alias = "OldName", hidden)] pub struct Example;, but this pattern only recognizes hidden immediately after doc(. A tracked Rust file containing that attribute therefore passes the new scan while rustdoc still hides the public item, including if it arrives in vendored code. Check all options in a doc attribute, not only the first, and add this case to sh/text.test.py.

Direction: keeping test support feature-gated and consolidating QMux at connection::mux fits the recorded plan; the enforcement gap above should be closed before treating the ban as complete.

Limits: GitHub-only static review of the diff, gate/tests, and selected API context. Rust's doc-attribute parser confirms it processes every option in the list. I did not run the regression example, quest context, Rust builds, or tests.

@pullfrog pullfrog 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.

Important

The new gate misses a valid doc attribute form: #[doc(alias = "OldName", hidden)] passes sh/text.sh while rustdoc still hides the item, so the ban is bypassable. The fix is a one-line pattern change plus a test case.

Reviewed changes

  • doc(hidden) gate in sh/text.sh: check:text now rejects doc(hidden) in any tracked *.rs (vendored included), including cfg_attr and spacing variants, sharing a forbid helper with the em-dash scan so one run reports both. sh/text.test.py gains coverage for the new cases.
  • Vendored attributes deleted: every #[doc(hidden)] in rs/moq-webrtc/src/vendor is gone; those modules are private, so nothing was hidden.
  • Feature-gated test support documented: fuzz in moq-net, moq-quic, moq-mux, and moq-rtmp; sim in moq-quic, moq-tokio, and quic::driver::sim; plus moq_json::bench, moq_stats::produce::bench, and moq_quic::connection::BenchSentPackets.
  • moq_tokio::settings and moq_webrtc::p2p documented as public API.
  • Breaking mux move: the moq_quic::mux root re-export is removed and qmux imports moq_quic::connection::mux; the MIGRATE.md entry is rewritten.
  • Wording sweep: "hidden module" comments, READMEs, Cargo feature notes, bench/README.md, and quest docs updated; the finished quest file is deleted.

ℹ️ One stale "hidden" reference survives the sweep

.github/relay-cpu-bisect.md:201 still describes fuzz::ObjectBatch as "the hidden fuzz::ObjectBatch helper", while the identical sentence in bench/README.md:447 was updated to fuzz::ObjectBatch. Since the module is documented test support now, the adjective is stale in one of its two homes.

Technical details
# Stale `hidden` wording in the bench report

## Affected sites
- `.github/relay-cpu-bisect.md:201` — "through the hidden `fuzz::ObjectBatch` helper"
- `bench/README.md:447` — the same sentence, already updated

## Required outcome
- Both sites describe `fuzz::ObjectBatch` the same way.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread sh/text.sh Resolved
Comment thread rs/moq-tokio/src/sim.rs Resolved
@kixelated
kixelated added this pull request to the merge queue Nov 10, 2026

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated review by review (OpenAI)

Reviewed head: e48e10a
Incremental review since: e0c2c12
Accounted for the main merge to ac3cb8c; the substantive follow-up is the four-file fix in f8731b7.

The prior P2 is addressed: sh/text.sh:38 now matches hidden after preceding doc options, and sh/text.test.py:90 includes the reported #[doc(alias = "Old", hidden)] case. Both moq-tokio sim modules now explicitly describe their test-support stability policy.

No new actionable findings in this delta. Direction remains consistent with the recorded plan: keep test support feature-gated and documented, and enforce the ban centrally.

Limits: GitHub-only static review of the follow-up files and base-relative changes. I did not execute the gate/regression tests, Rust builds, or quest checks. This is not a fresh audit of the unchanged portions of the original PR. COMMENT only, not approval.

@pullfrog pullfrog 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.

ℹ️ No critical issues — the gate fix and sim docs land cleanly; one stale "Hidden from the docs" note is left inline.

Reviewed changes

  • doc(hidden) gate closed: the pattern is now doc[[:space:]]*\([^)]*hidden, so #[doc(alias = "Old", hidden)] fails sh/text.sh, and sh/text.test.py covers that form.
  • moq-tokio sim docs completed: both sim and quic::driver::sim now end with "It tracks the crate's internals, so it can change in any release", and sim explains that the handshake, redials, and GOAWAY handling still run as over a socket.
  • origin/main merged at ac3cb8c8; no branch-side changes beyond the above.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread rs/moq-tokio/src/lib.rs
pub mod settings;
#[cfg(all(feature = "sim", feature = "net"))]
#[doc(hidden)]
pub mod sim;

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.

sim is documented now, but rs/moq-tokio/Cargo.toml:54 still closes the sim feature note with "Hidden from the

docs." That is the one Cargo feature comment the sweep missed; moq-quic, moq-rtmp, moq-mux, moq-json, and moq-stats all dropped that clause in this PR.

Merged via the queue into main with commit 2e7067a Nov 10, 2026
8 of 10 checks passed
@kixelated
kixelated deleted the quest/m2/api-shape/doc-hidden branch November 10, 2026 03:56
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