improvement(func-exec): normalize inputs to match schema#4473
improvement(func-exec): normalize inputs to match schema#4473icecrasher321 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Introduces shared utilities ( Adds targeted tests covering normalization behavior for arrays/records, Reviewed by Cursor Bugbot for commit da50222. Configure here. |
Greptile SummaryThis PR adds a normalization layer at all execution-context boundaries to handle legacy or corrupted workflow state where
Confidence Score: 4/5Safe to merge — the change is additive normalization that degrades gracefully and is well-covered by new unit tests The normalization utilities are correct and test coverage is solid. Two low-risk design concerns exist: normalizeWorkflowVariables silently lets a later legacy-array entry overwrite an earlier one when keys collide, and the function returns the original object reference for already-valid records, creating an implicit coupling with the in-place mutation in execution-core.ts. Neither issue manifests in the normal (non-legacy-array) path that most workflows use today. apps/sim/lib/core/utils/records.ts — the normalizeWorkflowVariables key-collision and shared-reference behaviour are the two points most worth a second look Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["ExecutionSnapshot / DAGExecutor constructor (unknown inputs)"]
B["normalizeWorkflowVariables"]
C{"isPlainRecord?"}
D["Return same ref"]
E{"Array?"}
F["Map id/name to record"]
G["Return {}"]
H["normalizeStringRecord"]
I{"isPlainRecord?"}
J["Drop null, coerce to String"]
K["Return {}"]
L["normalizeStringArray"]
M{"Array?"}
N["Filter string elements"]
O["Return []"]
A --> B & H & L
B --> C
C -- yes --> D
C -- no --> E
E -- yes --> F
E -- no --> G
H --> I
I -- yes --> J
I -- no --> K
L --> M
M -- yes --> N
M -- no --> O
D & F & G & J & K & N & O --> P["Executor / Handler typed inputs"]
|
Summary
Legacy / corrupted workflow vars was leading to schema violations.
Type of Change
Testing
Tested manually
Checklist