test(renderer): fuzz chat projection replay invariants#916
Closed
luoye520ww wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by consolidated IPC/SSE reliability PR #945, which passed Typecheck, Linux, macOS, and Windows packaged checks. Closing this duplicate to keep the review surface focused. |
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.
Problem
SSE reconnect and replay can deliver duplicated, out-of-order, late terminal, and cross-thread projection actions. Existing reducer tests covered a few hand-written sequences but did not exercise combinations of those events.
Root cause
There was no deterministic replay/fuzz harness for the pure chat projection reducer, so reducer invariants could regress without a reproducible sequence.
Scope
This PR adds renderer test coverage only. It does not change reducer behavior, SSE transport, or runtime state.
Changes
Safety
Typecheck
```text
npm.cmd run typecheck
npm.cmd --prefix kun run typecheck
```
Passed.
Tests
```text
npm.cmd exec vitest run src/renderer/src/store/chat-projection-reducer.test.ts src/renderer/src/store/chat-projection-reducer.fuzz.test.ts
npm.cmd run lint
npm.cmd run build
git diff --check
```
Results: 10 reducer tests passed; lint, build, and diff checks passed.
Review performed
Non-goals
This PR does not add property-test dependencies or change the event transport. A future PR can connect sequence-gap recovery to the reducer using the existing SSE contracts.
Part of the SSE/replay reliability work.