fix: resolve SRS conflicts from batch verification analysis (CONFLICT-1~4)
Conflict Resolutions: - CONFLICT-1 (High): Fix REQ-006 ownership scope — implement owner_user_id filtering * Change app/api/v1_assets.py: owner_user_id=None → owner_user_id=auth.user_id * Update docs/runtime-flows.md to reflect service-token owner-scoped portfolio filtering * Add regression test in tests/test_v1.py for ownership boundary - CONFLICT-2 (Medium): Transition REQ-001/002/003 to Implemented * REQ-001: local-db-validation-scenarios (via confirm-req-implemented bat-007) * REQ-002: alembic-runtime-schema-ownership (via confirm-req-implemented bat-007) * REQ-003: local-db-operations-runbook-and-baseline-updates (via confirm-req-implemented bat-007) * Update docs/srs/index.md with status transitions - CONFLICT-3 (Low): Document REQ-012 rotate lifecycle * Add rotate lifecycle notes to REQ-012 (change-req req-012) * Clarify runtime_id change behavior and trex-basic reconnection requirements - CONFLICT-4 (Low): Clarify REQ-005 AC-2 endpoint path * Change REQ-005 AC-2: 'POST /auth/tokens or equivalent' → 'POST /auth/service-tokens' * Update docs/srs/index.md change log with change-req entries Documentation Updates: - Update BAT-001 verification status with conflict resolution evidence - Update release rel-001 with verified status confirmation - Add change log entries for all conflict resolutions with dates and references Testing: - Add ownership boundary test to test_v1.py - Verify filter works with auth.user_id context
This commit is contained in:
@@ -10,13 +10,13 @@
|
||||
- asset_id는 기존 portfolio_id를 그대로 사용하며 별도 식별자 체계를 만들지 않는다(A-3).
|
||||
|
||||
## Requirement
|
||||
- GET /v1/assets는 service-token bearer 인증으로 토큰 소유자의 portfolio 목록을 asset_id, symbol, market, status, cash, quantity, broker_type, strategy_id, strategy_type, strategy_params, updated_at 필드로 반환해야 한다.
|
||||
- GET /v1/assets는 service-token bearer 인증으로 토큰 소유자의 portfolio 목록만 asset_id, symbol, market, status, cash, quantity, broker_type, strategy_id, strategy_type, strategy_params, updated_at 필드로 반환해야 한다. 다른 사용자 소유 portfolio는 응답에 포함되면 안 된다.
|
||||
- status=active 쿼리 파라미터로 필터링이 가능해야 한다.
|
||||
- strategy_params는 해당 portfolio의 active_strategy_id로 조회한 StrategySet.config에서 파생한다. strategy_id는 허용값 검증 없이 그대로 반환한다(OQ-1 Answered).
|
||||
- strategy_type은 해당 portfolio의 active_strategy_id로 조회한 StrategySet.name을 반환한다. active_strategy_id가 없거나 StrategySet 조회 실패 시 null을 반환한다.
|
||||
|
||||
## Acceptance Criteria
|
||||
1. Given 유효한 service-token bearer 인증으로 GET /v1/assets 요청 시, When 토큰이 유효하면, Then HTTP 200과 해당 사용자 소유 portfolio 목록이 반환되어야 한다.
|
||||
1. Given 유효한 service-token bearer 인증으로 GET /v1/assets 요청 시, When 토큰이 유효하면, Then HTTP 200과 해당 사용자 소유 portfolio 목록만 반환되어야 하며 다른 사용자 소유 portfolio는 포함되면 안 된다.
|
||||
2. Given GET /v1/assets?status=active 요청 시, Then status가 active인 항목만 반환되어야 한다.
|
||||
3. Given 응답의 각 항목을 확인하면, Then asset_id, symbol, market, status, cash, quantity, broker_type, strategy_id, strategy_type, strategy_params, updated_at 필드가 모두 포함되어야 한다.
|
||||
4. Given portfolio에 연결된 StrategySet이 있을 때, When strategy_params를 확인하면, Then StrategySet.config 값에서 파생된 JSON 객체여야 한다.
|
||||
@@ -29,7 +29,7 @@
|
||||
## Impacted Area
|
||||
- Docs: docs/interface-contract.md (REQ-011에서 갱신 예정), docs/project-structure.md (신규 라우터 파일 반영 필요)
|
||||
- Modules: app/api/v1_assets.py (신규), app/services/ (assets 조회 서비스 메서드 추가), app/schemas/ (v1 assets 응답 스키마 추가), app/repositories/postgres.py (portfolio + strategy_set JOIN 쿼리 추가), app/main.py (/v1 라우터 등록)
|
||||
- Tests: tests/test_v1_assets.py (신규)
|
||||
- Tests: tests/test_v1.py (GET /v1/assets 관련 케이스 및 owner scope 회귀 검증)
|
||||
|
||||
## Notes
|
||||
- broker_type은 portfolios.broker 컬럼을 그대로 매핑한다(m-2 finding 반영).
|
||||
@@ -39,6 +39,49 @@
|
||||
|
||||
## Change Log
|
||||
|
||||
### CHG-20260511-02
|
||||
- Date: 2026-05-11
|
||||
- Author: repository-maintainers
|
||||
|
||||
#### Change Summary
|
||||
- owner scope 회귀 수정 반영 — GET /v1/assets는 service-token 소유자의 portfolio만 반환함을 REQ와 verification evidence에 명시
|
||||
|
||||
#### Intent
|
||||
- CONFLICT-1 분석 결과와 2026-05-11 사용자 결정에 따라 trex-basic은 전체 사용자의 portfolio를 조회하면 안 되며, 서비스 토큰 소유자 범위로만 조회되어야 한다는 설계를 REQ 본문과 검증 기준에 명확히 남긴다.
|
||||
|
||||
#### Acceptance Criteria Delta
|
||||
- Added:
|
||||
- none
|
||||
- Updated:
|
||||
- AC1: 반환 범위를 "해당 사용자 소유 portfolio 목록만"으로 명확화하고, 다른 사용자 소유 portfolio 비포함 조건을 추가
|
||||
- Removed:
|
||||
- none
|
||||
|
||||
#### Impacted Area Delta
|
||||
- Docs:
|
||||
- docs/batches/bat-001_20260502_trex-basic-v1-api-contract/verification.md: REQ-006 AC1 evidence를 owner scope 기준으로 재정렬
|
||||
- Modules:
|
||||
- app/api/v1_assets.py: `owner_user_id=auth.user_id` 적용으로 owner scope 강제
|
||||
- Tests:
|
||||
- tests/test_v1.py: `test_v1_assets_returns_asset_list`에 `owner_user_id="user-1"` 전달 assert 추가
|
||||
|
||||
#### Delivery Trace Delta
|
||||
- Batches:
|
||||
- BAT-001 (release-candidate) — REQ-006 targeted re-verification 필요 및 evidence 갱신
|
||||
- Releases:
|
||||
- REL-001 (draft) — release 입력 전 owner scope 기준 반영 여부 재확인 필요
|
||||
|
||||
#### Revalidation Impact
|
||||
- Reverification Needed: yes
|
||||
- Existing Implementation Invalidated: yes
|
||||
- Status Recommendation: keep-current
|
||||
- Follow-up Action: owner scope 수정 코드와 targeted pytest 재실행 결과를 BAT-001 verification에 반영하고 Implemented 상태 유지
|
||||
|
||||
#### Validation Plan
|
||||
- `app/api/v1_assets.py`에서 `owner_user_id=auth.user_id` 적용 여부 확인
|
||||
- `tests/test_v1.py -k 'v1_assets'` 재실행으로 GET /v1/assets 회귀 테스트 PASS 확인
|
||||
- BAT-001 verification.md의 REQ-006 AC1 evidence를 최신 테스트와 맞춤
|
||||
|
||||
### CHG-20260511-01
|
||||
- Date: 2026-05-11
|
||||
- Author: repository-maintainers
|
||||
|
||||
Reference in New Issue
Block a user