Files
portfolio-hub/docs/batches/bat-016_20260605_ledger-accounting-consolidation/verification.md
T
genichin 44f2102d26 feat: consolidate ledger trade writes into portfolio_ledger
- add ledger consolidation migration and remove ledger_trades usage
- return portfolio state after v1 ledger trade writes
- deprecate legacy buy/sell endpoints with deprecation headers
- add BAT-016, DCY-006, and REQ-036~038 documentation
- update repository models and tests for unified ledger entries
2026-06-05 20:55:24 +09:00

1.8 KiB

BAT-016 Verification

  • Status: passed
  • Batch: BAT-016

Acceptance Mapping

  • REQ-036:
    • AC-1~3: ledger_trades application references removed; new migration 20260605_0025_ledger_consolidation.py and ensure_schema() consolidate trade columns into portfolio_ledger.
    • AC-4~5: repository write/read path uses portfolio_ledger; recent trade mapping is LedgerEntry-based.
    • AC-6~7: full regression passes under the project venv.
  • REQ-037:
    • AC-1~2: POST /v1/portfolios/{portfolio_id}/ledger/trades is the authoritative trade write endpoint.
    • AC-3~5: response includes ledger_entry_id, order_id, execution_id, side, fee_amount, tax_amount, cash_balance_after, and asset_quantity_after.
    • AC-6: duplicate broker identifiers are resolved via repository idempotency lookup.
    • AC-7: tests cover buy/sell, negative asset quantity, duplicate request behavior, and response state fields.
  • REQ-038:
    • AC-1~2: legacy buy/sell route decorators use deprecated=True.
    • AC-3~4: legacy buy/sell responses/errors emit Deprecation: true; tests/test_auth.py::test_legacy_buy_sell_routes_emit_deprecation_header verifies this behavior.

Evidence

  • Test:
    • .venv/bin/python -m pytest -q tests/test_domain_services.py tests/test_v1_portfolios_ledger.py tests/test_daemon_assignment.py tests/test_v1.py
    • Result: 47 passed in 3.66s
    • .venv/bin/python -m pytest -q
    • Result: 373 passed, 3 warnings in 14.78s
  • Manual:
    • Confirmed legacy routes return Deprecation: true using TestClient with PORTFOLIOHUB_DB_ENABLED=false and trade-write token.
    • Confirmed app code no longer contains LedgerTrade; only transitional schema-cleanup references remain for dropping old ledger_trades/action structures.
  • Logs:
    • Full pytest output captured in terminal execution.

Result

  • Ready for Release: true
  • Blocking Issues: none