Skip to content

feat(workflow-executor): pin Trigger Action source by stable step id (PRD-469)#1691

Open
Scra3 wants to merge 1 commit into
feature/prd-553-executor-filters-load-relatedfrom
feature/prd-598-executor-deterministic-trigger-action
Open

feat(workflow-executor): pin Trigger Action source by stable step id (PRD-469)#1691
Scra3 wants to merge 1 commit into
feature/prd-553-executor-filters-load-relatedfrom
feature/prd-598-executor-deterministic-trigger-action

Conversation

@Scra3

@Scra3 Scra3 commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Executor side of the Deterministic Trigger Action epic (PRD-469). The trigger-action executor resolved its source record by a runtime selectedRecordStepIndex (breaks on revise). Migrate to the stable selectedRecordStepId standardized by Load Related Record.

Changes

  • step-definition: TriggerAction.preRecordedArgs now uses selectedRecordStepId (revise-safe BPMN step id / workflow-start sentinel)
  • Lifted resolveSourceRecordRef from load-related-record-step-executor into the shared RecordStepExecutor base (trigger-action is now a second caller → extract); load-related inherits it
  • trigger-action: deterministic source via stable id; a source Load Related Record step that loaded nothing → SourceRecordMissingError (no AI fallback, no action triggered)
  • legacy steps (no selectedRecordStepId) keep AI record selection; actionName pinning unchanged
  • generalized SourceRecordMissingError wording (shared by load-related + trigger-action)

Tests

trigger-action: pinned workflow-start source + action → executes without AI (exact executeAction args asserted); pinned source that loaded nothing → error, no action. All 246 executor tests pass.

Stacked on feature/prd-553-executor-filters-load-related (PRD-471 not yet merged).

fixes PRD-598

Note

Pin Trigger Action source record by stable step id instead of index

  • Replaces selectedRecordStepIndex (number) with selectedRecordStepId (string) in TriggerActionStepDefinitionSchema.preRecordedArgs to reference a step by its stable BPMN id or WORKFLOW_START_STEP_ID.
  • When selectedRecordStepId is present, TriggerRecordActionStepExecutor.handleFirstCall resolves the source record deterministically via a new resolveSourceRecordRef method on the base RecordStepExecutor, skipping AI-based selection entirely.
  • resolveSourceRecordRef walks the live execution path to find the latest matching LoadRelatedRecord step, returns its loaded record, or throws SourceRecordMissingError if the step loaded nothing.
  • Legacy steps without selectedRecordStepId continue to use AI-based selection as before.
  • Behavioral Change: steps that previously fell back to AI selection when given an index will now error with SourceRecordMissingError if the pinned source step exists but loaded no record.

Macroscope summarized 3a96144.

…(PRD-469)

The trigger-action executor resolved its source record by a runtime
selectedRecordStepIndex, which breaks on revise. Switch to the stable
selectedRecordStepId standardized by Load Related Record (revise-safe BPMN
step id, or the workflow-start sentinel).

- step-definition: TriggerAction preRecordedArgs uses selectedRecordStepId
- lift resolveSourceRecordRef from load-related into the shared RecordStepExecutor
  base (second caller → extract); load-related now inherits it
- trigger-action: deterministic source via stable id; source step that loaded
  nothing → SourceRecordMissingError (no AI fallback, no action triggered)
- legacy steps (no selectedRecordStepId) keep AI record selection
- generalize SourceRecordMissingError wording (shared by both step types)

fixes PRD-598

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 21, 2026

Copy link
Copy Markdown

PRD-598

PRD-469

@qltysh

qltysh Bot commented Jun 21, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...ow-executor/src/executors/load-related-record-step-executor.ts100.0%
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/executors/record-step-executor.ts100.0%
Coverage rating: A Coverage rating: A
...-executor/src/executors/trigger-record-action-step-executor.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.

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.

1 participant