You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: address P1 double-substitution from cubic/coderabbit review
Both bots flagged a backward-compat regression: ${VAR} pass runs after
{env:VAR} pass, so an env value containing literal ${X} got expanded in
the second pass. Reordering only fixed one direction (reverse cascade
still possible when ${VAR}'s output contains {env:Y}).
Correct fix: single-pass substitution with one regex alternation that
evaluates all three patterns against the ORIGINAL text. Output of any
pattern cannot be re-matched by another.
Single regex handles:
$${VAR} or $${VAR:-default} → literal escape
(?<!$)${VAR}[:-default] → JSON-safe substitution
{env:VAR} → raw text injection
Regression tests added for both cascade directions:
- env.A="${B}" + {env:A} → literal ${B} stays
- env.A="{env:B}" + ${A} → literal {env:B} stays
All 34 tests pass. Typecheck + marker guard clean.
0 commit comments