Commit graph

65 commits

Author SHA1 Message Date
Barrett Ruth
425a8f36e9
fix: complete language version IDs for all platforms (#350)
## Problem

`LANGUAGE_VERSIONS` only covered cpp and python. Several platform IDs
were wrong — CodeChef used `C++ 17`/`Python 3` (correct: `C++`/`PYTH
3`), USACO listed nonexistent c++20/c++23 options, and CSES only had
C++17.

## Solution

Verify every platform's submit page and update all language ID tables.
Add java and rust entries where supported, fix incorrect CodeChef and
USACO IDs, and expand CSES `CSES_LANGUAGES` dict with
C++11/C++20/PyPy3/Java/Rust variants.
2026-03-06 19:28:06 -05:00
Barrett Ruth
58b6840815
feat: race countdown support and language version selection (#346)
## Problem

Two gaps in the plugin: (1) contest pickers have no way to know whether
a contest supports countdown (race), so the UI can't surface that
affordance; (2) `:CP submit` hardcodes a single language ID per platform
with no way to choose C++ standard or override the platform ID.

## Solution

**Race countdown** (`4e709c8`): Add `supports_countdown` boolean to
`ContestListResult` and wire it through CSES/USACO scrapers, cache, race
module, and pickers.

**Language version selection** (`b90ac67`): Add `LANGUAGE_VERSIONS` and
`DEFAULT_VERSIONS` tables in `constants.lua`. Config gains `version` and
`submit_id` fields validated at setup time. `submit.lua` resolves the
effective config to a platform ID (priority: `submit_id` > `version` >
default). Helpdocs add `*cp-submit-language*` section. Tests cover
`LANGUAGE_IDS` completeness.
2026-03-06 18:18:21 -05:00
Barrett Ruth
8465e70772
test: add offline fixture coverage for Kattis and USACO (#342)
## Problem

Kattis and USACO had zero offline test coverage — no fixtures, no
conftest
routers, and no entries in the test matrix. The `precision` field and
error
paths were also unverified across all platforms.

## Solution

Add HTML fixtures for both platforms and wire up `httpx.AsyncClient.get`
routers in `conftest.py` following the existing CSES/CodeChef pattern.
Extend the test matrix from 12 to 23 parametrized cases. Add a dedicated
test for the Kattis contest-vs-slug fallback path (verifying
`contest_url`
and `standings_url`), three parametrized metadata error cases, and a
targeted assertion that `extract_precision` returns a non-`None` float
for
problems with floating-point tolerance hints.

Closes #281.
2026-03-06 16:49:49 -05:00
Barrett Ruth
0b40e0f33e
fix: replace curl_cffi with scrapling in codeforces metadata (#334)
## Problem

`codeforces.py` used `curl_cffi` to bypass Cloudflare when fetching
contest problem HTML, making it unavailable in the nix python env and
requiring an extra dependency across `pyproject.toml` and `flake.nix`.

## Solution

Rewrite `_fetch_problems_html` to use scrapling `StealthySession` with
`solve_cloudflare=True`, matching the existing CF submit pattern. Extend
`needs_browser` in `scraper.lua` to route CF `metadata` and `tests`
through the FHS env on NixOS. Remove `curl-cffi` from `pyproject.toml`,
`flake.nix`, and test mocks.
2026-03-06 13:25:44 -05:00
b6f3398bbc fix(ci): formatting and typing 2026-02-18 14:13:37 -05:00
1162e7046b try to fix the setup 2026-02-18 14:13:37 -05:00
89c1a3c683 fix(ci): more fixes 2026-01-27 15:56:34 -05:00
d5c6783124 feat(scrapers): refactor 2026-01-27 15:43:40 -05:00
dfd8275421 fix: use a diff scraper for now 2025-12-08 19:46:14 -06:00
f805251762 some misc fixes 2025-12-07 16:09:17 -06:00
Barrett Ruth
0e778a128e Merge main into feat/io/view-togggle
Resolved conflicts:
- scrapers/atcoder.py: kept defensive if tests else '' checks
- scrapers/codechef.py: kept defensive if tests else '' checks
- tests/test_scrapers.py: kept comprehensive validation from main
- lua/cp/ui/views.lua: removed misplaced navigation code from loop
2025-11-05 23:01:04 -05:00
Barrett Ruth
e7ba6b4bb4 fix(test): update scrapers 2025-11-05 18:43:01 -05:00
Barrett Ruth
6a1534124d fix(ci): formatting 2025-11-04 22:16:49 -05:00
Barrett Ruth
1b0d5e4d77 feat: fix typign 2025-11-04 22:08:07 -05:00
Barrett Ruth
161c4cc113 fix(ci): format fixutres 2025-10-25 02:01:48 -04:00
Barrett Ruth
e89c2e1cf5 feat(codechef): finalize codechef impl 2025-10-25 01:41:55 -04:00
Barrett Ruth
f78e43bdd4 fix paths 2025-10-25 00:42:03 -04:00
Barrett Ruth
2ab03e624c fix rest of routes 2025-10-25 00:37:30 -04:00
Barrett Ruth
fa3de99222 fix(test): relocate fixtures 2025-10-25 00:37:19 -04:00
Barrett Ruth
4fe623c806 fix(test): refactor fixtures 2025-10-25 00:34:56 -04:00
Barrett Ruth
8ba2a598fe fix(tests): refactor fixture directory 2025-10-25 00:34:32 -04:00
Barrett Ruth
2fda5a74ca feat: codechef 2025-10-25 00:26:33 -04:00
Barrett Ruth
00fe1abcf1 fix(ci): format 2025-10-23 22:12:23 -04:00
Barrett Ruth
d4b88be44b fix formatting 2025-10-23 22:11:02 -04:00
32a46b4e98 feat: tests upgrade 2025-10-12 16:23:06 -04:00
617c1741cc fix(ci): typing 2025-10-05 23:18:09 -04:00
b30c036478 fix(ci): typing 2025-10-05 23:08:54 -04:00
4fac6c8019 feat(tests): fixtures 2025-10-05 23:06:38 -04:00
c143600c5b fix(tests): cleaunop 2025-10-05 22:13:48 -04:00
2426e1cbd4 fix: scrapers 2025-10-05 22:10:26 -04:00
c509102b37 feat(tests): basic tests 2025-10-05 21:58:43 -04:00
a7eb731730 fea(ci): improve prettier config 2025-10-05 21:06:57 -04:00
bb0ee24476 filler 2025-10-03 23:32:41 -04:00
4498c4a7fa fix scrapers 2025-10-03 19:19:02 -04:00
91ce43e529 fix(test): fix mock 2025-09-30 22:37:59 -04:00
b5b2c770fc fix(ci): remove unused import 2025-09-30 20:45:39 -04:00
99d6569809 fix(scrapers): update codeforce scraper with pytest 2025-09-30 20:44:37 -04:00
a48f4d049b snake to title case 2025-09-24 20:58:16 -04:00
b70f38626e cleanup 2025-09-24 20:04:29 -04:00
699207e713 lint 2025-09-24 00:44:08 -04:00
7ac91a3c4d fix async 2025-09-24 00:41:10 -04:00
0a8dc50c76 fix(test): systeamtically gather scrapers 2025-09-22 22:46:36 -04:00
89440e5d14 feat(scrapers): simplify structure 2025-09-22 22:44:08 -04:00
3b768cc6c4 fix(ci): fix ruff lint 2025-09-22 22:10:49 -04:00
db391da52c feat(scrapers): total refactor 2025-09-22 22:00:20 -04:00
eb3f7762de fix(ci): typing 2025-09-22 20:46:27 -04:00
16ddbb5b4e fix(test): names are plainly formatted now 2025-09-21 15:12:36 -04:00
46c615416f feat(scraper): use backoff 2025-09-21 11:26:54 -04:00
1f38dba57f fix(scrape): proper vars 2025-09-21 00:31:10 -04:00
803c2dc76e feat(scrapers): add contest subcommand to cses 2025-09-20 14:19:35 -04:00