Skip to content

Conversation

@mpscholten
Copy link
Member

Summary

  • Fix "consumeFlashMessagesMiddleware was not called" error by passing the current request (with flashVaultKey in vault) to renderHtml
  • Improve test mocking to run the full middleware stack for each request, matching production behavior
  • Preserve mock sessions from withUser when running through middleware stack

Problem

renderHtml was using frozenContext.request which didn't have flashVaultKey in the vault. The flash messages middleware adds flashVaultKey to the request it passes to next, but this modified request wasn't being used when rendering views.

Test plan

  • Production app no longer shows "consumeFlashMessagesMiddleware was not called" error
  • Tests run with full middleware stack like production
  • withUser mock sessions work correctly

🤖 Generated with Claude Code

mpscholten and others added 2 commits January 26, 2026 10:52
- callActionWithParams now runs the complete middleware stack per request
- Build real HTTP requests with form-encoded bodies
- Preserve mock sessions from withUser
- runTestMiddlewares simplified for initial setup only

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- renderHtml now takes ?request as implicit parameter
- render passes the modified request with flashVaultKey
- Layout functions updated with ?request constraint

Previously renderHtml was using frozenContext.request which didn't have
flashVaultKey in the vault, causing "consumeFlashMessagesMiddleware was
not called" errors.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mpscholten
Copy link
Member Author

@amitaibu this should fix the tests in tpp-app

This ensures tests using runActionWithNewContext have the ActionType
set in the request vault, matching the behavior of runAction' in
RouterSupport.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@mpscholten mpscholten merged commit 28f13de into master Jan 26, 2026
1 check passed
@mpscholten mpscholten deleted the fix-flash-messages-request-flow branch January 26, 2026 10:35
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