Skip to content

feat(workflow-executor): deterministic source record for Update Data steps (PRD-777)#1761

Merged
EnkiP merged 4 commits into
mainfrom
workflow/deterministic-update-data
Jul 21, 2026
Merged

feat(workflow-executor): deterministic source record for Update Data steps (PRD-777)#1761
EnkiP merged 4 commits into
mainfrom
workflow/deterministic-update-data

Conversation

@EnkiP

@EnkiP EnkiP commented Jul 15, 2026

Copy link
Copy Markdown
Member

Part of the deterministic Update Data step work.

fixes PRD-777

What

The update-record (Update Data) step can now resolve its source record deterministically from a build-time-configured stable BPMN step id (selectedRecordStepId), mirroring read-record (Get Data) and trigger-action — instead of always asking the AI to pick among the available records.

Changes

  • UpdateRecordStepDefinitionSchema.preRecordedArgs gains selectedRecordStepId (legacy selectedRecordStepIndex kept for back-compat; fieldName/value unchanged).
  • update-record-step-executor (handleFirstCall): when selectedRecordStepId is set, resolve via resolveSourceRecordRef (revise-safe; WORKFLOW_START_STEP_ID → base record). Falls back to legacy index / AI selection when unset.
  • Server contract (ServerWorkflowTaskUpdateData) + mapper forward preRecordedArgs for update-data.

Tests

  • Deterministic resolve skips the select-record AI round; WORKFLOW_START_STEP_ID → base record; unresolvable id → error.
  • Mapper forwards preRecordedArgs (selectedRecordStepId + fieldName + value).

Companion PRs: forestadmin-server (orchestrator), forestadmin (editor UI).

🤖 Generated with Claude Code

Note

Add deterministic source record resolution and preRecordedArgs support to Update Data workflow steps

  • Adds selectedRecordStepId to preRecordedArgs in UpdateRecordStepDefinitionSchema and the server task interface, allowing callers to pin the source record by BPMN step ID instead of index.
  • Updates UpdateRecordStepExecutor.handleFirstCall to support three tiers: (1) fieldName+value uses both as-is, (2) fieldName alone pins the field and asks the AI for the value via the new selectValueForField method, (3) neither defers fully to the AI.
  • Adds selectValueForField, a new method that builds a value-only AI tool (set-record-field-value) for pinned-field flows and coerces the returned value to the field's native type.
  • Fixes Boolean fields in AI tool schemas by adding a forAiTool flag to buildZodSchemaForPrimitive, using plain z.boolean() instead of a z.preprocess transform to avoid JSON Schema conversion errors.
  • Risk: value provided without fieldName in preRecordedArgs now throws an error; previously this combination was not validated.

Macroscope summarized 7c2eb74.

@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

PRD-777

@qltysh

qltysh Bot commented Jul 15, 2026

Copy link
Copy Markdown

3 new issues

Tool Category Rule Count
qlty Structure Function with many returns (count = 6): mapTask 3

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EnkiP
EnkiP force-pushed the workflow/deterministic-update-data branch from 7fa69b5 to 2a2dbdd Compare July 16, 2026 07:54
@qltysh

qltysh Bot commented Jul 16, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on main by 0.01%.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...workflow-executor/src/executors/update-record-step-executor.ts100.0%
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/adapters/step-definition-mapper.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

…I-resolved value

The build-time config lets the Editor pin the field while leaving the value to
the runtime prompt. The 'fieldName and value must both be provided or both
omitted' guard wrongly rejected that, throwing InvalidPreRecordedArgsError. Now
a value-less fieldName pins the field and the AI resolves only the value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EnkiP
EnkiP force-pushed the workflow/deterministic-update-data branch from 6a1f30f to 8dad337 Compare July 16, 2026 15:19
Enki Pontvianne added 2 commits July 17, 2026 13:00

@matthv matthv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@EnkiP
EnkiP merged commit 2589956 into main Jul 21, 2026
37 checks passed
@EnkiP
EnkiP deleted the workflow/deterministic-update-data branch July 21, 2026 09:10
forest-bot added a commit that referenced this pull request Jul 21, 2026
# @forestadmin/workflow-executor [1.20.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/workflow-executor@1.19.0...@forestadmin/workflow-executor@1.20.0) (2026-07-21)

### Features

* **workflow-executor:** deterministic source record for Update Data steps (PRD-777) ([#1761](#1761)) ([2589956](2589956))
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.

2 participants