scripts: add yosupo.py Library Checker judge helpers - #43
Open
devin-ai-integration[bot] wants to merge 8 commits into
Open
scripts: add yosupo.py Library Checker judge helpers#43devin-ai-integration[bot] wants to merge 8 commits into
devin-ai-integration[bot] wants to merge 8 commits into
Conversation
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
GCC Code Coverage Report📂 Overall coverage
|
Comment on lines
+76
to
+79
| def save_creds(creds: dict[str, Any]) -> None: | ||
| CRED_PATH.parent.mkdir(parents=True, exist_ok=True) | ||
| CRED_PATH.write_text(json.dumps(creds, indent=2) + "\n") | ||
| CRED_PATH.chmod(0o600) |
There was a problem hiding this comment.
🟨 Credential file briefly world-readable before permissions are tightened
In scripts/yosupo.py:76-79, save_creds writes the Firebase refresh/ID tokens to ~/.config/yosupo/credentials.json via write_text (which creates the file using the process umask, typically 0644) and only afterwards calls chmod(0o600). Between the write and the chmod there is a brief window where the file containing long-lived auth tokens is readable by other local users.
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
Co-Authored-By: Andrew He <he.andrew.mail@gmail.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
New
scripts/yosupo.py(uv script, stdlib + existingcompetitive-verifierdep viascripts/bundle.py) talks to the Library Checker REST API (https://v3.api.judge.yosupo.jp, the same API the frontend uses):yosupo.py status— scansverify/*.test.cppforcompetitive-verifier: PROBLEMslugs (multiple files per problem supported) and cross-references/users/{name}/statisticssolved_map, so you can see which problems you have code for vs. what's AC/LATEST_AC on the judge (plus problems solved online with no local verify file).yosupo.py status --compare— additionally fetches the sources of your recent AC submissions per problem (--depth, default 5) and compares each local bundle against them (normalized:#linedirectives, blank lines, trailing whitespace stripped). Exact match against any recent AC →up-to-date (matches #id); otherwisediffers from #id (+N/-M lines)so you can judge whether the drift warrants resubmitting.yosupo.py table [--todo]— every judge problem grouped by the judge's own categories (/categories), with columns for local verify file and judge AC status;--todofilters to problems missing either.yosupo.py diff verify/foo.test.cpp [--submission ID]— unified diff of the local bundle vs. your latest AC (or a specific submission).yosupo.py submissions [--problem P] [--user U]— lists your submissions via/submissions.yosupo.py submit verify/foo.test.cpp [--wait]— bundles withbundle.bundle(), infers the slug from the PROBLEM comment, POSTs/submit, and with--waitpolls/submissions/{id}until a terminal status (exit 0 iff AC).yosupo.py login— Firebase email/password sign-in; stores the refresh token at~/.config/yosupo/credentials.json(0600) and auto-refreshes ID tokens. Reads work without login given--user; onlysubmitneeds auth.Verified against the live judge:
status [--compare],table,diff, andsubmissionswork;submitis untested pending login credentials.Link to Devin session: https://app.devin.ai/sessions/bec160822d544e04b8db2be3d17bdb00
Requested by: @ecnerwala