fix(sync): stats unavailable hotfix (v3.5.1) - #26
Merged
Merged
Conversation
…s schema types Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
…vailable Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
Signed-off-by: night-slayer18 <samanuaia257@gmail.com>
Contributor
|
Thanks for the PR, @night-slayer18! 🎉 Before this gets reviewed, please make sure the following are checked:
The CI pipeline will also run build, test, lint, and typecheck automatically. |
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
Fixes the
leetcode synccommand always showingStats unavailablein commit bodies.Root Causes
Two independent bugs, both confirmed via live API probe:
Missing credential loading —
syncCommand()calledgetSubmissionList()before loading stored session credentials onto the HTTP client. Git auth (SSH/PAT) is independent of the LeetCode session, so the command could push to GitHub while unauthenticated against the LeetCode API.Schema type mismatch —
SubmissionDetailsSchemadeclaredruntimeandmemoryasstring, but the API returns them asnumber(raw ms / bytes). Zod rejected every response, triggering thecatchblock for every user on every problem.Changes
src/commands/sync.ts— callsetupClientIfLoggedIn()at entrysrc/schemas/api.ts—runtime/memoryacceptnumber | string,langnullablesrc/types.ts—SubmissionDetailsinterface updated to matchsrc/commands/submissions.ts— null guard fordetails.langsrc/__tests__/commands/sync.test.ts— 5 new regression tests (20 total)release.mjs— new release prep scriptdocs/releases.md— v3.5.1 changelog entrypackage.json/src/index.ts— version bumped to 3.5.1Testing
All 350 tests pass. Verified live against LeetCode API with authenticated session.