Skip to content

feat(i18n-gateway): dial TranslationTerm.GetTranslations; remove terms API - #253

Merged
buke merged 4 commits into
mainfrom
feat/i18n-gateway-translation-term-p3
Aug 6, 2026
Merged

feat(i18n-gateway): dial TranslationTerm.GetTranslations; remove terms API#253
buke merged 4 commits into
mainfrom
feat/i18n-gateway-translation-term-p3

Conversation

@buke

@buke buke commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

  • Switch GET /web/i18n/translations fan-out to dial {app}.TranslationTerm/GetTranslations (internal auth whitelist added; HTTP JSON contract unchanged).
  • Remove /web/i18n/terms, the old Terminology Editor page/route/menu, and terms_api; keep GET /web/i18n/po on Go I18n SearchTerms until P4/P5.
  • Relocate PO SearchTerms helpers and componentHintFromScope tests; assert terms routes return 404.

Test plan

  • go test ./internal/i18n/gateway/... ./internal/server/middleware/auth/grpcauth/...
  • ./choysum test unit web --fe and ./choysum test unit base --fe
  • Smoke: with installed apps that have TranslationTerm, browser/FE translations load still succeeds
  • Confirm GET|PATCH /web/i18n/terms → 404 and /base/terminology is unreachable
  • Confirm GET /web/i18n/po still exports for an authenticated terminology editor

Made with Cursor


PR Type

Enhancement, Tests


Description

  • Go Core: Dial TranslationTerm/GetTranslations and remove /web/i18n/terms

  • TS Modules: Delete Terminology Editor UI, route, and API

  • Licensing: Include SPDX headers for new source files

  • Tests: Add Go interceptor tests and TS unit tests


File Walkthrough

Relevant files
Documentation
1 files
auth_forward.go
Update comment for PO export authentication behavior         
+1/-1     
Enhancement
9 files
client.go
Dial TranslationTerm.GetTranslations instead of legacy I18n
+13/-4   
gateway.go
Remove terms route registration from Gateway mux                 
+2/-2     
term_search.go
Add shared SearchTerms RPC and error response helpers       
+35/-0   
terms.go
Remove terms HTTP handler and patch logic                               
+0/-387 
terms_client.go
Remove invokeAppUpdateTerm gRPC client helper                       
+0/-53   
interceptor.go
Whitelist TranslationTerm.GetTranslations in gRPC auth interceptor
+1/-0     
TerminologyEditor.vue
Delete Terminology Editor Vue page component                         
+0/-284 
index.ts
Remove terms_api exports from i18nStore                                   
+0/-2     
terms_api.ts
Delete terms_api fetch and patch utilities                             
+0/-218 
Tests
6 files
gateway_terms_test.go
Assert removed terms routes return HTTP 404                           
+18/-516
rpc_client_test.go
Add TranslationTerm bufconn dialer and clean up terms tests
+71/-33 
terms_client_test.go
Clean up term update RPC client unit tests                             
+2/-43   
interceptor_test.go
Add test coverage for TranslationTerm interceptor bypass 
+12/-0   
component_hint.test.ts
Add componentHintFromScope Vitest unit test                           
+13/-0   
terms_api.test.ts
Delete terms_api unit test file                                                   
+0/-90   
Formatting
1 files
po_export_test.go
Format field formatting in PO export test                               
+1/-1     
Refactoring
1 files
translations.go
Remove update handler function field                                         
+1/-2     
Configuration changes
2 files
menus.ts
Remove Terminology Editor menu entry from base module       
+0/-8     
routes.ts
Remove Terminology Editor route from base module                 
+0/-10   

Summary by CodeRabbit

  • Changes
    • Removed the terminology editor from the web interface, including its menu entry and route.
    • Terminology search and editing are no longer available through the former editor.
    • Updated translation loading to use the current translations service.
    • PO export functionality remains available through the existing translation export route.
    • Improved authentication handling for translation retrieval and export requests.

…s API

- Switch translations fan-out to {app}.TranslationTerm/GetTranslations and whitelist internal dial.

- Remove /web/i18n/terms, the old Terminology Editor, and terms_api while keeping PO SearchTerms export.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18eb3b76-25e9-4a7e-8cda-209eeb83a455

📥 Commits

Reviewing files that changed from the base of the PR and between bc2fa39 and a8e8604.

📒 Files selected for processing (5)
  • internal/i18n/gateway/rpc_client_test.go
  • internal/i18n/gateway/term_search.go
  • internal/i18n/gateway/terms_client_test.go
  • modules/base/i18n/base.pot
  • modules/base/i18n/zh_CN.po
📝 Walkthrough

Walkthrough

The gateway now serves translations through TranslationTerm/GetTranslations, retains PO export, and removes legacy terminology routes, APIs, and editor UI. Internal authentication and tests now cover the new RPC and route behavior.

Changes

Translation gateway migration

Layer / File(s) Summary
Translation route and RPC flow
internal/i18n/gateway/gateway.go, internal/i18n/gateway/client.go, internal/i18n/gateway/term_search.go, internal/i18n/gateway/translations.go
The translations route now uses TranslationTerm/GetTranslations. Shared search and gRPC error helpers support translation and PO handling.
Translation RPC authentication
internal/server/middleware/auth/grpcauth/*
Internal authentication now recognizes TranslationTerm/GetTranslations. Tests cover unauthenticated and authorized calls.
Legacy terminology surface removal
modules/base/web/menu/menus.ts, modules/base/web/route/routes.ts, modules/web/web/pages/TerminologyEditor.vue, modules/web/web/stores/i18nStore/*
The terminology editor, routes, menu entry, and legacy API exports were removed. The store now exports fetchWebTranslations and TerminologyLoadResult.
Gateway and client validation
internal/i18n/gateway/*_test.go
Tests cover removed terms routes, retained translation and PO routes, the new RPC dialer, dial failures, search behavior, RPC errors, and updated fixtures.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WebClient
  participant serveTranslations
  participant fetchAppTranslations
  participant TranslationTerm
  WebClient->>serveTranslations: request /web/i18n/translations
  serveTranslations->>fetchAppTranslations: fetch translations
  fetchAppTranslations->>TranslationTerm: call GetTranslations
  TranslationTerm-->>fetchAppTranslations: return translations
  fetchAppTranslations-->>serveTranslations: return translation data
  serveTranslations-->>WebClient: send HTTP response
Loading

Possibly related PRs

Suggested labels: Review effort 3/5

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. 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.
Title check ✅ Passed The title clearly summarizes the main changes: dialing TranslationTerm.GetTranslations and removing the legacy terms API.
Description check ✅ Passed The description explains the changes, lists completed and pending tests, and identifies the affected Go and TypeScript components.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i18n-gateway-translation-term-p3

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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/i18n/gateway/term_search.go`:
- Around line 26-27: Update the PermissionDenied response in writeTermsRPCError
to remove the terminology-editor-specific wording and use an
operation-appropriate generic permission error message, including for PO export
failures.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42db1212-09f3-4f70-83f0-33796f99d6ef

📥 Commits

Reviewing files that changed from the base of the PR and between 718e789 and bc2fa39.

📒 Files selected for processing (20)
  • internal/i18n/gateway/auth_forward.go
  • internal/i18n/gateway/client.go
  • internal/i18n/gateway/gateway.go
  • internal/i18n/gateway/gateway_terms_test.go
  • internal/i18n/gateway/po_export_test.go
  • internal/i18n/gateway/rpc_client_test.go
  • internal/i18n/gateway/term_search.go
  • internal/i18n/gateway/terms.go
  • internal/i18n/gateway/terms_client.go
  • internal/i18n/gateway/terms_client_test.go
  • internal/i18n/gateway/translations.go
  • internal/server/middleware/auth/grpcauth/interceptor.go
  • internal/server/middleware/auth/grpcauth/interceptor_test.go
  • modules/base/web/menu/menus.ts
  • modules/base/web/route/routes.ts
  • modules/web/web/pages/TerminologyEditor.vue
  • modules/web/web/stores/i18nStore/component_hint.test.ts
  • modules/web/web/stores/i18nStore/index.ts
  • modules/web/web/stores/i18nStore/terms_api.test.ts
  • modules/web/web/stores/i18nStore/terms_api.ts
💤 Files with no reviewable changes (8)
  • modules/web/web/pages/TerminologyEditor.vue
  • modules/web/web/stores/i18nStore/terms_api.ts
  • internal/i18n/gateway/terms_client.go
  • internal/i18n/gateway/terms.go
  • modules/web/web/stores/i18nStore/index.ts
  • modules/base/web/route/routes.ts
  • modules/base/web/menu/menus.ts
  • modules/web/web/stores/i18nStore/terms_api.test.ts

Comment thread internal/i18n/gateway/term_search.go Outdated
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

buke and others added 3 commits August 6, 2026 19:56
- PermissionDenied now returns a generic permission denied message after the terms Editor was removed.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Re-extract base.pot and sync zh_CN.po so pot-dirty CI status is clean.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add a bufconn server that returns Unavailable so fetchAppTranslations hits the Invoke error branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
@buke

buke commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a8e8604. Configure here.

@buke
buke merged commit bcf1054 into main Aug 6, 2026
46 checks passed
@buke
buke deleted the feat/i18n-gateway-translation-term-p3 branch August 6, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant