Fix batch - #18
Conversation
- Implemented replay statistics calculation in `replayStatCalc.ts`, including functions for fetching beatmap content, computing hit errors, and generating synthetic traces. - Created a replay watcher in `replayWatcher.ts` to monitor and process new replay files, integrating with the API to fetch user scores and beatmap metadata. - Enhanced `replayParser.ts` with improved parsing logic for life graphs and frame summaries, ensuring better data integrity and handling.
There was a problem hiding this comment.
Pull request overview
This PR refactors the replay parsing system by splitting it into stable and lazer-specific implementations, adds Git commit hash versioning, implements choke point detection for performance analysis, and addresses several UI/UX issues including cursor pointer visibility and favicon configuration.
Key Changes:
- Modularized replay parsing system with separate lazer utilities (parser, watcher, stat calculator)
- Dynamic Git hash version display replacing hardcoded version string
- Choke point detection with stress factor calculation for replay analysis
- UI improvements: cursor-pointer on clickable elements, removed hover effects on stat cards
Reviewed changes
Copilot reviewed 11 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
types/lzma.d.ts |
New TypeScript declaration for LZMA module |
server/plugins/replay-watcher.ts |
Refactored to delegate to modular lazer replay watcher |
public/icon.svg |
Removed SVG icon file (likely replaced with PNG) |
nuxt.config.ts |
Added Git hash resolution and exposed as runtime config |
app/utils/replayParser.ts |
Removed legacy parser (functionality moved to lazer) |
app/utils/lazer/replayWatcher.ts |
New modular replay watcher with file processing pipeline |
app/utils/lazer/replayStatCalc.ts |
New comprehensive replay statistics calculator with choke detection |
app/utils/lazer/replayParser.ts |
New lazer-specific replay parser with type-safe utilities |
app/app.vue |
Added cursor-pointer classes, dynamic version display, code cleanup |
.env.example |
Added replay path and watcher enable environment variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const duplicateIdx = matches.find((m) => { | ||
| const existing = history[m.idx] | ||
| const existingKey = (existing as any)?.cache_key | ||
| const existingTs = normalizeTimestampMs((existing as any)?.replay_timestamp ?? (existing as any)?.created_at) |
There was a problem hiding this comment.
The upsertHistory function has indentation inconsistency on line 296. The function call should be indented to match the surrounding code block structure.
| const existingTs = normalizeTimestampMs((existing as any)?.replay_timestamp ?? (existing as any)?.created_at) | |
| const existingTs = normalizeTimestampMs( | |
| (existing as any)?.replay_timestamp ?? (existing as any)?.created_at | |
| ) |
| })) | ||
| } | ||
|
|
||
| const spacing = hitErrors.length ? 0.4 : 0.4 |
There was a problem hiding this comment.
The spacing variable has a redundant ternary expression that always evaluates to 0.4 regardless of the condition. This should either be simplified to const spacing = 0.4 or implement different spacing logic based on whether hitErrors has length.
| const spacing = hitErrors.length ? 0.4 : 0.4 | |
| const spacing = 0.4 |
|
|
||
| let token: string | null = null | ||
| let userId: string | number | null = null | ||
| if (opts.clientId && opts.clientSecret) { | ||
| token = await fetchToken(opts.clientId, opts.clientSecret) | ||
| if (token) userId = await fetchUserId(opts.apiBase, token, opts.targetUser) |
There was a problem hiding this comment.
The error handler for chokidar import failure silently returns without properly shutting down the plugin. This could lead to the plugin appearing to be enabled when it's actually not functioning. Consider logging more context about the error and potentially throwing to make the failure more visible.
| return token.access_token || null | ||
| } catch (err) { | ||
| console.error('[Replay Watcher] Token exchange failed', err) | ||
| return null |
There was a problem hiding this comment.
Missing whitespace before the closing brace. This inconsistent indentation can reduce code readability.
| import { | ||
| calculateAccuracy, | ||
| calculateRank, | ||
| extractBeatmapHash, | ||
| isValidBeatmapHash, | ||
| modsToArray, | ||
| normalizeTimestampMs, | ||
| readReplayHits, | ||
| readReplayMods | ||
| } from './replayParser' |
There was a problem hiding this comment.
Unused import extractBeatmapHash.
| beatmapMeta?: any | null | ||
| apiScore?: any | null | ||
| }): Promise<ParsedEntry> { | ||
| const info = options.info || {} |
There was a problem hiding this comment.
Unused variable info.
| const info = options.info || {} |
Summary
cursor-pointeron clickable elemetns #6Why
Why is this change needed?
Testing
npm run buildSecurity / privacy
Notes
nah i'd win