@redpanda-data/docs-extensions-and-macros 5.13.0 → 5.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1234,7 +1234,15 @@ async function handleRpcnConnectorDocs (options) {
1234
1234
 
1235
1235
  console.log('Generating connector partials...')
1236
1236
  let partialsWritten, partialFiles
1237
+ const descriptionReports = []
1237
1238
  const lostSectionWarnings = []
1239
+ // Both generator call sites (partials and drafts) feed the same PR summary,
1240
+ // so they collect through one function. Pushed inline, the draft call site
1241
+ // silently dropped descriptionReports for months: the structure reports for
1242
+ // newly drafted connectors, the ones most likely to need an upstream fix,
1243
+ // never reached the summary.
1244
+ const { collectGeneratorReports } = require('./pr-summary-formatter.js')
1245
+ const collect = (result) => collectGeneratorReports(result, { descriptionReports, lostSectionWarnings })
1238
1246
 
1239
1247
  try {
1240
1248
  const result = await generateRpcnConnectorDocs({
@@ -1245,14 +1253,16 @@ async function handleRpcnConnectorDocs (options) {
1245
1253
  templateFields: options.templateFields,
1246
1254
  templateExamples: options.templateExamples,
1247
1255
  templateMetadata: options.templateMetadata,
1256
+ templateDescription: options.templateDescription,
1248
1257
  templateBloblang: options.templateBloblang,
1249
1258
  writeFullDrafts: false,
1259
+ pruneOrphanedDescriptions: !!options.pruneOrphanedDescriptions,
1250
1260
  includeBloblang: !!options.includeBloblang,
1251
1261
  csvMetadata
1252
1262
  })
1253
1263
  partialsWritten = result.partialsWritten
1254
1264
  partialFiles = result.partialFiles
1255
- lostSectionWarnings.push(...(result.lostSectionWarnings || []))
1265
+ collect(result)
1256
1266
  } catch (err) {
1257
1267
  console.error(`Error: Failed to generate partials: ${err.message}`)
1258
1268
  process.exit(1)
@@ -1883,6 +1893,12 @@ async function handleRpcnConnectorDocs (options) {
1883
1893
 
1884
1894
  // Check each cloud-supported connector
1885
1895
  // Filter to only check actual connector/component types that need individual pages
1896
+ // NOT the shared CONNECTOR_TYPE_DIRS: this list deliberately omits
1897
+ // rate_limits, per the comment below. rate_limits does have
1898
+ // per-component pages, so the omission looks like a bug and rate
1899
+ // limits are never checked for a cloud-docs stub -- but changing it
1900
+ // adds cloud-docs findings in a path with no test coverage, so it
1901
+ // needs its own ticket rather than riding along here.
1886
1902
  const connectorTypes = ['inputs', 'outputs', 'processors', 'caches', 'buffers', 'scanners', 'metrics', 'tracers']
1887
1903
 
1888
1904
  for (const connectorKey of cloudSupportedSet) {
@@ -2035,6 +2051,7 @@ async function handleRpcnConnectorDocs (options) {
2035
2051
  templateFields: options.templateFields,
2036
2052
  templateExamples: options.templateExamples,
2037
2053
  templateMetadata: options.templateMetadata,
2054
+ templateDescription: options.templateDescription,
2038
2055
  templateIntro: options.templateIntro,
2039
2056
  writeFullDrafts: true,
2040
2057
  cgoOnly: binaryAnalysis?.cgoOnly || [],
@@ -2045,7 +2062,7 @@ async function handleRpcnConnectorDocs (options) {
2045
2062
  fs.unlinkSync(tempDataPath)
2046
2063
  draftsWritten = draftResult.draftsWritten
2047
2064
  draftFiles = draftResult.draftFiles
2048
- lostSectionWarnings.push(...(draftResult.lostSectionWarnings || []))
2065
+ collect(draftResult)
2049
2066
  }
2050
2067
  } catch (err) {
2051
2068
  console.error(`Error: Could not draft missing: ${err.message}`)
@@ -2092,13 +2109,26 @@ async function handleRpcnConnectorDocs (options) {
2092
2109
 
2093
2110
  // Generate PR summary
2094
2111
  try {
2095
- const { printPRSummary } = require('./pr-summary-formatter.js')
2112
+ const { printPRSummary, renderLostSectionWarnings, renderDescriptionReports } = require('./pr-summary-formatter.js')
2096
2113
  // Use master diff if available, otherwise use single diff. Content-loss
2097
- // warnings ride the diff object so they lead the PR summary body instead
2098
- // of dying in the collapsed workflow log.
2114
+ // warnings and structure reports ride the diff object so they land in the
2115
+ // PR summary body instead of dying in the collapsed workflow log.
2099
2116
  const summaryDiff = masterDiff || diffJson
2100
- if (lostSectionWarnings.length) summaryDiff.lostSectionWarnings = lostSectionWarnings
2101
- printPRSummary(summaryDiff, binaryAnalysis, draftFiles, masterDiff ? true : false)
2117
+ if (summaryDiff) {
2118
+ if (lostSectionWarnings.length) summaryDiff.lostSectionWarnings = lostSectionWarnings
2119
+ if (descriptionReports.length) summaryDiff.descriptionReports = descriptionReports
2120
+ printPRSummary(summaryDiff, binaryAnalysis, draftFiles, masterDiff ? true : false)
2121
+ } else if (lostSectionWarnings.length || descriptionReports.length) {
2122
+ // No diff to summarize (no prior version, or versions match), but this
2123
+ // run still produced content-loss warnings or description-structure
2124
+ // reports that a reviewer needs to see -- print them on their own
2125
+ // instead of losing them because there was nothing to diff against.
2126
+ const lines = [
2127
+ ...renderLostSectionWarnings(lostSectionWarnings),
2128
+ ...renderDescriptionReports(descriptionReports)
2129
+ ]
2130
+ console.log('\n' + lines.join('\n') + '\n')
2131
+ }
2102
2132
  } catch (err) {
2103
2133
  console.error(`Warning: Failed to generate PR summary: ${err.message}`)
2104
2134
  }
@@ -3,23 +3,36 @@
3
3
  :type: {{type}}
4
4
  {{#if support}}:support: {{support}}{{/if}}
5
5
  :categories: [{{join categories ", "}}]
6
- {{#if summary}}
6
+ {{#if hasDescriptionAttrs}}
7
7
  // tag::meta[]
8
- :description: {{{summary}}}
8
+ {{{descriptionInclude this "attrs"}}}
9
+ // end::meta[]
10
+ {{else if summary}}
11
+ // tag::meta[]
12
+ :description: {{{summaryAttribute summary}}}
9
13
  // end::meta[]
10
14
  {{else if description}}
11
15
  // tag::meta[]
12
- :description: {{description}}
16
+ :description: {{{summaryAttribute description}}}
13
17
  // end::meta[]
14
18
  {{/if}}
15
- {{!-- No fallback line when neither exists: an emitted TODO would become
19
+ {{!-- The attrs include stays inside the meta tag region so single-source
20
+ stubs keep inheriting :description: as a header attribute, and the
21
+ value now refreshes with the connector instead of being frozen at
22
+ first draft. Component families with no description partial keep the
23
+ inline attribute.
24
+ No fallback line when neither exists: an emitted TODO would become
16
25
  the attribute VALUE and stubs would inherit it into their meta tags.
17
26
  Missing descriptions are the tracked editorial backlog
18
27
  (cloud-docs .github/description-allowlist.txt). --}}
19
28
 
20
29
  component_type_dropdown::[]
21
30
 
31
+ {{#if hasDescriptionPartial}}
32
+ {{{descriptionInclude this "body"}}}
33
+ {{else}}
22
34
  {{> intro}}
35
+ {{/if}}
23
36
 
24
37
  {{#if (or this.config.children children)}}
25
38
  [tabs]
@@ -0,0 +1,21 @@
1
+ {{#if (or summary description version)}}
2
+ // This content is autogenerated. Do not edit manually. The summary and description come from the connector's definition in the Connect source. To change them, update the connector upstream, or use the doc-tools CLI with the --overrides option: https://redpandadata.atlassian.net/wiki/spaces/DOC/pages/1247543314/Generate+reference+docs+for+Redpanda+Connect
3
+ //
4
+ // Pages consume this partial in two places so both stay fresh:
5
+ // header: include::...[tag=attrs] (sets :description: for search snippets and meta tags)
6
+ // body: include::...[tag=body] (renders the summary and description)
7
+
8
+ // tag::attrs[]
9
+ {{#if summary}}:description: {{{summaryAttribute summary}}}
10
+ {{/if}}// end::attrs[]
11
+
12
+ // tag::body[]
13
+ {{#if summary}}{{{summary}}}
14
+
15
+ {{/if}}{{#if version}}ifndef::env-cloud[]
16
+ Introduced in version {{version}}.
17
+ endif::[]
18
+
19
+ {{/if}}{{{renderConnectDescription this}}}
20
+ // end::body[]
21
+ {{/if}}
@@ -7,7 +7,7 @@ endif::[]
7
7
  {{/if}}
8
8
 
9
9
  {{#if description}}
10
- {{{descriptionWithMetadataInclude this}}}
10
+ {{{renderConnectDescription this}}}
11
11
  {{else}}
12
12
  // TODO: Missing description. Add a description in the overrides file or source data.
13
13
  {{/if}}