Skip to content

fix: Sprint 1+2 — критические исправления и рефакторинг (аудит июнь 2026)#4

Merged
ArtVsMark merged 1 commit into
mainfrom
fix/audit-june-2026
Jun 22, 2026
Merged

fix: Sprint 1+2 — критические исправления и рефакторинг (аудит июнь 2026)#4
ArtVsMark merged 1 commit into
mainfrom
fix/audit-june-2026

Conversation

@ArtVsMark

Copy link
Copy Markdown
Owner

🔧 Аудит июнь 2026 — Sprint 1 (критические) + Sprint 2 (рефакторинг)

Что исправлено

🔴 Sprint 1 — Critical Fixes

# Файл Изменение
1 pyproject.toml / requirements.txt Синхронизированы зависимости; добавлен chardet, убраны дубли
2 at_first.py Исправлен нерабочий эндпоинт /api/stepics/1/api/steps/{step_id}; убран _ = step_id
3 microbench_runner.py Fallback [source_code][""] — пустой stdin вместо кода в качестве ввода
4 at_first.py Опечатка «нет хватает» → «не хватает»
5 test.py avg_time = total_time при FAILED → avg_time = 0.0 (делитель был 0)
6 diagnostik_stepik.py OAuth HTTP-сервер: добавлен OAUTH_TIMEOUT_SECONDS = 120, server.timeout, join(timeout=120), TimeoutError вместо RuntimeError

🟡 Sprint 2 — Рефакторинг

# Файл Изменение
9 test.py Удалён дублирующий SIMILAR_THRESHOLD_PERCENT = 5.0; константа импортируется из microbench_runner — единый источник истины
10 microbench_runner.py Удалено мёртвое поле func_name: str = "<exec>" из @dataclass MicrobenchResult
11 test.py from __future__ import annotations уже присутствовал ✔

Проверка

python -m py_compile at_first.py diagnostik_stepik.py test.py microbench_runner.py executor.py
ruff check .

Что осталось (Sprint 3 — отдельная ветка)

  • Создать tests/ с unit-тестами (pytest)
  • python_requires = ">=3.10" в pyproject.toml
  • Выделить stepik_client.py

@ArtVsMark ArtVsMark merged commit 88bfa94 into main Jun 22, 2026
@ArtVsMark ArtVsMark deleted the fix/audit-june-2026 branch June 25, 2026 14:49
ArtVsMark added a commit that referenced this pull request Jul 2, 2026
…finding #4)

grader.py (1460 lines) violated SRP by combining test-case loading,
solution execution, table/rich output, and CLI menu logic in one file.
Splits it into three modules per Sprint 7:

- grader_core.py: load_test_cases, run_mode detection, wrapper codegen,
  run_single_test/run_tests/run_benchmark/run_microbench_mode.
- reporter.py: the _console/_RICH rich-optional singleton, format_*/
  print_* table functions, _cprint, _print_case_verbose.
- cli.py: _interactive_menu, load-profile prompts, new main() entry point.

grader.py itself becomes an 8-statement backward-compatibility facade:
`from X import *` plus explicit re-exports of every private name and
non-__all__ public name (run_microbench, apply_relative_ranking) the test
suite references directly as grader.X, since `import *` skips
underscore-prefixed names.

Several tests patched grader._RICH/_console/Table/Text/run_tests/
run_single_test/run_microbench expecting to affect functions that now live
in reporter.py/grader_core.py/cli.py -- those functions read their own
module's globals at call time, not grader.py's re-exported copy, so the
old patch targets silently stopped having any effect (two cases actually
failed with AssertionError/KeyError; others degraded into testing the
wrong branch without erroring). Updated patch targets in
test_grader_coverage_gap.py, test_menu_modes.py, test_grader_extra.py, and
test_formatters.py to point at the module that actually owns each name.

Added a ruff per-file-ignore for grader.py (F401/F403/F405/I001) since
every import in the facade is an intentional re-export.

465 passed (3 skipped), 88.97% coverage; ruff check/format clean;
`echo 0 | python grader.py` smoke-tested end-to-end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant