Skip to content

feat(docs-ci): validate docs config examples against the schema - #121336

Merged
steipete merged 10 commits into
mainfrom
claude/vigilant-goodall-3cbb1a
Aug 10, 2026
Merged

steipete merged 10 commits into
mainfrom
claude/vigilant-goodall-3cbb1a

Conversation

@steipete

@steipete steipete commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A docs audit found the dominant docs-drift class is JSON5 config examples in docs/** teaching keys the strict config schema rejects — it recurs every time a config key is retired, because nothing validated docs config fences against the schema. This PR adds a permanent CI gate and fixes all current drift (~130 findings across ~80 docs pages) so the gate starts green.

Why This Change Was Made

Docs are product surface: a competent operator copying a documented example must end with a config the gateway accepts. The gate keeps docs/** and src/config/dead-config-keys.test.ts in lockstep permanently instead of relying on periodic audits.

Design:

  • Core auditor src/config/docs-config-examples.ts (precedent: src/config/doc-baseline.ts): scans docs/**/*.md(x) fences with language json5/json/jsonc, JSON5-parses them, and validates whole-document candidates via validateConfigObjectRawWithPlugins({ validateBundledChannels: true }) against one source-checkout plugin metadata snapshot per audit. Findings are restricted to unrecognized-key issues — placeholder values never false-positive.
  • Whole-document heuristic: a strict majority of top-level keys must be recognized root config keys (schema-shape introspection). This keeps manifests, protocol payloads, policy.jsonc, and fragments out of scope (~2550 of ~3460 fences skipped).
  • $include keys are dropped recursively before validation, mirroring src/config/includes.ts resolution order, so include-demo fences stay validated for their other keys.
  • Opt-out: validate=false in the fence info string for deliberately partial/legacy/non-openclaw.json fences; 5 annotations total, each a genuinely non-config document (ACPX config, policy.jsonc, two gateway protocol payloads, one intentionally rejected legacy shape). Documented in docs/AGENTS.md.
  • Dual CI wiring, because run_check_docs only fires on docs changes: pnpm docs:check-config-examples (new, appended to check:docs) covers docs-only PRs, and the colocated lockstep test in src/config/docs-config-examples.test.ts is selected by change classification when src/config changes — so retiring a config key fails PR CI even with no docs edit. Together there is no classification gap.

Docs fixes by cluster: retired agents.list → canonical agents.entries roster (~27 pages); env.<KEY> → env.vars.<KEY> (~15 provider pages, root env is strict); agents.defaults.*GenerationModel and tools.media.*.models → agents.defaults.mediaModels.* (~14 pages); agents.defaults.promptOverlays.gpt5.personality → plugin-owned plugins.entries.openai.config.personality with corrected behavior prose; plus the long tail (browser.*.color, channel retry blocks, messages.queue.debounceMs → messages.inbound.debounceMs, slack.identity → postAs, hostnameAllowlist → allowedHostnames, pdfMaxBytesMb → pdfMaxMb, tools.exec.timeoutSec → timeoutSeconds, retired commands.ownerDisplay*/useAccessGroups, discovery.wideArea.enabled, messages.tts, twitch/whatsapp/zalouser shapes, bootstrapPromptTruncationWarning now built-in). Surrounding prose updated with the fences.

Production LOC: +377/−6 (net +371); tests +150/−2; docs net −28. The plugin schema baseline remains below current main (4053 → 4040) while exposing runtime-owned config and preserving Voice Call's shipped aliases; no new runtime option or default is introduced.

Overlap note: open contributor PRs #114593 (cacheTrace docs) and #114610 (hostnameAllowlist docs) address subsets of this drift; their target lines are fixed here as part of the sweep. Maintainer will resolve/credit those separately.

User Impact

Operators copying any whole-config example from the docs now get config the strict schema accepts. Docs authors get a clear contract: config fences are validated in CI; deliberately partial snippets annotate validate=false.

Evidence

  • Before: node scripts/check-docs-config-examples.mjs reported ~130 unrecognized-key findings across ~80 pages (full inventory in the check output; docs_config_fences_validated=912).
  • After: exit 0 — docs_config_files_scanned=763, docs_config_fences_seen=4556, docs_config_fences_validated=1165, 5 opt-outs.
  • Plugin-aware follow-up: the audit exposed five manifest-metadata gaps, all repaired at their owners (Voice Call canonical TTS speaker keys and agentId; Ollama webSearch.baseUrl).
  • Indented-fence coverage: the scanner now accepts arbitrary MDX component indentation and closes on the same fence character at the opening length or longer. This exposed and repaired docs/providers/anthropic.md's retired agents.list example plus 38 other nested examples.
  • ClawSweeper findings: voice and voiceId are restored beside canonical speakerVoice/speakerVoiceId in every Voice Call TTS provider schema, matching shipped runtime compatibility; the duplicate top-level agentId metadata/schema entry is removed. Retiring the aliases remains a future Voice Call doctor-migration task, not part of this PR.
  • The reported roster-gate symptom was real, but the mechanism was four-space MDX fence indentation rather than migration bypass. The existing raw + plugin-aware validator pair catches visible retired roster keys; the indentation repair closes the remaining gap.
  • Latest ClawSweeper P1 resolved: bundled plugin manifest changes now preserve their extension test target and additionally route src/config/docs-config-examples.test.ts, so schema-only manifest PRs exercise the docs audit even without a docs edit. The changed-target routing suite passes 85/85 on the final landing base.
  • Red-main lint: the required rebase brought 72c4f26a4eaa78, which independently removed the unused applySessionHints import while preserving the mock-factory key. Targeted oxlint passes on the rebased file.
  • Injected-drift demo: changing the documented OpenAI plugin key to personalityy fails with docs/gateway/config-agents.md:501 :: plugins.entries.openai.config :: invalid config: must not have additional properties: "personalityy"; reverting restores green.
  • node scripts/run-vitest.mjs src/config/docs-config-examples.test.ts: 14/14 passed, including the pre-fix failing indented Accordion fence, a longer closing fence, unsupported/supported OpenAI plugin config, and bundled-channel forwarding.
  • node scripts/run-vitest.mjs src/config/config.plugin-validation.test.ts: 82/82 passed after aligning the Voice Call manifest fixture with canonical speakerVoice.
  • pnpm config:docs:check passed with the plugin baseline ratcheted from 4053 → 4040 after current-main regeneration; targeted oxfmt/oxlint and git diff --check passed.
  • pnpm plugin-sdk:api:check passed on Linux Node 24 Testbox (run 31353580043); the generated API baseline is folded into the same feat commit.
  • pnpm lint:docs (755 files, 0 issues), node scripts/check-docs-mdx.mjs docs README.md passed (770 files), oxlint/oxfmt clean on touched files, git diff --check clean.
  • Fresh full-branch Codex autoreview against current origin/main: clean, "patch is correct" (0.99).
  • Replacement keys verified against the current schema; the lockstep test structurally guarantees every rewritten fence validates.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 10, 2026 01:47
@steipete
steipete requested a review from a team as a code owner August 10, 2026 01:47
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: slack Channel integration: slack channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser gateway Gateway runtime security Security documentation scripts Repository scripts docker Docker and sandbox tooling channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch extensions: codex plugin: bonjour Plugin integration: bonjour extensions: tts-local-cli plugin: azure-speech Azure Speech plugin extensions: cerebras extensions: deepinfra plugin: file-transfer extensions: policy plugin: pixverse extensions: meta Extension: meta extensions: baseten Extension: baseten channel: buzz extensions: fish-audio Extension: fish-audio size: M maintainer Maintainer-authored PR labels Aug 10, 2026
@steipete
steipete force-pushed the claude/vigilant-goodall-3cbb1a branch 4 times, most recently from c336af7 to 6db4d73 Compare August 10, 2026 04:36
@steipete steipete closed this Aug 10, 2026
@steipete steipete reopened this Aug 10, 2026
@steipete
steipete force-pushed the claude/vigilant-goodall-3cbb1a branch 3 times, most recently from 2d30962 to 760faa2 Compare August 10, 2026 05:34
@steipete
steipete force-pushed the claude/vigilant-goodall-3cbb1a branch 2 times, most recently from 6283a26 to e199a66 Compare August 10, 2026 06:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: discord Channel integration: discord channel: slack Channel integration: slack channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalouser Channel integration: zalouser docs Improvements or additions to documentation extensions: anthropic extensions: baseten Extension: baseten extensions: cerebras extensions: deepgram extensions: deepinfra extensions: fish-audio Extension: fish-audio extensions: groq extensions: meta Extension: meta extensions: ollama extensions: openai extensions: policy extensions: runway extensions: senseaudio extensions: tts-local-cli gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P1 High-priority user-facing bug, regression, or broken workflow. plugin: azure-speech Azure Speech plugin rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security Security documentation size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant