Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
7.2 KiB
7.2 KiB
Scratchpad — Workflow Regex Transform + AI-Assisted Authoring
- Plan slug:
2026-05-09-workflow-regex-transform-ai-authoring - Created:
2026-05-09
What This Is
Working notes for adding deterministic regex parsing/extraction/replacement Transform actions to the workflow system, modeled after the workflow JSON transform feature.
Decisions
- (2026-05-09) Mirror the JSON transform lane: pure Transform actions, normal
action.call, normalsaveAs, deterministic runtime, and optional Quick Ask authoring help. - (2026-05-09) Start with JavaScript RegExp syntax because the runtime is TypeScript/Node and workflow authors will paste JavaScript-style patterns/flags.
- (2026-05-09) MVP actions should be
transform.regex_match,transform.regex_extract, andtransform.regex_replace. - (2026-05-09) Regex support must include guardrails for invalid patterns, unsupported flags, input length, match count, and pathological patterns where feasible. Regex execution is not safely interruptible once started in plain JS.
- (2026-05-09) Regex transform actions are not AI-gated. AI guidance remains gated by existing Quick Ask/AI Assistant entitlement.
Discoveries / Constraints
- (2026-05-09) Existing transform actions live in
shared/workflow/runtime/actions/registerTransformActions.ts. - (2026-05-09) The JSON feature background indicates related editor/runtime surfaces now include
WorkflowDesigner.tsx,actionInputEditorState.ts,workflowDataContext.ts,WorkflowStepSaveOutputSection.tsx,workflowSaveAsPath.ts,workflowRunDisplayError.ts,WorkflowRunDetailsPanel.tsx,chatWorkflowJsonTransformGuidance.ts,Header.tsx,QuickAskContext.tsx, andInputMappingEditor.tsx. - (2026-05-09) Current expression editor already documents JSONata regex functions, but workflow Transform actions should not rely on users writing JSONata regex syntax for common parse/extract/replace tasks.
- (2026-05-09) There is unrelated untracked work in
packages/core/src/rateLimit/at plan creation time; do not include it in this plan.
Commands / Runbooks
- (2026-05-09) Context checks used:
rg -n "regex|regexp|replace_text|matches|pattern|flags" shared/workflow/runtime ee/server/src/components/workflow-designer ee/packages/workflows/src/actions- Read JSON transform plan at
ee/docs/plans/2026-05-09-workflow-json-transform-ai-authoring/.
Links / References
- Prior JSON feature plan:
ee/docs/plans/2026-05-09-workflow-json-transform-ai-authoring/ - Planned PRD:
ee/docs/plans/2026-05-09-workflow-regex-transform-ai-authoring/PRD.md - Planned feature checklist:
ee/docs/plans/2026-05-09-workflow-regex-transform-ai-authoring/features.json - Planned test checklist:
ee/docs/plans/2026-05-09-workflow-regex-transform-ai-authoring/tests.json
Open Questions
- Should
transform.regex_extractinfer named capture output fields from named groups in the pattern for downstream references, or expose a stable genericmatchesarray only in the first slice? - Should we add a safe-regex dependency/static heuristic, or only enforce length/match-count limits for MVP?
- Should replacement support JavaScript replacement tokens (
$1,$<name>,$$) exactly, or also offer a literal replacement mode? - Should no-match extraction be success with empty results by default, or should there be a configurable
requireMatchfailure mode?
2026-05-10 Implementation Notes
Decisions
- Added first-class
transform.regex_match,transform.regex_extract, andtransform.regex_replaceinsideshared/workflow/runtime/actions/registerTransformActions.tsusing pure transform semantics (sideEffectful: false, engine idempotency). - Used JavaScript
RegExpruntime behavior directly and documented replacement-token support ($1,$2,$<name>,$$) in both runtime schema descriptions and Quick Ask guidance. regex_extractuses a deterministic bounded collector capped bymaxMatches; it does not throw merely because more matches exist in source text. It throws when configured limits are invalid (e.g.maxMatchesabove system limit).- Added explicit guardrails: max text length (
100000), max pattern length (2000), maxmaxMatchesinput (1000), duplicate/unsupported flag validation, invalid pattern validation, and zero-width match progression protections.
Key Files Changed
shared/workflow/runtime/actions/registerTransformActions.tsshared/workflow/runtime/actions/__tests__/registerTransformActions.test.tsshared/workflow/runtime/nodes/__tests__/actionCallTransformRegexSaveAsRuntime.test.tsee/server/src/services/chatWorkflowRegexTransformGuidance.tsee/server/src/__tests__/services/chatWorkflowRegexTransformGuidance.test.tsee/server/src/services/chatCompletionsService.tsee/server/src/components/workflow-run-studio/__tests__/workflowRunDisplayError.test.tsee/server/src/components/workflow-designer/mapping/InputMappingEditor.tsxee/server/src/components/workflow-designer/__tests__/TransformActionInputEditor.test.tsxee/server/src/components/workflow-designer/__tests__/workflowDataContext.test.ts
Validation Commands
pnpm -s vitest run -c vitest.config.ts workflow/runtime/actions/__tests__/registerTransformActions.test.ts workflow/runtime/nodes/__tests__/actionCallTransformRegexSaveAsRuntime.test.ts(fromshared/)pnpm -s vitest run src/components/workflow-run-studio/__tests__/workflowRunDisplayError.test.ts src/__tests__/services/chatWorkflowRegexTransformGuidance.test.ts src/components/workflow-designer/__tests__/workflowDataContext.test.ts(fromee/server/)
Gotchas
ee/server/src/components/workflow-designer/__tests__/TransformActionInputEditor.test.tsxcurrently depends on broader module resolution that can fail in isolated runs due unresolved@alga-psa/reference-data/actionsin this environment; targeted suites above were run successfully.
Review Fixes (2026-05-10)
- Fixed
InputMappingEditorregex action detection by moving the regex action-id helper to module scope so both field editor render paths can use it safely. - Made regex
textinputs required with a finite primitive text-source schema instead of barez.unknown(), so missing text fails validation and JSON Schema marks it required. - Reset regex state before replacement after match counting so sticky (
y) regex replacements do not report a replacement count without changing text. - Added regression coverage for required regex text inputs and sticky first-only replacement.
- Stabilized the workflow transform component test environment by mocking server-side action dependencies and patching React.act compatibility for this workspace's React/testing-library combination.
Validation (2026-05-10 Review Fixes)
npx vitest run --config shared/vitest.config.ts workflow/runtime/actions/__tests__/registerTransformActions.test.ts workflow/runtime/nodes/__tests__/actionCallTransformRegexSaveAsRuntime.test.ts- Passed: 2 files, 11 tests.
cd ee/server && npx vitest run --config vitest.config.ts src/__tests__/services/chatWorkflowRegexTransformGuidance.test.ts src/components/workflow-designer/__tests__/TransformActionInputEditor.test.tsx src/components/workflow-designer/__tests__/workflowDataContext.test.ts src/components/workflow-run-studio/__tests__/workflowRunDisplayError.test.ts- Passed: 4 files, 28 tests.