Skip to content

Conversation

@lukaszlenart
Copy link
Member

Summary

Fixes WW-5587 - WithLazyParams interceptors lose parameters in stack configurations.

This is a critical bug fix that completes the work started in WW-5586. Even after WW-5586's fix, WithLazyParams interceptors still couldn't work properly in stack configurations because the parameter map wasn't being preserved in InterceptorMapping.

Problem

In InterceptorBuilder.constructParameterizedInterceptorReferences() at line 177, the code was creating InterceptorMapping instances using the 2-argument constructor:

InterceptorMapping mapping = new InterceptorMapping(key, interceptor);

This constructor defaults to an empty params map, which breaks the lazy parameter injection mechanism:

  1. At factory time: Interceptor properties are set (thanks to WW-5586) ✅
  2. At invocation time: LazyParamInjector.injectParams() needs the params map to re-evaluate expressions ❌
  3. But interceptorMapping.getParams() returns empty → nothing to re-evaluate ❌
  4. Result: Expression parameters like ${someValue} stay as literal strings ❌

Solution

Pass the map parameter to the 3-argument constructor:

InterceptorMapping mapping = new InterceptorMapping(key, interceptor, map);

This simple one-line change ensures the params map is preserved for LazyParamInjector to use during action invocation.

Changes

  • InterceptorBuilder.java:177 - Added map parameter to InterceptorMapping constructor
  • DefaultActionInvocationTest.java - Enhanced test to verify params are preserved in InterceptorMapping
  • Research document - Added comprehensive analysis of both WW-5586 and WW-5587 bugs

Test Coverage

Enhanced existing test testInvokeWithLazyParamsStackConfiguration() to assert that:

  • WithLazyParams interceptors have non-empty params in InterceptorMapping
  • Expression parameters are correctly evaluated at invocation time
  • Static parameters remain unchanged

Test passes successfully ✅

Related Issues

  • Fixes: WW-5587
  • Related: WW-5586 (partial fix - only fixed factory-time initialization)

Impact

This fix enables the complete dual initialization pattern for WithLazyParams interceptors:

  1. Factory time: Properties set with literal values (including expression strings)
  2. Invocation time: Expression parameters re-evaluated from ValueStack

Without this fix, WithLazyParams interceptors cannot be used with parameter overrides in interceptor stacks.

🤖 Generated with Claude Code

…ms interceptors

InterceptorBuilder.constructParameterizedInterceptorReferences() was
creating InterceptorMapping instances without passing the params map,
causing getParams() to return empty and breaking lazy parameter
injection at invocation time.

This fix adds the params map to the InterceptorMapping constructor call,
enabling LazyParamInjector to re-evaluate expression parameters during
action invocation as designed.

Enhanced test to verify params are preserved in InterceptorMapping.

Fixes WW-5587

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link

@lukaszlenart lukaszlenart merged commit a108e23 into main Nov 21, 2025
10 checks passed
@lukaszlenart lukaszlenart deleted the fix/ww-5587-interceptor-params-mapping branch November 21, 2025 05:48
@lukaszlenart lukaszlenart changed the title fix(core): preserve parameters in InterceptorMapping for WithLazyParams interceptors WW-5587 fix(core): preserve parameters in InterceptorMapping for WithLazyParams interceptors Nov 21, 2025
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