Skip to content

[doc][serve] Style pass on the Ray Serve advanced guides - #67069

Draft
dstrodtman wants to merge 4 commits into
doc-1547-serve-vale-termsfrom
doc-1547-serve-prose-advanced-guides
Draft

dstrodtman wants to merge 4 commits into
doc-1547-serve-vale-termsfrom
doc-1547-serve-prose-advanced-guides

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR is a style and grammar pass over the Ray Serve advanced guides against Ray's writing-style guide. It applies the Serve terminology from #67018, which seeds the Serve Vale rules and adds the "Writing Ray Serve docs" section to the guide.

Stacked on #67018. This PR targets that branch, so its diff shows only the prose changes. Retarget it to master once #67018 merges.

The PR covers 16 of the 18 pages under doc/source/serve/advanced-guides/. Two pages are left out because engineering PRs were rewriting them when this pass started, and a style pass would only have created conflicts:

Neither page has an open PR now, so a follow-up can cover both.

What changed

Most changes are prose: voice, tense, word choice, concision, and list and heading structure. No code and no literalinclude option changed. The only edits inside code fences are "threadpool" to "thread pool" in the text diagram in asyncio-best-practices.md, and the indentation of two bash blocks in advanced-autoscaling.md that now sit under list items.

  • Terms: generic Serve nouns are lowercase, per the new guide section ("Serve controller", "HTTP proxy", "Serve autoscaler", "deployment"). "Deployment graph" is rewritten to what each sentence means, because .bind() returns an Application. asyncio is lowercase, and brand casing is fixed for TensorFlow, GitHub, Podman, and ResNet.
  • Headings: headings are now in sentence case. Task headings are imperatives and concept headings are questions. Headings that sat inside admonitions moved out. The link text in index.md now matches each page's current title.
  • Old URL fragments still work: rewording a heading changes its section id. Each changed id now has a MyST label named after the id that docs.ray.io/en/master renders, placed directly above the new heading, so page.html#old-id links keep resolving. I checked every section id on the live pages against the new pages. Eight ids are intentionally not preserved, because the names are too generic to claim as site-wide labels: getting-started, usage, scaling-out, future-roadmap, and four *-a-deployment ids on the experimental Java page. Nothing in doc/source links to any of them.
  • Markup fixes:
    • A ::{note} ... :: in advanced-autoscaling.md rendered as literal text and split the parameter list. It's now a real note, indented under its list item.
    • Ordered lists use 1. throughout.
    • The load-test and benchmark images in advanced-autoscaling.md and custom-request-router.md have descriptive alt text.
    • The {doc} path link to the KubeRay GPU guide in multi-node-gpu-troubleshooting.md is now a {ref} to its label.
  • Factual fixes verified against source:
    • asyncio-best-practices.md: def methods in pure Serve run in a thread pool by default. RAY_SERVE_RUN_SYNC_IN_THREADPOOL defaults to "1" in python/ray/serve/_private/constants.py, since [Serve] Run sync deployment methods in a thread pool #66436. The page said they ran on the event loop unless you opted in, and its summary bullet said to "consider enabling" the flag.
    • app-builder-guide.md: Serve builds a typed builder's argument with model_validate, the Pydantic v2 API. That's python/ray/serve/_private/api.py. The page said parse_obj.
    • managing-java-deployments.md: the example passes the class name to setDeploymentDef(), not as an argument to Serve.deployment().
    • advanced-autoscaling.md: "up to six Driver deployments" now says replicas. Driver is one deployment, and the table above the sentence plots its replica count.
    • custom-request-router.md: max_ongoing_request was misspelled three times.
    • performance.md: two curly quotes inside inline code made the Python invalid.

Questions for Serve maintainers

These claims are pre-existing, and this PR doesn't change them. I'd rather ask than guess.

  1. performance.md, "Enable throughput-optimized serving" note: it says that in Ray v2.54.0 the defaults for RAY_SERVE_RUN_USER_CODE_IN_SEPARATE_THREAD and RAY_SERVE_RUN_ROUTER_IN_SEPARATE_LOOP "will change to 0." Both still default to "1" in constants.py on master, unless RAY_SERVE_THROUGHPUT_OPTIMIZED is set, and 2.59.0 has shipped. Did the flip slip, or should the note go?
  2. advanced-autoscaling.md, "How do autoscaling metrics work?": the page says replicas record metrics every 10s and push them on the RAY_SERVE_*_AUTOSCALING_METRIC_PUSH_INTERVAL_S interval. In replica.py and router.py, recording runs at min(look_back_period_s * RAY_SERVE_AUTOSCALING_METRIC_RECORD_INTERVAL_FACTOR, metrics_interval_s), which is 6s at the defaults, and pushes happen at metrics_interval_s. The same section says downscale_delay_s covers all downscaling "except" the one-to-zero transition, but the source falls back to it when downscale_to_zero_delay_s is unset.
  3. performance.md vs production-guide/config.md: this page says clients retry a request that request_timeout_s times out. config.md says Serve retries it at another replica. Which is right?
  4. inplace-updates.md: the lightweight-update and code-update field lists look incomplete. python/ray/serve/_private/config.py also marks options such as max_queued_requests, logging_config, and request_router_config as lightweight, and gang_scheduling_config as heavyweight. Should the lists be complete?
  5. grpc-guide.md: the error-code list says only the health check methods return UNAVAILABLE. grpc_util.py also maps DeploymentUnavailableError to UNAVAILABLE on regular requests. The route_prefix note also pins "As of Ray 2.7.0 ... Future releases will make it optional for gRPC." Is that still the plan? Separately, the message-size note says 100 MB for 104857600 bytes, which is 100 MiB.
  6. custom-request-router.md: the fault benchmark says it kills "the CapacityQueue router", but elsewhere CapacityQueue is the actor and CapacityQueueRouter is the router. "Higher throughput ... lower latency" also has no stated baseline in the prose, though the chart compares against the power-of-two-choices router.
  7. dyn-req-batch.md: the page refers to batching "decorators", plural, but names only @serve.batch.
  8. deployment-scoped-actors.md: the max_concurrency note says "If the actor uses threaded execution, Ray defaults max_concurrency to 1." Does "threaded" mean sync here?
  9. multi-node-gpu-troubleshooting.md: the page names aws-ofi-plugin, but the linked repository is aws-ofi-nccl.
  10. deploy-vm.md: the opening says the page shows how to update an application with the CLI, but no section covers it.
  11. advanced-autoscaling.md: the external-scaling curl example ends in a stray \ and uses /api/serve/applications/, while the scale endpoint uses /api/v1/....

Duplicate check

No open PR makes a style pass over these pages. Seven open PRs touch some of these files with feature or doc changes, mostly small edits. I included those files because the rebase is small either way: #64040, #66590, #66512, #61071, #67400, #67507, and #67724.

How this was reviewed

The pass ran in three stages, then two independent reviews:

  1. A mechanical pass applied the Vale-encoded term swaps and fixed curly quotes and brand casing.
  2. Each page got two LLM editing passes, a comprehensive prose pass and a cleanup pass. After each one, a structural check compared code-fence counts, {ref}/{py:*} targets, labels, and URLs against the page before editing.
  3. A meaning-diff review split the diff into 613 change blocks. 45 were cleared as provably cosmetic. One fresh reviewer per page checked the other 568 against the base text and the Serve source, and confirmed 3 drifts: a dropped "initially" in dyn-req-batch.md, "Prefer" firmed to "Write" in asyncio-best-practices.md, and an ambiguous "override it" in performance.md. It also showed that two counts the pass had added to inplace-updates.md made incomplete lists read as complete. All four are fixed in the second commit.
  4. A fresh-context style review of the result, by reviewers that hadn't seen the editing, produced the third commit. I left these structural suggestions for later rather than widen this PR:
    • Splitting the H5 headings under "External scaling API" in advanced-autoscaling.md.
    • Removing the H4s under the benchmark in custom-request-router.md.
    • Moving the configuration examples in gang-scheduling.md.
    • Converting .rst stub links to {py:class} roles.

Testing

vale doc/source/serve/advanced-guides/        # with the Serve rules from #67018
pre-commit run --files <changed files>
  • Vale 3.12.0: alerts on the 15 edited content pages dropped from 607 to 113, measured after the mechanical pass. Most of what remains is deliberate:
    • Passives where the page names no actor.
    • "Currently" or "yet" marking a temporary limitation.
    • Quoted error messages left verbatim.
    • Spelling hits on tool names such as grpcurl.
  • Anchors: every section id on the /en/master version of each page either still exists or is covered by a label, apart from the eight generic ids listed above. No label name is duplicated in doc/source.
  • pre-commit: passed.
  • Not run locally: the Sphinx build. Please check the RtD preview for the new labels, the stacked labels above existing ones, and the restructured admonitions in advanced-autoscaling.md and custom-request-router.md.

Prepared with AI assistance (Claude Code). Draft until the submitter has reviewed every changed line.

🤖 Generated with Claude Code

dstrodtman and others added 3 commits October 30, 2026 12:56
Edit 16 pages under doc/source/serve/advanced-guides/ against the Ray
writing-style guide and the Serve terms section. Prose only: no code
block, literalinclude, role target, or URL changes. Reworded headings
keep their old slug anchors through MyST labels. Two factual fixes are
verified against source: the RAY_SERVE_RUN_SYNC_IN_THREADPOOL default
and the max_ongoing_requests parameter name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
…s pass

A meaning-diff review of the style pass found three edits that changed
what a sentence claims, plus two counts that made incomplete lists read
as complete. Restore the original meaning for each. Also correct four
pre-existing claims that the Serve source settles, and rename four
slug-preserving labels to the section ids that docs.ray.io renders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
A fresh-context review of the advanced-guides pass flagged list lead-ins,
clause-joining colons, bold on inline code, undefined acronyms, missing
image alt text, a hardcoded docs.ray.io link, and repeated links. Fix the
ones that are guide violations and leave the structural changes for later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1547-serve-vale-terms branch from 5f9d68b to d5cc5d1 Compare October 30, 2026 16:56
@dstrodtman
dstrodtman force-pushed the doc-1547-serve-prose-advanced-guides branch from fe41edd to 1b80286 Compare October 30, 2026 16:56
## Description

**Stacked on #67069** (Serve advanced guides style pass), because both
edit `dev-workflow.md`. Merge #67069 first, then retarget this PR to
`master`.

Adds a "Write unit and integration tests" section to the Ray Serve
development workflow page. It follows the testing approach that Ray
Serve maintainers lay out in #44464 and its duplicate #34477:
- Keep business logic in a plain base class so you can unit test it
without Ray, and reach a deployment's underlying class through
`func_or_class`.
- Integration test by deploying with `serve.run`, then calling the app
through the returned `DeploymentHandle`
(`handle.method.remote(...).result()`) and over HTTP with `requests`.

The examples live in a new tested file,
`doc/source/serve/doc_code/testing_patterns.py`, which the existing
`source/serve/doc_code/**/*.py` glob in `doc/BUILD.bazel` already picks
up. FastAPI's `TestClient` is left out, because the issue says it's
untested with Serve. The `serve.status()` polling pattern is covered
separately by #65868 in the contributor guide.

Sources: #44464 and #34477, `python/ray/serve/deployment.py`
(`func_or_class`), `python/ray/serve/api.py` (`serve.run` returns a
`DeploymentHandle`), `python/ray/serve/handle.py`
(`DeploymentResponse.result()`).

## Related issues

Closes #44464

## Review notes

- The snippets show `from summarizer import ...`. The test file makes
that import work by registering `sys.modules["summarizer"]` outside the
include markers. Is that acceptable, or should the snippets drop the
import lines?
- The test target binds port 8000, and the serve `doc_code` targets are
tagged `exclusive`.

## Not a duplicate

`gh pr list --state open --search "44464 in:body"` returns nothing.
#65868 is related but documents a different pattern.

## Testing

- `python doc/source/serve/doc_code/testing_patterns.py` with
`ray[serve]==2.59.0`: 4 passed (`test_doubler_class`,
`test_summarize_truncates_text`, `test_summarize_with_handle`,
`test_summarize_with_http`).
- `make -C doc rtd-build`: `build succeeded.` with exit code 0 and no
Sphinx warnings.
- Vale on `dev-workflow.md`: no errors. `ruff check` on the new file:
clean.

## AI assistance

Drafted with AI assistance (Claude Code). The API usage was checked
against the Serve source and the example was run locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Nov 20, 2026

This branch has not been deployed

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

Labels

stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant