Skip to content

RR-20: schema docs generator drift - #426

Merged
michaeljgrimm merged 1 commit into
mainfrom
codex/rr-20-schema-docs-drift
Oct 6, 2026
Merged

michaeljgrimm merged 1 commit into
mainfrom
codex/rr-20-schema-docs-drift

Conversation

@michaeljgrimm

@michaeljgrimm michaeljgrimm commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Cause

scripts/generate-schema-docs.mjs is deterministic: two runs give identical output, and $defs are listed in schema order. The committed docs were wrong in three ways:

Fix

  • The examples/markdown/ line now lives in the generator, so docs/examples.md keeps it.
  • The generator renders if/then/else requirements as a "Conditional requirement" line. For Table that is dataset, otherwise rows, which keeps what the RR-54 hand edit was trying to say.
  • docs/schema-reference.md and docs/catalog-schema-reference.md are regenerated. The schema descriptions are the source of truth, so the RR-54 hand-written summaries are replaced by their (truncated) schema text.
  • New node scripts/generate-schema-docs.mjs --check and pnpm check:schema-docs. It fails and names the stale files when a committed file differs from a fresh build (CRLF is normalized for Windows checkouts). As a check:* script it runs in pnpm test through scripts/run-checks.mjs with no checks.json entry.
  • Changelog fragment changes/rr-20-schema-docs-drift.md (packages: []).

Verification

  • check:schema-docs fails on origin/main (schema-reference.md, catalog-schema-reference.md) and passes after regenerating.
  • check:changes, check:runners and check:text pass, and run-checks.mjs --list includes check:schema-docs.

Coordination with RR-55 (#423)

#423 hand-edits both references. After this lands it should run node scripts/generate-schema-docs.mjs instead of hand-reverting:

  • The Slide.layout row in schema-reference.md comes from its schema description change, so the generator reproduces it. This PR does not touch that row.
  • The new intro paragraph in catalog-schema-reference.md (the link to finding-schema-reference.md) is generator text. It has to go into catalogReference(). If RR-55: short-verb API, one validate, Finding schema, stats (core 0.14.0, breaking) #423 adds a finding.schema.json under spec/schemas/, the generator also needs to exclude it from the catalog list, as it already excludes opf.schema.json. Otherwise check:schema-docs fails on the rebased branch.

🤖 Generated with Claude Code


Note

Low Risk
Documentation and doc-generation tooling only; no runtime schema or engine behavior changes.

Overview
RR-20 restores the schema docs as true generator output and blocks future hand-edit drift.

scripts/generate-schema-docs.mjs now documents that docs/schema-reference.md, docs/catalog-schema-reference.md, and docs/examples.md must not be edited by hand. It emits conditional requirements from JSON Schema if/then/else (e.g. Table: dataset when present, otherwise rows), moves the examples/markdown/ bullet into the generator so it is not wiped on regen, and supports --check to compare committed files to a fresh build (CRLF-normalized). Writers return in-memory content; pnpm check:schema-docs wires that into CI via package.json.

The two reference markdown files are regenerated from schemas, replacing prior manual chart/table rows and stale truncation from missed regens after description changes. A changelog fragment records the fix.

Reviewed by Cursor Bugbot for commit b907b5c. Configure here.

The generator is deterministic; the committed docs had drifted. RR-54 hand-wrote
chart and table rows in docs/schema-reference.md, RR-30 hand-added the
examples/markdown/ line to docs/examples.md, and RR-41 changed audience
descriptions without regenerating, leaving stale truncations.

- Move the examples/markdown/ line into the generator.
- Render if/then/else requirements (Table: dataset, otherwise rows) as a
  conditional requirement.
- Regenerate docs/schema-reference.md and docs/catalog-schema-reference.md.
- Add --check and pnpm check:schema-docs, which fails on drift (runs in pnpm test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 6, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 1a5e8a19-49ef-4782-99d1-2f5ced77f578)

@michaeljgrimm
michaeljgrimm added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit d6dbbdc Oct 6, 2026
15 checks passed
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