Skip to content

[feat] auth-gateway Google 로그인이 있어야 Galpi를 사용하도록 변경 - #11

Merged
m16khb merged 3 commits into
mainfrom
10-require-gateway-google-login
Oct 9, 2026
Merged

m16khb merged 3 commits into
mainfrom
10-require-gateway-google-login

Conversation

@m16khb

@m16khb m16khb commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

요약

이제 Galpi는 auth-gateway를 거쳐 Google 계정으로 로그인해야 기능을 쓸 수 있습니다. 로그인은 시스템 브라우저와 127.0.0.1 루프백 주소, PKCE로 진행하며, 저장된 로그인이 있으면 auth-gateway에 닿지 못해도 계속 쓸 수 있습니다. auth-gateway가 세션을 거부(invalid_grant)하거나 사용자가 로그아웃할 때만 다시 로그인을 요구합니다.

Closes #10

변경 내용

  • Rust 호스트가 녹음 시작, 전사, 전사문 가져오기, AI 증강, 엔진 준비 명령을 로그인 전에는 AUTH_REQUIRED로 거부합니다. 녹음 정지·작업 취소·설정 저장·진단은 막지 않습니다.
  • 앱을 시작하면 저장된 세션을 auth-gateway에 한 번 갱신합니다. 갱신에 성공하면 새 토큰을 저장하고, 400 invalid_grant면 세션을 지우며, 연결 실패·5xx·429 같은 나머지 실패에서는 저장된 세션으로 앱을 엽니다.
  • 로그아웃하면 앱이 즉시 닫히고, auth-gateway에 이 기기 세션 종료를 요청한 뒤 응답과 관계없이 로컬 세션을 지웁니다. 녹음이나 작업이 진행 중일 때는 로그아웃 버튼이 비활성화됩니다.
  • 세션은 기존 비밀 저장 경로에 둡니다. Windows는 Credential Manager의 com.m16khb.galpi:gateway-session 항목을, macOS는 0600 권한의 settings.json을 씁니다. 이메일만 settings.json에 따로 저장하며, 창으로는 로그인 상태와 이메일만 넘어갑니다.
  • 화면에는 로그인 화면이 앱 앞에 놓이고, 로그인 전 앱 셸은 inert라 클릭과 키보드 이동이 닿지 않습니다. 로그인 뒤 상단에 계정 표시(온라인 또는 오프라인 · 저장된 로그인 사용)와 로그아웃 버튼이 나타납니다.
  • ChatGPT 로그인이 쓰던 브라우저 열기·루프백·PKCE 코드를 adapters/outbound/browser_sign_in/로 옮겨 두 로그인이 함께 씁니다. ChatGPT의 오류 코드와 동작은 그대로입니다.
  • IPC 명령 4개를 추가했습니다(load_app_access, sign_in_to_gateway, cancel_gateway_sign_in, sign_out_of_gateway). 기존 명령의 인자와 응답은 바뀌지 않았습니다.
  • README 두 벌에 로그인 단계·저장 위치·오프라인 동작을, DESIGN.md에 로그인 화면 상태와 문구를 적었고, 아키텍처 문서의 명령 수(28)와 포트 수(15)를 맞췄습니다.
  • 워커, 워커 프로토콜, auth-gateway 코드는 바꾸지 않았고, 역할·도메인 접근 제어도 넣지 않았습니다.

확인한 것

  • 호스트 동작은 가짜 포트로 고정했습니다. 저장 세션이 없을 때 기능 5개가 모두 AUTH_REQUIRED가 되는지, 갱신 성공·거부·연결 실패의 세 갈래, 로그인 중 두 번째 시도 거부, 로그인 중 로그아웃, 저장 세션이 있는 상태의 로그인 취소(세션 유지)를 확인했습니다(cargo test --all-targets gateway, 24개 성공).
  • auth-gateway 클라이언트는 테스트용 HTTP 서버로 교환 요청 본문, 시작 주소의 PKCE 값, /me 실패 시 이메일 없음, 다른 시도의 응답 거부, 갱신 응답 분류를 확인했습니다. 400 invalid_grant만 세션을 지우고 400 invalid_request·빈 400·401·429·503·형식 오류·연결 거부는 세션을 유지합니다.
  • 저장소는 macOS 방식(설정 파일)으로 저장한 세션이 재시작 뒤 다시 읽히는지, OS 저장소를 쓸 때 설정 파일에 토큰이 남지 않는지, 로그아웃 뒤 다른 설정이 없으면 설정 파일이 지워지는지 확인했습니다.
  • ChatGPT 로그인 테스트 68개는 import 경로만 바꾼 채 모듈 이동 뒤에도 통과했습니다. 전체 Rust 테스트는 224개가 성공했고, cargo fmt --check와 cargo clippy -D warnings도 경고 없이 끝났습니다.
  • 프런트엔드는 bun run check와 bun test(201개 성공)로 확인했습니다. 상태 기계 전이, 로그인 버튼 노출 규칙, 브라우저 대기 중 두 번째 로그인 호출이 0회인지, 런타임 연결 실패 시 재시작 안내만 보이는지, 토큰 필드가 섞인 응답을 Zod가 거부하는지가 테스트에 들어 있습니다.
  • Vite 개발 서버에 가짜 IPC를 넣어 실제 Chromium에서 로그인 전 화면, 브라우저 대기와 취소, 오프라인 로그인 뒤 작업 화면, 로그아웃 뒤 복귀, 375px 폭 화면을 눈으로 확인했습니다.
  • auth-gateway#8 브랜치의 소스와 대조해 경로, JSON 본문, Content-Type, 오류 형태가 맞는지 확인했습니다.

확인하지 못한 것:

  • 실제 auth-gateway를 띄운 로그인은 확인하지 못했습니다. 로컬 실행에 필요한 Supabase·Redis 자격 증명이 없어서, auth-gateway#8을 배포한 뒤 운영 주소로 확인해야 합니다.
  • Windows Credential Manager 항목의 생성과 삭제는 Windows 실기에서 확인해야 합니다.
  • 실제 Tauri 창은 실행까지만 확인했습니다. 이 환경에는 화면 캡처 권한이 없어 창 화면은 보지 못했습니다.

리뷰 포인트

  • 오프라인 판정 기준을 봐 주세요. 지금은 400 invalid_grant만 세션을 지우고, 401·403을 포함한 나머지는 모두 오프라인 사용으로 처리합니다.
  • 기능 차단 대상이 맞는지 봐 주세요. 녹음 정지·취소, 설정 저장, 진단은 로그인 전에도 허용합니다.
  • 업데이트 뒤 첫 실행은 온라인 로그인이 필요합니다. 배포 순서(auth-gateway#8 먼저)와 릴리스 노트 문구에 의견을 주세요.

m16khb added 3 commits October 9, 2026 20:35
Why: galpi#10 requires a Google sign-in through auth-gateway before the app can be used. Sign-in follows RFC 8252 (system browser, loopback redirect, PKCE) against the gateway's /auth/native endpoints; any signed-in Google account is allowed, a stored session keeps the app usable offline, and only a 400 invalid_grant from the gateway or a sign-out discards it.

Lore:
- Intent: Gate every feature behind an auth-gateway session, enforced by the host.
- Changes:
  - Move the browser opener, loopback listener, and PKCE out of chatgpt/ into adapters/outbound/browser_sign_in/; callers pass SignInCodes, so ChatGPT keeps its error codes.
  - Add domain/gateway.rs, GatewayAuthPort/GatewaySessionStore, application/gateway.rs AppAccessGate, and AUTH_REQUIRED on prepare, refine_transcript, transcribe, import_transcript, start_recording.
  - Add GatewayOAuthAdapter, Secret::GatewaySession with settings/gateway.rs, four Tauri commands, and composition wiring.
  - Add the login screen in front of the inert shell, the account chip with sign-out, access-machine, access-controller, and the strict Zod AppAccess schema.
  - Update README (ko/en), DESIGN.md, AGENTS.md files, ARCHITECTURE.md, OPEN_API_SPEC.md, and overviews to 28 commands and 15 ports.
- Tested: cargo fmt --check; cargo clippy --all-targets -D warnings; cargo test --all-targets (224 passed); bun run check; bun test (201 pass); python3 scripts/verify-docs-platform.py; issueops gates check (11/11)
- Not-tested: real sign-in against a running auth-gateway (needs Supabase/Redis credentials; deferred until auth-gateway#8 is deployed); Windows Credential Manager entry on real Windows hardware.
- Risk: The first launch after updating needs an online Google sign-in. macOS keeps the gateway refresh token in the 0600 settings file until the app is signed.
Why: The auth-gateway sign-in gate is a structural decision, and implementing it surfaced two pitfalls worth keeping: adding a stored credential needs every LocalSettingsStore match arm plus is_empty, and the runtime-unavailable message now lives on the login screen, so plain-browser QA mocks the Tauri IPC.

Lore:
- Intent: Keep the decision and pitfalls from galpi#10 in the project docs.
- Changes:
  - Add an ADR for requiring the auth-gateway Google sign-in and host-side AUTH_REQUIRED.
  - Add a caution for new stored credentials in LocalSettingsStore.
  - Add a caution for the login-screen runtime failure and IPC-mocked browser QA.
- Tested: python3 scripts/verify-docs-platform.py (PLATFORM_DOCS_OK)
- Risk: Low; documentation only.
Why: The IssueOps cycle for galpi#10 keeps its plan, intent, plan review, gate ledger, and verification report next to the change they describe.

Lore:
- Intent: Track the cycle materials for io-21fd3b1e1f06.
- Changes:
  - Add plan.md, intent.md, plan-review.md, gates.md (11/11 met), and report.md under .issueops/issues/10/.
- Tested: issueops gates check (11/11 met)
- Risk: Low; records only.
@m16khb m16khb added the enhancement New feature or request label Oct 9, 2026
@m16khb m16khb linked an issue Oct 9, 2026 that may be closed by this pull request
7 tasks
@m16khb m16khb self-assigned this Oct 9, 2026
@m16khb
m16khb marked this pull request as ready for review October 9, 2026 11:47
@m16khb
m16khb merged commit 3732162 into main Oct 9, 2026
9 checks passed
@m16khb
m16khb deleted the 10-require-gateway-google-login branch October 9, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth-gateway Google 로그인이 있어야 Galpi를 사용할 수 있도록 변경

1 participant