Skip to content

docs: share copied field descriptions and fail CI on new copies - #4875

Merged
JakeSCahill merged 8 commits into
mainfrom
docs/copies-check
Oct 8, 2026
Merged

JakeSCahill merged 8 commits into
mainfrom
docs/copies-check

Conversation

@JakeSCahill

@JakeSCahill JakeSCahill commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #4866, #4867, #4868, #4869, and #4870. The base, docs/descriptions-combined, is those five merged together, so this diff shows only the new work. I'll retarget it once they merge.

Why

The reference docs are now generated from these field descriptions, but many were written out more than once: the Elasticsearch v8, v9, and OpenSearch outputs, the AWS IAM fields on the CDC inputs, and the LLM tool fields across four chat processors. When one copy is fixed, the others go on saying the old thing, and the docs disagree between components. That had already happened in several places.

How it stays fixed

TestFieldDescriptionsAreNotCopied in cmd/tools/docs_gen parses the source with go/ast. It fails when two .Description(...) literals of 40 or more characters on fields with the same name have words that are at least 90% the same, whether they're identical or have drifted. It scans this repo and benthos's public packages. The fix it asks for is one constant or field constructor. There's no allowlist.

Every copy it found is resolved one of two ways:

  • Shared. Same feature, one definition, for example internal/llm (tool fields, prompts), internal/impl/elasticsearch/esoutput, internal/impl/aws/config/iam_auth.go, internal/replication/fields.go, internal/writecodec, retries.MaxRetriesDescription, and schemaregistry.URLFieldDescription. Per-component differences are parameters, and flags stay at each call site.
  • Made specific. Different features with lookalike text, such as client_id on Kafka, MQTT, and Redis, now say what's true for each component, checked in its code.

New shared packages carry the Apache header, so community builds don't import enterprise code.

Fact corrections found on the way

  • snowflake_put holds one connection lock for the whole WriteBatch, so batches upload one at a time whatever max_in_flight is set to. The docs now say so. This may be worth a look as a behavior change.
  • aws_bedrock_chat prompt and system_prompt were declared as plain strings but parsed as interpolated. They're now declared as interpolated.
  • amqp_1 output metadata is sent as message annotations, not headers.
  • mysql and postgres CDC allow role and roles together (role first), while MongoDB rejects the combination.
  • Redis commit_period batches XACK calls; it doesn't commit offsets.

Copies of benthos internals, such as the retry backoff, OAuth2, and http_server sync-response fields, need benthos to export helpers first. That's a follow-up.

Build, tests for every touched package, and lint pass. task docs passes with x_benthos_extra.

@JakeSCahill
JakeSCahill removed this pull request from stack #4883 October 8, 2026 15:14
@JakeSCahill
JakeSCahill changed the base branch from docs/descriptions-combined to main October 8, 2026 15:15
@Leward
Leward added this pull request to stack #4940 October 8, 2026 17:28
@Leward
Leward self-requested a review October 8, 2026 17:42
@JakeSCahill
JakeSCahill merged commit 2133c86 into main Oct 8, 2026
1 check passed
@JakeSCahill
JakeSCahill deleted the docs/copies-check branch October 8, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants