Commit Graph
7 Commits
Author SHA1 Message Date
oqyude 6b8d508c4f D32: календарная точность регулярных платежей (dateutil rrule)
Вместо «месячной доли» (D16b: amount/30.4, amount/4.33, amount/12)
регулярный платёж раскладывается по календарю: сколько и каких списаний
выпадает в конкретный месяц.

- domain/recurrence.py — планировщик на dateutil.rrule: daily/weekly/monthly/
  yearly, якорь даты старта сохраняется, end_date ограничивает окно,
  разбор дат в пользовательских форматах, русские синонимы периодичности;
- domain/recurring.py — amount_in_month(month_start, month_end, default_start)
  вместо monthly_amount()/is_active_in_month(); amount теперь — сумма
  ОДНОГО списания; периодичность нормализуется при валидации;
- application/forecast.py — платёж раскладывается по месяцам сетки.

Числа изменились (было → стало):
- yearly 1200: 100.00/мес, итог 1200.00 → 1200.00 в месяц якоря, итог 1200.00;
- weekly 100: 23.09/мес, итог 277.14 → по календарю (янв 500, фев 400, …);
- daily 1: 0.03/мес, итог 0.39 → по числу дней месяца (31, 28, 31, …).

Тесты: 255 → 289 (новый tests/test_recurrence.py, переписаны тесты D16b).
2026-11-15 05:49:34 +03:00
oqyude 9562adb53f D12: pyproject.toml — dev-extra, настройки pytest и coverage
- [project.optional-dependencies] dev: pytest>=8.0, ruff==0.17.2, coverage>=7.0
  (ruff зафиксирован точной версией: вывод `ruff format` зависит от версии,
  иначе гейт `ruff format --check .` может «поплыть» при обновлении;
  coverage добавлен, чтобы работал [tool.coverage.run])
- [tool.pytest.ini_options]: addopts = "-ra --strict-markers" (testpaths сохранён)
- [tool.coverage.run]: branch=true, source=application/domain/infrastructure,
  omit тестов; [tool.coverage.report]: show_missing, skip_covered

Установка dev-окружения: pip install -e ".[dev]"
2026-10-25 05:17:32 +03:00
oqyude b6b64a9878 T6: Decompose CLI — main.py → 9 command files, config.py → config_cmd.py
Split infrastructure/cli/:
- main.py (330 LOC) → 9 files in infrastructure/cli/commands/:
  * init.py, forecast.py, scenario.py, whatif.py, compare.py
  * import_xlsx.py, export_xlsx.py, analyze.py, info.py
- config.py (428 LOC) → commands/config_cmd.py (15 sub-commands)
- main.py → app.py (entry point: registers all commands)
- New: paths.py (MODEL_PATH, DATA_DIR)
- New: services.py (composition root + helpers: load_model, save_model,
  build_services, resolve_currency, convert_value, fmt_amount)
- cli/__init__.py (empty) удалён

Each command module: <100 LOC.
pyproject.toml: cf = infrastructure.cli.app:app
tests/test_cli.py: import обновлён на infrastructure.cli.app

CLI behavior идентично, все команды работают.
Tests: 67/67 pass.
2026-10-08 16:56:49 +03:00
oqyude c765f3672a T2: Pydantic v2 — replace @dataclass with BaseModel
- All domain models now use pydantic.BaseModel
- Removed manual to_dict()/from_dict() — use model_dump(mode='json')/model_validate()
- Added field validators:
  - Account.balance >= 0
  - Transaction.amount != 0
  - RecurringCashflow.amount != 0, frequency in {daily, weekly, monthly, yearly}
  - Liability.interest, payment >= 0
  - ExchangeRate.rate > 0
  - ForecastScenario.multipliers >= 0
- pydantic v2 native UUID handling (auto str in JSON)
- Updated excel_sync.py to use model_validate()
- Updated tests/test_model.py and tests/test_currency.py
- Added pydantic>=2.0 to pyproject.toml

Tests: 63/63 pass.
2026-10-08 16:42:04 +03:00
oqyude feb77ef217 T1: restructure to domain/application/infrastructure + schema version 1
- Move cashflow_model/ -> domain/
- Move engine/ -> application/
- Move cli/, sync/, ai/ -> infrastructure/
- Update all imports across codebase and tests
- Add version=1 to FinancialModel.to_dict() with migration hook in from_dict
- Update pyproject.toml: cf entry point and packages.find

Tests: 63/63 pass.
2026-10-08 16:34:10 +03:00
oqyude e9c7120323 testing new features 2026-07-22 12:40:42 +03:00
oqyude 940d25435e bootstrap 2026-07-12 19:46:07 +03:00