Skip to content

refactor(session): unify simulator event classification - #772

Closed
beruro wants to merge 1 commit into
developfrom
junyu/unify-simulator-event-category
Closed

refactor(session): unify simulator event classification#772
beruro wants to merge 1 commit into
developfrom
junyu/unify-simulator-event-category

Conversation

@beruro

@beruro beruro commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

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 simulatorEventFilterCategory module 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 other as 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.
  • The current develop snapshot does not contain the repository's newer verify:quick / verify:final scripts, so exact Vitest, ESLint, and pnpm typecheck entry 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.

@beruro

beruro commented Aug 11, 2026

Copy link
Copy Markdown
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.

@beruro beruro closed this Aug 11, 2026
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.

1 participant