fix: resolve ${VAR} templates against environment variables #9
+184
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
resolveArgsTemplate()only looked up${VAR}from workflow args (passed via--args-json), soenv: { MY_VAR: "${MY_VAR}" }in workflow YAML produced the literal string"${MY_VAR}"instead of the actual value fromprocess.env. This also affected${VAR}incommand,stdin, andcwdfields.The fix threads the accumulated environment through
resolveTemplate,resolveStdin, andresolveCwdso${VAR}falls back to the process/workflow environment when not found in args. Args still take precedence over env vars.Also adds relative
cwdresolution —cwd: ./scriptsnow resolves relative to the workflow file's directory instead of being passed as-is tospawn().lobster-biscuit
Repro Steps
env: { TEST_VAR: "${TEST_VAR}" }TEST_VAR=hello lobster run --file workflow.lobsterprocess.env.TEST_VARis the literal"${TEST_VAR}"instead of"hello"Root Cause
resolveArgsTemplateonly checkedargs(workflow-defined args from--args-json). It had no fallback to the environment, so any${VAR}not defined inargswas returned verbatim.Behavior Changes
${VAR}inenv,command,stdin, andcwdvalues now resolves from the environment when not found in workflow argscwdvalues (e.g../scripts) now resolve relative to the workflow file directory${VAR}still pass through as beforeTests
6 new tests in
test/workflow_env.test.ts:All 53 tests pass (47 existing + 6 new).
pnpm build && pnpm test— clean.Manual Testing
Sign-Off
envparams preserve backward compatibility