Skip to content

feat(strategy): implement DefineStrategyVersion slice - #2

Merged
liveforpresent merged 1 commit into
mainfrom
feature/strategy-version
Aug 15, 2026
Merged

liveforpresent merged 1 commit into
mainfrom
feature/strategy-version

Conversation

@liveforpresent

Copy link
Copy Markdown
Contributor

Summary

  • Feature-centric Gradle multi-module 구조와 공통 build convention을 구성했습니다.
  • Strategy 생성·단건 조회 vertical slice를 Web → Inbound Port → Application →
    Persistence/Snowflake Adapter 흐름으로 구현했습니다.
  • BacktestRun을 PENDING 상태로 생성하는 최소 RunBacktest slice와 Compute outbound port를
    추가했습니다.
  • context 소유 문서/OpenAPI 스냅샷을 동기화하고 core-api 전용 agent 규칙을 정리했습니다.

Implemented Use Cases

  • CreateStrategy: Snowflake 기반 Strategy ID 생성, 테스트용 MemberId 공급, PostgreSQL 저장.
  • GetStrategy: StrategyReader를 통한 단건 조회와 Web 응답 매핑.
  • RunBacktest: StrategyVersionId로 BacktestRun(PENDING) 생성. Compute 호출/폴링 구현은
    이번 범위에서 제외하고 outbound port만 정의.

Related ADR

  • ADR-002 — Primary Signal Asset은 명시적으로 지정.
  • ADR-013 — Strategy와 생성 후 불변인 StrategyVersion.
  • ADR-018 — Feature-centric Gradle 모듈, inbound/outbound port, technology-specific adapter.

Core ↔ Compute API Contract

  • Compute client 구현이나 요청/응답 동작은 변경하지 않았습니다.
  • 포함된 OpenAPI 파일은 context 저장소의 동기화 스냅샷입니다. 별도 Compute API 계약 변경 PR은
    없습니다.

Persist immutable StrategyVersion definitions through the Strategy Store and expose the define endpoint.

Related: ADR-001, ADR-002, ADR-013, ADR-018; Use Case DefineStrategyVersion.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the “DefineStrategyVersion” vertical slice for the strategy feature (Web → Inbound Port → Application → Persistence/Snowflake adapters) and extends strategy retrieval to return version details.

Changes:

  • Add DefineStrategyVersion inbound port + application service + web endpoint (POST /strategies/{id}/versions) and response/request DTOs.
  • Persist and read StrategyVersion (and its conditions) via new JPA entities + updated store/reader adapters; introduce StrategyVersionIdGenerator with Snowflake implementation.
  • Expand “GetStrategy” read/result/HTTP response to include versions and latestVersionId; add unit + HTTP integration tests.

Reviewed changes

Copilot reviewed 19 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/outbound/StrategyStore.kt Extend outbound store contract to support findById for command-side aggregate load.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/outbound/StrategyReader.kt Expand read model to include versions and version details.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/outbound/StrategyIdGenerator.kt Add StrategyVersionIdGenerator outbound port.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/inbound/strategy/get/GetStrategyResult.kt Extend inbound result DTOs to include version details.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/inbound/strategy/define/DefineStrategyVersionUseCase.kt New inbound use case interface for defining versions.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/inbound/strategy/define/DefineStrategyVersionResult.kt New inbound result for version definition.
strategy/port/src/main/kotlin/com/refinvest/core/strategy/port/inbound/strategy/define/DefineStrategyVersionCommand.kt New inbound command for version definition.
strategy/application/src/test/kotlin/com/refinvest/core/strategy/application/strategy/get/GetStrategyServiceTest.kt Update unit test for expanded read model shape.
strategy/application/src/test/kotlin/com/refinvest/core/strategy/application/strategy/define/DefineStrategyVersionServiceTest.kt New unit tests for DefineStrategyVersion application service.
strategy/application/src/test/kotlin/com/refinvest/core/strategy/application/strategy/create/CreateStrategyServiceTest.kt Update unit test to match new StrategyStore interface.
strategy/application/src/main/kotlin/com/refinvest/core/strategy/application/strategy/get/GetStrategyService.kt Map versions from read model into inbound result DTOs.
strategy/application/src/main/kotlin/com/refinvest/core/strategy/application/strategy/define/DefineStrategyVersionService.kt New transactional application service implementing DefineStrategyVersion.
strategy/application/build.gradle.kts Add Spring TX dependency for @Transactional.
strategy/adapter/web/src/main/kotlin/com/refinvest/core/strategy/adapter/web/strategy/StrategyController.kt Add HTTP endpoint for defining versions; include versions in GetStrategy response.
strategy/adapter/web/src/main/kotlin/com/refinvest/core/strategy/adapter/web/strategy/get/GetStrategyResponse.kt Define typed versions response model and mapping helper.
strategy/adapter/web/src/main/kotlin/com/refinvest/core/strategy/adapter/web/strategy/define/DefineStrategyVersionResponse.kt New response DTOs for DefineStrategyVersion (including condition/exit representations).
strategy/adapter/web/src/main/kotlin/com/refinvest/core/strategy/adapter/web/strategy/define/DefineStrategyVersionRequest.kt New request DTOs and request→domain mapping logic.
strategy/adapter/snowflake/src/main/kotlin/com/refinvest/core/strategy/adapter/out/id/SnowflakeStrategyVersionIdGenerator.kt Snowflake-backed generator for StrategyVersionId.
strategy/adapter/persistence/src/main/kotlin/com/refinvest/core/strategy/adapter/out/persistence/StrategyVersionJpaEntity.kt New JPA entity for strategy versions and version conditions relation.
strategy/adapter/persistence/src/main/kotlin/com/refinvest/core/strategy/adapter/out/persistence/StrategyJpaEntity.kt Add versions collection to strategy JPA entity.
strategy/adapter/persistence/src/main/kotlin/com/refinvest/core/strategy/adapter/out/persistence/JpaStrategyStoreAdapter.kt Update store adapter to load/save versions + conditions.
strategy/adapter/persistence/src/main/kotlin/com/refinvest/core/strategy/adapter/out/persistence/JpaStrategyReaderAdapter.kt Update reader adapter to return versions and compute latest version id.
strategy/adapter/persistence/src/main/kotlin/com/refinvest/core/strategy/adapter/out/persistence/ConditionJpaEntity.kt New JPA entity for version conditions.
gradle/libs.versions.toml Add spring-tx library coordinate.
app/src/test/kotlin/com/refinvest/RefinvestApplicationTests.kt Add HTTP-level tests for defining and retrieving versions + validation failure case.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@liveforpresent
liveforpresent requested a balanced review from Copilot August 15, 2026 07:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@liveforpresent
liveforpresent merged commit 86b2868 into main Aug 15, 2026
1 check passed
@liveforpresent
liveforpresent deleted the feature/strategy-version branch August 15, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants