Commit graph

5 commits

Author SHA1 Message Date
516d1b02b7
fix(stress): shorten terminal buffer name and clean up CSES versions
Problem: stress terminal buffer showed the full nix python path and
absolute script path, making it illegible. CSES language maps included
unused version variants.

Solution: rename stress terminal buffer to a readable
`term://stress.py` format. Use `python` instead of `python3` in
`build_run_cmd`. Trim CSES `LANGUAGE_VERSIONS`, `CSES_LANGUAGES`,
and `EXTENSIONS` to only the default versions.
2026-03-06 20:20:05 -05:00
446f87f98c
fix(stress): restore IO view after stress session ends
Problem: `:CP stress` saves/restores the session via `mksession`,
but scratch IO buffers lose their contents and `clearcol` window
options are not restored.

Solution: call `ensure_io_view()` after session restore in both
the toggle and cleanup paths.
2026-03-06 20:20:04 -05:00
Barrett Ruth
7e7e135681
fix: cancel active process on contest switch (#316)
## Problem

Switching contests while a run, interactive session, or stress test was
active left orphaned callbacks and terminal jobs alive. Running `:CP
run`
twice also let the first run's stale output overwrite the buffer.

## Solution

Replace the `io_view_running` bool in `views.lua` with a generation
counter so concurrent `run_io_view` calls self-cancel via stale-gen
checks in async callbacks. Add `cancel_io_view`, `cancel_interactive`,
and `stress.cancel` for forceful teardown, and call them in
`setup_contest` whenever `is_new_contest` is true.
2026-03-05 17:42:50 -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
39b7b3d83f feat(stress): add stress test loop
Add stress.lua that auto-detects or accepts generator and brute solution
files, compiles C++ if needed, and launches scripts/stress.py in a
terminal buffer with session save/restore and cleanup autocmds.

Add scripts/stress.py as a standalone loop that runs generator → brute →
candidate, comparing outputs and exiting on the first mismatch.
2026-03-03 15:09:41 -05:00