Replace fabricated code samples in docs with links to actual source files#1216
Conversation
…iles The documentation had many code examples that were written by hand and didn't match the actual API, leading to constantly incorrect docs. Replace them with GitHub links to real example files, test suites, and config files that are compiled/tested and stay up to date. Files updated: doc/js/@moq/lite.md, doc/js/@moq/token.md, doc/js/index.md, doc/rs/crate/hang.md, doc/rs/crate/libmoq.md, doc/rs/crate/moq-lite.md, doc/rs/crate/moq-mux.md, doc/rs/crate/moq-token.md, doc/rs/crate/web-transport.md, doc/app/relay/auth.md, doc/app/relay/config.md https://claude.ai/code/session_012bjdV8HhxAUCenrhVBELw5
…tion Create two working examples: - basic.rs: symmetric HMAC key, sign/verify, key round-trip - asymmetric.rs: ECDSA key pair, public key extraction, sign/verify Update docs to link to these new examples instead of the test suite. https://claude.ai/code/session_012bjdV8HhxAUCenrhVBELw5
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe pull request refactors documentation by replacing many inline code and TOML examples with links to external example files (primarily under 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
rs/moq-token/examples/asymmetric.rs (1)
9-9: Align binary error type with repo convention (anyhow::Result).Line 9 should use
anyhow::Result<()>for consistency with other binaries/examples.♻️ Proposed fix
-fn main() -> moq_token::Result<()> { +fn main() -> anyhow::Result<()> {As per coding guidelines
**/*.rs: "Usethiserrorwith#[from]for library crates,anyhowfor binaries."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@rs/moq-token/examples/asymmetric.rs` at line 9, Change the binary's main signature from moq_token::Result<()> to anyhow::Result<()> by updating fn main() -> moq_token::Result<()> to fn main() -> anyhow::Result<()> and ensure anyhow is available (add anyhow to Cargo.toml dependencies if missing); update any local use statements if you prefer a type alias (e.g., add use anyhow::Result;) so the example binary follows the repo convention.doc/rs/crate/moq-token.md (1)
148-148: Add one concrete JWKS expectation in this section.After removing the inline sample, this is a bit underspecified. Add a short sentence clarifying the relay expects a JWKS JSON endpoint (and that keys are selected by
kid) to keep setup unambiguous.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@doc/rs/crate/moq-token.md` at line 148, Clarify that the relay expects a JWKS JSON endpoint that serves a JWK Set (JSON with a "keys" array) and that the relay selects the verification key by matching the token's "kid" to an entry in that array; update the sentence near the existing mention of "host a JWK set and configure the relay to fetch keys from a URL" to state this explicitly and reference key selection by "kid" so readers know the endpoint format and selection mechanism.doc/app/relay/auth.md (1)
171-174: Prefer version-stable repo-relative links overblob/mainURLs.These links will always resolve to the latest
main, which can drift from the doc version being viewed. Prefer repo-relative/internal doc links so examples stay version-aligned with the page.Suggested direction
-- **Development** - [`demo/relay/root.toml`](https://github.com/moq-dev/moq/blob/main/demo/relay/root.toml) +- **Development** - [`demo/relay/root.toml`](/demo/relay/root.toml) -- [`rs/moq-token/examples/basic.rs`](https://github.com/moq-dev/moq/blob/main/rs/moq-token/examples/basic.rs) +- [`rs/moq-token/examples/basic.rs`](/rs/moq-token/examples/basic.rs)Also applies to: 180-185
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@doc/app/relay/auth.md` around lines 171 - 174, Replace the absolute blob/main GitHub URLs in doc/app/relay/auth.md with repo-relative links so they remain version-stable; specifically update the two links to demo/relay/root.toml and demo/relay/prod.toml to use repository-relative paths (e.g., /moq/tree/<path> or just the relative path within the repo/docs system) instead of https://github.com/.../blob/main/... and apply the same change for the other occurrences mentioned (lines ~180-185) so examples stay aligned with the doc version.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@doc/js/`@moq/lite.md:
- Line 53: The wording incorrectly states that named streams (tracks) are
"created via `subscribe`"; update the sentence in doc/js/@moq/lite.md so it
clarifies that tracks are created/published by the publisher (e.g., via the
publish/create API) and are consumed by subscribers using `subscribe` — replace
"created via `subscribe`" with phrasing like "published by the publisher and
consumed via `subscribe`" and mention `subscribe` only as the consumer-side
operation.
---
Nitpick comments:
In `@doc/app/relay/auth.md`:
- Around line 171-174: Replace the absolute blob/main GitHub URLs in
doc/app/relay/auth.md with repo-relative links so they remain version-stable;
specifically update the two links to demo/relay/root.toml and
demo/relay/prod.toml to use repository-relative paths (e.g., /moq/tree/<path> or
just the relative path within the repo/docs system) instead of
https://github.com/.../blob/main/... and apply the same change for the other
occurrences mentioned (lines ~180-185) so examples stay aligned with the doc
version.
In `@doc/rs/crate/moq-token.md`:
- Line 148: Clarify that the relay expects a JWKS JSON endpoint that serves a
JWK Set (JSON with a "keys" array) and that the relay selects the verification
key by matching the token's "kid" to an entry in that array; update the sentence
near the existing mention of "host a JWK set and configure the relay to fetch
keys from a URL" to state this explicitly and reference key selection by "kid"
so readers know the endpoint format and selection mechanism.
In `@rs/moq-token/examples/asymmetric.rs`:
- Line 9: Change the binary's main signature from moq_token::Result<()> to
anyhow::Result<()> by updating fn main() -> moq_token::Result<()> to fn main()
-> anyhow::Result<()> and ensure anyhow is available (add anyhow to Cargo.toml
dependencies if missing); update any local use statements if you prefer a type
alias (e.g., add use anyhow::Result;) so the example binary follows the repo
convention.
🪄 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: b48485b5-d68a-44e1-a469-ceb99c22b8e2
📒 Files selected for processing (13)
doc/app/relay/auth.mddoc/app/relay/config.mddoc/js/@moq/lite.mddoc/js/@moq/token.mddoc/js/index.mddoc/rs/crate/hang.mddoc/rs/crate/libmoq.mddoc/rs/crate/moq-lite.mddoc/rs/crate/moq-mux.mddoc/rs/crate/moq-token.mddoc/rs/crate/web-transport.mdrs/moq-token/examples/asymmetric.rsrs/moq-token/examples/basic.rs
- Fix @moq/lite.md: clarify tracks are "published by the producer and
consumed via subscribe" instead of "created via subscribe"
- Fix moq-token.md: replace vague JWKS wording with accurate description
of key_dir resolving individual {kid}.jwk files
- Fix examples: use anyhow::Result<()> per repo convention for binaries,
add anyhow dev-dependency to moq-token
Skipped auth.md relative URL nitpick: the doc site (VitePress) cannot
serve files outside doc/, so GitHub URLs are the correct approach for
linking to source files like demo/relay/*.toml.
https://claude.ai/code/session_012bjdV8HhxAUCenrhVBELw5
The documentation had many code examples that were written by hand and
didn't match the actual API, leading to constantly incorrect docs.
Replace them with GitHub links to real example files, test suites, and
config files that are compiled/tested and stay up to date.
Files updated: doc/js/@moq/lite.md, doc/js/@moq/token.md, doc/js/index.md,
doc/rs/crate/hang.md, doc/rs/crate/libmoq.md, doc/rs/crate/moq-lite.md,
doc/rs/crate/moq-mux.md, doc/rs/crate/moq-token.md,
doc/rs/crate/web-transport.md, doc/app/relay/auth.md,
doc/app/relay/config.md
https://claude.ai/code/session_012bjdV8HhxAUCenrhVBELw5