submit/login robustness: known scraper edge cases #295

Closed
opened 2026-03-05 00:28:03 +00:00 by barrettruth · 0 comments
barrettruth commented 2026-03-05 00:28:03 +00:00

Several edge cases in the submit and login paths that need fixing:

CSES

  • `_web_login`: bare dict access `api_data["X-Auth-Token"]` and `api_data["authentication_url"]` — `KeyError` propagates uncaught if the API response changes shape
  • `_check_token`: returns `False` on any exception including transient network errors, triggering a full unnecessary re-login
  • Poll loop: `submission_id = str(info.get("id", ""))` — empty string polls `/submissions/` (invalid endpoint); should bail early

AtCoder

  • Cookie save block runs even when `login_error` is set — should be gated on successful login

Codeforces

  • Cookie guard checks for `JSESSIONID` which CF doesn't use — cookie persistence may never fire
  • `submit_action`: `_solve_turnstile` exceptions silently swallowed (`except: pass`) — Turnstile failure proceeds invisibly instead of erroring

General

  • `:CP submit` (or `:CP login`) without cached credentials should prompt for login rather than failing with an opaque error
Several edge cases in the submit and login paths that need fixing: **CSES** - \`_web_login\`: bare dict access \`api_data["X-Auth-Token"]\` and \`api_data["authentication_url"]\` — \`KeyError\` propagates uncaught if the API response changes shape - \`_check_token\`: returns \`False\` on any exception including transient network errors, triggering a full unnecessary re-login - Poll loop: \`submission_id = str(info.get("id", ""))\` — empty string polls \`/submissions/\` (invalid endpoint); should bail early **AtCoder** - Cookie save block runs even when \`login_error\` is set — should be gated on successful login **Codeforces** - Cookie guard checks for \`JSESSIONID\` which CF doesn't use — cookie persistence may never fire - \`submit_action\`: \`_solve_turnstile\` exceptions silently swallowed (\`except: pass\`) — Turnstile failure proceeds invisibly instead of erroring **General** - \`:CP submit\` (or \`:CP <platform> login\`) without cached credentials should prompt for login rather than failing with an opaque error
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/cp.nvim#295
No description provided.