Skip to content

feat: config docs generator #6171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 19, 2025

Conversation

Jiloc
Copy link
Contributor

@Jiloc Jiloc commented Jun 3, 2025

Description

Dpn't be too scared! Many of the line changes are due to the final Markdown, the updated comments (already in review in #6168) and the tests!

This PR introduces a new workspace member, config-docs-generator, a tool designed to automatically generate Markdown documentation for Stacks node TOML configuration options. The documentation is extracted directly from Rust source code comments, primarily from stackslib/src/config/mod.rs and other specified locations.

The config-docs-generator consists of two main binaries:

  1. extract-docs: This binary uses cargo +nightly rustdoc --output-format json to generate documentation in JSON format. It then parses this JSON to extract structured documentation for specified configuration structs, including descriptions, default values (resolving constant references across crates), notes, deprecation messages, and TOML examples.
  2. generate-markdown: This binary takes the JSON output from extract-docs and converts it into a comprehensive Markdown file (docs/generated/configuration-reference.md), complete with a table of contents and cross-references.

A shell script, contrib/tools/config-docs-generator/generate-config-docs.sh, orchestrates the building of these tools and the entire documentation generation pipeline.

A Dockerfile builds the config-docs-generator tools and sets its entrypoint to generate-config-docs.sh. This allows for generating configuration documentation in a consistent, containerized environment.

Applicable issues

Additional info (benefits, drawbacks, caveats)

Benefits:

  • Ensures configuration documentation is always up-to-date and directly reflects the source code, reducing the likelihood of documentation drift.
  • Automates the documentation process, reducing manual effort in maintaining it.
  • Provides users with a clear, consistent, and comprehensive reference for all node configuration options.

Drawbacks/Caveats:

  • The extract-docs tool relies on the nightly rustdoc JSON output format (-Z unstable-options --output-format json)

Checklist

  • Test coverage for new or modified code paths
  • Changelog is updated
  • Required documentation changes (e.g., docs/rpc/openapi.yaml and rpc-endpoints.md for v2 endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo
  • New integration test(s) added to bitcoin-tests.yml

@Jiloc Jiloc requested review from a team as code owners June 3, 2025 21:31
@Jiloc Jiloc self-assigned this Jun 3, 2025
@Jiloc Jiloc added this to sBTC Jun 3, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in sBTC Jun 3, 2025
@wileyj wileyj mentioned this pull request Jun 3, 2025
5 tasks
@Jiloc Jiloc requested review from wileyj and fdefelici June 3, 2025 22:11
@Jiloc Jiloc moved this from Needs Triage to In Review in sBTC Jun 3, 2025
@Jiloc Jiloc added this to the 3.1.0.0.12 milestone Jun 3, 2025
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 99.46588% with 9 lines in your changes missing coverage. Please review.

Project coverage is 83.70%. Comparing base (28fc444) to head (826c7cc).
Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
...ols/config-docs-generator/src/generate_markdown.rs 99.12% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6171      +/-   ##
===========================================
+ Coverage    83.42%   83.70%   +0.27%     
===========================================
  Files          546      549       +3     
  Lines       392583   396519    +3936     
  Branches       323      323              
===========================================
+ Hits        327531   331901    +4370     
+ Misses       65044    64610     -434     
  Partials         8        8              
Files with missing lines Coverage Δ
...ib/tools/config-docs-generator/src/extract_docs.rs 96.00% <ø> (ø)
...b/tools/config-docs-generator/tests/integration.rs 100.00% <100.00%> (ø)
...ols/config-docs-generator/src/generate_markdown.rs 99.12% <99.12%> (ø)

... and 52 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28fc444...826c7cc. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aldur aldur requested a review from rdeioris June 4, 2025 14:44
@rdeioris
Copy link
Contributor

rdeioris commented Jun 5, 2025

I definitely love it, I would just make it less "hardcoded" (see my comments)

Copy link
Collaborator

@wileyj wileyj left a comment

Choose a reason for hiding this comment

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

some structure changes are needed - duplicate changes as #6168, and the produced markdown sholdn't be commited (but should be auto-generated)

@github-project-automation github-project-automation bot moved this from In Review to In Progress in sBTC Jun 6, 2025
@aldur aldur requested review from wileyj and fdefelici June 12, 2025 14:53
fdefelici
fdefelici previously approved these changes Jun 12, 2025
fdefelici
fdefelici previously approved these changes Jun 13, 2025
@Jiloc Jiloc moved this to Status: In Review in Stacks Core Eng Jun 17, 2025
@aldur aldur requested review from wileyj, kantai and fdefelici June 18, 2025 14:42
Copy link
Collaborator

@wileyj wileyj left a comment

Choose a reason for hiding this comment

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

lgtm

@github-project-automation github-project-automation bot moved this from Status: In Review to Status: 💻 In Progress in Stacks Core Eng Jun 19, 2025
@Jiloc Jiloc added this pull request to the merge queue Jun 19, 2025
Merged via the queue into stacks-network:develop with commit 2de8ade Jun 19, 2025
214 of 218 checks passed
@github-project-automation github-project-automation bot moved this from Status: 💻 In Progress to Status: ✅ Done in Stacks Core Eng Jun 19, 2025
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Status: Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

6 participants