Skip to content

Conversation

@sAchin-680
Copy link
Contributor

@sAchin-680 sAchin-680 commented Nov 5, 2025

Description

Implements automatic documentation generation for component feature gates via mdatagen.

Component authors can now declare feature gates in metadata.yaml, and mdatagen will automatically generate standardized markdown documentation including gate IDs, stages, descriptions, version information, and reference links.

Key Changes:

  • Extended metadata-schema.yaml with feature_gates section
  • Added FeatureGate types with validation (required fields, valid stages, version format)
  • Created documentation template rendering feature gates as markdown table
  • Integrated into existing documentation generation pipeline
  • Added test coverage and usage documentation

Link to tracking issue

Fixes (edit by @mx-psi) Updates #14067

Testing

  • All 282 tests passing
  • Added TestRunContents/feature_gates.yaml test case
  • Validated documentation generation and error handling
  • Lint checks passing

Documentation

  • Added "Feature Gates Documentation" section to cmd/mdatagen/README.md with usage examples
  • Generated example visible in cmd/mdatagen/internal/testdata/documentation.md

@sAchin-680 sAchin-680 requested review from a team and dmitryax as code owners November 5, 2025 13:53
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 5, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@sAchin-680 sAchin-680 force-pushed the feat/mdatagen-featuregates-docs branch 3 times, most recently from 1ba9385 to cc3891a Compare November 5, 2025 14:07
@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.22%. Comparing base (6fb786c) to head (363aa67).

Files with missing lines Patch % Lines
cmd/mdatagen/internal/metadata.go 94.73% 1 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (94.87%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14130      +/-   ##
==========================================
- Coverage   92.25%   92.22%   -0.04%     
==========================================
  Files         658      658              
  Lines       41184    41222      +38     
==========================================
+ Hits        37996    38017      +21     
- Misses       2182     2193      +11     
- Partials     1006     1012       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Implements automatic documentation generation for component feature gates
via mdatagen, addressing issue open-telemetry#14067.

Changes:
- Extended metadata-schema.yaml with feature_gates section
- Added FeatureGate types and validation to metadata.go
- Created documentation template for feature gates
- Integrated into documentation generation pipeline
- Added test data and test cases
- Updated README with usage examples

All tests passing (282 tests) and lint checks clean.

Signed-off-by: SACHIN <[email protected]>
Fix import grouping to properly separate standard library imports from
third-party imports. This resolves the goimpi check failure in CI.

Signed-off-by: SACHIN <[email protected]>
@sAchin-680 sAchin-680 force-pushed the feat/mdatagen-featuregates-docs branch from 0fe7f89 to ca8e3eb Compare November 5, 2025 14:40
Add test cases covering all validation scenarios:
- Valid alpha and stable gates
- Empty description error
- Invalid stage error
- Version format validation (missing 'v' prefix)
- to_version requirement for stable/deprecated gates
- Empty gate ID validation

Achieves 100% coverage for validateFeatureGates function.

Signed-off-by: SACHIN KUMAR <[email protected]>
- Changed FeatureGates to []FeatureGate with ID field for preserved ordering
- Added duplicate ID validation
- Updated templates to iterate list using .ID
- Added feature_gates section to schema and README
- Updated tests and testdata
- Removed accidentally committed mdatagen binary

Addresses all feedback from @mx-psi on PR open-telemetry#14130
sAchin-680 and others added 2 commits November 7, 2025 14:30
- Remove changelog entry (mdatagen is internal tool)

- Add validation: feature gates must be sorted by ID

- Add validation: each feature gate must have reference_url

- Add validation: ID must match regex ^[0-9a-zA-Z.]*$

- Add comprehensive tests for all validations

- Revert unrelated formatting changes to package_test.go.tmpl
@sAchin-680 sAchin-680 requested a review from mx-psi November 11, 2025 10:03
@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Nov 11, 2025
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

To make CI pass you can run make gogenerate and add 'mycomponent' to this list

There's a couple more things to do but we can do them in a follow up PR, let's focus on these and the inline comment and I can merge your PR

sAchin-680 and others added 2 commits November 11, 2025 17:58
- Add 'mycomponent' to allowed status.class in metadata-schema.yaml
- Add 'mycomponent' to cspell dictionary for spelling checks
@sAchin-680
Copy link
Contributor Author

Done in f92d1f8!

  • Ran make gogenerate,
  • Added 'mycomponent' to metadata-schema.yaml status.class,
  • Added 'mycomponent' to cspell.json,
  • Reverted all autoformatting changes - now only 2 clean additions vs main (no IDE formatting)

The schema file now has zero unrelated changes.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

Thanks @sAchin-680! Looks like just a space in the generated file's import list and it should be good to go to pass the CI checks

@sAchin-680
Copy link
Contributor Author

Thanks @sAchin-680! Looks like just a space in the generated file's import list and it should be good to go to pass the CI checks

Hey @codeboten. Fixed the import spacing in generated_package_test.go. Should be good to go now.

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

Labels

cmd/mdatagen Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants