feat: update agent bootstrap scripts and CLI commands, move contract docs to archive
This commit is contained in:
parent
ac44c85d34
commit
0cf544e2d7
17 changed files with 620 additions and 72 deletions
|
|
@ -0,0 +1,97 @@
|
|||
<!-- task=m-cross-os-runner-bootstrap/04+02,03_binary_contract plan=0 tag=BINARY -->
|
||||
|
||||
# CODE REVIEW: bootstrap 설치 binary 확인 계약
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md`
|
||||
- Epic: `[bootstrap-platforms] Cross-OS bootstrap contract`
|
||||
- Task id: `[oto-binary]`
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 구현 에이전트 소유 섹션
|
||||
|
||||
### 계획 대비 변경 사항
|
||||
|
||||
- 없음. 계획대로 Unix/Windows bootstrap 스크립트에 binary `--version` 확인 절차를 추가하고, 해당 동작이 실패할 시 적절한 에러 출력과 함께 설치를 중단하도록 수정했다. 또한 이에 대응하는 테스트 fixture를 추가하고, 토큰 등의 민감한 정보가 에러 출력에 노출되지 않음을 보증했다.
|
||||
|
||||
### 수정 파일
|
||||
|
||||
- [apps/runner/assets/script/shell/oto_agent_bootstrap.sh](file:///config/workspace/oto/apps/runner/assets/script/shell/oto_agent_bootstrap.sh)
|
||||
- [services/core/internal/httpserver/oto_agent_bootstrap.sh](file:///config/workspace/oto/services/core/internal/httpserver/oto_agent_bootstrap.sh)
|
||||
- [apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1](file:///config/workspace/oto/apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1)
|
||||
- [services/core/internal/httpserver/oto_agent_bootstrap.ps1](file:///config/workspace/oto/services/core/internal/httpserver/oto_agent_bootstrap.ps1)
|
||||
- [apps/runner/test/oto_agent_bootstrap_script_test.dart](file:///config/workspace/oto/apps/runner/test/oto_agent_bootstrap_script_test.dart)
|
||||
- [apps/runner/test/oto_agent_bootstrap_ps1_test.dart](file:///config/workspace/oto/apps/runner/test/oto_agent_bootstrap_ps1_test.dart)
|
||||
|
||||
### 검증 결과
|
||||
|
||||
- `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart` 실행 결과: `All tests passed!`
|
||||
- `cd apps/runner && dart analyze` 실행 결과: `No issues found!`
|
||||
- `cd services/core && go test ./...` 실행 결과: 모든 테스트 패키지 캐시 또는 성공 (embedded copy와 asset drift 검증 테스트 포함)
|
||||
|
||||
### 구현 체크리스트
|
||||
|
||||
- [x] Unix bootstrap이 설치된 `oto` binary 실행 경로를 확인하고 버전 또는 동등한 health command를 실행한다.
|
||||
- [x] Windows bootstrap이 설치된 `oto.exe` 실행 경로를 확인하고 버전 또는 동등한 health command를 실행한다.
|
||||
- [x] fake binary fixture가 성공/실패 케이스를 검증하고 실패 출력에 token을 노출하지 않는다.
|
||||
- [x] README 또는 agent-smoke의 binary 확인 기준이 바뀌면 함께 갱신한다. (검토 결과 갱신 대상 없음 확인)
|
||||
- [x] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드 리뷰 전용 섹션
|
||||
|
||||
- [x] `02_unix_bootstrap`와 `03+01_windows_bootstrap` 완료 근거가 있다.
|
||||
- [x] version/health command 실패가 설치 성공으로 처리되지 않는다.
|
||||
- [x] fake binary test가 성공과 실패를 모두 검증한다.
|
||||
- [x] embedded script copy drift가 없다.
|
||||
|
||||
## 완료 판정 메모
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|----|
|
||||
| Verdict | PASS |
|
||||
| Roadmap Completion | `[oto-binary]` only |
|
||||
| Archive ready | true |
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
- 종합 판정: FAIL
|
||||
- 차원별 평가:
|
||||
- Correctness: Fail
|
||||
- Completeness: Fail
|
||||
- Test coverage: Fail
|
||||
- API contract: Fail
|
||||
- Code quality: Pass
|
||||
- Plan deviation: Fail
|
||||
- Verification trust: Fail
|
||||
- 발견된 문제:
|
||||
- Required: `apps/runner/assets/script/shell/oto_agent_bootstrap.sh:127`와 `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1:109`가 설치된 binary에 `--version`을 호출하지만, 현재 runner CLI에는 top-level `--version` 계약이 없다. `apps/runner/lib/cli/commands/command_manager.dart:56`의 unknown-command 경로는 help/error를 출력하고도 실패 exit code를 설정하지 않아 `cd apps/runner && dart run bin/main.dart --version`이 `The "--version" command does not exist.`를 출력하면서 `exit_code=0`으로 끝난다. 그래서 bootstrap 검증은 실제 버전/health 확인 없이 통과할 수 있다. 실제 `oto --version` 계약을 구현하고 unknown-command 실패 exit code를 보강하거나, 스크립트를 이미 존재하는 deterministic health command로 바꾼 뒤 해당 명령을 실제 runner entrypoint로 실행하는 회귀 테스트를 추가해야 한다. Core embedded copy는 byte-identical이므로 같은 수정이 `services/core/internal/httpserver/oto_agent_bootstrap.sh`와 `services/core/internal/httpserver/oto_agent_bootstrap.ps1`에도 반영되어야 한다.
|
||||
- 다음 단계:
|
||||
- FAIL: active plan/review를 archive하고 위 Required 이슈만 다루는 후속 PLAN/CODE_REVIEW를 생성한다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||
- [x] active `CODE_REVIEW-local-G06.md`를 `code_review_local_G06_0.log`로 아카이브한다.
|
||||
- [x] active `PLAN-local-G06.md`를 `plan_local_G06_0.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
|
||||
- [ ] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
|
||||
- [ ] PASS이면 active task 디렉터리 `agent-task/m-cross-os-runner-bootstrap/04+02,03_binary_contract/`를 `agent-task/archive/YYYY/MM/m-cross-os-runner-bootstrap/04+02,03_binary_contract/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
|
||||
- [ ] PASS이고 task group이 `m-cross-os-runner-bootstrap`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||
- [ ] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-cross-os-runner-bootstrap/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
|
||||
- [x] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-local-G07.md`와 `CODE_REVIEW-local-G07.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||
- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다.
|
||||
- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다.
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
<!-- task=m-cross-os-runner-bootstrap/04+02,03_binary_contract plan=1 tag=REVIEW_BINARY -->
|
||||
|
||||
# Code Review Reference - REVIEW_BINARY
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
|
||||
> The task is NOT complete until every implementation-owned section below is filled in.
|
||||
> Complete the `구현 체크리스트`; the final checklist item is mandatory before saving.
|
||||
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
|
||||
> If implementation is blocked by a user-only decision, user-owned external environment prerequisite, or scope conflict, fill `사용자 리뷰 요청` with evidence and stop with active files in place; code-review decides whether to write `USER_REVIEW.md`. Evidence gaps that a follow-up agent can close by rerunning commands or collecting artifacts are normal follow-up issues, not user-review blockers by themselves.
|
||||
> Do not ask the user directly, present choices in chat, or call `request_user_input` during implementation; record the needed decision in `사용자 리뷰 요청` and stop for code-review.
|
||||
> Finalization (`코드리뷰 결과`, log rename, `complete.log`, archive moves, `코드리뷰 전용 체크리스트`) is review-agent-only, even after compaction/resume.
|
||||
> Follow the ownership table at the bottom of this file for which sections you own.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-16
|
||||
task=m-cross-os-runner-bootstrap/04+02,03_binary_contract, plan=1, tag=REVIEW_BINARY
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md`
|
||||
- Epic: `[bootstrap-platforms] Cross-OS bootstrap contract`
|
||||
- Task id: `[oto-binary]`
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 이 파일을 읽는 리뷰 에이전트에게
|
||||
|
||||
> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.
|
||||
|
||||
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
||||
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.
|
||||
|
||||
1. 판정을 append한다.
|
||||
2. `CODE_REVIEW-local-G07.md` -> `code_review_local_G07_N.log`, `PLAN-local-G07.md` -> `plan_local_G07_N.log`로 아카이브한다.
|
||||
3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 `agent-task/archive/YYYY/MM/m-cross-os-runner-bootstrap/04+02,03_binary_contract/`로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다.
|
||||
4. PASS이고 task group이 `m-cross-os-runner-bootstrap`이면 완료 이벤트 메타데이터를 보고한다. roadmap 상태 체크와 `update-roadmap` 호출은 런타임 책임이다.
|
||||
5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.
|
||||
|
||||
---
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [REVIEW_BINARY-1] bootstrap binary 검증 명령을 실제 CLI 계약과 연결 | [x] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [x] 실제 runner entrypoint가 bootstrap에서 호출하는 version 또는 health command를 성공 exit code와 식별 가능한 정상 출력으로 제공한다.
|
||||
- [x] unknown top-level command가 실패 exit code를 반환하거나, bootstrap 검증이 unknown-command help/error 출력을 성공으로 오인하지 않게 한다.
|
||||
- [x] Unix/Windows bootstrap script와 Core embedded copy가 같은 검증 command를 사용하고 실패 시 설치를 중단한다.
|
||||
- [x] regression test가 실제 runner entrypoint로 선택한 검증 command를 실행해 정상 출력과 exit code를 확인하고, unknown-command 출력이 검증 성공으로 처리되지 않음을 고정한다.
|
||||
- [x] `CODE_REVIEW-local-G07.md`의 `검증 결과`에 필수 검증 명령의 실제 stdout/stderr를 붙인다.
|
||||
- [x] `CODE_REVIEW-local-G07.md`의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
|
||||
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
|
||||
|
||||
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||
- [x] active `CODE_REVIEW-local-G07.md`를 `code_review_local_G07_1.log`로 아카이브한다.
|
||||
- [x] active `PLAN-local-G07.md`를 `plan_local_G07_1.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
|
||||
- [x] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
|
||||
- [x] PASS이면 active task 디렉터리 `agent-task/m-cross-os-runner-bootstrap/04+02,03_binary_contract/`를 `agent-task/archive/2026/06/m-cross-os-runner-bootstrap/04+02,03_binary_contract/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
|
||||
- [x] PASS이고 task group이 `m-cross-os-runner-bootstrap`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||
- [x] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-cross-os-runner-bootstrap/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
|
||||
- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-{build_lane}-GNN.md`와 `CODE_REVIEW-{review_lane}-GNN.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||
- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다.
|
||||
- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
- 없음. 계획된 binary 검증 강화를 위해 CLI 에러 처리 및 version 커맨드를 구현했습니다.
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
- **Subcommand 구조 유지**: `--version`을 CommandBase를 오케스트레이션하는 CLI 구조상 새로운 Command인 `CommandVersion`으로 설계하여 clean architecture를 유지했습니다.
|
||||
- **Arguments Normalization**: `-v` 입력을 `--version`으로 cli.dart 단에서 정규화하여 사용자의 편의를 높이고 동일한 CommandVersion 실행 흐름으로 매핑했습니다.
|
||||
- **Unknown Command 에러 동기화**: `printHelp`를 비동기 Future로 수정하여 unknown command일 때 help 출력이 완료된 후 `exit(1)` 프로세스 종료가 이루어지도록 보장했습니다.
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- `dart run bin/main.dart --version` 또는 구현자가 선택한 health command가 더 이상 unknown-command help/error로 통과하지 않는지 확인한다.
|
||||
- bootstrap script가 단순 exit code만 믿어 거짓 양성을 만들지 않는지 확인한다.
|
||||
- runner asset과 Core embedded shell/PS1 copy가 byte-identical인지 확인한다.
|
||||
- 검증 출력에 enrollment token 또는 private release host 원문이 노출되지 않는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._
|
||||
|
||||
필수 규칙:
|
||||
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
|
||||
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
|
||||
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.
|
||||
- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다.
|
||||
- mobile/UI hang, timeout, 또는 2분 무진행은 blind retry를 중단하고 focused rerun 명령과 screenshot/window/UI-tree evidence path를 남기며, 불가능하면 정확한 사유를 남긴다.
|
||||
|
||||
### REVIEW_BINARY-1 중간 검증
|
||||
|
||||
```text
|
||||
$ cd apps/runner && dart run bin/main.dart --version
|
||||
Execute command: --version
|
||||
|
||||
|
||||
oto version 1.0.0
|
||||
|
||||
$ cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart
|
||||
00:06 +33: All tests passed!
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
|
||||
```text
|
||||
$ git diff --check
|
||||
(성공적으로 통과 - 출력 없음)
|
||||
|
||||
$ cd apps/runner && dart analyze
|
||||
Analyzing runner...
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart
|
||||
00:06 +33: All tests passed!
|
||||
|
||||
$ cd apps/runner && dart run bin/main.dart --version
|
||||
Execute command: --version
|
||||
|
||||
|
||||
oto version 1.0.0
|
||||
|
||||
$ cd services/core && go test -count=1 ./...
|
||||
? github.com/toki/oto/services/core/cmd/oto-core [no test files]
|
||||
ok github.com/toki/oto/services/core/internal/cicdstate (cached)
|
||||
ok github.com/toki/oto/services/core/internal/httpserver 0.123s
|
||||
ok github.com/toki/oto/services/core/internal/runnerregistry (cached)
|
||||
? github.com/toki/oto/services/core/oto [no test files]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section: completion table, implementation checklist, changes from plan, design decisions, and verification output?**
|
||||
> If anything is blank, go back and fill it in before saving this file.
|
||||
> Leave review-agent-only sections unchanged.
|
||||
|
||||
## Ownership
|
||||
|
||||
| 섹션 | 소유자 | 설명 |
|
||||
|------|--------|------|
|
||||
| 헤더 주석, 개요(date/task/plan/tag), 리뷰 에이전트 지시 | 스텁 생성 시 고정 | 구현 에이전트가 수정하거나 실행하지 않음 |
|
||||
| Roadmap Targets | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 수정하지 않음; PASS 시 code-review가 `complete.log`의 `Roadmap Completion`으로 복사 |
|
||||
| 구현 항목별 완료 여부 (항목명) | 스텁 생성 시 고정 | `[ ]` -> `[x]` 체크만 구현 에이전트가 수행 |
|
||||
| 구현 체크리스트 (항목 텍스트/순서) | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 `[ ]` -> `[x]` 체크만 수행; 마지막 체크박스는 저장 전 필수 |
|
||||
| 코드리뷰 전용 체크리스트 | Review agent only | Implementing agent must not modify or check this section |
|
||||
| 계획 대비 변경 사항, 주요 설계 결정 | 구현 에이전트가 채움 | placeholder 텍스트를 실제 내용으로 교체 |
|
||||
| 사용자 리뷰 요청 | 구현 에이전트가 채움 | 진행에 사용자 입력이 필요하지 않으면 `상태: 없음` 유지; 구현 중 직접 질문은 금지; 필요하면 결정 항목, 근거, 명령 출력, 자동 후속 불가 이유, 재개 조건을 기록 |
|
||||
| 리뷰어를 위한 체크포인트 | 스텁 생성 시 고정 | 계획에서 추출한 리뷰 포인트 |
|
||||
| 검증 결과 (섹션 제목 + 명령) | 스텁 생성 시 고정 | 실행 출력만 구현 에이전트가 채움; 명령 변경은 `계획 대비 변경 사항`에 기록 |
|
||||
| 코드리뷰 결과 | 리뷰 에이전트가 append | 스텁에 포함하지 않음 |
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
- 종합 판정: PASS
|
||||
- 차원별 평가:
|
||||
- Correctness: Pass
|
||||
- Completeness: Pass
|
||||
- Test coverage: Pass
|
||||
- API contract: Pass
|
||||
- Code quality: Pass
|
||||
- Plan deviation: Pass
|
||||
- Verification trust: Pass
|
||||
- 발견된 문제: 없음
|
||||
- 다음 단계:
|
||||
- PASS: active plan/review를 archive하고 `complete.log` 작성 후 task 디렉터리를 archive로 이동한다.
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
# Complete - m-cross-os-runner-bootstrap/04+02,03_binary_contract
|
||||
|
||||
## 완료 일시
|
||||
|
||||
2026-06-16
|
||||
|
||||
## 요약
|
||||
|
||||
bootstrap 설치 binary 확인 계약을 2회 리뷰 루프로 완료했다. 최종 판정은 PASS.
|
||||
|
||||
## 루프 이력
|
||||
|
||||
| Plan | Review | Verdict | 메모 |
|
||||
|------|--------|---------|------|
|
||||
| `plan_local_G06_0.log` | `code_review_local_G06_0.log` | FAIL | bootstrap이 `--version`을 호출했지만 runner CLI가 해당 계약을 제공하지 않고 unknown command가 exit 0으로 끝나 follow-up 필요 |
|
||||
| `plan_local_G07_1.log` | `code_review_local_G07_1.log` | PASS | `--version` CLI 계약과 unknown-command non-zero 회귀를 보강하고 OS별 bootstrap binary 검증을 통과 |
|
||||
|
||||
## 구현/정리 내용
|
||||
|
||||
- Unix/Windows bootstrap script가 설치된 `oto`/`oto.exe`에 `--version`을 실행해 binary 검증에 실패하면 설치를 중단하도록 했다.
|
||||
- runner CLI에 `--version`/`-v` 경로를 추가하고, unknown top-level command가 non-zero exit code로 종료되도록 보강했다.
|
||||
- fake binary 성공/실패 fixture, actual CLI version/unknown-command regression, Core embedded bootstrap drift 검증을 확인했다.
|
||||
|
||||
## 최종 검증
|
||||
|
||||
- `git diff --check` - PASS; 출력 없음.
|
||||
- `cd apps/runner && dart analyze` - PASS; `No issues found!`
|
||||
- `cd apps/runner && dart run bin/main.dart --version` - PASS; `oto version 1.0.0`, `exit_code=0`
|
||||
- `cd apps/runner && dart run bin/main.dart -v` - PASS; `oto version 1.0.0`, `exit_code=0`
|
||||
- `cd apps/runner && dart run bin/main.dart nonexistent-command-999` - PASS; `command does not exist`, `exit_code=1`
|
||||
- `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart` - PASS; `+33: All tests passed!`
|
||||
- `cd apps/runner && dart test test/oto_cli_runtime_test.dart` - PASS; `+7: All tests passed!`
|
||||
- `cd apps/runner && dart test test/oto_agent_migration_plan_test.dart test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart test/oto_agent_cli_test.dart test/oto_agent_config_test.dart test/oto_agent_registration_test.dart test/oto_server_connection_smoke_test.dart` - PASS; `+101: All tests passed!`
|
||||
- `cd services/core && go test -count=1 ./...` - PASS; core packages passed, `cmd/oto-core` and generated `oto` package had no test files.
|
||||
- `cmp -s apps/runner/assets/script/shell/oto_agent_bootstrap.sh services/core/internal/httpserver/oto_agent_bootstrap.sh` - PASS; `shell_cmp_exit=0`
|
||||
- `cmp -s apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1 services/core/internal/httpserver/oto_agent_bootstrap.ps1` - PASS; `ps1_cmp_exit=0`
|
||||
|
||||
## Roadmap Completion
|
||||
|
||||
- Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md`
|
||||
- Completed task ids:
|
||||
- `[oto-binary]`: PASS; evidence=`plan_local_G07_1.log`, `code_review_local_G07_1.log`; verification=`cd apps/runner && dart analyze`, `cd apps/runner && dart run bin/main.dart --version`, `cd apps/runner && dart run bin/main.dart nonexistent-command-999`, `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart`, `cd apps/runner && dart test test/oto_cli_runtime_test.dart`, `cd services/core && go test -count=1 ./...`
|
||||
- Not completed task ids: 없음
|
||||
|
||||
## 잔여 Nit
|
||||
|
||||
- 없음
|
||||
|
||||
## 후속 작업
|
||||
|
||||
- 없음
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<!-- task=m-cross-os-runner-bootstrap/04+02,03_binary_contract plan=1 tag=REVIEW_BINARY -->
|
||||
|
||||
# PLAN: bootstrap binary 검증 명령 실계약 보강
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
이 계획은 직전 코드리뷰 `code_review_local_G06_0.log`의 Required 이슈만 해결한다. 사용자에게 직접 질문하지 말고, 사용자 결정이 필요한 경우 `CODE_REVIEW-local-G07.md`의 `사용자 리뷰 요청` 섹션을 채운 뒤 멈춘다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md`
|
||||
- Epic: `[bootstrap-platforms] Cross-OS bootstrap contract`
|
||||
- Task id: `[oto-binary]`
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 배경
|
||||
|
||||
Unix/Windows bootstrap은 설치된 binary에 `--version`을 실행해 binary 확인 계약을 고정하려 했지만, 현재 runner CLI는 top-level `--version`을 실제 계약으로 제공하지 않는다. 더 큰 문제는 unknown command 경로가 실패 exit code를 반환하지 않아, bootstrap의 exit-code-only 검증이 help/error 출력만 보고도 성공으로 처리될 수 있다는 점이다.
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-task/m-cross-os-runner-bootstrap/04+02,03_binary_contract/code_review_local_G06_0.log`
|
||||
- `apps/runner/assets/script/shell/oto_agent_bootstrap.sh`
|
||||
- `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1`
|
||||
- `services/core/internal/httpserver/oto_agent_bootstrap.sh`
|
||||
- `services/core/internal/httpserver/oto_agent_bootstrap.ps1`
|
||||
- `apps/runner/lib/cli/cli.dart`
|
||||
- `apps/runner/lib/cli/commands/command_manager.dart`
|
||||
- `apps/runner/bin/main.dart`
|
||||
- `apps/runner/test/oto_agent_bootstrap_script_test.dart`
|
||||
- `apps/runner/test/oto_agent_bootstrap_ps1_test.dart`
|
||||
- `services/core/internal/httpserver/server_test.go`
|
||||
|
||||
### 재현 근거
|
||||
|
||||
`cd apps/runner && dart run bin/main.dart --version` 실행 시 `The "--version" command does not exist.`가 출력되지만 `exit_code=0`으로 종료한다. 따라서 현재 bootstrap script의 `"$install_dir/oto" --version` 성공 판정은 실제 version/health 계약을 검증하지 못한다.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
release asset 생성, bootstrap command API, runner registration 동작은 변경하지 않는다. 설치 binary 검증 명령과 그 명령을 검증하는 regression test만 보강한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
`local-G07`: CLI entrypoint와 OS별 bootstrap script가 함께 걸린 correctness follow-up이지만, 결함은 명확하고 deterministic command/test로 검증 가능하다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] 실제 runner entrypoint가 bootstrap에서 호출하는 version 또는 health command를 성공 exit code와 식별 가능한 정상 출력으로 제공한다.
|
||||
- [ ] unknown top-level command가 실패 exit code를 반환하거나, bootstrap 검증이 unknown-command help/error 출력을 성공으로 오인하지 않게 한다.
|
||||
- [ ] Unix/Windows bootstrap script와 Core embedded copy가 같은 검증 command를 사용하고 실패 시 설치를 중단한다.
|
||||
- [ ] regression test가 실제 runner entrypoint로 선택한 검증 command를 실행해 정상 출력과 exit code를 확인하고, unknown-command 출력이 검증 성공으로 처리되지 않음을 고정한다.
|
||||
- [ ] `CODE_REVIEW-local-G07.md`의 `검증 결과`에 필수 검증 명령의 실제 stdout/stderr를 붙인다.
|
||||
- [ ] `CODE_REVIEW-local-G07.md`의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다.
|
||||
|
||||
### [REVIEW_BINARY-1] bootstrap binary 검증 명령을 실제 CLI 계약과 연결
|
||||
|
||||
문제: bootstrap script가 `--version`을 binary 확인 명령으로 호출하지만, runner CLI는 현재 해당 top-level 명령을 지원하지 않는다. 또한 unknown-command 경로가 exit code 0으로 끝나므로 검증이 거짓 양성으로 통과할 수 있다.
|
||||
|
||||
해결 방법:
|
||||
|
||||
- 선호안: runner CLI에 top-level `--version` 또는 동등한 version/health 계약을 추가하고, 정상 출력 형식을 테스트로 고정한다.
|
||||
- 함께 보강: unknown top-level command가 실패 exit code를 반환하거나, bootstrap script가 version/health 정상 출력까지 확인해 help/error 출력을 성공으로 처리하지 않게 한다.
|
||||
- OS별 bootstrap script와 `services/core/internal/httpserver/` embedded copy를 byte-identical 상태로 유지한다.
|
||||
|
||||
수정 후보 파일:
|
||||
|
||||
- `apps/runner/lib/cli/cli.dart`
|
||||
- `apps/runner/lib/cli/commands/command_manager.dart`
|
||||
- `apps/runner/bin/main.dart`
|
||||
- `apps/runner/assets/script/shell/oto_agent_bootstrap.sh`
|
||||
- `apps/runner/assets/script/powershell/oto_agent_bootstrap.ps1`
|
||||
- `services/core/internal/httpserver/oto_agent_bootstrap.sh`
|
||||
- `services/core/internal/httpserver/oto_agent_bootstrap.ps1`
|
||||
- `apps/runner/test/oto_agent_bootstrap_script_test.dart`
|
||||
- `apps/runner/test/oto_agent_bootstrap_ps1_test.dart`
|
||||
- CLI regression test file if an existing suitable file is available
|
||||
|
||||
테스트 작성:
|
||||
|
||||
- 실제 runner entrypoint를 실행해 선택한 version/health command가 exit code 0과 정상 출력을 반환하는지 검증한다.
|
||||
- 존재하지 않는 top-level command가 bootstrap 검증 성공 조건으로 오인되지 않도록 exit code 또는 출력 검증을 고정한다.
|
||||
- Unix fake binary fixture는 version/health 성공과 실패를 계속 검증한다.
|
||||
- PowerShell fixture는 선택한 command, exit code 확인, 실패 메시지, token 미노출 조건을 고정한다.
|
||||
|
||||
중간 검증:
|
||||
|
||||
- `cd apps/runner && dart run bin/main.dart --version`
|
||||
- `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart`
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- `dart run bin/main.dart --version` 또는 구현자가 선택한 health command가 더 이상 unknown-command help/error로 통과하지 않는지 확인한다.
|
||||
- bootstrap script가 단순 exit code만 믿어 거짓 양성을 만들지 않는지 확인한다.
|
||||
- runner asset과 Core embedded shell/PS1 copy가 byte-identical인지 확인한다.
|
||||
- 검증 출력에 enrollment token 또는 private release host 원문이 노출되지 않는지 확인한다.
|
||||
|
||||
## 최종 검증
|
||||
|
||||
- `git diff --check`
|
||||
- `cd apps/runner && dart analyze`
|
||||
- `cd apps/runner && dart test test/oto_agent_bootstrap_script_test.dart test/oto_agent_bootstrap_ps1_test.dart`
|
||||
- `cd apps/runner && dart run bin/main.dart --version`
|
||||
- `cd services/core && go test -count=1 ./...`
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-local-G07.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<!-- task=m-cross-os-runner-bootstrap/04+02,03_binary_contract plan=0 tag=BINARY -->
|
||||
|
||||
# CODE REVIEW: bootstrap 설치 binary 확인 계약
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/control-plane-product-surface/milestones/cross-os-runner-bootstrap.md`
|
||||
- Epic: `[bootstrap-platforms] Cross-OS bootstrap contract`
|
||||
- Task id: `[oto-binary]`
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 구현 에이전트 소유 섹션
|
||||
|
||||
### 계획 대비 변경 사항
|
||||
|
||||
- 미작성
|
||||
|
||||
### 수정 파일
|
||||
|
||||
- 미작성
|
||||
|
||||
### 검증 결과
|
||||
|
||||
- 미작성
|
||||
|
||||
### 구현 체크리스트
|
||||
|
||||
- [ ] Unix bootstrap이 설치된 `oto` binary 실행 경로를 확인하고 버전 또는 동등한 health command를 실행한다.
|
||||
- [ ] Windows bootstrap이 설치된 `oto.exe` 실행 경로를 확인하고 버전 또는 동등한 health command를 실행한다.
|
||||
- [ ] fake binary fixture가 성공/실패 케이스를 검증하고 실패 출력에 token을 노출하지 않는다.
|
||||
- [ ] README 또는 agent-smoke의 binary 확인 기준이 바뀌면 함께 갱신한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드 리뷰 전용 섹션
|
||||
|
||||
- [ ] `02_unix_bootstrap`와 `03+01_windows_bootstrap` 완료 근거가 있다.
|
||||
- [ ] version/health command 실패가 설치 성공으로 처리되지 않는다.
|
||||
- [ ] fake binary test가 성공과 실패를 모두 검증한다.
|
||||
- [ ] embedded script copy drift가 없다.
|
||||
|
||||
## 완료 판정 메모
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|----|
|
||||
| Verdict | 미작성 |
|
||||
| Roadmap Completion | `[oto-binary]` only |
|
||||
| Archive ready | 미작성 |
|
||||
|
|
@ -104,6 +104,18 @@ runtime:
|
|||
|
||||
$otoBin = Join-Path $installDir 'oto.exe'
|
||||
|
||||
Write-Host 'Verifying OTO binary...'
|
||||
try {
|
||||
$versionProc = Start-Process -FilePath $otoBin -ArgumentList '--version' -NoNewWindow -Wait -PassThru
|
||||
if ($versionProc.ExitCode -ne 0) {
|
||||
Write-Error 'Error: OTO binary verification failed.'
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
Write-Error 'Error: OTO binary verification failed.'
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($background) {
|
||||
Write-Host 'Starting OTO agent in the background...'
|
||||
$outLog = Join-Path $logDir 'oto-agent.out.log'
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ mkdir -p "$install_dir"
|
|||
cp "$tmp_dir/oto" "$install_dir/oto"
|
||||
chmod +x "$install_dir/oto"
|
||||
|
||||
echo "Verifying OTO binary..."
|
||||
if ! "$install_dir/oto" --version > /dev/null 2>&1; then
|
||||
echo "Error: OTO binary verification failed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_dir=$(dirname "$config_path")
|
||||
agent_state_dir="${HOME}/.oto/agent"
|
||||
pid_path="${agent_state_dir}/oto-agent.pid"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import 'package:oto/cli/commands/command_exe.dart';
|
|||
import 'package:oto/cli/commands/command_catalog.dart';
|
||||
import 'package:oto/cli/commands/command_validate.dart';
|
||||
import 'package:oto/cli/commands/command_agent.dart';
|
||||
import 'package:oto/cli/commands/command_version.dart';
|
||||
|
||||
void main(List<String> arguments) async {
|
||||
Application('oto', 'com.toki-labs.oto', () {
|
||||
|
|
@ -19,6 +20,7 @@ void main(List<String> arguments) async {
|
|||
CommandCatalogCli(),
|
||||
CommandValidateCli(),
|
||||
CommandAgent(),
|
||||
CommandVersion(),
|
||||
]);
|
||||
}, (error, stack) {
|
||||
print(error);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,11 @@ class CLI {
|
|||
|
||||
args.removeAt(0);
|
||||
}
|
||||
|
||||
if (command == '-v') {
|
||||
command = '--version';
|
||||
}
|
||||
|
||||
await _commandManager.execute(command, args);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ class CommandManager {
|
|||
|
||||
Future execute(String? command, List<String> parameters) async {
|
||||
if (command == null) {
|
||||
printHelp();
|
||||
await printHelp();
|
||||
} else {
|
||||
if (commandMap.containsKey(command)) {
|
||||
var argStr = '';
|
||||
|
|
@ -54,15 +55,16 @@ class CommandManager {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
printHelp(append: [
|
||||
await printHelp(append: [
|
||||
'${CLI.style('Error:', background: Color.red)} The ${CLI.style('"$command"', color: Color.red, style: Style.bold)} command does not exist.'
|
||||
]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
void printHelp({List<String>? append}) {
|
||||
Future printHelp({List<String>? append}) async {
|
||||
var serviceName = CLI.current.config.serviceName;
|
||||
var exeName = CLI.executableFileName;
|
||||
final commandTag = '{COMMAND}';
|
||||
|
|
@ -97,6 +99,6 @@ class CommandManager {
|
|||
list.insertAll(0, append);
|
||||
list.insert(0, '');
|
||||
}
|
||||
CLI.print(list);
|
||||
await CLI.print(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
apps/runner/lib/cli/commands/command_version.dart
Normal file
30
apps/runner/lib/cli/commands/command_version.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto/cli/cli.dart';
|
||||
import 'package:oto/cli/commands/command_base.dart';
|
||||
|
||||
class CommandVersion extends CommandBase {
|
||||
@override
|
||||
Map<String, List<String>> get arguments => {};
|
||||
|
||||
@override
|
||||
String get name => '--version';
|
||||
|
||||
@override
|
||||
String get usage => '';
|
||||
|
||||
@override
|
||||
bool shouldExecuteWithoutParameters() => true;
|
||||
|
||||
@override
|
||||
Future execute(List<String> parameters) async {
|
||||
await CLI.println('oto version 1.0.0');
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
@override
|
||||
String getDescription() {
|
||||
return 'Print OTO runner version.';
|
||||
}
|
||||
}
|
||||
|
|
@ -85,6 +85,14 @@ void main() {
|
|||
expect(content, contains('oto-agent.err.log'));
|
||||
});
|
||||
|
||||
test('should contain binary verification before background execution', () {
|
||||
expect(content, contains('Verifying OTO binary...'));
|
||||
expect(content, contains('Start-Process'));
|
||||
expect(content, contains('--version'));
|
||||
expect(content, contains('ExitCode -ne 0'));
|
||||
expect(content, contains('Error: OTO binary verification failed.'));
|
||||
});
|
||||
|
||||
test('should apply ACL hardening to config file after write', () {
|
||||
expect(content, contains('SetAccessRuleProtection'));
|
||||
expect(content, contains('FileSystemAccessRule'));
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ Future<_BootstrapRunResult> _runBootstrapWithFakeUname(
|
|||
required String unameM,
|
||||
bool provideTarGz = true,
|
||||
String token = 'test-token-secret',
|
||||
int fakeOtoVersionExitCode = 0,
|
||||
}) async {
|
||||
final tmpDir = await Directory.systemTemp.createTemp('oto_matrix_test_');
|
||||
try {
|
||||
|
|
@ -70,9 +71,13 @@ esac
|
|||
final fakeOtoSrc = Directory('${tmpDir.path}/fake_oto_src');
|
||||
await fakeOtoSrc.create(recursive: true);
|
||||
final fakeOtoBin = File('${fakeOtoSrc.path}/oto');
|
||||
await fakeOtoBin.writeAsString(
|
||||
'#!/bin/sh\nwhile true; do sleep 1; done\n',
|
||||
);
|
||||
await fakeOtoBin.writeAsString('''#!/bin/sh
|
||||
if [ "\$1" = "--version" ]; then
|
||||
echo "fake-oto-version"
|
||||
exit $fakeOtoVersionExitCode
|
||||
fi
|
||||
while true; do sleep 1; done
|
||||
''');
|
||||
await Process.run('chmod', ['+x', fakeOtoBin.path]);
|
||||
final tarGz = File('${tmpDir.path}/fake.tar.gz');
|
||||
await Process.run('tar', [
|
||||
|
|
@ -242,6 +247,12 @@ void main() {
|
|||
expect(content, contains('nohup'));
|
||||
expect(content, contains('oto-agent.pid'));
|
||||
});
|
||||
|
||||
test('should contain binary verification step', () {
|
||||
expect(content, contains('Verifying OTO binary...'));
|
||||
expect(content, contains('--version'));
|
||||
expect(content, contains('Error: OTO binary verification failed.'));
|
||||
});
|
||||
});
|
||||
|
||||
group('Bootstrap Script OS/Arch Matrix Tests', () {
|
||||
|
|
@ -330,6 +341,22 @@ void main() {
|
|||
expect(r.stderr, isNot(contains(token)));
|
||||
},
|
||||
);
|
||||
|
||||
test('fails when OTO binary verification fails', () async {
|
||||
const token = 'secret-verification-token-999';
|
||||
final r = await _runBootstrapWithFakeUname(
|
||||
scriptFile,
|
||||
unameS: 'Linux',
|
||||
unameM: 'x86_64',
|
||||
provideTarGz: true,
|
||||
token: token,
|
||||
fakeOtoVersionExitCode: 1,
|
||||
);
|
||||
expect(r.exitCode, isNot(0));
|
||||
expect(r.stderr, contains('Error: OTO binary verification failed.'));
|
||||
expect(r.stdout, isNot(contains(token)));
|
||||
expect(r.stderr, isNot(contains(token)));
|
||||
});
|
||||
});
|
||||
|
||||
group('Linux Bootstrap Script Functional & Regressions Tests', () {
|
||||
|
|
@ -370,9 +397,13 @@ void main() {
|
|||
final fakeOtoSource = Directory('${tempDir.path}/fake_oto_src');
|
||||
await fakeOtoSource.create(recursive: true);
|
||||
final fakeOtoFile = File('${fakeOtoSource.path}/oto');
|
||||
await fakeOtoFile.writeAsString(
|
||||
'#!/bin/sh\nwhile true; do sleep 1; done\n',
|
||||
);
|
||||
await fakeOtoFile.writeAsString('''#!/bin/sh
|
||||
if [ "\$1" = "--version" ]; then
|
||||
echo "fake-oto-version"
|
||||
exit 0
|
||||
fi
|
||||
while true; do sleep 1; done
|
||||
''');
|
||||
await Process.run('chmod', ['+x', fakeOtoFile.path]);
|
||||
|
||||
// 2. 가짜 tar.gz 아카이브 생성
|
||||
|
|
@ -479,9 +510,13 @@ fi
|
|||
final fakeOtoSource = Directory('${tempDir.path}/fake_oto_src');
|
||||
await fakeOtoSource.create(recursive: true);
|
||||
final fakeOtoFile = File('${fakeOtoSource.path}/oto');
|
||||
await fakeOtoFile.writeAsString(
|
||||
'#!/bin/sh\nwhile true; do sleep 1; done\n',
|
||||
);
|
||||
await fakeOtoFile.writeAsString('''#!/bin/sh
|
||||
if [ "\$1" = "--version" ]; then
|
||||
echo "fake-oto-version"
|
||||
exit 0
|
||||
fi
|
||||
while true; do sleep 1; done
|
||||
''');
|
||||
await Process.run('chmod', ['+x', fakeOtoFile.path]);
|
||||
|
||||
// 2. 가짜 tar.gz 아카이브 생성
|
||||
|
|
|
|||
|
|
@ -255,4 +255,50 @@ void main() {
|
|||
contains('setx path "some_old_path"'));
|
||||
});
|
||||
});
|
||||
|
||||
group('CLI Version and Unknown Command Tests', () {
|
||||
late String workingDir;
|
||||
|
||||
setUp(() {
|
||||
var current = Directory.current.path;
|
||||
if (current.endsWith('runner')) {
|
||||
workingDir = current;
|
||||
} else {
|
||||
workingDir = path.join(current, 'apps/runner');
|
||||
}
|
||||
});
|
||||
|
||||
test('should return version information with exit code 0 on --version', () async {
|
||||
final result = await Process.run(
|
||||
'dart',
|
||||
['run', 'bin/main.dart', '--version'],
|
||||
workingDirectory: workingDir,
|
||||
);
|
||||
|
||||
expect(result.exitCode, 0);
|
||||
expect(result.stdout.toString(), contains('oto version 1.0.0'));
|
||||
});
|
||||
|
||||
test('should return version information with exit code 0 on -v', () async {
|
||||
final result = await Process.run(
|
||||
'dart',
|
||||
['run', 'bin/main.dart', '-v'],
|
||||
workingDirectory: workingDir,
|
||||
);
|
||||
|
||||
expect(result.exitCode, 0);
|
||||
expect(result.stdout.toString(), contains('oto version 1.0.0'));
|
||||
});
|
||||
|
||||
test('should return non-zero exit code on unknown command', () async {
|
||||
final result = await Process.run(
|
||||
'dart',
|
||||
['run', 'bin/main.dart', 'nonexistent-command-999'],
|
||||
workingDirectory: workingDir,
|
||||
);
|
||||
|
||||
expect(result.exitCode, isNot(0));
|
||||
expect(result.stdout.toString(), contains('command does not exist'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,18 @@ runtime:
|
|||
|
||||
$otoBin = Join-Path $installDir 'oto.exe'
|
||||
|
||||
Write-Host 'Verifying OTO binary...'
|
||||
try {
|
||||
$versionProc = Start-Process -FilePath $otoBin -ArgumentList '--version' -NoNewWindow -Wait -PassThru
|
||||
if ($versionProc.ExitCode -ne 0) {
|
||||
Write-Error 'Error: OTO binary verification failed.'
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
Write-Error 'Error: OTO binary verification failed.'
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($background) {
|
||||
Write-Host 'Starting OTO agent in the background...'
|
||||
$outLog = Join-Path $logDir 'oto-agent.out.log'
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ mkdir -p "$install_dir"
|
|||
cp "$tmp_dir/oto" "$install_dir/oto"
|
||||
chmod +x "$install_dir/oto"
|
||||
|
||||
echo "Verifying OTO binary..."
|
||||
if ! "$install_dir/oto" --version > /dev/null 2>&1; then
|
||||
echo "Error: OTO binary verification failed." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
config_dir=$(dirname "$config_path")
|
||||
agent_state_dir="${HOME}/.oto/agent"
|
||||
pid_path="${agent_state_dir}/oto-agent.pid"
|
||||
|
|
|
|||
Loading…
Reference in a new issue