From f5636c1ade9be96b8787d1214fd827261450df6b Mon Sep 17 00:00:00 2001 From: Justin Ko Date: Tue, 14 Jul 2026 19:54:20 +0900 Subject: [PATCH] docs(stagepilot): confirm manual ledger batch verification --- .../bat-024_20260714_manual-ledger-api/index.md | 13 +++++++++++-- .../verification.md | 10 ++++++++++ docs/batches/index.md | 2 +- .../req-056_v1-portfolios-manual-ledger-api.md | 13 ++++++++++++- docs/srs/index.md | 3 ++- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/docs/batches/bat-024_20260714_manual-ledger-api/index.md b/docs/batches/bat-024_20260714_manual-ledger-api/index.md index f39d5d1..9911c94 100644 --- a/docs/batches/bat-024_20260714_manual-ledger-api/index.md +++ b/docs/batches/bat-024_20260714_manual-ledger-api/index.md @@ -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. diff --git a/docs/batches/bat-024_20260714_manual-ledger-api/verification.md b/docs/batches/bat-024_20260714_manual-ledger-api/verification.md index bafe216..7c280cd 100644 --- a/docs/batches/bat-024_20260714_manual-ledger-api/verification.md +++ b/docs/batches/bat-024_20260714_manual-ledger-api/verification.md @@ -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`. diff --git a/docs/batches/index.md b/docs/batches/index.md index 9b8a757..770263d 100644 --- a/docs/batches/index.md +++ b/docs/batches/index.md @@ -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/) | diff --git a/docs/srs/Interface/req-056_v1-portfolios-manual-ledger-api.md b/docs/srs/Interface/req-056_v1-portfolios-manual-ledger-api.md index be8d680..18b5ac2 100644 --- a/docs/srs/Interface/req-056_v1-portfolios-manual-ledger-api.md +++ b/docs/srs/Interface/req-056_v1-portfolios-manual-ledger-api.md @@ -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()`. diff --git a/docs/srs/index.md b/docs/srs/index.md index c5b27ec..72524b6 100644 --- a/docs/srs/index.md +++ b/docs/srs/index.md @@ -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 재할당 원자화 수정 명시.