Commit Graph
15 Commits
Author SHA1 Message Date
oqyude 3ef10618dc T7: Final validation + README update
- pytest: 67/67 pass
- Manual CLI test: init, forecast, scenario, whatif, compare, info, analyze
  all work; Excel round-trip (export → init → import) preserves data
- README.md: обновлён под новую архитектуру domain/application/infrastructure
  с описанием слоёв, pydantic, Decimal, Repository, DI, schema versioning
  и расширенным списком команд (config sub-typer с account/transaction/etc)

Tests: 67/67 pass.
Project: refactor complete — все 5 направлений реализованы.
2026-10-08 16:57:50 +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 541a76835f T5: Dependency Injection — services через composition root
- AssistantService теперь принимает ForecastService в конструкторе
  (раньше создавал new ForecastService() внутри analyze/advice)
- infrastructure/cli/main.py: _build_services() — composition root,
  собирает граф ForecastService, ScenarioService, AssistantService, CurrencyConverter
- Все CLI-команды используют _build_services(model) вместо прямого new
- test_ai.py: обновлён под новый контракт AssistantService

Tests: 67/67 pass.
2026-10-08 16:53:04 +03:00
oqyude 3f7268d14c T4: Repository pattern — ModelRepository, JsonFileRepository, ExcelRepository
- application/repositories/model_repository.py: ModelRepository Protocol
  with load(path) and save(model, path)
- infrastructure/repositories/json_file_repository.py: JsonFileRepository
  (вынесен из FinancialModel.save/load)
- infrastructure/repositories/excel_repository.py: ExcelRepository
  (бывший ExcelSync, переименован)
- FinancialModel.save/load удалены — теперь только данные
- infrastructure/sync/ удалён (ExcelSync перенесён в repositories/)
- infrastructure/cli/main.py и config.py используют JsonFileRepository +
  ExcelRepository через локальные singletons
- test_excel_sync.py переименован в test для ExcelRepository
- Новый test_repositories.py: 5 тестов для JsonFileRepository + протокол
- test_model.py: использован JsonFileRepository

Tests: 68/68 pass (было 63 + 5 новых).
2026-10-08 16:50:06 +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 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 12611edd6f metaagent update 2026-10-08 15:40:35 +03:00
oqyude e9c7120323 testing new features 2026-07-22 12:40:42 +03:00
oqyude 3cc8e94863 metaagent updated 2026-07-22 01:37:07 +03:00
oqyude 5afea8238c beginning 2026-07-12 19:51:00 +03:00
oqyude 940d25435e bootstrap 2026-07-12 19:46:07 +03:00
oqyude 2ddf2251d6 gitignore 2026-07-12 19:25:40 +03:00
oqyude b71c4bfcd8 Edit README.md 2026-06-09 22:34:03 +00:00
oqyude b534d58c20 Initial commit 2026-06-09 22:32:57 +00:00