Skip to content

Add automated documentation validation to CI#734

Merged
anishnaik merged 5 commits intomasterfrom
dev/docs-check-script
Nov 26, 2025
Merged

Add automated documentation validation to CI#734
anishnaik merged 5 commits intomasterfrom
dev/docs-check-script

Conversation

@anishnaik
Copy link
Copy Markdown
Collaborator

@anishnaik anishnaik commented Nov 26, 2025

Summary

Adds automated documentation validation to prevent drift between code and documentation during PR reviews.

Changes

  • New script: scripts/check_docs.py validates:

    • CLI flags are documented in docs/src/cli/*.md
    • Cheatcodes are in interface at docs/src/cheatcodes/cheatcodes_overview.md
    • Config fields (with json tags) are documented in docs/src/project_configuration/*.md
  • CI integration: Added docs-check job to .github/workflows/ci.yml

    • Runs on PRs and master branch
    • Integrated into all-checks gate

Validation Strategy

  • Heuristic-based: No manual allowlist required
  • Smart filtering: Automatically excludes nested config structs
  • Flexible parsing: Handles JSON tag modifiers like ,omitempty
  • Simple maintenance: Regex-based parsing for easy updates

Current Status

The script currently detects 6 documentation gaps:

  • ❌ Missing label cheatcode in interface (known issue)
  • ❌ 3 CLI flags: --verbosity, --rpc-url, --rpc-block
  • ❌ 2 config fields: coverageExclusions, contractAddressOverrides

These can be fixed in follow-up PRs. The goal of this PR is to establish the validation infrastructure to prevent future drift.

Test Plan

  • Script runs successfully locally
  • Detects the known missing label cheatcode
  • Excludes nested struct fields correctly
  • CI job runs on this PR and shows errors in GitHub console

🤖 Generated with Claude Code

Implements a Python script that validates documentation sync between
code and docs by checking:
- CLI flags are documented in docs/src/cli/
- Cheatcodes are in interface at docs/src/cheatcodes/cheatcodes_overview.md
- Config fields (with json tags) are documented in docs/src/project_configuration/

Features:
- Heuristic-based exclusions (no manual allowlist)
- Automatically excludes nested config structs
- Strips JSON tag modifiers like ,omitempty
- Simple regex-based parsing for maintainability

Adds docs-check job to CI workflow that runs on PRs and master.
Currently detects 6 documentation gaps including the missing 'label' cheatcode.

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

Co-Authored-By: Claude <[email protected]>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 232 to 235
all-checks:
if: always()
needs: [lint, test, build, release]
needs: [lint, test, build, release, docs-check]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid breaking all-checks on known failing docs-check

The new docs-check job is wired into all-checks with no allowed skips, but scripts/check_docs.py currently exits non‑zero on the existing tree (e.g., missing docs for --rpc-url, --verbosity, --rpc-block, label, coverageExclusions, contractAddressOverrides). With this change, every PR and the default branch will go red until those docs are added, effectively breaking CI rather than surfacing warnings.

Useful? React with 👍 / 👎.

anishnaik and others added 4 commits November 26, 2025 16:44
Documentation fixes:
- Add label cheatcode to interface in cheatcodes_overview.md
- Document --verbosity long form in fuzz.md CLI docs
- Add --rpc-url and --rpc-block flag documentation
- Document coverageExclusions config field

Script improvements:
- Exclude fields with ,omitempty tag from validation (optional/internal fields)
- These fields are not required in user-facing documentation

All validation checks now pass (31 cheatcodes, 21 CLI flags, 44 config fields).

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

Co-Authored-By: Claude <[email protected]>
- Create docs/src/cheatcodes/label.md with description, example, and signature
- Add label entry to SUMMARY.md navigation

The label cheatcode sets a human-readable label for an address, making it
easier to identify specific contracts or accounts in execution traces and
error messages during testing.

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

Co-Authored-By: Claude <[email protected]>
@anishnaik anishnaik merged commit 0c993c4 into master Nov 26, 2025
11 checks passed
@anishnaik anishnaik deleted the dev/docs-check-script branch November 26, 2025 22:07
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