Skip to content

scripts: add yosupo.py Library Checker judge helpers - #43

Open
devin-ai-integration[bot] wants to merge 8 commits into
masterfrom
devin/1784963113-yosupo-helpers
Open

scripts: add yosupo.py Library Checker judge helpers#43
devin-ai-integration[bot] wants to merge 8 commits into
masterfrom
devin/1784963113-yosupo-helpers

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

New scripts/yosupo.py (uv script, stdlib + existing competitive-verifier dep via scripts/bundle.py) talks to the Library Checker REST API (https://v3.api.judge.yosupo.jp, the same API the frontend uses):

  • yosupo.py status — scans verify/*.test.cpp for competitive-verifier: PROBLEM slugs (multiple files per problem supported) and cross-references /users/{name}/statistics solved_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: #line directives, blank lines, trailing whitespace stripped). Exact match against any recent AC → up-to-date (matches #id); otherwise differs 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; --todo filters 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 with bundle.bundle(), infers the slug from the PROBLEM comment, POSTs /submit, and with --wait polls /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; only submit needs auth.

Verified against the live judge: status [--compare], table, diff, and submissions work; submit is untested pending login credentials.

Link to Devin session: https://app.devin.ai/sessions/bec160822d544e04b8db2be3d17bdb00
Requested by: @ecnerwala


Open in Devin Review (Beta)

Co-Authored-By: Andrew He <he.andrew.mail@gmail.com>
@ecnerwala ecnerwala self-assigned this Jul 25, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

GCC Code Coverage Report

📂 Overall coverage

Metric Coverage
Lines 🟢 6341/6920 (91.6%)
Functions 🟡 862/1024 (84.2%)
Branches 🔴 5605/7868 (71.2%)

@beta-devin-ai-integration beta-devin-ai-integration Bot 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.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review (Beta)

Comment thread scripts/yosupo.py
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟨 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.

Open in Devin Review (Beta)

Was this helpful? React with 👍 or 👎 to provide feedback.

devin-ai-integration Bot and others added 7 commits July 25, 2026 07:44
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>
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.

1 participant