Reproduce confetti animation bug: non-deterministic particles#68
Merged
jappeace merged 2 commits intojappeace:masterfrom Apr 19, 2026
Merged
Reproduce confetti animation bug: non-deterministic particles#68jappeace merged 2 commits intojappeace:masterfrom
jappeace merged 2 commits intojappeace:masterfrom
Conversation
Add integration tests that render the confetti widget tree through hatter's rendering engine and verify animation behaviour. The reproducer test "confetti uses newStdGen" demonstrates the bug: confettiOverlay uses newStdGen on every call, producing different particle positions each render. The diff engine sees changed widgets, re-registers tweens and restarts animation from scratch. AppState already has stConfettiSeed for deterministic particles but confettiOverlay ignores it. Five passing tests confirm the animation system itself works: - Tweens register on first render - Tweens register on Stack 1->2 child transition - Particles start at origin (0,0) - Particles have non-zero target positions - Fade end-state has alpha 0 Prompt: investigate why the animation for confetti doesn't work, make a reproducer first Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
confettiOverlay was calling newStdGen on every render, producing different random particle positions each time. Hatter's diff engine saw the changed widgets, re-registered tweens, and restarted the animation from scratch on every re-render. Now confettiOverlay takes a StdGen parameter. enterPRView passes stConfettiSeed from AppState, which was already created for this purpose but never used. The determinism test now passes. Prompt: okay go do that then Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
confettiOverlayusesnewStdGeninstead ofstConfettiSeed, making particles non-deterministic across re-rendersTest results
confettiOverlayis not deterministic across callsRoot cause
confettiOverlay(Views.hs:231) callsnewStdGenon every invocation.AppStatealready hasstConfettiSeed :: StdGen(AppState.hs:37) intended for deterministic particles, butconfettiOverlayignores it.Test plan
cabal buildpassesconfettiOverlayacceptStdGenparameter, passstConfettiSeed🤖 Generated with Claude Code