From 564f9286da57c227c4d22bc667bae6009e40b613 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Sat, 7 Mar 2026 15:38:12 -0500 Subject: [PATCH] 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\`. --- lua/cp/config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cp/config.lua b/lua/cp/config.lua index 74a40b7..2291101 100644 --- a/lua/cp/config.lua +++ b/lua/cp/config.lua @@ -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