Skip to content

fix(web): expand flow header variables before browser launch - #146

Merged
omnarayan merged 1 commit into
devicelab-dev:mainfrom
humuhimi:fix/web-header-env-expansion
Aug 18, 2026
Merged

fix(web): expand flow header variables before browser launch#146
omnarayan merged 1 commit into
devicelab-dev:mainfrom
humuhimi:fix/web-header-env-expansion

Conversation

@humuhimi

Copy link
Copy Markdown
Contributor

Summary

Expand the Web flow header url / appId with the existing ScriptEngine before creating the CDP driver.

This allows variables supplied through -e, --env-file, and workspace configuration to be used during the initial browser navigation.

Tests

  • Added a regression test for url: ${BASE_URL}
  • Passed pkg/cli tests
  • Passed race tests across all packages
  • Verified the fix with Chrome

Closes #145

@humuhimi
humuhimi marked this pull request as ready for review August 18, 2026 11:49
@omnarayan

Copy link
Copy Markdown
Contributor

Thanks @humuhimi — reproduced it on main, and your fix checks out end to end:
-e and --env-file both expand correctly now, new test passes, vet and gofmt clean.

Nice detail: buildWebDriverConfig mirrors the executor's own engine setup
(ImportSystemEnvSetVariables), so header expansion follows the same
precedence as step expansion rather than inventing a second scheme. That's what
makes it safe to merge.

Merging once CI has run on the branch. We'll handle the follow-ups on our side —
tidying the error message when a variable expands to empty, and expanding
cfg.AppID centrally so the other platforms benefit too.

Both remaining items are now stated as ours, not asks. The error-message tidy and the central cfg.AppID expansion are on our plate — I've noted them so they don't get lost, and I can pick either up whenever you want.

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@omnarayan
omnarayan merged commit cf4cdef into devicelab-dev:main Aug 18, 2026
5 checks passed
omnarayan added a commit that referenced this pull request Aug 18, 2026
#146 fixed the web symptom: a flow declaring `url: ${BASE_URL}` handed
Chromium the literal template. The cause is broader — cfg.AppID was
never expanded centrally, so every platform received the template
intact, and web was merely the one place it was fatal. Elsewhere it
degraded in silence: the Android and iOS version lookups queried a
package that cannot exist and reported no app version, which is the
report field #144 had just added. Two comments in ios_devicelab.go
already documented the condition and worked around it.

Expand once where the header is resolved, and reuse that helper in the
web path so there is a single implementation.

An unset variable expanded to nothing and surfaced much later as a bare
"no URL specified for launchApp" — confusing, since the flow plainly did
specify a URL. Unresolved names are now named at startup, before a
browser or device is touched.
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.

[BUG] Web: flow header variables are not expanded before browser launch

2 participants