RPCN - Support for optional fields#2560
Conversation
The v4.53→v4.73 benthos bump in cloudv2 (PR #27724) re-serialized the Connect config schema, restoring per-field is_optional/is_advanced/ is_secret/is_deprecated. Wire those signals through: - enrichComponentsWithConfigSchema stamps requiredBySchema/secret onto proto specs from the raw GetPipelineServiceConfigSchema JSON (the ListComponents proto still drops non-string defaults and has no secret field at all). - checkRequired prefers the stamp; the proto-flag ladder remains as a documented degraded fallback for pre-4.59 dataplanes. - generateDefaultValue stops zero-filling fields whose default was lost in proto serialization, so engine defaults apply. - Deprecated fields are excluded from forms and generated configs; secret masking is the schema flag unioned with the name heuristic. - useEnrichedComponents consolidates the enrichment recipe for the pipeline editor, onboarding wizard, and template form panel, gating spec consumption until the config schema settles. - Ground-truth fixtures captured from the served schema (RPCN 4.100.0) back integration tests for kafka/generate/http_client/aws_s3/mapping/ chunker required-vs-optional behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four templates drifted from the components Connect actually ships, and the drift was invisible because the schema snapshot the regression tests validate against was frozen at RPCN 4.65 with the affected components allowlisted as known-missing: - dynamodb-cdc: aws_dynamodb_stream never shipped; rebuilt on aws_dynamodb_cdc (tables list, start_from/snapshot_mode knobs). - oracle-cdc: oracle_cdc → oracledb_cdc (connection_string/include). - sqlserver-cdc: sql_server_cdc → microsoft_sql_server_cdc (connection_string/include). - iceberg: catalog_uri/warehouse moved to catalog.url and the now-optional catalog.warehouse. This one was user-visible broken — the component exists, so the template showed in the gallery and its YAML failed dataplane lint on deploy. Refresh the snapshot to the RPCN 4.100 cloud schema cloudv2 actually serves, which also surfaced that redpanda_migrator dropped its batching field (removed from the mirror template). Empty the KNOWN_MISSING_COMPONENTS allowlist: every template is now fully validated against the snapshot. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Clean — no registry drift, off-token colours, or ad-hoc classesApp:
Generated by lookout audit-changes. |
…n fix The isSchemaLoading gate in useEnrichedComponents held specs empty until the multi-MB GetPipelineServiceConfigSchema settled, while pickers and forms rendered from the instantly-available proto componentList. Every confirmed regression traced to that window: silent no-op connector inserts, the serverless create timeout firing then a late resolution clobbering user-typed YAML, wizard YAML regeneration failing on deep-linked steps, and view mode rendering schema-less (forever, on a hung request). Specs are now available as soon as ListComponents resolves and re-emit with enrichment stamps when the schema settles — the interim proto-flag fallback is the same degraded mode used for pre-4.59 dataplanes. The template form's one-shot defaults reset still waits for full fidelity via isLoading, and enrichment results are memoized module-wide instead of recomputed per mount. Separately, harden the serverless create flow against the pre-existing race: after the init timeout has surfaced the editor, a late resolution no longer replaces the buffer. Fix a deterministic generation bug: components whose root config is an array of objects (switch, group_by) can never be "required", so the required-only collection seeding emitted undefined → `switch:` YAML null, which fails lint. Component roots now always produce a type-correct value. Cleanups from the same review: fold the deprecated-field exclusion into isFormField, deduplicate the SASL array generation into generateObjectArrayValue, and share a findConnectComponent lookup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@claude review |
|
Claude finished @SpicyPete's task in 3m 24s —— View job Code Review — RPCN optional field support
Reviewed the full diff against Findings below are all minor / non-blocking. 1. Template-form default reset now depends on the config-schema query settling
2. List-entry scalars are force-set to
|
RPCN: adopt restored schema flags and fix drifted templates
Background
cloudv2 #27724 (merged 2026-07-14) bumped
benthos/v44.53 → 4.73 inredpanda-connect-api, which re-serializes the Connect config schema before serving it. Benthos only began emitting per-fieldis_optional/is_advanced/is_secret/is_deprecatedat v4.59, so until that bump the console never received them and the frontend compensated with a defensive heuristic ladder (checkRequired) that guessed required-ness from proto flags and name patterns.The two RPCs still differ in what they carry (verified against cloudv2 source and the embedded RPCN 4.100 schema):
ListComponents(protoFieldSpec)GetPipelineServiceConfigSchema(raw JSON)optional/advanced/deprecatedis_secret''requiredarrays computed by the backend with full default knowledgeSo required/secret truth must come from the raw JSON path; the proto alone cannot distinguish "required" from "default lost in serialization".
What's changed
Schema-signal enrichment
enrichComponentsWithConfigSchema(utils/schema-enrichment.ts) stampsrequiredBySchemaandsecretonto proto-derived specs by walking the raw config-schema JSON (object/array/map wrappers unwrapped so JSON-Schema nodes line up with proto children).is_optionalanywhere) leaves specs unstamped.useEnrichedComponentshook consolidates the recipe for all three YAML-generating consumers (pipeline editor, onboarding wizard, template form panel) and keepscomponentsempty until the schema query settles, so YAML is never generated from un-enriched specs. Display-only consumers (gallery grid, tiles, command palette) intentionally stay on plainparseSchema.Required-field detection
checkRequiredis now: deprecated guard → trustrequiredBySchemastamp → documented degraded proto ladder (for pre-4.59 dataplanes only). Dead heuristic branches deleted.generateDefaultValueno longer zero-fills fields whose default was dropped by the proto — they're omitted so engine defaults apply (previously e.g.auto_replay_nacksdefaulting totruewas rendered asfalse).Visual editor forms
is_secretflag unioned with the old name regex (the flag misses e.g. AWS session tokens; the regex is all we have on older dataplanes).kind(batching policies).Template fixes (drift caught by this work)
Four templates referenced components/fields the engine never shipped or has since renamed — invisible because the test snapshot was frozen at RPCN 4.65 with the components allowlisted as known-missing:
aws_dynamodb_stream→aws_dynamodb_cdc(tableslist,start_from/snapshot_mode)oracle_cdc→oracledb_cdc(connection_string,include)sql_server_cdc→microsoft_sql_server_cdc(connection_string,include)catalog_uri/warehouse→catalog.url/ optionalcatalog.warehouse— this one was user-visible broken: the component exists, so the template showed in the gallery and its YAML failed dataplane lint on every deployassets/rp-connect-schema-full.json4.65 → RPCN 4.100 (the cloud schema cloudv2 actually serves) also caughtredpanda_migratorhaving dropped itsbatchingfield; removed from the mirror template.KNOWN_MISSING_COMPONENTSis now empty — every template is fully validated by the regression tests (schemaField paths resolve, stitched YAML contains only known fields, required fields always emitted).Behavior changes to be aware of
topicsandseed_brokersare no longer marked required — they genuinely are.Optional()in the engine (regexp_topics_includeis the alternative). The wizard still auto-populates them.requiredvalues were audited against the served schema: templates stricter than the engine (e.g. S3 region/credentials) are deliberate curation; the one looser case (postgres-cdcslot_name) is safe becausedefaultWhenBlankalways supplies a value.Deferred (needs cloudv2 changes)
is_secretcan never ride the proto path — the field doesn't exist inFieldSpec; a protogen regen won't help.convertFieldSpecstill drops non-string defaults. Serializing them would let the degradedcheckRequiredladder be deleted entirely.