@redpanda-data/docs-extensions-and-macros 5.12.4 → 5.13.1

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.
@@ -892,6 +892,15 @@ async function handleRpcnConnectorDocs (options) {
892
892
  fs.closeSync(fd)
893
893
 
894
894
  const rawJson = fs.readFileSync(tmpFile, 'utf8')
895
+ // Deliberately plain JSON.parse/stringify, not bigIntJson: this is connect
896
+ // data, which carries example config text as escaped JSON-shaped strings
897
+ // (e.g. bloblang examples), indistinguishable by regex from real JSON
898
+ // value position. bigIntJson's value-position regex matches inside such a
899
+ // string and inserts stray quotes -- confirmed to throw on the real,
900
+ // currently-published connect attachment, not merely round a number. A
901
+ // plain round trip still silently rounds int64 defaults past MaxInt64 (the
902
+ // pre-existing defect this file has always had), which is the safer
903
+ // failure mode until a real JSON scanner replaces the regex.
895
904
  const parsed = JSON.parse(rawJson)
896
905
  fs.writeFileSync(finalFile, JSON.stringify(parsed, null, 2))
897
906
  fs.unlinkSync(tmpFile)
@@ -1225,7 +1234,15 @@ async function handleRpcnConnectorDocs (options) {
1225
1234
 
1226
1235
  console.log('Generating connector partials...')
1227
1236
  let partialsWritten, partialFiles
1237
+ const descriptionReports = []
1228
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 })
1229
1246
 
1230
1247
  try {
1231
1248
  const result = await generateRpcnConnectorDocs({
@@ -1236,14 +1253,16 @@ async function handleRpcnConnectorDocs (options) {
1236
1253
  templateFields: options.templateFields,
1237
1254
  templateExamples: options.templateExamples,
1238
1255
  templateMetadata: options.templateMetadata,
1256
+ templateDescription: options.templateDescription,
1239
1257
  templateBloblang: options.templateBloblang,
1240
1258
  writeFullDrafts: false,
1259
+ pruneOrphanedDescriptions: !!options.pruneOrphanedDescriptions,
1241
1260
  includeBloblang: !!options.includeBloblang,
1242
1261
  csvMetadata
1243
1262
  })
1244
1263
  partialsWritten = result.partialsWritten
1245
1264
  partialFiles = result.partialFiles
1246
- lostSectionWarnings.push(...(result.lostSectionWarnings || []))
1265
+ collect(result)
1247
1266
  } catch (err) {
1248
1267
  console.error(`Error: Failed to generate partials: ${err.message}`)
1249
1268
  process.exit(1)
@@ -1874,6 +1893,12 @@ async function handleRpcnConnectorDocs (options) {
1874
1893
 
1875
1894
  // Check each cloud-supported connector
1876
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.
1877
1902
  const connectorTypes = ['inputs', 'outputs', 'processors', 'caches', 'buffers', 'scanners', 'metrics', 'tracers']
1878
1903
 
1879
1904
  for (const connectorKey of cloudSupportedSet) {
@@ -2026,6 +2051,7 @@ async function handleRpcnConnectorDocs (options) {
2026
2051
  templateFields: options.templateFields,
2027
2052
  templateExamples: options.templateExamples,
2028
2053
  templateMetadata: options.templateMetadata,
2054
+ templateDescription: options.templateDescription,
2029
2055
  templateIntro: options.templateIntro,
2030
2056
  writeFullDrafts: true,
2031
2057
  cgoOnly: binaryAnalysis?.cgoOnly || [],
@@ -2036,7 +2062,7 @@ async function handleRpcnConnectorDocs (options) {
2036
2062
  fs.unlinkSync(tempDataPath)
2037
2063
  draftsWritten = draftResult.draftsWritten
2038
2064
  draftFiles = draftResult.draftFiles
2039
- lostSectionWarnings.push(...(draftResult.lostSectionWarnings || []))
2065
+ collect(draftResult)
2040
2066
  }
2041
2067
  } catch (err) {
2042
2068
  console.error(`Error: Could not draft missing: ${err.message}`)
@@ -2083,13 +2109,26 @@ async function handleRpcnConnectorDocs (options) {
2083
2109
 
2084
2110
  // Generate PR summary
2085
2111
  try {
2086
- const { printPRSummary } = require('./pr-summary-formatter.js')
2112
+ const { printPRSummary, renderLostSectionWarnings, renderDescriptionReports } = require('./pr-summary-formatter.js')
2087
2113
  // Use master diff if available, otherwise use single diff. Content-loss
2088
- // warnings ride the diff object so they lead the PR summary body instead
2089
- // 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.
2090
2116
  const summaryDiff = masterDiff || diffJson
2091
- if (lostSectionWarnings.length) summaryDiff.lostSectionWarnings = lostSectionWarnings
2092
- 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
+ }
2093
2132
  } catch (err) {
2094
2133
  console.error(`Warning: Failed to generate PR summary: ${err.message}`)
2095
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}}