Skip to content

fix(google): preserve permission enum in normalized errors - #5243

Merged
luvs01 merged 2 commits into
lidge-jun:devfrom
luvs01:fix/google-permission-enum
Sep 22, 2026
Merged

luvs01 merged 2 commits into
lidge-jun:devfrom
luvs01:fix/google-permission-enum

Conversation

@luvs01

@luvs01 luvs01 commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • safeGoogleHttpErrorMessage dropped Google's explicit PERMISSION_DENIED enum when normalizing the error prefix (Antigravity access denied: ...). Downstream classifyError then saw only the detail text, so a 400 PERMISSION_DENIED body containing location wording (for example User location is not supported for this project) was reported as location_not_supported instead of permission_denied.
  • Keep the enum in the normalized prefix (access denied (PERMISSION_DENIED)) so the authoritative permission reason survives downstream classification. Plain-text payloads and bare HTTP 403s without the enum still produce the existing access denied prefix.

Verification

  • bun test tests/adapters/google/google-errors.test.ts — 16 pass, 0 fail (includes a new regression test asserting classifyError returns permission_denied for a 400 PERMISSION_DENIED + location body).
  • bun x tsc --noEmit — clean.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Google permission error messaging by distinguishing explicit PERMISSION_DENIED responses from other access-denied errors.
    • Permission errors now retain the provider’s explicit status through downstream error classification, including for HTTP 400 responses.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 20, 2026
@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 480ff699-55d0-4e8f-ae11-79f57d2ebbe2

📥 Commits

Reviewing files that changed from the base of the PR and between 12cb129 and 5d7a568.

📒 Files selected for processing (2)
  • src/adapters/google-errors.ts
  • tests/adapters/google/google-errors.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The Google error classifier now preserves explicit PERMISSION_DENIED enum status in its message. Tests verify the message suffix and downstream permission_error classification, including for HTTP 400 responses.

Changes

Google Permission Error Classification

Layer / File(s) Summary
Preserve explicit permission status
src/adapters/google-errors.ts, tests/adapters/google/google-errors.test.ts
classifyGoogle now handles PERMISSION_DENIED before the shared permission checks and returns the (PERMISSION_DENIED) suffix. Tests verify message generation and downstream classification as permission_error with code permission_denied, including on a 400 response.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving the explicit Google PERMISSION_DENIED enum during error normalization.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

✅ 4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

@github-actions
github-actions Bot marked this pull request as draft September 20, 2026 03:23
@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 71 / 80

이 PR은 Google/Antigravity HTTP 에러를 짧게 정리할 때, Google이 준 PERMISSION_DENIED 값을 버려서 생기는 오분류를 고칩니다. 예전에는 enum이 있어도 앞부분만 Antigravity access denied로 만들고, 본문 설명만 뒤에 붙였습니다. 그런데 아래쪽 classifyError는 permission_denied 글자가 메시지에 남아 있을 때만 “권한 거부”로 먼저 확정하고, 그게 없으면 본문에 “location is not supported” 같은 말이 있을 때 location_not_supported로 잡습니다. 그래서 400 + PERMISSION_DENIED + 위치 문구가 같이 오면, Google이 권한 거부를 분명히 말했는데도 위치 미지원으로 잘못 보였습니다. 이번 수정은 enum이 명시되면 앞부분을 access denied (PERMISSION_DENIED)로 남겨, 그 글자가 아래 분류까지 살아남게 합니다. enum이 없고 HTTP 403이거나 본문에만 권한 문구가 있는 경우는 예전처럼 그냥 access denied입니다.

바뀐 파일은 src/adapters/google-errors.ts와 회귀 테스트 하나입니다. 테스트가 정규화 문자열뿐 아니라 classifyError(400, …)까지 이어서 permission_error / permission_denied를 확인하므로, 이번에 고친 버그를 바로 잠급니다. base는 dev이고 types/config 분리와도 무관합니다. 범위가 아주 작고 방향이 맞습니다. 다만 아직 draft이고 리뷰 readiness 체크리스트가 0/4라서, 머지 후보로 보기 전에 작성자가 체크를 채워야 합니다. hygiene/enforce-target 같은 게이트는 통과한 상태입니다.

라인 classifyGoogle PERMISSION_DENIED 분기 - enum이 있으면 접두사에 (PERMISSION_DENIED)를 남긴다. classifyError의 text.includes("permission_denied")가 location 추론보다 먼저 이기게 하는 핵심이다.
라인 두 번째 권한 분기 - enum 없이 403/permission denied/access denied만 있을 때는 예전처럼 access denied만 쓴다. 의도된 하위 호환이다.
경로 tests/.../google-errors.test.ts - 400 + enum + 위치 본문으로 end-to-end 회귀를 잠근 점이 좋다. 접두사 문자열만 검사하던 기존 테스트도 새 접두사에 맞춰 갱신됐다.
경로 잔여 구멍 - 본문에만 permission denied(띄어쓰기)가 있고 enum은 없으며 위치 문구도 같이 있으면, 접두사에 permission_denied가 안 남아서 여전히 location이 이길 수 있다. 이번 버그(명시 enum 유실)와는 다른 축이다.
경로 draft 게이트 - readiness 0/4. 코드 품질과 별개로 머지 전에 작성자 체크가 필요하다.

메인테이너의 판단이 필요한 지점

너의 추천
방향은 맞고 회귀 테스트도 충분하니, readiness 체크리스트를 채운 뒤 단독 머지하세요. 휴리스틱 접두사까지 넓히는 후속은 지금 넣지 말고, 실제 오분류 사례가 더 보이면 그때 열면 됩니다. types/config 캠페인과 무관하니 닫을 중복 PR도 없습니다.

이 댓글은 grok-bot이 작성했습니다

@github-actions
github-actions Bot marked this pull request as ready for review September 20, 2026 03:33
@Ingwannu

Copy link
Copy Markdown
Owner

I approved the hosted runs for exact head 5d7a5687137ca238b4498198388a5ce3bc2f9446 after confirming that it changes only the Google error normalizer and its focused test. This is CI authorization, not merge approval: current dev has advanced four commits since this head, so please refresh onto current dev and obtain green replacement-head checks before final review.

@github-actions
github-actions Bot marked this pull request as draft September 20, 2026 04:27

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved on the current dev merge head. Preserving the explicit PERMISSION_DENIED enum in normalized text prevents lower-priority location wording from overriding Google’s authoritative permission verdict, and the focused regression exercises the downstream classifier. Merge only after the replacement-head required checks are green.

@lidge-jun

Copy link
Copy Markdown
Owner

추가 리뷰 · 우선순위 72 / 80

지난 리뷰 이후 tip이 5d7a568에서 3304532로 바뀌었습니다. 새 커밋은 기능 수정이 아니라 dev를 이 브랜치로 끌어온 머지입니다. 메인테이너가 예전에 “현재 dev 위로 맞춘 뒤 새 head CI를 보라”고 했고, 그 요청을 따른 갱신입니다. 머지로 들어온 것은 버전 bump(2.61.0), Fernet fixture 테스트 한 줄, 계약/릴리스 쪽 문서 정리뿐입니다. Google 에러 정규화 파일과 회귀 테스트 본문은 그대로입니다.

그래서 이전 리뷰의 핵심은 그대로입니다. PERMISSION_DENIED enum이 있으면 접두사에 (PERMISSION_DENIED)를 남겨, 아래 classifyError가 위치 문구보다 권한 거부를 먼저 잡게 합니다. 400 + enum + 위치 본문 end-to-end 테스트도 그대로입니다. base는 여전히 dev이고 types/config 분리와도 무관합니다. 지금 새 head용 CI는 대부분 아직 pending이고, draft readiness 체크리스트는 여전히 0/4입니다. 코드 방향은 맞지만, 머지 전에는 이 head의 초록 CI와 작성자 체크가 필요합니다.

경로 src/adapters/google-errors.ts / tests/.../google-errors.test.ts - 머지 후에도 PR 본문 diff는 이 두 파일뿐. 충돌·되돌림 없음.
경로 tip 3304532 - 기능 커밋 없이 dev 동기화만. 이전 리뷰 SHA 5d7a568 대비 수정 로직은 동일.
경로 CI - 새 head 기준 게이트/테스트 다수 pending. 예전 head 승인만으로 최종 머지 근거로 쓰지 말 것.
경로 draft 게이트 - readiness 0/4 그대로. 코드와 별개로 작성자 체크 필요.

메인테이너의 판단이 필요한 지점

  • 새 head CI가 초록이 된 뒤 바로 단독 랜딩할지
  • draft 체크리스트를 작성자가 채울 때까지 기다릴지
  • (이전과 동일) enum 없는 본문 휴리스틱까지 접두사 보존을 넓힐지 — 이번 tip에서는 손대지 않음

너의 추천
dev 맞추기는 끝났고 수정 본문은 그대로이니, 이 head CI가 통과하고 readiness를 채운 뒤 단독 머지하세요. 휴리스틱 확장이나 types/config 관련 닫을 중복은 없습니다.

이 댓글은 grok-bot이 작성했습니다

@luvs01
luvs01 marked this pull request as ready for review September 20, 2026 04:44
@luvs01
luvs01 merged commit 39143fd into lidge-jun:dev Sep 22, 2026
35 checks passed
@luvs01
luvs01 deleted the fix/google-permission-enum branch September 22, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants