Code review проекта: исправление багов, CI, линтинг и документация#45
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: netkeep80#44
Исправления багов: - anum_prover.py: _check_meta_self_closure проверял expr2.value вместо expr2.reference (логическая ошибка) - extended_anum_parser.py: char == 'INF' никогда не сработает для одиночного символа - complex_anum_parser.py: bare import не работает при запуске из корня проекта - anum_prover.py, mtc_formula_prover.py: unreachable код (дублированная проверка '=') - notation_system.py: дублированный '!=' в FORMULA_OPERATORS CI pipeline: - check-file-limits: переменная EXIT_CODE не выходила из подоболочки (баг с pipe + while) - Удалён --exit-zero у ruff и continue-on-error у тестов (CI не ловил ошибки) Линтинг (ruff): - validate_axioms.py: f-string без плейсхолдеров - anum_prover.py, mtc_formula_prover.py: type() == type() → type() is type() - extended_anum_parser.py: неиспользуемая переменная start_pos - anum_prover.py, mtc_formula_prover.py: bare except → except Exception - ascii_unicode.py: неиспользуемый import re Документация: - README.md: английская секция аксиом обновлена до А0-А16 (была устаревшая А0-А11) - .gitignore: добавлены Python-специфичные записи Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Выделены общие хелперы _check_val_closure_composition и _check_ref_closure_composition для обобщения повторяющихся паттернов проверки r♀...♀ и ♂...♂v с произвольным количеством форм. Файл уменьшен с 1561 до 1343 строк (в рамках лимита CI 1500). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 0611e4f.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit or discard them. Uncommitted files: Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback. |
🔄 Auto-restart 1/3 LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
🤖 Models used:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Полный code review проекта по запросу из issue #44. Найдены и исправлены баги, проблемы CI pipeline, нарушения линтинга и несоответствия в документации.
Fixes #44
Обнаруженные и исправленные проблемы
Критические баги
parsers/anum_prover.py:577_check_meta_self_closureпроверялexpr2.valueвместоexpr2.reference— некорректные результаты эквивалентности для паттерна♂∞ = ∞ → ♂∞expr2.reference(как вmtc_formula_prover.py:1294)parsers/extended_anum_parser.py:90char == 'INF'— одиночный символ никогда не равен 3-символьной строкеparsers/complex_anum_parser.py:10from extended_anum_parser import ...— bare import не работает при запуске из корня проекта.github/workflows/ci.yml:72EXIT_CODE=1в pipe +while readустанавливается в subshell и не видна в parent shell — проверка никогда не проваливаетсяfor file in $(find ...)CI pipeline
ruff check --exit-zero+continue-on-error: true— линтинг полностью игнорируется--exit-zeroиcontinue-on-errorpytestсcontinue-on-error: true— тесты не блокируют pipelinecontinue-on-errorМёртвый / unreachable код
parsers/anum_prover.py:226if self.current_char == '='— уже обработана на строке 211parsers/mtc_formula_prover.py:303'='— уже обработана на строке 283core/notation_system.py:44'!='вFORMULA_OPERATORSЛинтинг (ruff)
core/axioms/validate_axioms.py:139parsers/anum_prover.py:623type(x) == type(y)→type(x) is type(y)parsers/mtc_formula_prover.py:1440type(x) == type(y)→type(x) is type(y)parsers/extended_anum_parser.py:225start_posparsers/anum_prover.py:37except:→except Exception:parsers/mtc_formula_prover.py:43except:→except Exception:converters/ascii_unicode.py:31import reДокументация
README.md:216.gitignore.pytest_cache/,.ruff_cache/,.venv/,.egg-info/, IDE файлыЗамечания для будущей работы (не исправлено в этом PR)
Следующие проблемы обнаружены, но выходят за рамки bugfix-PR:
mtc_formula_prover.pyиanum_prover.py— базовые классы (Symbol,Connection,AssociativeRootи др.) скопированы целиком. Рекомендуется выделить в общий модуль.validate_axioms.pyне валидирует ничего — все 17 тестов передаютTrueвlog_test()hardcoded. Это документационный runner, а не тест-сьют.ascii_unicode.py:ascii_to_unicodeнаивно заменяетMиFво всём тексте черезstr.replace(), что может повредить обычный текст (например,"FORM"→"♀OR♂").mtc_formula_prover.py: 1560 строк — файл превышает рекомендуемый лимит CI (1500). Рекомендуется разбить на модули.complex_anum_parser.py,mtc_original_abit_parser.py,extended_anum_parser.py,notation_system.py.tests/test.bat— только Windows, нет аналога для Linux/macOS.Test plan
ruff check parsers/ converters/ core/ tests/ --ignore E501,F401— All checks passedpython -m pytest tests/test_converters.py -v --tb=short— 43 tests passed🤖 Generated with Claude Code