Skip to content

[2.0] Generate docs/schema-reference.md from the config dataclasses - #388

Closed
ishandhanani wants to merge 2 commits into
idhanani/srt2-02-examples-matrixfrom
idhanani/srt2-03-schema-docs
Closed

ishandhanani wants to merge 2 commits into
idhanani/srt2-02-examples-matrixfrom
idhanani/srt2-03-schema-docs

Conversation

@ishandhanani

Copy link
Copy Markdown
Collaborator

Summary

Third PR of the 2.0 stack (plan: #385, Track 1 item 2). Stacked on #387; the diff against that branch is what to review.

docs/config-reference.md is hand-written prose and drifts from the schema (the power docs merged last week already reference a telemetry.provider field that #317 removed). This adds a generated, CI-checked field-level reference so keys, types, and defaults live in the code.

  • src/srtctl/core/schema_docs.py walks the dataclass tree rooted at SrtConfig, the four backend types, and ClusterConfig, and renders one Markdown table per dataclass: YAML key (honoring marshmallow data_key, so gpus_per_prefill rather than _explicit_gpus_per_prefill), type (nested dataclasses linked, Literals expanded), default, and a description taken from the class docstring Attributes: block or the # comment on the field.
  • srtctl schema-docs writes docs/schema-reference.md (562 lines, 38 sections). srtctl schema-docs --check exits 1 when the checked-in file is stale.
  • Enforcement in three places: a CI lint step, make schema-docs-check (part of make check), and tests/test_schema_docs.py::test_checked_in_schema_reference_is_current.
  • docs/config-reference.md now points at the generated file as authoritative for keys, types, and defaults; SUMMARY.md links it; CLAUDE.md tells contributors to regenerate after any schema change and where to put field descriptions so they land in the table.

Validation

  • ruff, ruff format --check, and ty clean on the new module
  • tests/test_schema_docs.py (9 tests: drift check, determinism, data_key handling, docstring and comment descriptions, backend and cluster sections, CLI write/check/stale)
  • srtctl schema-docs --check passes on the committed file

Stack

  1. [2.0] Remove the --bash direct-host execution path #386 remove --bash
  2. [2.0] Replace the recipes archive with a curated examples matrix #387 examples matrix
  3. this PR schema-generated reference

docs/config-reference.md is hand-written prose and drifts from the schema
(the power docs merged last week already reference a field that #317
removed). This adds a generated, CI-checked field-level reference so the
truth lives in the code.

- src/srtctl/core/schema_docs.py walks the dataclass tree rooted at
  SrtConfig plus the four backend types and ClusterConfig, and renders one
  Markdown table per dataclass: YAML key (honoring marshmallow data_key),
  type (nested dataclasses linked, Literals expanded), default, and a
  description taken from the class docstring `Attributes:` block or the
  comment on the field.
- `srtctl schema-docs` writes docs/schema-reference.md; `--check` exits 1
  when the checked-in file is stale. `make schema-docs-check` and a CI
  lint step run the check; tests/test_schema_docs.py enforces it in the
  test suite too and covers the renderer and the CLI.
- docs/config-reference.md points at the generated file as authoritative
  for keys, types, and defaults; SUMMARY.md links it; CLAUDE.md tells
  contributors to regenerate after any schema change.

Part of the 2.0 plan: #385
@ishandhanani

Copy link
Copy Markdown
Collaborator Author

Consolidated into #407, which carries these same commits as one PR against main (this description is reproduced there as one of its parts). Closing to keep review in one place; the branch stays for per-step reference via stack #398.

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