docs(stagepilot): confirm manual ledger batch verification

This commit is contained in:
2026-07-14 19:54:20 +09:00
parent b3447f699e
commit f5636c1ade
5 changed files with 36 additions and 5 deletions
@@ -2,7 +2,7 @@
- Batch ID: BAT-024
- Profile: standard
- Status: implemented
- Status: release-candidate
- Discovery: dcy-012_20260714_manual-ledger-write-api-owner-scoped
- Included REQ: REQ-056
- Folder: docs/batches/bat-024_20260714_manual-ledger-api/
@@ -33,7 +33,7 @@ REQ-056 구현: trex-web이 user/session token으로 자기 소유 portfolio에
- [x] 기존 `/ledger/trades`, `GET /v1/portfolios`, CLI/domain flow 회귀 없음
- [x] baseline docs(`interface-contract`, `runtime-flows`, `data-model`) 갱신
- [x] draft-batch-verification 문서에 AC별 PASS/FAIL evidence 기록
- [ ] independent QC PASS 후 lead `confirm-batch-verification`
- [x] independent QC PASS 후 lead `confirm-batch-verification`
## 비가역 결재 게이트
@@ -45,3 +45,12 @@ REQ-056 구현: trex-web이 user/session token으로 자기 소유 portfolio에
- `QUANTITY_ADJUSTMENT`는 1차 제외.
- `PROFIT`은 신규 manual API 필수 action이며 순입금액 계산에는 포함하지 않는다.
## Verification / Gate Result
- Developer verification: PASS — `594 passed, 12 warnings in 37.24s`.
- Independent QC: PASS — delegation `deleg_f2337a39`, HEAD `b3447f6`, `594 passed, 12 warnings in 37.29s`, focused remediation `4 passed`.
- Lead gate: `confirm-batch-verification` accepted 2026-07-14 KST.
- REQ gate: `confirm-req-implemented` accepted for REQ-056.
- Release note: Production rollout still requires release gate; Alembic migration/runbook for additive `portfolio_ledger` columns remains a release risk to decide before production DB rollout.
@@ -73,6 +73,16 @@ Added regression coverage in `tests/test_v1_portfolios_manual_ledger.py`:
- `test_amount_actions_reject_fee_and_tax_fields`
- `test_reversal_rejects_fee_tax_and_missing_target`
## Independent QC result
- QC delegation: `deleg_f2337a39`
- Target HEAD: `b3447f6`
- Verdict: PASS
- QC compile evidence: `python3 -m compileall app` → `exit_code=0`
- QC full regression: `PYTHONPATH=. uv run python -m pytest -q --override-ini addopts=''` → `594 passed, 12 warnings in 37.29s`
- QC focused remediation tests: admin owner-scope, manual read owner-scope, fee/tax validation, reversal missing target → `4 passed, 1 warning in 0.92s`
- Lead decision: `confirm-batch-verification` PASS accepted.
## Notes / follow-up risks
- The implementation adds additive bootstrap columns via `ensure_schema()` for `portfolio_ledger`: `source`, `target_ledger_entry_id`, `confirmation_evidence`, `actor_user_id`.
+1 -1
View File
@@ -31,4 +31,4 @@
| BAT-021 | standard | release-candidate | REQ-047 | dcy-010 | [bat-021](./bat-021_20260628_req047-step2-integration-and-runbook/) |
| BAT-022 | standard | release-candidate | REQ-052, REQ-053, REQ-054 | dcy-011 | [bat-022](./bat-022_20260628_daemon-crud-self-service-credential-api/) |
| BAT-023 | batch-lite | in-progress | REQ-055 | trex-tvr-v1 dcy-001 | [bat-023](./bat-023_20260704_portfolios-strategy-market-meta/) |
| BAT-024 | standard | in-progress | REQ-056 | dcy-012 | [bat-024](./bat-024_20260714_manual-ledger-api/) |
| BAT-024 | standard | release-candidate | REQ-056 | dcy-012 | [bat-024](./bat-024_20260714_manual-ledger-api/) |
@@ -1,6 +1,6 @@
# REQ-056: owner-scoped 수동 장부 입력 HTTP API
- Status: Approved
- Status: Implemented
- Type: Interface
- Priority: High
- Owner: Justin Ko
@@ -181,3 +181,14 @@
#### Validation Plan
- AC-1~19를 batch verification에서 API/repository/concurrency/regression evidence로 검증한다.
## Implementation Confirmation
- Confirmed: 2026-07-14 KST
- Implementing Batch: BAT-024 — `docs/batches/bat-024_20260714_manual-ledger-api/`
- Implementation commit: `b3447f6 feat(api): add owner-scoped manual ledger endpoint`
- Developer verification: `594 passed, 12 warnings in 37.24s`
- Independent QC: PASS (`deleg_f2337a39`) — `594 passed, 12 warnings in 37.29s`; focused remediation tests `4 passed`.
- Lead gate: `confirm-req-implemented` accepted.
- Release caveat: production DB rollout needs release-gate handling for additive `portfolio_ledger` columns (`source`, `target_ledger_entry_id`, `confirmation_evidence`, `actor_user_id`), preferably Alembic migration/runbook instead of relying only on `ensure_schema()`.
+2 -1
View File
@@ -136,10 +136,11 @@
| REQ-053 | admin 데몬 CRUD HTTP API | Interface | Implemented | High | Justin Ko | [req-053](./Interface/req-053_admin-daemon-crud-api.md) |
| REQ-054 | 인증정보 관리 보안 격리 — write-only·secret 미반환·로그 미노출 | Non-Functional | Implemented | High | Justin Ko | [req-054](./Non-Functional/req-054_credential-management-security-write-only.md) |
| REQ-055 | GET /v1/portfolios 응답에 전략·시장 메타데이터 노출 (additive) | Interface | Implemented | High | Justin Ko | [req-055](./Interface/req-055_v1-portfolios-strategy-market-meta-exposure.md) |
| REQ-056 | owner-scoped 수동 장부 입력 HTTP API | Interface | Approved | High | Justin Ko | [req-056](./Interface/req-056_v1-portfolios-manual-ledger-api.md) |
| REQ-056 | owner-scoped 수동 장부 입력 HTTP API | Interface | Implemented | High | Justin Ko | [req-056](./Interface/req-056_v1-portfolios-manual-ledger-api.md) |
## Recent Change Log Summary
- 2026-07-14: REQ-056 `Approved` → `Implemented` (confirm-req-implemented) — BAT-024 local implementation commit `b3447f6`, independent QC PASS (`deleg_f2337a39`). Manual ledger API endpoints added (`POST/GET /v1/portfolios/{portfolio_id}/ledger/manual`, `GET /v1/portfolios/{portfolio_id}/returns/summary`), strict owner-scope without admin bypass, service-token fail-closed, insufficient state 409, daemon-managed confirmation, `total_value_after`, `cumulative_profit_withdrawn`. Verification: full `594 passed`, focused remediation `4 passed`. Release caveat: production DB rollout should address additive `portfolio_ledger` columns with migration/runbook at release gate.
- 2026-07-14: REQ-056 `Proposed` → `Approved` (confirm-req) — dcy-012 confirmed Discovery 근거. 신규 `POST /v1/portfolios/{portfolio_id}/ledger/manual` + action enum(`INVEST`, `BUFFER_OUT`, `BUFFER_IN`, `BUY`, `SELL`, `WITHDRAW`, `PROFIT`, `REVERSAL`) owner-scoped user/session API 계약. 기존 `/ledger/trades`는 daemon/service-token broker write 전용으로 보존. 부족 cash/quantity/buffer 409, daemon-managed confirmation 409 `MANUAL_WRITE_REQUIRES_CONFIRMATION`, after-snapshot/history fields, `cumulative_profit_withdrawn` 및 `PROFIT` 순입금액 미포함 의미 포함. BAT-024 delivery 후보로 진행.
- 2026-07-04: REQ-055 신규 생성 `Implemented` (draft-req) — trex-tvr-v1 dcy-001 confirmed Discovery 근거. `GET /v1/portfolios` 응답에 `active_strategy_id`·`strategy_name`·`strategy_params`·`markets` additive 노출. DB 마이그레이션 불필요(기존 컬럼·테이블 활용), N+1 금지·파싱 에러 격리(500 금지) 포함. BAT-024 delivery 후보로 진행.
- 2026-06-28: REQ-052/053/054 `Approved` → `Implemented` (confirm-req-implemented) — BAT-022 PR #19 mergeCommit 1b78c18, QC PASS-WITH-NOTES(opus, blocker 0). 565 passed(+leak 테스트), AC 전건·secret 미반환·소유 스코프·REQ-051 회귀 PASS. Major 보안 #3(owner 재할당 credential leak) 원자화 수정(83e6dde) 반영 — 단일 트랜잭션+선삭제+leak 방지 테스트 3종. REQ-053 owner 재할당 원자화 수정 명시.