Skip to content

validation: allow multiple constraints per projection#2977

Open
mdibaiee wants to merge 2 commits into
masterfrom
mahdi/multiple-projection-constraints
Open

validation: allow multiple constraints per projection#2977
mdibaiee wants to merge 2 commits into
masterfrom
mahdi/multiple-projection-constraints

Conversation

@mdibaiee
Copy link
Copy Markdown
Member

@mdibaiee mdibaiee commented May 27, 2026

Description:

  • Materialization connectors report field constraints through a map<string, Constraint> in Validated.Binding. Because it's a map, only one constraint per projection field is possible.

  • This caused a bug we saw with a customer recently: when a new binding is attached to an existing table whose flow_document column has an incompatible type, the connector emits flow_document: INCOMPATIBLE. The control plane drops bare INCOMPATIBLE on new bindings (no live spec) because there's no way to know whether the field is required — so FieldSelection.Document is set to "" and the materialization silently degrades to
    delta updates writes since there is no flow_document, creating duplicate rows on every update.

  • The connector can't fix this unilaterally: emitting LOCATION_REQUIRED instead of INCOMPATIBLE hides the incompatibility signal: they can publish but they will get an error during connector runtime that complains about an incompatible flow_document column.

  • This PR allows connectors to provide multiple constraints per field. This allows a connector to emit both LOCATION_REQUIRED and INCOMPATIBLE, which results in control plane throwing a clean error about why the field cannot be materialized as-is.

  • Existing tasks are not affected, there is full backwards compatibility. Once we merge and land this, I will work on migrating all materializations to use the new protocol field, and later we can remove the old deprecated field.

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)

Notes for reviewers:

(anything that might help someone review this PR)

@mdibaiee mdibaiee force-pushed the mahdi/multiple-projection-constraints branch 5 times, most recently from 451d1d0 to 8ceb86b Compare May 27, 2026 16:55
@mdibaiee mdibaiee force-pushed the mahdi/multiple-projection-constraints branch from 8ceb86b to 1407552 Compare May 27, 2026 17:11
@mdibaiee mdibaiee force-pushed the mahdi/multiple-projection-constraints branch from 1407552 to a961fa0 Compare May 27, 2026 17:14
@mdibaiee mdibaiee marked this pull request as ready for review May 27, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant