fix(web): исправить режимы 1/2 по фидбеку в #125#235
Merged
Conversation
…source Thin backend endpoints for the mode-1 (single-file check) file picker: GET /api/solutions?path= lists found .py solutions in a folder (via the already-used find_all_solution_files, no grading), GET /api/source?path= reads one file's text for display before running. Reading an arbitrary local path doesn't widen the threat model: grade_path()/grade_benchmark() already execute arbitrary local .py files in a subprocess without a sandbox — reading text is strictly less risky than what already exists. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The redesign's "Режим 1" was a mistranslation of the mask -- it became a
benchmark-style "Сравнение" (Compare) mode, but the owner clarified it
must be the actual analogue of CLI mode 1: check a single file, not
compare/benchmark anything.
- Режим 1 ("Один файл"): pick a folder, click "Найти решения" (new
GET /api/solutions?path=, thin adapter over find_all_solution_files),
choose one found file from the list, see its source (new
GET /api/source?path=), then run just that file. "Найти эталонное
решение" stays a disabled placeholder for #55.
- Режим 2 ("Папка"): unchanged behavior, but its "Параметры" tab is now
visibly present-but-greyed (tests mode genuinely has no parameters --
repeats only applies to bench). Режим 1 hides that tab entirely.
- Removed the bottom scenario-button bar (#scenario-buttons) app-wide --
auto-shown run_again/toggle_theme/switch_section buttons when nothing
is selected. Command palette and the detail panel's action cards are
unaffected.
- grade_benchmark(reference=...)/_apply_reference_ranking() from the prior
redesign stay in place and tested, just unused by the frontend now --
useful once #55 lands a real reference file to compare bench/microbench
against.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Правки визуального слоя после фидбека владельца в issue #125 на предыдущий редизайн (PR #234): «Режим 1» ошибочно был реализован как бенчмарк-сравнение с эталоном («Сравнение»/Compare), хотя должен быть аналогом CLI-режима 1 — проверка одного файла, без какого-либо сравнения.
GET /api/solutions?path=, тонкий адаптер надfind_all_solution_files) → выбираете один найденный файл → видите его код (новыйGET /api/source?path=) → запускаете проверку именно этого файла. Кнопка «Найти эталонное решение» — задел под ✨ [Feature] feat(stepik): полуавтоматический импорт закреплённого решения из saved JSON через target page #55, сейчасdisabled.repeatsотносится только к bench). В режиме 1 вкладка скрыта полностью.#scenario-buttons, авто-показ run_again/toggle_theme/switch_section, когда ничего не выбрано) — из всего приложения. Command palette и action cards в detail panel не затронуты.grade_benchmark(reference=...)/_apply_reference_ranking()из прошлого PR остаются в коде и под тестами, просто фронтенд их больше не вызывает — пригодятся, когда эталон из ✨ [Feature] feat(stepik): полуавтоматический импорт закреплённого решения из saved JSON через target page #55 нужно будет сравнивать с bench/microbench.Test plan
pytest tests/ -x -q --tb=short— 887 passed (36 pre-existing subprocess-related failures на этой машине, идентичные main)ruff check ./ruff format --check .— чистоmypy src/stepik_grader --ignore-missing-imports— чистоCHANGELOG.md— запись под[Unreleased]🤖 Generated with Claude Code