-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: add practice typing mode (no stats, xp, or pb) (@Vishal27alpha) #7482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add practice typing mode (no stats, xp, or pb) (@Vishal27alpha) #7482
Conversation
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new practice typing mode intended for “no-stats” sessions, wiring it through shared mode schemas, backend result submission, and default frontend result filters.
Changes:
- Extend shared mode/schema typing to include
practice. - Backend: special-case
practicein result submission (skip PB checks, skip DB insert, XP=0). - Frontend: default result filters mark
practiceas excluded.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/schemas/src/shared.ts | Adds practice to the modes derived from PersonalBestsSchema. |
| backend/src/api/controllers/result.ts | Adds practice handling in result endpoints and XP calculation. |
| frontend/src/ts/constants/default-result-filters.ts | Excludes practice from default stats/result filtering. |
| zen: z.record(z.literal("zen"), z.array(PersonalBestSchema)), | ||
|
|
||
| // practice mode: intentionally empty, never tracked | ||
| practice: z.never(), |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
practice: z.never() makes PersonalBestsSchema impossible to satisfy (key becomes required but can never validate), so parsing existing user/tag PB objects will start failing. Make the key optional while still adding it to ModeSchema (eg z.never().optional()), or model it as optional/undefined and keep PB storage unchanged.
| practice: z.never(), | |
| practice: z.never().optional(), |
| const isPractice = completedEvent.mode === "practice"; | ||
|
|
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isPractice currently only skips PB checks + DB insert, but practice is supposed to not affect stats/leaderboards. Later in this handler you still update typing stats (updateTypingStats/PublicDAL.updateStats), streak, testActivity, and potentially daily leaderboards (if config rules match practice). Wrap those side effects in if (!isPractice) too (or early-return with a practice-specific response) to match the mode contract.
| const data: PostResultResponse = { | ||
| insertedId: insertedId ?? "practice", | ||
| isPb, |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning insertedId: "practice" will be treated as a real result id by the frontend (it sets edit-tags data-result-id and saves a snapshot with _id = insertedId), leading to broken tag editing / local history for practice runs. Either persist a real result id (and exclude it from stats/history), or change the response/consumer so practice runs don’t provide/use an id.
| const isPractice = completedEvent.mode === "practice"; | ||
|
|
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add/extend controller tests for mode: "practice" to assert no persistence and no stat updates (eg ResultDAL.addResult, UserDAL.updateTypingStats, PublicDAL.updateStats, UserDAL.updateStreak, incrementTestActivity, daily leaderboard). Current tests already mock these calls for normal modes, so adding a practice case should be straightforward.
|
You can already turn off result saving in the comand line |
|
Thanks for pointing that out, I wasn’t aware this already existed via the command line. That explains the gap I felt from a user perspective. Would you be open to reframing this PR to focus on exposing the existing practice mode in the UI (making it more discoverable), rather than adding new backend behavior? Happy to adjust or close the PR based on your preference. |
Lets add a "result saving" settin to the account section in the settings page. In the description mention the word 'practice' so its easier to find. We should also add a 'practice' alias to the result saving commandline commands. |
|
Thanks a lot for the clarification that makes perfect sense. -Add a “Result saving” toggle in the Account section of Settings I’ll start exploring this and update the PR accordingly, unless you’d prefer this to be handled as a separate PR instead. |
Same pr is fine |
Description
What
Adds a new
practicetyping mode that allows users to type freely without affecting:Why
This enables low-pressure practice sessions while preserving competitive integrity of stats.
How
practicemodeNotes
Relevant files: