Repository navigation
Conversation
Moves the event log types into @monkeytype/event-log and adds v2: events keep deltaCentiMs (hundredths of a ms since the previous event) instead of testMs, with convert() between versions and a zod schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Approval is blocked because there are still moderate-impact issues to address, including a too-narrow return type in parseEventLogV2 and an invalid concurrency value type in turbo.json, alongside a minor documentation typo.
3 open issues
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
Introduces a new workspace package @monkeytype/event-log to centralize event-log types and add a v2 stored-log format (delta centi-ms) with schema + converters, then updates frontend code/tests to consume the package.
Changes:
- Add
packages/event-logwith v1 runtime types, v2 stored format + zod schema, and v1↔v2 conversion utilities plus tests. - Rewire frontend and tests to import event-log/keycode/input-type definitions from
@monkeytype/event-log/*. - Update Vite workspace aliasing for exact package subpaths and adjust repo tooling/config docs.
| File | Description |
|---|---|
| turbo.json | Updates Turbo configuration to set a concurrency limit for tasks. |
| pnpm-lock.yaml | Updates the lockfile to include the new workspace package and its dependencies. |
| packages/event-log/vitest.config.ts | Adds Vitest configuration for the new @monkeytype/event-log package. |
| packages/event-log/tsup.config.js | Adds tsup build configuration for bundling the new package. |
| packages/event-log/tsconfig.json | Defines TypeScript compiler settings for building the event-log package. |
| packages/event-log/src/v2/types.ts | Introduces TypeScript types/constants for the v2 stored event-log format. |
| packages/event-log/src/v2/schema.ts | Adds a Zod schema and parsing utilities for validating v2 stored logs. |
| packages/event-log/src/v2/index.ts | Exports the v2 public API surface (types/schema/conversion). |
| packages/event-log/src/v2/convert.ts | Implements conversion logic between v1 runtime logs and v2 stored logs using delta centi-ms timing. |
| packages/event-log/src/v1/index.ts | Exports the v1 runtime event-log format and related types. |
| packages/event-log/src/keycode.ts | Moves/defines the shared Keycode type in the new package. |
| packages/event-log/src/input-type.ts | Moves/defines shared input-type unions in the new package. |
| packages/event-log/src/events.ts | Moves/defines the shared event type definitions in the new package. |
| packages/event-log/src/convert.ts | Adds version-agnostic conversion helpers to convert between event-log versions via v1. |
| packages/event-log/package.json | Defines the new workspace package metadata, exports map, scripts, and dependencies. |
| packages/event-log/.oxlintrc.json | Adds lint configuration for the new event-log package. |
| packages/event-log/__test__/v2.spec.ts | Adds tests covering v2 schema validation behavior. |
| packages/event-log/__test__/tsconfig.json | Adds a TypeScript config tailored for running package tests. |
| packages/event-log/__test__/fixture.ts | Provides shared fixture data for event-log conversion and schema tests. |
| packages/event-log/__test__/convert.spec.ts | Adds tests verifying v1↔v2 conversion round-trips and delta semantics. |
| GLOSSARY.md | Adds or updates glossary documentation related to event logs. |
| frontend/vite-plugins/workspace-packages.ts | Updates Vite workspace package aliasing to support exact export subpaths (e.g., ./v1, ./v2). |
| frontend/src/ts/utils/layout-key-codes.ts | Updates key-code layout utilities to use the package-provided Keycode typing. |
| frontend/src/ts/utils/key-converter.ts | Switches key conversion utilities to import Keycode from the new package. |
| frontend/src/ts/test/words-history.ts | Updates words-history test utilities to use event-log types from the package. |
| frontend/src/ts/test/shift-tracker.ts | Updates shift-tracking logic to use the package Keycode type. |
| frontend/src/ts/test/engine/result-data.ts | Updates engine result-data typing to use packaged event-log v1 types. |
| frontend/src/ts/test/engine/input-type.ts | Replaces local input-type definitions with imports from @monkeytype/event-log. |
| frontend/src/ts/test/engine/events/stats.ts | Updates stats event processing typings/imports to consume packaged event-log types. |
| frontend/src/ts/test/engine/events/live-cache.ts | Updates live-cache event typings to use packaged event types. |
| frontend/src/ts/test/engine/events/helpers.ts | Updates helper typings/imports to use packaged event definitions. |
| frontend/src/ts/test/engine/events/data.ts | Updates event test data and typings to use @monkeytype/event-log exports. |
| frontend/src/ts/states/monkey.ts | Updates application state typing to use packaged Keycode where relevant. |
| frontend/src/ts/states/event-log-viewer.ts | Updates event-log viewer state typing to use the new package event-log definitions. |
| frontend/src/ts/input/helpers/word-navigation.ts | Updates word-navigation helper typing to use packaged delete/input-type unions. |
| frontend/src/ts/input/helpers/test-event-code.ts | Updates test-event code helpers to use packaged Keycode typing. |
| frontend/src/ts/input/handlers/keydown.ts | Updates keydown handler typings/imports to use @monkeytype/event-log key/event types. |
| frontend/src/ts/input/handlers/insert-text.ts | Updates insert-text handler typings/imports to use packaged input-type definitions. |
| frontend/src/ts/input/handlers/delete.ts | Updates delete handler typings/imports to use packaged input-type definitions. |
| frontend/src/ts/constants/keys.ts | Refactors key constants/types to rely on the shared package Keycode typing. |
| frontend/src/ts/components/pages/test/result/ResultWordsHistory.tsx | Updates result words-history component prop/data typing to use packaged event-log types. |
| frontend/src/ts/components/pages/test/result/ResultMainStats.tsx | Updates result main-stats component typing to use packaged event-log types. |
| frontend/src/ts/components/pages/test/result/ResultChart.tsx | Updates result chart component typing to use packaged event-log types. |
| frontend/src/ts/components/pages/test/result/replay.ts | Updates replay logic typing to use packaged event-log types. |
| frontend/src/ts/components/pages/event-log-viewer/EventLogViewerPage.tsx | Updates the event-log viewer page to use packaged event-log types and constants. |
| frontend/package.json | Adds @monkeytype/event-log as a frontend dependency. |
| frontend/__tests__/test/engine/events/stats.spec.ts | Updates stats-related engine tests to import event-log types from the new package. |
| frontend/__tests__/test/engine/events/helpers.spec.ts | Updates engine helper tests to import event/input types from the new package. |
| frontend/__tests__/test/engine/events/data.spec.ts | Updates engine event data tests to import event/keycode types from the new package. |
| frontend/__tests__/input/handlers/insert-text.spec.ts | Updates insert-text handler tests to import input/event types from the new package. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
v1 events and context are zod schemas now, types are inferred from them. v2 reuses the same event definitions with deltaCentiMs instead of testMs, so the two versions can't drift apart. Co-Authored-By: Claude Opus 5.5 <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
Event log types move into a package; adds v2, a storage format for event logs. Nothing writes or reads v2 yet: saving stacks on this (#8643).
Also: vite alias for exact package subpaths (
./v1), turboconcurrencyfor the extra dev task.Evidence
vitest.config.tswarning on master).Merge Danger
Door: two-way
No runtime behaviour change: frontend imports move to the package.
Blast Radius: imports
Frontend build resolves the new workspace package; a missing alias would break the build, not runtime.
🤖 Generated with Claude Code