Skip to content

feat(workflow-executor): PRD-551 apply deterministic Load Related Record config (revise-safe)#1687

Open
Scra3 wants to merge 3 commits into
mainfrom
feature/prd-551-executor-apply-deterministic-load-related
Open

feat(workflow-executor): PRD-551 apply deterministic Load Related Record config (revise-safe)#1687
Scra3 wants to merge 3 commits into
mainfrom
feature/prd-551-executor-apply-deterministic-load-related

Conversation

@Scra3

@Scra3 Scra3 commented Jun 19, 2026

Copy link
Copy Markdown
Member

Context

Runtime half of the Deterministic Load Related Record epic (PRD-471). The executor must consume the preRecordedArgs the orchestrator now sends (PRD-548) and resolve the source record + relation deterministically.

What

  • Forward preRecordedArgs from the orchestrator wire: it was silently dropped by step-definition-mapper (only prompt/executionType/title were mapped). Added to ServerWorkflowTaskLoadRelatedRecord + the mapper.
  • Revise-safe source resolution: resolveSourceRecordRef matches a previous load-related step on its own stepIndex or originalStepIndex (mirrors resolveStepExecution / getAvailableRecordRefs), plus the workflow-start record. The previous strict own-index match on the flattened pool reported a valid chained source as "no source record" after a revise.
  • Removed selectedRecordIndex (index-based record pinning) from schema/executor/tests: brittle, not revise-safe, unused here. The final record stays AI-suggested + user-confirmed.

Scope

Source + relation are pinned; the final record choice remains AI-suggested + user-confirmed (Full AI pinning is PRD-148). Error on deleted relation/collection reuses existing InvalidPreRecordedArgsError / RelationNotFoundError (dual technical/user message).

Tests

80/80 in the load-related suite (added a revise-safety test that fails on the old strict match), 1081/1081 across the package.

fixes PRD-551

🤖 Generated with Claude Code

Note

Replace index-based pinning with stable step-id resolution in LoadRelatedRecordStepExecutor

  • preRecordedArgs for LoadRelatedRecord steps now pins the source record using a stable BPMN step id (selectedRecordStepId) instead of a runtime step index (selectedRecordStepIndex), making recordings revise-safe.
  • A new WORKFLOW_START_STEP_ID sentinel ('workflow-start') identifies the workflow's base/trigger record as the source.
  • A new SourceRecordMissingError is thrown when the referenced source step ran but loaded no record.
  • Pre-recorded selection of a specific related record by index is removed; the final record is always chosen via AI suggestion and user confirmation.
  • Behavioral Change: recordings using the old selectedRecordStepIndex or selectedRecordIndex fields will fail schema validation and must be migrated to selectedRecordStepId.

Macroscope summarized ed69e2b.

…ig (revise-safe)

- Forward preRecordedArgs from the orchestrator wire through the step-definition
  mapper (it was dropped) and the ServerWorkflowTaskLoadRelatedRecord type.
- Resolve the "Related to" source revise-safely: match a previous load-related
  step on its own stepIndex OR originalStepIndex (mirrors resolveStepExecution),
  plus the workflow-start record — instead of a strict own-index match on the
  flattened pool, which wrongly reported a valid chained source as missing after
  a revise.
- Remove selectedRecordIndex (index-based record pinning): brittle, not
  revise-safe, unused — the final record stays AI-suggested + user-confirmed.

fixes PRD-551

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

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

PRD-551

@qltysh

qltysh Bot commented Jun 19, 2026

Copy link
Copy Markdown

1 new issue

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

@qltysh

qltysh Bot commented Jun 19, 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/errors.ts100.0%
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/types/validated/step-definition.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.

…not runtime index

The "Related to" source is now referenced by the source step's stable BPMN step id
(selectedRecordStepId) or the WORKFLOW_START_STEP_ID sentinel, instead of the runtime
stepIndex. This is knowable by the editor at build time (the runtime index is not) and
survives revisions by construction (clones keep their step id), so the own→originalStepIndex
index juggling is gone. In a loop the most recent live-path occurrence wins.

fixes PRD-551

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When the "Related to" source step ran but loaded no record, throw SourceRecordMissingError with a
clear user message (naming the source step when available) instead of the generic
"pre-configured step parameters are invalid". A config pointing at a non-existent step still
throws InvalidPreRecordedArgsError.

fixes PRD-551

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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