fix(workflow-executor): tolerate non-primitive field types in collection schema#1756
Open
ShohanRahman wants to merge 1 commit into
Open
Conversation
…ion schema
forest-rails apimaps carry field types the executor's ColumnType contract
can't model — hand-authored smart-field type strings, and `[null]` from array
columns the liana fails to map. These made CollectionSchemaSchema.parse throw
a ZodError in getCollectionSchema, surfaced to the customer as a
DomainValidationError ("Internal validation error occurred while preparing the
step") that blocked their Get Data steps.
Add `.catch(null)` on the field `type` so an unparseable type normalizes to
null instead of failing the whole collection schema. Consumers already guard
on a null type (e.g. update-record filters `f.type != null`), consistent with
this schema's resilient-to-orchestrator-drift design.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A customer running migrated workflows hit
Internal validation error occurred while preparing the step(DomainValidationError) on their Get Data step. This message isDomainValidationError's user-facing text, thrown whenCollectionSchemaSchema.parse()fails insidegetCollectionSchema(forest-server-workflow-port.ts:197,209).The executor's
ColumnTypeSchemaonly accepts primitive/tuple/record/composite types. Two shapes in a forest-rails apimap fail it:PRIMITIVE_TYPES(e.g.DateTime) — rejected byz.enum(PRIMITIVE_TYPES).[null]array-column types (columns the liana can't map) — the field's top-leveltypeis already.nullable(), but the tuple branchz.tuple([ColumnTypeSchema])has a non-nullable inner element, so[null]fails.A single unmodelable field type failed the entire collection schema and blocked the run.
What
.catch(null)onFieldSchemaSchema.typeso an unparseable type normalizes tonullinstead of throwing — the whole collection schema keeps parsing.update-record-step-executor.ts:315filtersf.type != null.[null]normalize tonull; primitive/null/absent types are unchanged; a mixed collection parses instead of being rejected.Test plan
yarn workspace @forestadmin/workflow-executor test -- test/types/collection.test.ts— 6/6 passforest-server-workflow-port,schema-resolver,schema-cache,update-record-step-executor) — 155/155 pass🤖 Generated with Claude Code
Note
Tolerate non-primitive field types in
FieldSchemaSchemacollection parsingAdds
.catch(null)to thetypefield inFieldSchemaSchemaso unparseableColumnTypeSchemavalues (e.g. smart-field type strings or array-column[null]) resolve tonullinstead of failing validation. Explicitnullstaysnulland missingtypestaysundefined. New Jest tests in collection.test.ts cover all these cases.Macroscope summarized 54a2705.