Skip to content

chore(docs): massive docs refactor for QA - #230

Merged
ayushag-nv merged 3 commits into
mainfrom
ayushag/docs-refactor-should-be-final
Jul 31, 2026
Merged

chore(docs): massive docs refactor for QA#230
ayushag-nv merged 3 commits into
mainfrom
ayushag/docs-refactor-should-be-final

Conversation

@ayushag-nv

@ayushag-nv ayushag-nv commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

Reworked docs with libsy and rust server

Why

The motivation — what problem does this solve, or which ticket does it close?

Closes #

How tested

  • uv run ruff check . clean
  • uv run mypy switchyard clean
  • uv run pytest tests/ green
  • Manual smoke (describe what was run)

Checklist

  • One class per file; filename = snake_case of the primary class.
  • New public symbols exported from switchyard/__init__.py.__all__ if intended for downstream use.
  • Unit tests added for new components / bug fixes.
  • README / --help updated if customer-facing surface changed.
  • Commits signed off (Signed-off-by: Your Name <email>) per the DCO.

Notes for reviewers

Anything reviewers should pay extra attention to — risky paths, follow-up tickets, intentional trade-offs.

Summary by CodeRabbit

  • Documentation

    • Reorganized the README and documentation around launcher, standalone server, and library workflows.
    • Added comprehensive installation, configuration, startup, validation, routing, TOML schema, and CLI guidance.
    • Updated architecture and routing documentation for native Rust deployments and TOML configuration.
    • Documented context-overflow handling, subagent routing, telemetry opt-out, and supported protocol formats.
    • Removed outdated sticky-routing and legacy Python/YAML guidance.
  • Tests

    • Expanded documentation checks for command coverage, section ordering, current workflows, and server options.

Relates to SWITCH-1134

Signed-off-by: ayushag <ayushag@nvidia.com>
@ayushag-nv
ayushag-nv requested a review from a team as a code owner July 31, 2026 17:14
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-230/

Built to branch gh-pages at 2026-07-31 18:49 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Comment thread docs/operations/context_window.md
Comment thread docs/operations/context_window.md Outdated
Signed-off-by: ayushag <ayushag@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR updates project and documentation pages for native Rust launcher and server workflows. It adds TOML deployment and routing references, revises operational guidance, removes obsolete sticky-routing documentation, updates navigation, and expands documentation drift tests.

Changes

Native Rust deployment documentation

Layer / File(s) Summary
Runtime model and documentation structure
AGENTS.md, README.md, docs/core_concepts.md, docs/index.md
Documents Rust runtime surfaces, normalized protocol flow, supported API formats, deployment concepts, and updated navigation.
Launcher and server onboarding
README.md, docs/cli_reference.md, docs/getting_started.md, tests/getting_started/*, tests/readme/*, tests/test_cli_reference_docs.py
Documents launcher and standalone server setup, build, validation, startup, health checks, and CLI options. Tests validate section order, current commands, and server help flags.
TOML deployment schema
docs/reference/toml_schema.md
Documents clients, targets, routes, algorithm settings, defaults, validation, and unknown-key behavior.
Routing algorithm guidance
docs/architecture.md, docs/routing_algorithms/*, mkdocs.yml
Updates protocol translation, TOML routing configuration, classifier and escalation behavior, direct and random routes, and reference navigation. Removes the Sticky Routing page from navigation.
Operational routing behavior
docs/operations/context_window.md, docs/internal/subagent_override.md
Documents context-overflow failover, session persistence, terminal errors, and optional subagent-target routing.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Poem

A rabbit hops through TOML rows,
Past launch commands where Rust now grows.
Routes choose weak or strong with care,
Context overflow finds paths elsewhere.
Docs bloom fresh in every burrow.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title identifies a documentation refactor but uses vague wording and does not state the primary documentation scope. Replace “massive docs refactor for QA” with a specific summary, such as “docs: update native Rust deployment and routing documentation”.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (3)
tests/test_cli_reference_docs.py (1)

55-70: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Bound the Cargo subprocess duration.

cargo run can wait on dependency or toolchain resolution. Without a timeout, a stalled Cargo process can hang the pytest run. Set a CI-appropriate timeout.

Proposed fix
         text=True,
         check=False,
+        timeout=300,
     )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_cli_reference_docs.py` around lines 55 - 70, Set a CI-appropriate
timeout on the subprocess.run invocation that executes cargo run in the CLI
reference test, while preserving its existing command, working directory, output
capture, text mode, and check behavior.
tests/getting_started/test_getting_started.py (2)

15-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover every documented launcher agent.

docs/getting_started.md documents claude, codex, and openclaw in Lines [46-53], but this test checks only Claude. Add assertions for the Codex and OpenClaw examples.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/getting_started/test_getting_started.py` around lines 15 - 18, Extend
the getting-started guide assertions in the test around the existing Claude
launcher check to also verify the documented Codex and OpenClaw launcher command
examples, preserving the current assertions for Claude and the other setup
commands.

10-12: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Make Markdown decoding deterministic in all drift tests.

Pass encoding="utf-8" to all six read_text() calls in the three test files, including lines 47 and 73 of tests/test_cli_reference_docs.py.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/getting_started/test_getting_started.py` around lines 10 - 12, Make
Markdown decoding deterministic by passing encoding="utf-8" to every read_text()
call in tests/getting_started/test_getting_started.py (lines 10-12),
tests/readme/test_readme.py (line 10), and tests/test_cli_reference_docs.py
(lines 34, 47, and 73). Update all six calls without changing their existing
path or validation behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/internal/subagent_override.md`:
- Around line 45-49: Update the trusted-ingress header handling described in the
x-switchyard-is-subagent routing flow so this client-controlled header is
stripped before routing, or honored only when supplied by authenticated trusted
callers. Preserve the existing true-to-subagent_target and
false-to-normal-routing behavior for permitted trusted inputs, while preventing
untrusted inbound requests from influencing routing.

In `@docs/operations/context_window.md`:
- Around line 54-63: Update the “Evictions last for the session” section to
document how clients recover after truncating or resetting context: instruct
them to rotate the session ID, or explicitly state that evictions remain
permanent when the ID is reused. Keep the existing session-header behavior and
no-header behavior unchanged.

In `@docs/reference/toml_schema.md`:
- Around line 88-92: Update the weights entry in the schema table to state that
all weights must be finite and non-negative, with at least one positive value,
and document that invalid weights are rejected during validation.
- Around line 183-224: Clarify the Validation and Errors documentation that
deserialization failures from toml::from_str are prefixed with “failed to parse
TOML:”, while config.build() validation errors are returned with their inner
messages unchanged. Update the error-format description or examples so the two
error classes are explicitly distinguished.
- Around line 80-82: Expand the `noop` section in the TOML schema documentation
to describe its runtime response and intended use, or explicitly label it as an
internal route if it is not supported for external use. Keep the existing
accepted-key definition and ensure the documented behavior matches the
implementation.

In `@docs/routing_algorithms/escalation_router_routing.md`:
- Around line 48-49: Update the ignored-settings list in the escalation routing
documentation to also include message_hash_fallback and the route-level
recent_turn_window, alongside the existing min_confidence,
capability_elevated_floor, and session_affinity entries. Preserve the note that
base_threshold remains required.

In `@docs/routing_algorithms/llm_classifier_routing.md`:
- Around line 39-40: Update the routing example and the message_hash_fallback
documentation to warn that deriving affinity from the first user-message text
can collide across independent sessions with repeated prompts. Prefer adding
explicit session IDs to the primary example; otherwise clearly label
message_hash_fallback as best-effort and unsuitable for repeated prompts.

In `@docs/routing_algorithms/overview.md`:
- Around line 133-134: Update the routing overview’s TOML schema reference link
to point to the public reference page at ../reference/toml_schema.md, making
that generated documentation the authoritative source for the complete schema
and route options.

In `@README.md`:
- Around line 110-111: Update the client-format description in the README to
state that the server accepts OpenAI Chat Completions, OpenAI Responses, and
Anthropic Messages formats, while each configured LLM client selects exactly one
upstream format. Remove wording that implies every upstream client supports all
three formats.

In `@tests/getting_started/test_getting_started.py`:
- Around line 30-31: Remove both future-work TODO comments from
tests/getting_started/test_getting_started.py lines 30-31 and
tests/readme/test_readme.py lines 26-27, unless implementing the requested
Python snippet and TOML schema coverage there. Do not replace them with
additional future-work comments.

---

Nitpick comments:
In `@tests/getting_started/test_getting_started.py`:
- Around line 15-18: Extend the getting-started guide assertions in the test
around the existing Claude launcher check to also verify the documented Codex
and OpenClaw launcher command examples, preserving the current assertions for
Claude and the other setup commands.
- Around line 10-12: Make Markdown decoding deterministic by passing
encoding="utf-8" to every read_text() call in
tests/getting_started/test_getting_started.py (lines 10-12),
tests/readme/test_readme.py (line 10), and tests/test_cli_reference_docs.py
(lines 34, 47, and 73). Update all six calls without changing their existing
path or validation behavior.

In `@tests/test_cli_reference_docs.py`:
- Around line 55-70: Set a CI-appropriate timeout on the subprocess.run
invocation that executes cargo run in the CLI reference test, while preserving
its existing command, working directory, output capture, text mode, and check
behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5ccc7f60-7260-4fdb-a991-6db013e2dbf0

📥 Commits

Reviewing files that changed from the base of the PR and between c5041dd and 001cea6.

📒 Files selected for processing (19)
  • AGENTS.md
  • README.md
  • docs/architecture.md
  • docs/cli_reference.md
  • docs/core_concepts.md
  • docs/getting_started.md
  • docs/index.md
  • docs/internal/subagent_override.md
  • docs/operations/context_window.md
  • docs/reference/toml_schema.md
  • docs/routing_algorithms/escalation_router_routing.md
  • docs/routing_algorithms/llm_classifier_routing.md
  • docs/routing_algorithms/overview.md
  • docs/routing_algorithms/random_routing.md
  • docs/routing_algorithms/sticky_routing.md
  • mkdocs.yml
  • tests/getting_started/test_getting_started.py
  • tests/readme/test_readme.py
  • tests/test_cli_reference_docs.py
💤 Files with no reviewable changes (1)
  • docs/routing_algorithms/sticky_routing.md

Comment thread docs/internal/subagent_override.md
Comment thread docs/operations/context_window.md Outdated
Comment thread docs/reference/toml_schema.md Outdated
Comment thread docs/reference/toml_schema.md Outdated
Comment thread docs/reference/toml_schema.md Outdated
Comment thread docs/routing_algorithms/escalation_router_routing.md
Comment thread docs/routing_algorithms/llm_classifier_routing.md
Comment thread docs/routing_algorithms/overview.md Outdated
Comment thread README.md Outdated
Comment thread tests/getting_started/test_getting_started.py
@linj-glitch

Copy link
Copy Markdown
Contributor

docs/routing_algorithms/escalation_router_routing.md — one logical issue in the "When not to use" section:

"Traffic without session identity. With confirmations above 1, the route cannot accumulate a streak and never latches."

This implies confirmations = 1 works fine without a session. It doesn't. Without a session the streak is ephemeral (reset every request), so the latch never persists regardless of the confirmations value. With confirmations = 1, the route does escalate on any turn the judge fires on (within that single turn), but it re-evaluates efficient + judge every subsequent turn — there's no skip-judge benefit. The "when not to use" bullet should say this applies to any confirmations value, not just > 1.

Everything else I checked (default values, streak reset-on-decline / hold-on-failure, cost at the confirming turn, flowchart) matches the current implementation.

Signed-off-by: ayushag <ayushag@nvidia.com>
@ayushag-nv
ayushag-nv enabled auto-merge (squash) July 31, 2026 19:09
@ayushag-nv
ayushag-nv merged commit d676965 into main Jul 31, 2026
20 checks passed
@ayushag-nv
ayushag-nv deleted the ayushag/docs-refactor-should-be-final branch July 31, 2026 19:26
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.

3 participants