Skip to content

fix(integration): Poppy-Server 실제 계약에 Client API 연동 정렬 - #45

Merged
exijn merged 1 commit into
mainfrom
fix/42-server-contract-alignment
Sep 17, 2026
Merged

exijn merged 1 commit into
mainfrom
fix/42-server-contract-alignment

Conversation

@exijn

@exijn exijn commented Sep 17, 2026

Copy link
Copy Markdown
Member

Closes #43

배경

Poppy-Client의 기존 Session/Simulation/Execution/SSE API 계층이 Poppy-Server의 확정된 /api/v1 계약과 달라 실제 Server 연동이 불가능한 경로가 남아 있었습니다.

변경 사항

  • Session 생성/복구와 X-Session-Token 전달 정렬
  • immutable Block Revision과 exact blockVersion 흐름 정렬
  • Simulation Pass 기록 후 Execution 요청 정렬
  • Server uppercase status를 명시적인 UI model로 변환
  • session-scoped SSE, 인증 header, executionId 필터, fragmented frame 처리
  • MSW mock을 실제 Server 계약으로 정렬
  • 실제 HTTP Server를 대상으로 하는 opt-in live contract smoke test 추가
  • cross-repository contract matrix 문서 추가

소유권 및 후속 항목

검증

  • Client unit/integration tests
  • npm run typecheck
  • npm run lint
  • npm run format:check
  • npm run build
  • local Poppy-Server live Session → Revision → Simulation Pass → Execution → Status → Restore → SSE smoke
  • local Poppy-Server + Mock Agent Full Mock E2E
  • Server Gradle test/build 및 harness

안전 경계

실제 GO2, SportClient, DDS command publisher, physical movement, physical emergency stop은 사용하지 않았습니다. Physical Readiness는 계속 BLOCKED입니다.

@exijn
exijn requested a review from jjhhss100906 as a code owner September 17, 2026 08:48
@exijn

exijn commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

@inryeok-bot review 최신 head를 기준으로 계약/보안/SSE 회귀를 검토해 주세요.

@exijn
exijn merged commit 58c8523 into main Sep 17, 2026
1 check passed

@inryeok-bot inryeok-bot Bot 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.

리뷰 결과

변경된 27개 파일을 검토했으며, 수정이 필요한 문제 3개를 발견했습니다.

심각도 개수
Critical 0
High 2
Medium 1
Low 0

주요 내용

  • HIGH · BEHAVIOR — 기본 프로그램의 GREET 블록 때문에 정상 실행 흐름이 막힙니다
  • HIGH · DATA_INTEGRITY — 기존 버전이 있으면 최신 편집 내용을 저장하지 않고 시뮬레이션합니다
  • MEDIUM · ERROR_HANDLING — localStorage를 사용할 수 없으면 생성된 세션도 즉시 사용할 수 없습니다

파일·PR 단위 검토

HIGH · BEHAVIOR

PR 전체 · 기본 프로그램의 GREET 블록 때문에 정상 실행 흐름이 막힙니다

새 변환기는 greet를 무조건 예외로 거부하지만, 기존 INITIAL_PROGRAM에는 greet-0이 포함되어 있고 팔레트에서도 GREET를 계속 추가할 수 있습니다. 사용자가 기본 화면에서 종료 블록만 연결하는 정상 흐름을 따라도 자동 저장이 실패하여 offline으로 표시되고, projectVersion이 0에 머물러 Simulation Pass와 실행 단계로 진행할 수 없습니다.

서버가 GREET를 지원하지 않는 동안에는 기본 프로그램과 팔레트에서 제거하거나, 저장/시뮬레이션 전에 사용자에게 명확한 unsupported-block 검증 오류를 제공해야 합니다.

발생 조건: 기본 프로그램의 종료 블록을 연결하거나 사용자가 팔레트의 GREET 블록을 포함한 프로그램을 저장·시뮬레이션할 때 발생합니다.

영향: 대표적인 기본 사용자 여정이 서버 저장 단계에서 실패하고 로봇 실행까지 진행할 수 없으며, 실제 원인 대신 오프라인 상태로 잘못 안내됩니다.

근거: `toServerBlockProgram()`은 `greet`에서 예외를 던집니다. 반면 `src/views/experience/model/blockProgram.ts`의 `INITIAL_PROGRAM`에는 `greet-0`이 있고 `BlockKind`와 팔레트도 `greet`를 계속 지원합니다. `useAutoSaveProject`는 이 일반 예외를 `offline`으로 분류합니다.

수정 방향: 서버 지원 블록과 UI capability를 동시에 맞추십시오. GREET를 UI에서 제거하거나 비활성화하고 기존 draft를 안내와 함께 마이그레이션하는 방법, 또는 서버 계약에 맞는 정식 GREET 표현을 추가하는 방법이 필요합니다.

검토한 head: fc0f711deaac

if (simulation.isPending || !blockValid) return;
simulation.mutate({ program: serializeProgram(program) });
let currentVersion = projectVersion;
if (session.data && currentVersion === 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH · DATA_INTEGRITY

기존 버전이 있으면 최신 편집 내용을 저장하지 않고 시뮬레이션합니다

runSimulation()은 projectVersion === 0일 때만 현재 프로그램을 저장하고 flushSave()를 기다립니다. 이미 서버 버전이 있는 상태에서 블록을 편집한 직후 600ms 자동 저장 전에 시뮬레이션하면, 로컬에서는 새 프로그램을 검사하지만 Simulation Pass는 이전 blockVersion에 기록됩니다. 그 사이 실행 버튼을 누르면 화면에서 검사한 프로그램이 아니라 서버의 이전 revision이 실행될 수 있습니다.

시뮬레이션을 시작할 때마다 현재 스냅샷을 저장 큐에 넣고 해당 저장이 완료된 버전을 받아 그 버전에만 pass를 기록해야 합니다.


export function writeSessionCredentials(credentials: StoredSessionCredentials): void {
try {
storage()?.setItem(STORAGE_KEY, JSON.stringify(credentials));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 MEDIUM · ERROR_HANDLING

localStorage를 사용할 수 없으면 생성된 세션도 즉시 사용할 수 없습니다

writeSessionCredentials()는 저장 실패를 무시하지만 별도의 메모리 보관소가 없습니다. 이후 모든 인증 API는 sessionAuthHeaders()에서 다시 localStorage만 읽으므로, 세션 생성 응답에 유효한 토큰이 있어도 곧바로 An active session credential is required가 발생합니다. 주석에 적힌 것과 달리 저장소 실패가 API 흐름을 중단합니다.

현재 탭에서 사용할 메모리 credential을 유지하고 localStorage는 영속화 수단으로만 사용하거나, 세션 상태의 토큰을 인증 호출에 명시적으로 전달해야 합니다.

jjhhss100906 added a commit that referenced this pull request Sep 17, 2026
팀원 파트(#32 블록 삭제, #45 서버 계약 정렬)가 main에 먼저 들어와 있어
#28을 그 위로 리베이스했다. 그 과정에서 필요했던 보정:

- toServerBlockProgram 의 블록 종류 switch 가 새 블록 10종을 몰라 컴파일이
  깨졌다. greet 과 같은 방식으로 "서버 계약이 아직 지원하지 않는 블록"
  오류를 던지도록 명시적으로 채워 넣었다(실제 서버 계약이 확정되기 전까지는
  이 블록들을 쓴 프로젝트는 로컬 초안으로만 남는다 — greet 도 이미 같은
  상태).
- 팔레트 카테고리 전환으로 '종료'가 '흐름' 목록이 아니라 '시작' 탭 안으로
  옮겨져, 기존 통합 테스트(blockDnd.test.tsx)가 '시작' 탭을 먼저 클릭하지
  않고 종료 팔레트 버튼을 찾다가 실패했다 — 탭 전환을 테스트에 추가했다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
wook10 added a commit that referenced this pull request Sep 17, 2026
…credentials

fix: PR #45 코드리뷰 3건 반영 (greet 제거·시뮬레이션 버전·credential 폴백)
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.

fix(integration): Poppy-Server 실제 Session/Execution 계약에 Client API 연동 정렬

1 participant