Commit graph

6 commits

Author SHA1 Message Date
8b1f6b349f
ci: format 2026-03-06 18:17:21 -05:00
326e015f9b
feat(race): show contest display name and human-readable countdown
Problem: race notifications showed raw contest IDs (e.g. "2204") and
formatted time as `HH:MM:SS`, which is unreadable for multi-day waits.

Solution: look up `display_name` from cache and use it in the timer
notification. Format countdown as `9d 15h 27m 3s`. Remove redundant
initial log since the timer fires immediately.
2026-03-06 18:14:05 -05:00
4e709c8470
feat(race): add supports_countdown to ContestListResult
Problem: `:CP race` on platforms without future contests (CSES, USACO)
wastes time fetching the full contest list only to discover there is
no `start_time`. The error message is also uninformative.

Solution: Add `supports_countdown` bool to `ContestListResult` (default
`True`). CSES and USACO set it to `False`. Cache the flag per-platform
so subsequent calls skip the fetch entirely. `race.lua` checks the
cached value first, then the scraper result, and shows
`"<Platform> does not support :CP race"` instead of a generic error.
2026-03-06 18:01:08 -05:00
Barrett Ruth
a202725cc5
fix(submit): use file path over stdin; fix CF CodeMirror textarea (#305)
## Problem

After the initial submit hardening, two issues remained: source code was
read in Lua and piped as stdin to the scraper (unnecessary roundtrip
since
the file exists on disk), and CF's `page.fill()` timed out on the hidden
`textarea[name="source"]` because CodeMirror owns the editor state.

## Solution

Pass the source file path as a CLI arg instead — AtCoder calls
`page.set_input_files(file_path)` directly, CF reads it with
`Path(file_path).read_text()`. Fix CF source injection via
`page.evaluate()`
into the CodeMirror instance. Extract `BROWSER_SUBMIT_NAV_TIMEOUT` as a
per-platform `defaultdict` (CF defaults to 2× nav timeout). Save the
buffer
with `vim.cmd.update()` before submitting.
2026-03-05 14:34:14 -05:00
e79f992e0b fix: resolve lua typecheck warnings in race and scraper
Problem: luals flagged undefined-field on uv timer methods because
race_state.timer was untyped, and undefined-field on env_extra/stdin
because they were missing from the run_scraper opts annotation.

Solution: hoist race_state.timer into a typed local before the nil
check so luals can narrow through it; add env_extra and stdin to the
opts inline type in run_scraper.
2026-03-03 15:09:41 -05:00
f5c1b978a2 feat(race): add contest countdown timer
Add race.lua with a 1-second vim.uv timer that counts down to a contest
start time and auto-calls setup.setup_contest() at T=0. Exposes
M.start(), M.stop(), and M.status() for command dispatch and statusline
integration.
2026-03-03 15:09:41 -05:00