docs: record ProofLine specification for issue 28

This commit is contained in:
2026-08-19 17:42:22 +09:00
parent 5eb8c04266
commit fe22be0b66
11 changed files with 554 additions and 21 deletions
@@ -0,0 +1,50 @@
## 구현 완료
### 구현 내용
- Portfolio return aggregate에서 original ledger의 `source='manual'` 제한을 제거해 모든 source의 유효한 `INVEST`·`WITHDRAW`·`PROFIT`을 side별로 집계한다.
- `total_invested`는 gross `Σ INVEST`, `total_withdrawn`은 `Σ WITHDRAW`, `net_contributed_capital`은 두 값의 차로 유지한다.
- `PROFIT`는 투자 원금 계산에서 제외하고 `cumulative_profit_withdrawn`으로만 별도 집계한다.
- Matching `REVERSAL.target_ledger_entry_id`는 original과 reversal의 source와 무관하게 original entry를 제외한다.
- `buffer_out` 등 non-capital side는 `INVEST`로 재해석하거나 집계하지 않는다.
- Existing ledger row mutation/backfill 없이 query semantic만 교정했다.
- List와 단건 returns summary가 동일한 repository aggregate를 사용하도록 유지했다.
- API schema, data model, runtime flow와 외부 interface contract를 all-source 의미로 동기화했다.
### 실제 검증 결과
- Focused repository/API/docs contract tests: **39 passed**
- Disposable PostgreSQL 16 semantic integration: **1 passed**
- Non-zero broker-only INVEST
- Manual/broker mixed INVEST·WITHDRAW·PROFIT
- Manual reversal → broker original
- Broker reversal → manual original
- `buffer_out` 집계 제외
- Clean candidate full suite: **661 passed, 16 skipped**
- 변경 테스트 범위 Ruff: **PASS**
- `git diff --check`: **PASS**
- 최초 독립 QC: Blocker 0 / Major 1 / Minor 0 — stale manual-only interface contract 발견
- 보완 후 독립 재QC: **PASS — Blocker 0 / Major 0 / Minor 0**
원본 checkout의 full suite에서는 기존 `temp/deleted_20260813/.worktrees/` 복제본을 grep하는 auth-surface tests 3건만 실패했다. 해당 pre-existing artifact를 수정·삭제하지 않고 제외한 clean candidate copy에서 전체 회귀가 통과했다.
### 비차단 후속 권고
- 배포 절차에서 승인된 read-only production pre/post check로 실제 portfolio의 source-independent 합계와 list/detail parity를 확인한다.
- Portfolio `353200`은 source-filter 교정 관찰에만 사용하며 `buffer_out=INVEST` 또는 zero-amount broker `invest` 교정 완료를 주장하지 않는다.
- `buffer_out` 재분류나 producer의 ledger-event modelling 변경이 필요하면 별도 Discovery로 결정한다.
### 완료 및 외부 반영 경계
- 로컬 `main` 구현·검증·독립 재QC·커밋 완료:
- `5eb8c042668b1c383ac59ca9be00aa1a5dfcb37a`
- `fix: aggregate investment totals across ledger sources`
- Tracked worktree/index: clean
- 원격 push: **수행하지 않음**
- PR: **생성하지 않음**
- Release: **수행하지 않음**
- Production deployment/restart: **수행하지 않음**
- Production read-only pre/post check: **배포 절차에서 수행 예정이며 현재 미수행**
- Production ledger mutation: **수행하지 않음**
따라서 이 완료는 로컬 제품 구현·검증·커밋 완료를 의미하며 원격 통합, release 또는 production deployment 완료를 의미하지 않는다.