refactor(session): unify simulator event classification - #772
Closed
beruro wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #780, which preserves this change as an independent commit and has passed the consolidated CI suite. The source branch is retained for recovery. |
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
The same fallback simulator-event category decision was implemented independently in three production paths: normalized snapshot materialization, optimistic action previews, and derived filtering. A new or renamed event kind could therefore be categorized differently before and after the authoritative snapshot arrives, causing visible filter flicker or incorrect simulator grouping.
Solution
Move the fallback category policy into a core-level
simulatorEventFilterCategorymodule and wire all three consumers to that one function. The derived module re-exports the existing public API, so callers outside SessionCore keep the same import contract while lower-level core code no longer depends on an upper derived layer.The canonical fallback remains intentionally exhaustive over known event shapes and preserves
otheras the safe category for unknown future events.Potential risks
This is a behavior-preserving consolidation, but import-layer mistakes could create a circular dependency or change the public export surface. The helper lives in the lower core layer, the existing derived export is preserved, and the full TypeScript check plus focused SessionCore tests cover those risks. Rollback is a normal revert of this commit.
Verification
pnpm exec vitest run src/engines/SessionCore/derived/simulatorEventFilters.test.ts src/engines/SessionCore/core/atoms/__tests__/actions.test.ts src/engines/SessionCore/__tests__/simulatorEventMapping.test.ts— 3 files, 103 tests passed.pnpm exec eslint src/engines/SessionCore/core/simulatorEventFilterCategory.ts src/engines/SessionCore/core/store/snapshotMaterialization.simulatorPreview.ts src/engines/SessionCore/core/atoms/actions.simulatorPreview.ts src/engines/SessionCore/derived/simulatorEventFilters.ts— passed.pnpm typecheck— full TypeScript check executed and passed.git diff --check— passed.developsnapshot does not contain the repository's newerverify:quick/verify:finalscripts, so exact Vitest, ESLint, andpnpm typecheckentry points were used.Effects: none added or modified. UI screenshots are not useful because this refactor intentionally preserves the existing category output and rendered appearance.