fix(scraper): httpx login fast paths, proactive validation, and slug filename fix (#358)

## Problem

httpx scrapers (CSES, Kattis, USACO) always ran full login flows even
with valid cached sessions. \`credentials.lua\` always prompted before
trying cached credentials. \`default_filename\` doubled the slug for
Kattis single-problem mode (e.g. \`addtwonumbersaddtwonumbers.cc\`).

## Solution

Added token/cookie fast paths to CSES \`login()\` and USACO
\`login()\`/\`submit()\`.
Hardened Kattis reactive re-auth trigger to check status code first.
Refactored \`credentials.lua\` to try cached credentials before
prompting.
Fixed \`default_filename\` to not concatenate when \`contest_id ==
problem_id\`.
This commit is contained in:
Barrett Ruth 2026-03-07 15:38:12 -05:00 committed by GitHub
parent eb0dea777e
commit 564f9286da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -605,10 +605,10 @@ end
---@param problem_id? string
---@return string
local function default_filename(contest_id, problem_id)
if problem_id then
if problem_id and problem_id ~= contest_id then
return (contest_id .. problem_id):lower()
end
return contest_id:lower()
return (problem_id or contest_id):lower()
end
M.default_filename = default_filename