Skip to content

env3 test 실행 UX 재설계: run_tests auto-attach + 고전 pnpm test:env3 경로 (설계 먼저) #684

Description

@DaveDev42

배경 (실측에서 도출)

env3에서 .ait.test 슈트를 돌리는 현재 플로우가 어색하다. 에이전트가 start_debugstart_attach → (QR 스캔 대기) → evaluate(__AIT_CELL__ 주입) → run_tests일일이 수동 오케스트레이션해야 한다. 두 가지를 원한다:

  1. run_tests auto-attach — 연결이 없을 때 run_tests(및 동급 진입)가 스스로 QR을 띄우고 폰 연결까지 기다린 뒤 테스트를 돌려야 한다. 에이전트가 단계별로 제어하는 게 아니라.
  2. 고전적 npm script 경로 — 테스트 구동이 MCP 전용이면 안 된다. pnpm test:env3 같은 클래식 스크립트로도 실행 가능해야 한다(devtools-test bin이 이미 package.json에 있으나 main()이 stub).

현재 아키텍처 (Explore 매핑 결과)

  • run core는 이미 순수: discoverTestFilesrunWithConnection(cli.ts:71) → runTestFilesOverRelaybundleTestFileinjectAndRunBundle. CdpConnection 인터페이스에만 의존, MCP 결합 없음. 재사용 준비됨.
  • 막힌 곳 1 — attach 오케스트레이션이 클로저에 인라인: createDebugServer 안의 prepareAttach(debug-server.ts:737), mintAttachUrl(:707), renderAndMaybeWait(:971), waitWithRemint(:1011)이 6개 클로저 변수(getTunnelStatus/getTotpSecret/qrHttpServer/onAttachUrlBuilt/stalePageThresholdMs/nowMs)에 의존. 모듈 레벨 waitForAttachWithEvents(debug-server.ts:579)는 이미 순수 재사용 가능.
  • 막힌 곳 2 — CLI main()이 stub: src/test-runner/cli.ts:100main()이 discoverTestFiles만 하고 cli.ts:135-141에서 "standalone relay attach is not wired yet"로 throw. CdpConnection 생성을 안 함.
  • cell 주입 수동: __AIT_CELL__(sdkLine/platform)을 에이전트가 evaluate로 매번 손으로 주입. auto-attach 경로가 생기면 attach 직후 자동 주입돼야 한다.

이 이슈의 산출물 = 설계문서 (구현 전)

meta/ 또는 devtools repo 내 설계 노트로:

  1. attach orchestrator 추출createDebugServer 클로저에서 MCP·CLI 양쪽이 공유할 수 있는 모듈 레벨 orchestrator로 추출하는 경계. 6개 클로저 변수를 명시적 의존성(options 객체)으로 승격하는 방안. waitForAttachWithEvents(이미 순수)와의 관계.
  2. run_tests auto-attach — 연결 없을 때 run_tests가 orchestrator를 호출해 QR 띄우고 대기 → 연결 후 자동으로 cell 주입 + 테스트. 기존 "이미 연결됨" 경로와의 분기.
  3. pnpm test:env3 classic pathdevtools-test bin의 main()이 같은 orchestrator + run core를 써서 standalone relay attach → run. sdk-example의 pnpm test:env3 스크립트 형태(어느 패키지가 owns?).
  4. cell 자동 주입 — sdkLine/platform을 attach 직후 자동 inject하는 지점.

설계 승인 후 구현은 별도 PR(들)로. community 톤. Biome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    roadmapharness roadmap 작업 항목 (Project #1)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions