fix(bridge): renderer script debugging — async fetch, install path fix, product.json checksums

- Replace sync XHR tryPing() with async fetch tryPingAsync() for port discovery
- Add ag-sdk JS file to product.json checksums in updateProductChecksums()
- Revert to inline script approach for jetski HTML (vscode-file:// blocks custom .js)
- Remove old external script tag cleanup, add inline markers
- Update known-issues with 3 new findings
- Add devlog entry #16
This commit is contained in:
2026-03-08 19:51:27 +09:00
parent 43f023c87e
commit 8ed1ece87a
6 changed files with 90 additions and 118 deletions

View File

@@ -99,3 +99,21 @@
- **원인**: 렌더러 스크립트가 `./ag-bridge-ports.json`을 동기 XHR로 읽으려 하나, `vscode-file://` 프로토콜이 `.json` 파일 서빙 거부
- **해결**: (1) 프로젝트명 해시 기반 **결정론적 포트** 사용 (`gravity_control→34332`), (2) 스크립트 생성 시 포트를 `HARDCODED_PORT=${port}`로 직접 삽입
- **주의**: `server.listen(0)` 랜덤 포트 → 매 재시작마다 변경되어 렌더러와 불일치. 결정론적 포트는 `EADDRINUSE` 시 랜덤 폴백 필요
### [2026-03-08] Extension 컴파일 경로 != 설치 경로
- **증상**: `npm run compile` 후 Extension 동작이 변하지 않음
- **원인**: `npm run compile``extension/out/extension.js`에만 빌드. Antigravity는 `~/.antigravity/extensions/variet.gravity-bridge-X.X.X/out/extension.js`에서 로드
- **해결**: 컴파일 후 반드시 설치 경로로 수동 복사하거나, `vsce package` → VSIX 재설치
- **주의**: `extension/out/` ≠ 실행 경로. 항상 설치 경로 확인 필요
### [2026-03-08] Electron 메인 프로세스 체크섬 캐시 — Reload Window 불충분
- **증상**: product.json 체크섬 업데이트 + HTML 패치 후 `Reload Window` → 패치 미적용
- **원인**: Electron 메인 프로세스가 시작 시 product.json 체크섬을 메모리에 캐시. `Reload Window`는 렌더러만 재시작하므로 캐시된 구 체크섬 사용
- **해결**: Antigravity를 **완전 종료 후 재시작** 필요 (File → Exit 후 재실행)
- **주의**: `Reload Window` ≠ 앱 재시작. 체크섬 변경 시 항상 풀 재시작 필요
### [2026-03-08] Renderer 동기 XHR — Electron 보안 정책 차단
- **증상**: `tryPing()` 함수가 동기 `XMLHttpRequest`로 HTTP bridge에 연결 시도 → 타임아웃
- **원인**: Electron 렌더러 프로세스에서 동기 XHR이 보안 정책에 의해 차단됨
- **해결**: `fetch()` + `AbortSignal.timeout(2000)` 비동기 방식으로 교체 (`tryPingAsync`)
- **주의**: `async/await` 사용 불가 (ES5 환경). `.then()` 체이닝으로 구현