Repository navigation
Reject ingestion pipeline sourceConfig without type - #29566
Conversation
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
|
Pushed a fix for the current migration review thread in |
|
The failed downstream compatibility test expected an empty sourceConfig.config to succeed. I opened https://github.com/open-metadata/openmetadata-collate/pull/6300 to assert the new 400 invariant and started the exact compatibility workflow against this PR commit: https://github.com/open-metadata/openmetadata-collate/actions/runs/33415404671. Once the downstream PR is merged, rerun maven-collate-ci here. |
|
Status update: downstream test alignment is in https://github.com/open-metadata/openmetadata-collate/pull/6300, and the exact compatibility workflow is now running against this PR head: https://github.com/open-metadata/openmetadata-collate/actions/runs/33415404671. The test now intentionally expects HTTP 400 with sourceConfig.config.type is required for an empty config. This preserves the persistence invariant introduced here rather than weakening it. After #6300 merges, rerun maven-collate-ci on this PR. |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
There was a problem hiding this comment.
🟢 Approval recommended
The change matches the stated invariant and is backed by targeted unit + integration coverage across validation, migration backfill, and producer serialization paths.
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Lite
| private static boolean hasSourceConfigType(Object config, Map<?, ?> configMap) { | ||
| Object type = configMap.get(SOURCE_CONFIG_TYPE); | ||
| return type instanceof String typeValue && !typeValue.isBlank() | ||
| || !(config instanceof Map<?, ?>) && type instanceof Enum<?>; | ||
| } |
| private static boolean isMissingOrBlank(JsonNode type) { | ||
| return type == null || type.isNull() || type.isTextual() && type.asText().isBlank(); | ||
| } |
There was a problem hiding this comment.
🟢 Approval recommended
The invariant is enforced consistently across write/deploy paths, legacy data is backfilled conservatively, and the change is covered by focused unit + integration tests across the affected layers.
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 0 new
- Review effort level: Lite
🚦 Removed from the merge queue —
|
Code Review ✅ Approved 7 resolved / 7 findingsEnforces ✅ 7 resolved✅ Bug: Backfill added to already-released v1131 migration may never run
✅ Edge Case: Backfill no-ops on scalar sourceConfig.config rows, leaving them typeless
✅ Edge Case: Backfill only types databaseService metadata pipelines
✅ Edge Case: Snapshot emitted after listener registration can duplicate a live event
✅ Edge Case: Service type map keeps arbitrary relationship when >1 CONTAINS
...and 2 more resolved from earlier reviews OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Fixes #28818.
Why this is needed
External automation can create ingestion pipelines while omitting the Pydantic-defaulted
sourceConfig.config.typediscriminator. Those persisted rows cannot be reliably deserialized for later UI redeployment, which is the failure reported in #28818.What changed
sourceConfig.config.typeon writes, and rejects non-object configs. Explicit non-blank strings remain unchanged.CONTAINSrelationship and the pipeline type identify a known source config.BaseWorkflowmaterializes defaulted source-config discriminators during self-registration, soexclude_unset=Truedoes not omit the required field.Scope
This is a runtime persistence invariant. The JSON schema and generated clients still model some discriminators as optional; aligning that broader contract is intentionally out of scope for this PR.
This PR does not change progress-SSE behavior. The existing stream implementation is unchanged from the merge base.
Validation
mvn -pl openmetadata-service -Dtest=IngestionPipelineMigrationUtilTest,IngestionPipelineRepositoryTest test- 77 passed.mvn -pl openmetadata-service spotless:checkpassed.git diff --checkpassed.Greptile Summary
This PR enforces a runtime persistence invariant:
sourceConfig.config.typemust be a non-blank string on every ingestion pipeline write and deployment, and backfills the discriminator for legacy rows that were persisted without it. The fix spans the Java repository layer (validation inprepare()anddeployIngestionPipeline()), a v2.1.0 data migration that repairs existing rows using service CONTAINS relationships, the PythonBaseWorkflowself-registration path (forcing the Pydantic default intomodel_fields_set), and the Playwright fixture that was triggering the now-enforced validation.validateSourceConfigHasType) rejects missing, null, blank, and non-stringtypeon all write paths (POST / PUT / PATCH) and before pipeline deployment, tested end-to-end via raw-HTTP integration tests that bypass SDK serialization.IngestionPipelineMigrationUtilbatch-scans non-deleted pipelines and writes a repaired type by resolving service-type × pipeline-type pairs; unresolvable rows (orphaned, ambiguous, or malformed) are logged and left unchanged to avoid silent data corruption.BaseWorkflow._source_config_with_explicit_type()copies the source config withtypeexplicitly placed inmodel_fields_set, soexclude_unset=Trueserialization no longer omits it during self-registration.Confidence Score: 5/5
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Client Request\nPOST / PUT / PATCH] --> B[IngestionPipelineRepository.prepare] B --> C[validateSourceConfigHasType] C --> D{sourceConfig or\nconfig is null?} D -- Yes --> E[400 BadRequest\ntype is required] D -- No --> F[getSourceConfigMap] F --> G{config is Map?} G -- Yes --> H[Use config as-is] G -- No --> I[JsonUtils.getMap - convert typed obj] H --> J[hasSourceConfigType] I --> J J --> K{type is non-blank\nString?} K -- Yes --> L[Validation passes\nWrite to DB] K -- No --> M{config NOT Map AND\ntype is Enum?} M -- Yes --> L M -- No --> E N[deployIngestionPipeline] --> C O[Migration: backfillSourceConfigTypes] --> P[Batch scan non-deleted pipelines] P --> Q[getServiceTypeResolutions via\nCONTAINS relationships] Q --> R{sourceConfig.config\nhas explicit type?} R -- Yes --> S[NOT_NEEDED - skip] R -- No, missing/blank --> T{Service + PipelineType\nresolvable?} T -- Yes --> U[Write repaired type to DB] T -- No/Ambiguous --> V[UNRESOLVED - log and skip] W[Python BaseWorkflow\n_source_config_with_explicit_type] --> X{config is\nOpenMetadataBaseModel?} X -- No --> Y[Return unchanged source_config] X -- Yes --> Z{type attribute\nis None?} Z -- Yes --> Y Z -- No --> AA[model_copy with type\nexplicitly in model_fields_set] AA --> BB[create_or_update pipeline\ntype serialized even with exclude_unset=True]Reviews (20): Last reviewed commit: "test: expand ingestion source config cov..." | Re-trigger Greptile