feat: let a delegated tool start from an empty strategy and find what to put in it - #281
Merged
Merged
Conversation
… to put in it
Three gaps kept "make me an Apple RSI strategy" from working, and the first two were
invisible until the CLI was run against the deployed API.
A new strategy is {"groups":[],"mode":"BASIC"} with no catalogId, and every proposed
document must parse as an official assembly, which requires one. ADD_GROUP shipped
without that, so creating a container still produced a document that could not be
read: AWS answered 422 on the first edit of every new strategy. The first edit now
stamps the catalog it is already being validated against. Nothing is invented; the
value was implied by the request and simply had nowhere to be written.
The unit fixtures all carried a catalogId, and the HTTP journey read its 422 as
"there is no group yet" — the right code for the wrong reason, so nothing caught it.
Both now start from the document a new strategy actually has.
`catalog elements` and `catalog instruments --symbol` close the other gap. A person
says "Apple" and "RSI"; a container names instruments by id and blocks by published
element code. Without a lookup a tool has to guess, and a guessed code is refused —
so the tool cannot complete the request it was given. Both routes already existed;
only the CLI could not reach them.
The tool contract now names the discovery step and the create/delegate steps ahead of
the edit workflow, because an external tool reads that file to learn the sequence.
Refs #479
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
후속: Idea2Strategy/Idea2Strategy#479
목표는 이것이다 — 사람이 "애플 요즘 좋던데 RSI 써서 만들어줘" 라고 하면 외부 AI 가 우리 CLI 를
도구처럼 써서 전략을 만든다. 그 사이를 막고 있던 세 가지를 없앤다.
1. 빈 전략의 첫 편집이 항상 422 였다
새 전략의 문서는
{"groups":[],"mode":"BASIC"}이고catalogId가 없다. 그런데 제안된 문서는반드시 정식 조립체로 파싱돼야 하고 그 파싱이
catalogId를 요구한다. 즉ADD_GROUP을 넣은뒤에도 새 전략의 첫 편집은 예외 없이 실패했다. AWS 실측으로 확인했다.
첫 편집이 자기가 검증받는 그 카탈로그를 문서에 찍는다. 값을 지어내는 게 아니라, 이미 그 편집의
기준인 카탈로그를 명시할 자리가 없었던 것뿐이다.
왜 안 잡혔나: 단위 테스트 픽스처가 전부
catalogId를 갖고 있었고, HTTP 저니는 빈 전략에서나온 422 를 "아직 그룹이 없어서" 로 해석해 정상으로 단언했다. 맞는 코드에 틀린 이유였고, 그래서
아무도 몰랐다. 두 테스트 모두 이제 새 전략이 실제로 갖는 문서 에서 출발한다.
2. 도구가 무엇을 쓸지 알아낼 방법이 없었다
사람은 "애플" 과 "RSI" 라고 말하는데, 컨테이너는 종목을 id 로 지목하고 블록은 발행된
요소 코드 로 지목한다. 조회 명령이 없으면 도구는 추측해야 하고, 추측한 코드는 거절된다 — 받은
요청을 완수할 방법이 없다.
두 라우트는 이미 있었고 CLI 만 닿지 못했다. AWS 에서 실제로 확인했다.
3. 계약이 순서를 알려주지 않았다
외부 도구는
tool-contract를 읽고 사용법을 배운다. 거기에 조회 단계와 전략 생성·위임 단계가없어서, 편집 워크플로만 알고 그 앞을 몰랐다. 이제
discovery와 create/delegate 가 계약에 있다.검증
:apps:idea2strategy-cli:test·:modules:backend-application:test·:apps:backend-api:test --tests '*ExternalToolDelegatedEditJourney*'통과.새 커버리지: 빈 전략에서 컨테이너 → 블록 3개 → 연결 2개를 만들어
valid: true로 apply 까지가는 단위 테스트. HTTP 저니도 이제 빈 전략에서 preview 200 을 받고
diff[0] == "ADD_GROUP buy BUY",previewHash,expectedEditSequence, 그리고 찍힌catalogId를 단언한다.남는 것
브라우저 로그인이다. 지금
login은 stdin 으로 비밀번호를 받는다. "설치하고 설정해줘" 에브라우저가 열리려면 별도 인증 흐름이 필요하고, 이 PR 범위가 아니다.
🤖 Generated with Claude Code