feat(engine): implement Regex in FlowExpr and migrate FeatureFilter#2122
Conversation
There was a problem hiding this comment.
Pull request overview
This PR continues the ongoing FlowExpr migration by refactoring FeatureFilter condition expressions from a plain string (Expr) into a structured { type, value } Code object, and extends the FlowExpr runtime with several usability features needed by migrated workflows.
Changes:
- Update FeatureFilter condition schema from
Expr(string) toCode(type+value) and migrate test workflow fixtures accordingly. - Extend FlowExpr runtime with
Regex(...)support and raw-string literals (r"...") for easier regex authoring. - Add list/array
.get(...)and centralize index resolution logic to simplify safe indexing and reduce duplicated bounds logic.
Reviewed changes
Copilot reviewed 96 out of 97 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| engine/schema/actions.json | Introduces Code/CodeType schema and switches Condition.expr to reference Code. |
| engine/schema/actions_en.json | Language-specific schema mirror for Code/CodeType + Condition.expr update. |
| engine/schema/actions_ja.json | Language-specific schema mirror for Code/CodeType + Condition.expr update. |
| engine/schema/actions_zh.json | Language-specific schema mirror for Code/CodeType + Condition.expr update. |
| engine/schema/actions_fr.json | Language-specific schema mirror for Code/CodeType + Condition.expr update. |
| engine/schema/actions_es.json | Language-specific schema mirror for Code/CodeType + Condition.expr update. |
| engine/schema/i18n/actions/en.json | Adds i18n placeholders for the new Code definition fields. |
| engine/schema/i18n/actions/ja.json | Adds i18n placeholders for the new Code definition fields. |
| engine/schema/i18n/actions/zh.json | Adds i18n placeholders for the new Code definition fields. |
| engine/schema/i18n/actions/fr.json | Adds i18n placeholders for the new Code definition fields. |
| engine/schema/i18n/actions/es.json | Adds i18n placeholders for the new Code definition fields. |
| engine/runtime/action-processor/src/feature/filter.rs | Refactors FeatureFilter to compile/evaluate Code and route by eval_bool(). |
| engine/runtime/types/src/expr.rs | Adds CompiledCode::eval_bool() and adjusts string evaluation to use str_cast. |
| engine/runtime/runtime/src/builder_dag.rs | Adds/maintains dynamic output-port extraction for FeatureFilter from with.conditions[].outputPort. |
| engine/runtime/expr/src/lib.rs | Adjusts public re-exports (adds bool_cast/str_cast) and removes eval_string helper. |
| engine/runtime/expr/src/core/lexer.rs | Adds r"..." raw string literal tokenization. |
| engine/runtime/expr/src/core/eval.rs | Refactors array index assignment bounds logic to use shared index resolution. |
| engine/runtime/expr/src/core/builtins/array.rs | Adds array/list .get(...) and resolve_index(...) helper. |
| engine/runtime/expr/src/core/builtins/regex.rs | Adds Regex builtin object with find/find_all-style methods and tests. |
| engine/runtime/tests/fixture/workflow/feature/filter.yaml | Migrates FeatureFilter test fixture to {type: flowExpr, value: ...}. |
| engine/runtime/tests/fixture/workflow/geometry/neighbor_finder/proximity_search_with_geojson.yaml | Migrates FeatureFilter test fixture to {type: flowExpr, value: ...}. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2122 +/- ##
=====================================
Coverage 7.86% 7.86%
=====================================
Files 224 224
Lines 37600 37600
=====================================
Hits 2956 2956
Misses 34391 34391
Partials 253 253
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
2f403d0 to
b2e46e8
Compare
b2e46e8 to
a0a9d97
Compare
Overview
Continuing #2030, #2087, #2109, migrating FeatureFilter and update FlowExpr implementation.
Changes
findandfind_allmethods.geton list to simplify out of range fallback on listNotes
Currently condition expression accepts both code and string types which is a known problem. Schema generation for the new code fields are not determined. The fix will be implemented in another PR.