Skip to content

feat: let a delegated tool build a strategy from an empty one - #275

Merged
kcrmin merged 2 commits into
developfrom
feature/488-delegated-group-creation
Aug 9, 2026
Merged

feat: let a delegated tool build a strategy from an empty one#275
kcrmin merged 2 commits into
developfrom
feature/488-delegated-group-creation

Conversation

@kcrmin

@kcrmin kcrmin commented Aug 9, 2026

Copy link
Copy Markdown
Member

후속: Idea2Strategy/Idea2Strategy#479 (컨테이너 생성 권한 결정)

무엇이 막혀 있었나

ADD_BLOCK 은 이미 존재하는 컨테이너를 채울 뿐이고 새 전략은 {"groups":[],"mode":"BASIC"} 이다.
그래서 외부 도구에게 "RSI 전략 만들어줘" 라고 하면 아무것도 못 했다. 사용자가 UI 에서 매수·매도
컨테이너를 먼저 만들어야 도구가 그 안을 채울 수 있었다.

ADD_GROUP 이 그 단계를 없앤다. 빈 전략을 건네면 도구가 뼈대부터 만든다.

인자를 기본값으로 채우지 않은 이유

컨테이너는 블록 담는 그릇이 아니다. 방향, 블록을 결합하는 방식, 자금 배분 방식, 거래 종목
함께 정한다. 이것들은 사용자가 의견을 가질 법한 부분이고, 도구가 추측하면 전략 자체를 추측하는
셈이다. 그래서 전부 명시 인자이고, 종목이 비면 거절한다.

불변규칙 9.9 를 연산에서 강제한다

전략은 한 방향에 컨테이너 하나이고 두 번째 BUY 컨테이너는 정의된 의미가 없다. 검증까지 미루지
않고 연산에서 거절하므로, 도구가 아직 작성 중일 때 반응할 수 있다.

고지 문안 v2

같은 변경에 포함했다. v1 은 "사용자가 이미 만들어 둔 전략 안의 블록 편집" 을 약속했는데, 이제
컨테이너 자체를 만들 수 있다. 위임 범위를 축소해서 고지하는 것 이 그 문서가 막으려는 실패다.

v1 은 수정하지 않고 은퇴시켰다 — 적용된 마이그레이션은 불변이고, v1 에 동의한 사용자는 v1 에
동의한 것이다. 발급 경로가 이미 최신 발행본을 선택하므로 코드 변경은 없다.

바뀐 부분:

  • 지정한 전략에 매수·매도 컨테이너를 만드는 것. 컨테이너를 만들 때 매수/매도 방향, 조건을
    결합하는 방식, 자금을 배분하는 방식, 거래할 종목을 함께 정합니다

빈 전략을 건네면 도구가 전략의 뼈대부터 만들 수 있습니다.

금지 항목(주문·체결·자금 이동·봇 실행·출시·타 전략·임의 코드·외부 데이터)은 그대로다.

검증

backend-application · db-migration · idea2strategy-cli 테스트 통과. 새 커버리지:

  • 컨테이너 생성이 ADD_GROUP sell SELL 로 기록되고 문서에 반영된다
  • 같은 방향의 두 번째 컨테이너는 거절된다
  • 종목이 비었거나 모드 값이 카탈로그 밖이면 거절된다
  • tool-contract 의 allowedEditOperations 가 5개로 고정된다

제품 권한

제품 권한자 kcrmin 지시 (2026-08-10): "AI가 빈 전략에서 시작할 수 있도록 컨테이너도 생성
가능하도록 해줘."

🤖 Generated with Claude Code

kcrmin and others added 2 commits August 10, 2026 01:14
ADD_BLOCK only fills a container that already exists, and a new strategy is
{"groups":[],"mode":"BASIC"}, so asking an external tool to "make me an RSI
strategy" produced nothing: the customer had to shape the buy and sell containers
in the UI first and the tool could only fill them in. ADD_GROUP removes that step.

A container is not a bag of blocks. It carries the side, how its blocks combine,
how capital is split, and which instruments it trades, so every argument is
explicit rather than defaulted — these are the parts of a strategy a customer is
most likely to have an opinion about, and a tool that guessed them would be
guessing the strategy.

Rule 9.9 is enforced at the operation: a strategy holds one container per side, and
a second BUY container has no defined meaning. Refusing it here lets the tool react
while it is still composing, instead of letting it survive into a document that
only fails later at validation.

The disclosure moves to v2 in the same change. v1 promised block editing inside a
strategy the customer had already shaped; this delegation can now create the
containers themselves. A disclosure that understates what is delegated is precisely
the failure that document exists to prevent. v1 is retired rather than edited,
because a customer who consented to v1 consented to v1, and the grant path already
selects the newest published version.

Decided by product authority kcrmin on 2026-08-10: "AI가 빈 전략에서 시작할 수 있도록
컨테이너도 생성 가능하도록 해줘."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ys exists

The v2 timestamps were 2026-08-10T00:00:00Z, which was still in the future when the
migration ran. The selecting query is `retired_at is null and published_at <= now()`,
so v1 was retired while v2 was not yet publishable and the policy code had no current
document at all. Every delegation grant failed with nothing to point at, and the
disclosure_policy_document_id column is NOT NULL, so there was no degraded mode — the
feature was simply off.

Both instants are now one second after v1's publication and safely in the past, which
also fixes the ordering rather than leaning on the version-string tiebreak.

CI caught this because it runs the two integration suites that read the document. I had
run only the application, migration, and CLI modules locally, and none of them touch it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kcrmin
kcrmin merged commit 88da68e into develop Aug 9, 2026
2 checks passed
@kcrmin
kcrmin deleted the feature/488-delegated-group-creation branch August 9, 2026 16:37
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.

1 participant