Commit Graph
3 Commits
Author SHA1 Message Date
oqyude 8af1d9a010 D2: починить lint-гейт — ruff check . проходит
Было: `ruff check .` → 10 ошибок, CI-гейт на ruff был бы красным сразу.
- 9× I001 (порядок импортов) — application/forecast.py:1,
  application/scenarios.py:1, domain/currency.py:1,
  infrastructure/ai/assistant.py:1, infrastructure/cli/app.py:11,
  infrastructure/cli/commands/init.py:2, infrastructure/cli/services.py:2,
  tests/test_model.py:1, tests/test_repositories.py:1
- 1× E501 — infrastructure/cli/services.py:30, сигнатура build_services
  перенесена на три строки

Поведение не меняется: переупорядочены только импорты, убраны пустые
строки, перенесена длинная сигнатура. Порядок импорта в app.py не влияет
на момент вызова setup_i18n() — он по-прежнему после импорта команд.

Проверка: 75/75 тестов зелёные, ruff check . — All checks passed.
2026-10-23 18:29:48 +03:00
oqyude 363d440d53 T3: Decimal for money — all monetary fields migrated from float
- All domain monetary fields now use Decimal:
  - Account.balance, Asset.value, Asset.growth_rate
  - Liability.balance, Liability.interest, Liability.payment
  - Transaction.amount, RecurringCashflow.amount
  - ExchangeRate.rate
  - ForecastScenario.income_multiplier, expense_multiplier, growth_multiplier
- CurrencyConverter: all arithmetic in Decimal, quantize to 0.01 with ROUND_HALF_UP
- ForecastService: Decimal arithmetic throughout (income, expenses, balance, growth, liability cost)
- ScenarioService: Decimal multipliers, deepcopy safe with Decimal fields
- assistant.py: _DecimalEncoder for json.dumps (Decimal -> str in JSON)

Pydantic v2 + Decimal:
- model_dump(mode='json') converts Decimal to str (JSON-safe)
- model_validate() parses str back to Decimal
- Round-trip preserves precision (100.50 stays 100.50)

Tests: 63/63 pass.
2026-10-08 16:44:59 +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