Skip to content

Conversation

JakeSCahill
Copy link
Contributor

@JakeSCahill JakeSCahill commented Oct 20, 2025

This pull request introduces a new system for generating consolidated AsciiDoc partials for Redpanda property documentation. The changes allow for more flexible documentation builds, including the ability to generate either full property pages, partials, or both, controlled using flags. The error reporting system is now integrated into the JSON output for better downstream consumption.

Property Documentation Generation Enhancements

  • Added a new function generatePropertyPartials to create consolidated AsciiDoc partials for each property type (cluster, topic, broker, object-storage), supporting both standard and cloud-aware templates. This enables easier reuse and inclusion of property documentation in other docs.
  • Updated generatePropertyDocs to conditionally select between a full property page template and an include-based template, allowing for modular documentation generation. [1] [2]
  • The main generation workflow (generateAllDocs) now supports skipping full property pages and/or partials based on environment variables (GENERATE_PAGES, GENERATE_PARTIALS), improving build flexibility. [1] [2] [3]

Error Reporting and Output Improvements

  • Error reports for empty descriptions and deprecated properties are now logged with percentages and added directly to the input JSON file, rather than being written to separate text files. This makes error data more accessible for downstream processing.
  • The summary statistics returned from documentation generation now include the count of property partials generated, providing better visibility into the documentation build process.

Template and Path Handling Updates

  • Improved path logic for deprecated property documentation to ensure correct placement in the partials directory regardless of the output directory structure.
  • Minor updates and fixes to property templates, including better handling of cloud-only and self-managed-only properties, and improved formatting for aliases and related topics. [1] [2] [3]

Version Bump

  • Bumped package version in package.json from 4.10.1 to 4.10.2.

@netlify
Copy link

netlify bot commented Oct 20, 2025

Deploy Preview for docs-extensions-and-macros ready!

Name Link
🔨 Latest commit ff65c4d
🔍 Latest deploy log https://app.netlify.com/projects/docs-extensions-and-macros/deploys/68f77d17539e0b00081276fb
😎 Deploy Preview https://deploy-preview-140--docs-extensions-and-macros.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@JakeSCahill JakeSCahill requested a review from paulohtb6 October 20, 2025 15:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This PR extends the property documentation generation system with configurable generation modes controlled via CLI flags and environment variables. It introduces --generate-partials, --partials-dir, and --generate-pages options to enable generating consolidated AsciiDoc partials and complete property pages. The core generation logic is refactored to support two template modes: includes-based (which references separate partial files) and full-content. Error reporting is simplified to embed results directly in JSON output rather than writing separate files. Templates are updated to support cloud deployments and include directives.

Sequence Diagram

sequenceDiagram
    participant CLI as doc-tools.js CLI
    participant Env as Environment Variables
    participant Gen as generate-handlebars-docs.js
    participant Make as Makefile

    CLI->>Env: Set GENERATE_PARTIALS, OUTPUT_PARTIALS_DIR,<br/>GENERATE_PAGES if flags provided
    CLI->>Make: Invoke make-based tooling
    Make->>Gen: Call generateAllDocs()
    
    rect rgb(200, 220, 255)
        Note over Gen: Check GENERATE_PARTIALS
        alt GENERATE_PARTIALS === '1'
            Gen->>Gen: generatePropertyPartials()
            Gen->>Gen: Group properties by config_scope
            Gen->>Gen: Write per-type partial files<br/>(cluster, topic, object-storage, broker)
        else
            Gen->>Gen: Skip partials generation
        end
    end
    
    rect rgb(220, 200, 255)
        Note over Gen: Check GENERATE_PAGES
        alt GENERATE_PAGES === '1'
            Gen->>Gen: generatePropertyDocs()<br/>per config_scope type
            Gen->>Gen: Select template<br/>(with-includes vs full-content)
            Gen->>Gen: Write complete pages
        else
            Gen->>Gen: Compute counts only,<br/>skip page generation
        end
    end
    
    Gen->>Gen: Generate error reports<br/>(embedded in JSON)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

The changes span multiple interdependent systems: substantial refactoring of the core generation logic with new conditional branching, introduction of a new public function with property categorization logic, template selection based on generation mode, simplified error reporting flow, and modifications across multiple template files. The diversity of changes across CLI configuration, build tooling, core generation logic, and templates requires separate reasoning for each component despite consistent patterns in conditional logic.

Possibly related PRs

Suggested reviewers

  • paulohtb6
  • kbatuigas

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add support for saving properties to partials" directly and clearly captures the primary objective of this changeset. The PR introduces a new system for generating consolidated AsciiDoc partials through the addition of the generatePropertyPartials function and new CLI options (--generate-partials, --partials-dir, --generate-pages), along with supporting environment-variable-driven logic in the build workflow. The title is concise, specific, and accurately reflects the main change without being overly broad or generic.
Description Check ✅ Passed The description is clearly related to the changeset and provides meaningful detail across multiple aspects of the changes. It accurately describes the main enhancements (the new generatePropertyPartials function, conditional template selection in generatePropertyDocs, and environment-variable-controlled logic in generateAllDocs), error reporting improvements (integration into JSON output), template and path handling updates, and the version bump. All points mentioned align with the changes shown in the raw_summary, making this a substantive and relevant description.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
tools/property-extractor/Makefile (1)

31-31: Expose OUTPUT_PARTIALS_DIR in make check for easier debugging.

Add it to the diagnostics so users can confirm where consolidated partials will land.

@@
 check:
@@
 	@echo "OUTPUT_JSON_DIR:          $(OUTPUT_JSON_DIR)"
 	@echo "OUTPUT_AUTOGENERATED_DIR: $(OUTPUT_AUTOGENERATED_DIR)"
+	@echo "OUTPUT_PARTIALS_DIR:      $(OUTPUT_PARTIALS_DIR)"
tools/property-extractor/generate-handlebars-docs.js (4)

210-229: Includes vs full template override: unify env var names.

Currently this looks for TEMPLATE_PROPERTY_PAGE_WITH_INCLUDES, while the CLI sets TEMPLATE_PROPERTY_PAGE. Either accept both here or set both in the CLI (see suggested CLI fix).

-    templatePath = getTemplatePath(
-      path.join(__dirname, 'templates', 'property-page-with-includes.hbs'),
-      'TEMPLATE_PROPERTY_PAGE_WITH_INCLUDES'
-    );
+    // Accept either env var for overrides
+    templatePath = getTemplatePath(
+      path.join(__dirname, 'templates', 'property-page-with-includes.hbs'),
+      process.env.TEMPLATE_PROPERTY_PAGE_WITH_INCLUDES ? 'TEMPLATE_PROPERTY_PAGE_WITH_INCLUDES' : 'TEMPLATE_PROPERTY_PAGE'
+    );

417-426: Deprecated partial path derivation is brittle; prefer OUTPUT_PARTIALS_DIR.

String matching on 'pages/properties' can misroute on custom layouts. Use process.env.OUTPUT_PARTIALS_DIR if present, with a safe fallback.

-  let outputPath;
-  if (outputDir.includes('pages/properties')) {
-    outputPath = path.join(path.dirname(path.dirname(outputDir)), 'partials', 'deprecated', 'deprecated-properties.adoc');
-  } else {
-    outputPath = path.join(outputDir, 'partials', 'deprecated', 'deprecated-properties.adoc');
-  }
+  const basePartialsDir = process.env.OUTPUT_PARTIALS_DIR
+    ? path.resolve(process.env.OUTPUT_PARTIALS_DIR)
+    : (outputDir.includes('pages')
+        ? path.resolve(outputDir, '..', '..', 'partials')
+        : path.join(outputDir, 'partials'));
+  const outputPath = path.join(basePartialsDir, 'deprecated', 'deprecated-properties.adoc');

63-74: Deduplicate object-storage classification logic.

The name-based checks are repeated in PROPERTY_CONFIG, partials generation, and counting. Extract a single predicate to avoid drift.

// helpers/classification.js (example)
function isObjectStorageProperty(name = '') {
  return /^(cloud_storage|s3_|azure_|gcs_|archival_|remote_|tiered_)/.test(name);
}
module.exports = { isObjectStorageProperty };

Usage (illustrative):

- prop.name.includes('cloud_storage') || ...
+ isObjectStorageProperty(prop.name)

Also applies to: 88-97, 334-346, 507-515


575-599: Deterministic error arrays.

Sort the arrays before persisting to stabilize diffs and downstream consumers.

   Object.values(properties).forEach(prop => {
@@
   });
 
-  // Return the arrays so they can be added to the JSON output
+  // Stabilize output
+  emptyDescriptions.sort();
+  deprecatedProperties.sort();
   return {
     empty_descriptions: emptyDescriptions,
     deprecated_properties: deprecatedProperties
   };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d03185d and 8ec097b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • bin/doc-tools.js (2 hunks)
  • package.json (1 hunks)
  • tools/property-extractor/Makefile (1 hunks)
  • tools/property-extractor/generate-handlebars-docs.js (5 hunks)
  • tools/property-extractor/templates/property-cloud.hbs (1 hunks)
  • tools/property-extractor/templates/property-page-with-includes.hbs (1 hunks)
  • tools/property-extractor/templates/property.hbs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - docs-extensions-and-macros
  • GitHub Check: Header rules - docs-extensions-and-macros
  • GitHub Check: Pages changed - docs-extensions-and-macros
🔇 Additional comments (4)
package.json (1)

3-3: Version bump looks good.

Please ensure a matching tag/release notes entry when merging.

tools/property-extractor/templates/property-cloud.hbs (1)

23-25: Good: BYOC note gated by env-cloud.

Confirm env-cloud is set appropriately in Antora builds so the note appears only in Cloud docs.

tools/property-extractor/templates/property-page-with-includes.hbs (1)

1-17: Include-based page template LGTM.

Path reference matches modules/reference/partials/properties by default.

tools/property-extractor/templates/property.hbs (1)

62-64: Helper is properly registered and available.

The renderPropertyExample helper is:

  • Defined in tools/property-extractor/helpers/renderPropertyExample.js
  • Exported from tools/property-extractor/helpers/index.js (line 11)
  • Registered with Handlebars in tools/property-extractor/generate-handlebars-docs.js via the loop at lines 22-28 that iterates through all exported helpers and calls handlebars.registerHelper(name, fn)

The helper usage in property.hbs (and other template files) will work correctly.

@JakeSCahill JakeSCahill merged commit 79bc698 into main Oct 21, 2025
14 checks passed
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.

2 participants