Skip to content

fix(lang): include mobile and skip refs in step dependency graph#20

Merged
euskadi31 merged 1 commit into
masterfrom
feature/mobile-improve
May 18, 2026
Merged

fix(lang): include mobile and skip refs in step dependency graph#20
euskadi31 merged 1 commit into
masterfrom
feature/mobile-improve

Conversation

@euskadi31
Copy link
Copy Markdown
Contributor

StepDependencies only walked When, Request, Expect, Capture and Keyword expressions to extract implicit result.<step> references for the DAG. It never traversed step.Mobile nor step.SkipRules, so a mobile step referencing a previous keyword/HTTP step (e.g.
input_text { value = result.user.email }) had no recorded dependency on user. The DAG placed both steps in the same topological layer and ran them in parallel; the mobile evaluator then observed result.user as the empty object pre-populated by NewScenarioState and failed with the misleading HCL error "Unsupported attribute" in ~100us, before the keyword had a chance to write its outputs. The same latent bug applied to skip rules referencing other steps' results.

Refactor StepDependencies into focused helpers (collectRequestRefs, collectExpectRefs, collectMobileRefs, collectMobileExpectRefs, collectSkipRefs) to keep gocyclo under the v2 lint threshold while covering every Expression in MobileStep (Platform, Target, Launch.ClearState, each Action's five fields, every Expect.* slice with their ID/Expected/Timeout/Interval fields) and every Expression in SkipRule (Condition, Reason, OS, Arch, EnvSet, Env).

Adds four unit tests in refs_test.go for the new walks and a DAG-level integration test in runner_test.go that builds a keyword step followed by a mobile step referencing it and asserts buildLayers produces two distinct layers in the expected order.

StepDependencies only walked When, Request, Expect, Capture and Keyword
expressions to extract implicit `result.<step>` references for the DAG.
It never traversed `step.Mobile` nor `step.SkipRules`, so a mobile step
referencing a previous keyword/HTTP step (e.g.
`input_text { value = result.user.email }`) had no recorded dependency
on `user`. The DAG placed both steps in the same topological layer and
ran them in parallel; the mobile evaluator then observed `result.user`
as the empty object pre-populated by NewScenarioState and failed with
the misleading HCL error "Unsupported attribute" in ~100us, before the
keyword had a chance to write its outputs. The same latent bug applied
to skip rules referencing other steps' results.

Refactor StepDependencies into focused helpers (collectRequestRefs,
collectExpectRefs, collectMobileRefs, collectMobileExpectRefs,
collectSkipRefs) to keep gocyclo under the v2 lint threshold while
covering every Expression in MobileStep (Platform, Target,
Launch.ClearState, each Action's five fields, every Expect.* slice
with their ID/Expected/Timeout/Interval fields) and every Expression
in SkipRule (Condition, Reason, OS, Arch, EnvSet, Env).

Adds four unit tests in refs_test.go for the new walks and a
DAG-level integration test in runner_test.go that builds a keyword
step followed by a mobile step referencing it and asserts buildLayers
produces two distinct layers in the expected order.
@euskadi31 euskadi31 self-assigned this May 18, 2026
Copilot AI review requested due to automatic review settings May 18, 2026 23:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes step dependency graph construction by ensuring StepDependencies also traverses expressions inside step.Mobile and step.SkipRules, so result.<step> references in those blocks correctly enforce execution ordering (preventing unintended parallel execution and misleading early HCL evaluation failures).

Changes:

  • Refactors StepDependencies into helper walkers for request/expect/mobile/skip rule expressions and adds the missing traversals.
  • Adds unit tests covering mobile action refs, mobile expect refs, mobile platform/launch refs, and skip rule refs.
  • Adds an integration-style test asserting buildLayers orders a mobile step after a keyword step it references via result.user.*.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/lang/refs.go Adds request/expect/mobile/skip expression walkers so result.<step> refs are included in step DAG dependencies.
internal/lang/refs_test.go Adds unit tests ensuring mobile and skip-rule expressions contribute implicit step dependencies.
internal/runtime/runner_test.go Adds a DAG layering test proving mobile steps referencing prior steps are scheduled in later layers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@euskadi31 euskadi31 merged commit f8457f2 into master May 18, 2026
2 checks passed
@euskadi31 euskadi31 deleted the feature/mobile-improve branch May 18, 2026 23:43
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