Skip to content

Fix batch - #18

Merged
korpseluv merged 9 commits into
mainfrom
parser!redo
Dec 30, 2025
Merged

Fix batch#18
korpseluv merged 9 commits into
mainfrom
parser!redo

Conversation

@korpseluv

@korpseluv korpseluv commented Dec 30, 2025

Copy link
Copy Markdown
Owner

Summary

Why

Why is this change needed?

Testing

  • [ - ] npm run build
  • [ - ] Manual check (screenshots optional)

Security / privacy

  • [ - ] No secrets added
  • [ - ] No new replay parsing/network behavior without opt-in
  • [ - ] No new endpoints exposed in production unintentionally

Notes

nah i'd win

- 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.
Copilot AI review requested due to automatic review settings December 30, 2025 12:22
@korpseluv
korpseluv merged commit f300d65 into main Dec 30, 2025
2 checks passed
@korpseluv
korpseluv deleted the parser!redo branch December 30, 2025 12:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upsertHistory function has indentation inconsistency on line 296. The function call should be indented to match the surrounding code block structure.

Suggested change
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
)

Copilot uses AI. Check for mistakes.
}))
}

const spacing = hitErrors.length ? 0.4 : 0.4

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
const spacing = hitErrors.length ? 0.4 : 0.4
const spacing = 0.4

Copilot uses AI. Check for mistakes.
Comment on lines +348 to +353

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)

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
return token.access_token || null
} catch (err) {
console.error('[Replay Watcher] Token exchange failed', err)
return null

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing whitespace before the closing brace. This inconsistent indentation can reduce code readability.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +15
import {
calculateAccuracy,
calculateRank,
extractBeatmapHash,
isValidBeatmapHash,
modsToArray,
normalizeTimestampMs,
readReplayHits,
readReplayMods
} from './replayParser'

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import extractBeatmapHash.

Copilot uses AI. Check for mistakes.
beatmapMeta?: any | null
apiScore?: any | null
}): Promise<ParsedEntry> {
const info = options.info || {}

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable info.

Suggested change
const info = options.info || {}

Copilot uses AI. Check for mistakes.
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.

bug: the damn favicon feat: add link to osu! profile feat: use cursor-pointer on clickable elemetns

2 participants