Skip to content

frontend/rpcn: render field descriptions as prose, link each field to its docs - #2621

Merged
SpicyPete merged 6 commits into
masterfrom
rpcn/short-field-descriptions
Sep 2, 2026
Merged

frontend/rpcn: render field descriptions as prose, link each field to its docs#2621
SpicyPete merged 6 commits into
masterfrom
rpcn/short-field-descriptions

Conversation

@SpicyPete

@SpicyPete SpicyPete commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Field help text in the RPCN config form now renders the schema's prose properly instead of dumping raw AsciiDoc under the control, and every field links to its own heading in the docs.

  • Prefer FieldSpec.short_description (a markup-free one-liner) when the dataplane serves it; fall back to the AsciiDoc description, which is still the majority path.
  • New FieldDescription component: converts AsciiDoc to Markdown, and collapses long or multi-paragraph prose behind "Show more" so it doesn't bury the input. A single-paragraph description renders inline, so its docs link trails the sentence instead of claiming a row.
  • AsciiDoc conversion moved out of the command-palette utils into rp-connect/utils/asciidoc.ts, shared by the palette, the form and the template gallery.
  • Template gallery slots prefer the short description too, and flatten the AsciiDoc fallback.

Per-field docs links

getFieldDocsUrl(section, connector, path) deep-links a field's own heading on its connector reference page. The docs generator anchors each field heading with its dotted path, list markers dropped — batching.byte_size#batching-byte_size, sasl[].aws.credentials.role#sasl-aws-credentials-role — which is exactly the path the form already carries, so no new plumbing beyond a context holding the component's identity.

Checked against the live docs rather than assumed: over 90 randomly sampled cloud component pages (all HTTP 200), 1,770 leaf-field headings resolve, with 3 (0.17%) anchored -2 because a prose section on the same page claimed the plain id first. Those land on that same-named section, and an anchor that misses at all leaves the reader at the top of the right page — never worse than the connector-level link we'd otherwise ship. Field headings sit in a flat Fields section after the common/advanced tabs, so the anchor isn't buried in a collapsed panel. Verified end-to-end in localdev: all 13 links the form generated for input: redpanda, nested tls.* included, exist verbatim on the published page.

Object-group headers (batching, sasl) deliberately get no link — they carry no description, and they're where the -2 collisions cluster (11 of 231).

AsciiDoc rendering fixes

Found by reviewing the new converter against the bundled schema (rp-connect-schema-full.json: 4,650 non-deprecated field descriptions + 439 component prose blocks), and each fix re-verified over the whole corpus:

Issue Before After
<<anchor, label>> cross-references were never converted 19 fields + 17 component blocks leaked A database <\<drivers, driver>> to use. A database driver to use. — 0 left
Markdown pipe tables unparsed (react-markdown is mounted without remark-gfm) sql_raw.query and 4 others rendered | Driver | Style | |---|---| as literal text flattened to - Driver — Placeholder Style; 0 pipe rows left in 5,089 outputs
format=dsv tables split on the wrong separator - CHAR, VARCHAR:string - CHAR, VARCHAR — string, separator read from the table's own attribute line
Collapsed preview kept raw Markdown when a link label nested brackets 8 dsn fields showed [`clickhouse://[user[:pass]@]…`](https://…) verbatim, URL included 0 residual links
cleanText applied to multi-paragraph prose in template slots 9 fields leaked ==== Drivers :driver-support: mysql=certified… into slot help full conversion + plain-text pass; 0 leaks
Slot help used shortDescription untrimmed a whitespace-only value from the wire blanked the slot, while the config form treats it as absent both consumers agree

Known gap, not fixed here: the line-based block transforms aren't fence-aware, so a ---- separator or a line like ["a","b"] inside a ``` fenced example would be dropped. Zero triggers across all 49 fenced descriptions in the current schema, so it's latent rather than live — worth a follow-up rather than a restructure in this PR.

Notes for review

  • node-config-form.tsx is an 18-line change: the field docs lookup rides on ResourceFieldContext, which already carries the edited component's identity, rather than adding a provider (a second wrapper re-indented the whole form body for no benefit).
  • cleanText is gone. markdownToPlainText(asciidocToMarkdown(x)) is byte-identical on all 235 component summaries — its only render site — and strictly better on descriptions, so there is now one way to flatten schema prose.
  • text-body-sm is the text-xs rung and computes to 10.5px here, which is why the docs-link icon is size-3 and positioned with vertical-align rather than a flex box — a flex box baselines on the icon's bottom edge and drops the word below the prose.

Testing

bun run type:check, bun run lint (clean tree), and the full rp-connect suites: 139 unit + 772 integration passing. New coverage: internal cross-references in both conversion paths, pipe-table and dsv flattening, bracketed link labels in both the rendered link and the collapsed preview, the field-level anchor contract (including nested paths through the form), and the two template-slot fallbacks.

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Clean — no registry drift, off-token colours, or ad-hoc classes

App: frontend · Scope: diff vs origin/master · Files: 13

Count
⚠️ Outdated registry components 0
🛠 Locally-modified components 0
❓ Unknown to registry 0
🎨 Off-token palette colours 0
🔢 Ad-hoc utility classes 0

Generated by lookout audit-changes.

@SpicyPete SpicyPete self-assigned this Aug 28, 2026
@SpicyPete
SpicyPete requested review from a team, datamali, graham-rp, sago2k8 and yougotashovel and removed request for a team August 28, 2026 22:10
@SpicyPete SpicyPete changed the title frontend/rpcn: render field descriptions as prose, prefer short_description frontend/rpcn: render field descriptions as prose, link each field to its docs Aug 31, 2026
Review pass aimed at PR size rather than behaviour.

- Read the field docs URL off ResourceFieldContext (which already carries
  component identity) instead of adding a provider. The extra JSX nesting
  level had re-indented the whole form body: 296 changed lines -> 18.
- Delete cleanText. markdownToPlainText(asciidocToMarkdown(x)) is
  byte-identical on all 235 component summaries, its only render site, and
  strictly better on descriptions, so the palette now uses that pair and
  reuses the markdown it had already converted.
- Consolidate tests without dropping assertions: table-driven cases for the
  converter and getFieldDocsUrl, and three overlapping render tests merged.
- Share one InlineHelp block between the short_description and
  single-paragraph paths.

Diff against master: 1107 changed lines -> 772.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
if (!description) {
return docsLink;
}
return <LongDescription docsLink={docsLink} source={description} />;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HUMAN REVIEW: I think for docs link we should use a docs badge similar to how ADP does it, it's also a common pattern in the case of cloudflare which what we originally adopted/got inspired from, just sprinkling docs where relevant so it's interweaved with the user journey.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not seeing docs in ADP, can you attach a screenshot as an example?
Right now at he end of the descriptions we are showing the docs link + a docs icon

@SpicyPete
SpicyPete merged commit 878fd95 into master Sep 2, 2026
21 checks passed
@SpicyPete
SpicyPete deleted the rpcn/short-field-descriptions branch September 2, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants