When a base template defers a variable before its block definitions, the
eager first pass produced output without {% set current_path = '...' %},
leaving the second pass without a base-template path reference. This would
break relative path resolution for any base template using includes or
other path-dependent tags.
The pathSetter was only written when resolveBlockStubs() added deferred
tokens (deferred content inside block bodies). It was not written when
the base template itself produced deferred tokens before its blocks
(preserveBlocks = true). Fix: also set pathSetter when preserveBlocks
is true.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
When a Jinja template extends a base that defers a variable before its block definitions, the eager first-pass output was missing the {% set current_path = '...' %} preamble that all other eager extends scenarios include. Without it, the second pass has no base-template path reference, which would break relative path resolution (e.g., {% include %} calls) inside any such base template.
The pathSetter node — responsible for emitting the current_path reconstruction — was only written when resolveBlockStubs() added deferred tokens (i.e., deferred content inside block bodies). It was not written when the base template itself produced deferred tokens before its blocks (preserveBlocks = true). The fix is a one-character condition change: also set pathSetter when preserveBlocks is true.
This is the root cause of internal HubL issue https://github.com/HubSpotProductSupport/ProductSupport/issues/146621.
BRAVE
Backwards Compatibility
No API or behavioral change for non-deferred templates. The fix only applies when preserveBlocks is already true, which only happens in eager mode when the base template itself defers content.
Rollout and Rollback Plan
Automated Testing
Verification
Expect Dependencies to Fail
None expected.
PR description authored by Claude Code
REVIEWERS: Please review both the code changes and the answers above, and validate that they match the expectations for BRAVE