3di | Enhance metadata - #6981
Conversation
…st them as changes
…lock at top of the file
|
Taking this back to draft so I can push more commits for workflow features and test them in-place. |
…erities and blank/prepopuldated values
…orkflow relatively clean
604689d to
4361dce
Compare
|
@keithkirkwood-3di Can you clarify what this is supposed to do exactly? From what I gather this is supposed to add metadata and a short description to a given article. Why isn't it sufficient to just check that that those two directives exist in the file and that there is some text after the directive? Wouldn't it be easier to ask new contributors to include a brief description of the article they just contributed? |
Hey Kat - yeah, this is correct as far as you go. However, one piece of the metadata (area) is essential for the complete solution we are building for OR, and some is optional (these are reflected in the severities). Also, some of the metadata can have a fixed value (product and distro) and some need to be populated by the contributor. The short description also needs to be tagged with a new directive, and placed just under the first heading to follow the design our content consultant came up with. In my view, all of this wants to be configurable for future expansion. In addition, we got guidance from Geoff and Tully that we should use the Suggested changes mechanism here in GitHub where possible, which is what I've done, falling back to a comment with the missing elements only if needed. When we put all of this together with the design from our tech consultant, you've got the UX and solution described in this PR. We should of course also update the contribution docs to reflect all this, but the intention here was to create fine-grained validation to support the new IA which 3di is delivering. |
|
@kscottz Hello - did my reply last week make sense, or do you have any other thoughts on this? There's a README in the |
|
As it stands this is about 3k lines of code that we're going to need to maintain. I understand that it would be nice to have a "suggest changes" feature that enforces a particular policy, but couldn't we accomplish compliance by largely providing a restructured text template with an example header, a guide for news users, and a simple CI check to make sure the header is included? |
|
@kscottz Thanks for the feedback - think I'd best discuss this with the rest of the 3di team before going much further. Either myself or someone else on the team will get back to you soon. |
|
@kscottz Hi Kat - we'll remove all the code concerned with suggested changes and annotations, leaving only the checks for metadata, meta display and short description directives, as these specifically support the information architecture. As you say, we can then have example(s) in the contributor docs for these for use in the header. I'm pretty sure this will drastically cut down the code present in this PR and give a leaner solution. |
Description
This PR introduces the mechanism and configuration for automated RST docs enhancements required to support the new ROS documentation information architecture. In effect, all RST files created or modified in a pull request to the default branch (rolling) on
ros2_documentationare checked against rules defined intools/enhance.yaml:Document Metadata (
.. meta::block):{PRODUCT}and{DISTRO}) as well as fields that require manual input from contributors (e.g.area).Post-Heading Directives (
after_title):.. short-description::: Automatically wraps the first prose paragraph after the primary document title in a.. short-description::directive. Source sentence formatting (such as "one sentence per line") is preserved with standard 3-space directive indentation... showmeta::: Automatically inserts or completes a.. showmeta::directive immediately following the short description with configured options (e.g.:order: area, content-type, experience).Each rule can be configured as a
warning(advisory, non-blocking step failure) or anerror(blocking error that fails the workflow).Inline Suggestions & Summary Reviews:
.. meta::) or the after-title/prose area (short-description/showmeta), GitHub Actions appends inline Commit suggestions on the Files changed tab... meta::issues anchor to line 1/top-of-file, while after-title issues anchor to the paragraph being wrapped beneath the heading.Testing
For security reasons, the new
Enhanceworkflow runs trusted code from the base branch of the PR (typicallyrolling), while processing content from the incoming head branch. This pattern (usingpull_request_targetin GitHub Actions) grants necessary write permissions for fork PRs (enabling inline suggestions and review comments) without executing untrusted code from forks.To test this PR locally or on a fork:
rolling) of your fork first.rollingwith new or edited.rstfiles.Changes
tools/enhance.yamland add support forafter_titledirective rules.tools/ensure_enhancements.pyCLI to enforce metadata fields and wrap/insert after-title directives (.. short-description::and.. showmeta::).tools/rst_utils.pyhelpers for directive parsing, prose extraction, sentence-line preservation, and directive injection.tools/supersede_enhancement_reviews.shscript to minimise outdated review comments via GitHub GraphQL API.PRODUCTandDISTROmacro placeholders expanded by Sphinx inconf.py..github/workflows/enhance.ymlworkflow to orchestrate enhancement checks, inline suggestions (suggest-changes), and summary reviews.Makefilewithensure-enhancementsandsupersede-enhancement-reviewstargets.tools/tests/test_ensure_enhancements.pyandtools/tests/test_rst_utils.py.tools/README.md.Did you use Generative AI?
Yes - Cursor IDE, using models Composer 2.5, Gemini Pro 3.1, Flash 3.6, and Anthropic Sonnet 5 / Opus 5.
Additional Information
Issue: #6991