Skip to content

refactor(i18n): lookup-only TermStore and remove Go I18n - #255

Merged
buke merged 7 commits into
mainfrom
refactor/i18n-p5-lookup-remove-go-i18n
Aug 7, 2026
Merged

refactor(i18n): lookup-only TermStore and remove Go I18n#255
buke merged 7 commits into
mainfrom
refactor/i18n-p5-lookup-remove-go-i18n

Conversation

@buke

@buke buke commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

  • Make UpsertPackagedTerms the sole packaged-term write path and trim TermStore to Lookup/warm/invalidate/termHash for _t.
  • Dial TranslationTerm Search/Count/GetTranslations via loader.GetMethodDescriptor; delete Go {app}.I18n handlers, EnsureI18nMeta, EnsureTranslationTermTable, and ServiceDescs I18n injection.
  • Rebind terminology.editor ACL to TranslationTerm Search/Browse/Update/Count (Editor + PO export paging).

Test plan

  • go test ./internal/i18n/... ./internal/service/... ./internal/server/... ./internal/module/lifecycle/... ./internal/module/evolution/schema/... -count=1
  • Install modules and confirm _t still resolves via Go Lookup cache
  • As terminology.editor: GET /web/i18n/translations and GET /web/i18n/po?module=…&application=…&lang=… succeed
  • Confirm no {app}.I18n ServiceDesc / no go://i18n/<app> meta after install

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Improved terminology search and PO export with accurate counting, pagination, filtering, and truncation.
    • Translation terms now support more consistent language, query, status, kind, and numeric-value handling.
    • Packaged PO imports can create missing translation-term storage automatically.
  • Bug Fixes

    • Clarified permission errors to identify the required terminology editor role.
    • Improved handling of missing, malformed, or unavailable translation data and service metadata.
  • Access

    • Updated terminology editor permissions for searching, browsing, counting, and updating translation terms.

PR Type

Enhancement, Refactoring


Description

  • Go Core: Removed legacy {app}.I18n gRPC handlers and trimmed TermStore to a lookup-only cache for _t.

  • Go Core: Re-routed I18n gateway RPCs and PO exports to {app}.TranslationTerm Search/Count via dynamic descriptors.

  • Go Core: Updated schema migration and ACL seeding to grant terminology.editor access to TranslationTerm methods.

  • TypeScript Modules: Rebound terminology.editor ACL in modules/auth bootstrap JSON to TranslationTerm Search/Browse/Update/Count.

  • SPDX & Licensing: New file internal/i18n/models/terminology_acl_test.go includes SPDX LGPL-3.0 header; no license boundary impact.

  • Test Coverage: Cleaned up obsolete Go i18nservice tests and updated unit tests across gateway, models, store, schema migrator, and server middleware.


File Walkthrough

Relevant files
Refactor
9 files
client.go
Fetch app translations via TranslationTerm GetTranslations descriptor
+8/-10   
import.go
Rename packaged write helper to UpsertPackagedTerms           
+15/-9   
terminology_acl.go
Replace EnsureI18nMeta with EnsureTerminologyEditorAllows for
TranslationTerm
+14/-61 
translation_term.go
Rename table helper to MigrateTranslationTermTable for test fixtures
+7/-12   
service.go
Remove legacy Go I18n service implementation                         
+0/-350 
term_store.go
Trim TermStore to lookup-only cache for hot path translations
+4/-245 
migrator.go
Update schema migrator to seed terminology editor ACL allowances
+3/-9     
interceptor.go
Remove legacy I18n GetTranslations from internal auth method lists
+0/-1     
service.go
Remove automatic injection of I18n descriptors into ApplicationService
+0/-5     
Enhancement
2 files
po_export.go
Update PO export collection using TranslationTerm Count and Search
+33/-4   
terms_client.go
Dial TranslationTerm Count and Search RPCs with query conditions
+189/-49
Tests
1 files
terminology_acl_test.go
Add unit tests for EnsureTerminologyEditorAllows early returns
+25/-0   
Configuration changes
1 files
bootstrap.json
Rebind terminology.editor role permissions to TranslationTerm
Search/Browse/Update/Count
+49/-4   
Documentation
1 files
routes.ts
Update terminology editor route comment to reflect new ACL methods
+1/-1     
Additional files
19 files
rpc_client_test.go +14/-244
term_search.go +1/-1     
terms_client_test.go +17/-12 
translations.go +1/-1     
import_test.go +34/-25 
i18n_meta_test.go +0/-592 
translation_term_test.go +22/-22 
parse_int32_test.go +0/-31   
proto.go +0/-214 
search.go +0/-89   
service_test.go +0/-503 
update.go +0/-92   
term_store_internal_test.go +10/-6   
term_store_test.go +21/-112
migrator_test.go +7/-22   
interceptor_test.go +0/-12   
server_service_registration_test.go +0/-6     
i18n.go +0/-13   
service_test.go +23/-35 

- Make UpsertPackagedTerms the sole packaged write path and trim TermStore to Lookup/warm/invalidate.
- Dial TranslationTerm Search/Count/GetTranslations via loader; drop Go {app}.I18n handlers and Ensure*.
- Seed terminology.editor ACL on TranslationTerm Search/Browse/Update/Count for Editor and PO export.

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

cursor Bot commented Aug 6, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_2ea4ce03-d7e4-4011-ae67-0393f4d47c93)

@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: 1 minute

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: 86697603-cafe-4271-be1a-5859ef194d86

📥 Commits

Reviewing files that changed from the base of the PR and between 7359a99 and bf5828e.

📒 Files selected for processing (8)
  • internal/i18n/gateway/po_export.go
  • internal/i18n/gateway/po_export_test.go
  • internal/i18n/gateway/terms_client.go
  • internal/i18n/gateway/terms_rpc_fixture_test.go
  • internal/i18n/import/import.go
  • internal/i18n/import/import_test.go
  • internal/i18n/import/migrate_hook_test.go
  • internal/i18n/models/translation_term_test.go
📝 Walkthrough

Walkthrough

The PR replaces legacy I18n RPC usage with dynamic TranslationTerm Count, Search, and GetTranslations calls. It updates PO export pagination, packaged-term migration, term-store tests, authorization records, and service registration.

Changes

TranslationTerm migration

Layer / File(s) Summary
Dynamic TranslationTerm gateway flow
internal/i18n/gateway/client.go, internal/i18n/gateway/terms_client.go, internal/i18n/gateway/*test.go
The gateway loads RPC descriptors dynamically, invokes Count/Search methods, parses paginated results, and decodes translation responses.
PO export pagination
internal/i18n/gateway/po_export.go, internal/i18n/gateway/term_search.go
PO export precomputes totals, handles nonpositive limits, selects the configured paging path, and reports the required role for denied requests.
Translation-term migration and import
internal/i18n/models/*, internal/i18n/import/*, internal/module/evolution/schema/*
EnsureTranslationTermTable becomes MigrateTranslationTermTable. Packaged imports migrate missing tables. Module schema migration no longer creates translation-term tables or i18n metadata.
Term-store cache scope
internal/i18n/store/*
TermStore removes database-backed search and override APIs while retaining lookup-cache, hash, warming, and invalidation coverage.
Legacy I18n service removal
internal/server/middleware/auth/grpcauth/*, internal/server/*, internal/service/*
Legacy I18n authentication and service descriptors are removed from registration and descriptor expectations.
TranslationTerm authorization
modules/auth/data/bootstrap.json, modules/base/web/route/routes.ts
The terminology editor role receives TranslationTerm Search, Browse, Update, and Count permissions.

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

Sequence Diagram(s)

sequenceDiagram
  participant Gateway
  participant DescriptorLoader
  participant TranslationTermRPC
  participant POExporter
  Gateway->>DescriptorLoader: load TranslationTerm descriptors
  Gateway->>TranslationTermRPC: Count terms
  TranslationTermRPC-->>Gateway: return total
  Gateway->>TranslationTermRPC: Search terms by page
  TranslationTermRPC-->>Gateway: return term rows
  POExporter->>Gateway: collect terms for PO export
  Gateway-->>POExporter: return paginated terms
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.26% 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
Title check ✅ Passed The title clearly summarizes the primary i18n refactor, including the lookup-only TermStore and removal of the Go I18n service.
Description check ✅ Passed The description explains the refactor, affected components, ACL changes, testing plan, and implementation details.
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.
✨ 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 refactor/i18n-p5-lookup-remove-go-i18n

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

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.91892% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/i18n/gateway/po_export.go 96.2% 0 Missing and 1 partial ⚠️
internal/i18n/import/import.go 88.8% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/i18n/store/term_store_internal_test.go (1)

82-98: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Invalidate TermStore after direct TranslationTerm mutations commit.

Generated TranslationTerm models use the generic ORM mutation path, which does not call InvalidateModule. An editor update can leave stale translations cached and allow WarmLanguage to install a stale snapshot. Cover every reachable create, update, and delete path.

🤖 Prompt for 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.

In `@internal/i18n/store/term_store_internal_test.go` around lines 82 - 98, Update
the generic TranslationTerm mutation flow so every committed create, update, and
delete operation calls TermStore.InvalidateModule for the affected module.
Ensure invalidation occurs only after a successful database mutation and covers
all reachable ORM mutation paths, allowing WarmLanguage to discard stale
snapshots.
🧹 Nitpick comments (4)
internal/i18n/gateway/rpc_client_test.go (1)

96-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Restore deterministic dial-failure coverage.

fetchAppSearchTerms and fetchAppTranslations resolve a descriptor before they call client.Dial. A descriptor-load failure now satisfies these tests, so neither test proves that dial boom reaches client.ToStatusError.

Set up a valid descriptor fixture before each call. Then assert the returned error contains the dial failure. Keep descriptor-load failure in a separate test.

🤖 Prompt for 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.

In `@internal/i18n/gateway/rpc_client_test.go` around lines 96 - 112, Update
TestFetchAppSearchTermsDialFailure and TestFetchAppTranslationsDialFailure to
register or provide a valid descriptor fixture before invoking the fetch
functions, ensuring execution reaches client.Dial and client.ToStatusError.
Assert the returned errors contain “dial boom” rather than only checking for any
error, and add separate coverage for descriptor-load failures.
internal/i18n/import/import.go (1)

76-82: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the missing-table fallback.

All displayed UpsertPackagedTerms tests call MigrateTranslationTermTable before importing. They do not execute this branch. Add a fresh-scope test that imports one PO entry without a table, then asserts table creation and the imported row.

🤖 Prompt for 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.

In `@internal/i18n/import/import.go` around lines 76 - 82, Add a fresh-scope test
for UpsertPackagedTerms that skips MigrateTranslationTermTable, imports one PO
entry, and verifies the missing-table fallback creates the translation-term
table and persists the imported row. Keep existing migrated-table tests
unchanged and assert both table existence and stored term data after the import.
internal/module/evolution/schema/migrator_test.go (1)

46-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add a positive ACL-seeding test.

Both tests cover only no-op paths. TestMigratorMigrateCallsTerminologyEditorAllows has no effective catalog or role tables, so EnsureTerminologyEditorAllows returns before it creates an allow row. Removing the call from migrator.Migrate would still pass this test.

  • internal/module/evolution/schema/migrator_test.go#L46-L60: create the catalog, terminology.editor role, TranslationTerm services, and role-access table; then assert that Migrate seeds Search, Browse, Update, and Count.
  • internal/i18n/models/terminology_acl_test.go#L8-L25: add a direct unit test that asserts one allow row for each TranslationTerm method.
🤖 Prompt for 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.

In `@internal/module/evolution/schema/migrator_test.go` around lines 46 - 60, Add
positive ACL-seeding coverage: in
internal/module/evolution/schema/migrator_test.go lines 46-60, configure the
catalog, terminology.editor role, TranslationTerm services, and role-access
table, then assert Migrate seeds Search, Browse, Update, and Count; in
internal/i18n/models/terminology_acl_test.go lines 8-25, add a direct test
asserting one allow row for each TranslationTerm method. Use the existing
migrator and EnsureTerminologyEditorAllows test helpers and preserve the
no-table-creation assertion.
internal/i18n/store/term_store_test.go (1)

312-333: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the same TermStore after the table is created.

The first WarmLanguage call exercises the missing-table branch. Replacing ts with a new store bypasses the transition from the empty cache to the migrated table. Remove the reassignment and warm the original store again. This ensures the test detects regressions in recovery for an existing TermStore.

Proposed test adjustment
-	ts = store.NewTermStore(rs, "auth")
	if err := ts.WarmLanguage("zh_CN"); err != nil {
🤖 Prompt for 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.

In `@internal/i18n/store/term_store_test.go` around lines 312 - 333, Update
TestTermStoreWarmMissingTableAndBumpInvalidate to keep the original TermStore
instance after migrating and populating the table; remove the reassignment to
store.NewTermStore and call WarmLanguage on the existing ts to exercise recovery
from the missing-table cache state.
🤖 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.

Outside diff comments:
In `@internal/i18n/store/term_store_internal_test.go`:
- Around line 82-98: Update the generic TranslationTerm mutation flow so every
committed create, update, and delete operation calls TermStore.InvalidateModule
for the affected module. Ensure invalidation occurs only after a successful
database mutation and covers all reachable ORM mutation paths, allowing
WarmLanguage to discard stale snapshots.

---

Nitpick comments:
In `@internal/i18n/gateway/rpc_client_test.go`:
- Around line 96-112: Update TestFetchAppSearchTermsDialFailure and
TestFetchAppTranslationsDialFailure to register or provide a valid descriptor
fixture before invoking the fetch functions, ensuring execution reaches
client.Dial and client.ToStatusError. Assert the returned errors contain “dial
boom” rather than only checking for any error, and add separate coverage for
descriptor-load failures.

In `@internal/i18n/import/import.go`:
- Around line 76-82: Add a fresh-scope test for UpsertPackagedTerms that skips
MigrateTranslationTermTable, imports one PO entry, and verifies the
missing-table fallback creates the translation-term table and persists the
imported row. Keep existing migrated-table tests unchanged and assert both table
existence and stored term data after the import.

In `@internal/i18n/store/term_store_test.go`:
- Around line 312-333: Update TestTermStoreWarmMissingTableAndBumpInvalidate to
keep the original TermStore instance after migrating and populating the table;
remove the reassignment to store.NewTermStore and call WarmLanguage on the
existing ts to exercise recovery from the missing-table cache state.

In `@internal/module/evolution/schema/migrator_test.go`:
- Around line 46-60: Add positive ACL-seeding coverage: in
internal/module/evolution/schema/migrator_test.go lines 46-60, configure the
catalog, terminology.editor role, TranslationTerm services, and role-access
table, then assert Migrate seeds Search, Browse, Update, and Count; in
internal/i18n/models/terminology_acl_test.go lines 8-25, add a direct test
asserting one allow row for each TranslationTerm method. Use the existing
migrator and EnsureTerminologyEditorAllows test helpers and preserve the
no-table-creation assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b4b91f7e-bebc-4570-af7e-d7487adf1c39

📥 Commits

Reviewing files that changed from the base of the PR and between 8c9ddcc and b317109.

📒 Files selected for processing (33)
  • internal/i18n/gateway/client.go
  • internal/i18n/gateway/po_export.go
  • internal/i18n/gateway/rpc_client_test.go
  • internal/i18n/gateway/term_search.go
  • internal/i18n/gateway/terms_client.go
  • internal/i18n/gateway/terms_client_test.go
  • internal/i18n/gateway/translations.go
  • internal/i18n/import/import.go
  • internal/i18n/import/import_test.go
  • internal/i18n/models/i18n_meta_test.go
  • internal/i18n/models/terminology_acl.go
  • internal/i18n/models/terminology_acl_test.go
  • internal/i18n/models/translation_term.go
  • internal/i18n/models/translation_term_test.go
  • internal/i18n/service/parse_int32_test.go
  • internal/i18n/service/proto.go
  • internal/i18n/service/search.go
  • internal/i18n/service/service.go
  • internal/i18n/service/service_test.go
  • internal/i18n/service/update.go
  • internal/i18n/store/term_store.go
  • internal/i18n/store/term_store_internal_test.go
  • internal/i18n/store/term_store_test.go
  • internal/module/evolution/schema/migrator.go
  • internal/module/evolution/schema/migrator_test.go
  • internal/server/middleware/auth/grpcauth/interceptor.go
  • internal/server/middleware/auth/grpcauth/interceptor_test.go
  • internal/server/server_service_registration_test.go
  • internal/service/i18n.go
  • internal/service/service.go
  • internal/service/service_test.go
  • modules/auth/data/bootstrap.json
  • modules/base/web/route/routes.ts
💤 Files with no reviewable changes (12)
  • internal/server/server_service_registration_test.go
  • internal/service/i18n.go
  • internal/i18n/service/proto.go
  • internal/i18n/service/parse_int32_test.go
  • internal/server/middleware/auth/grpcauth/interceptor_test.go
  • internal/i18n/service/search.go
  • internal/i18n/service/update.go
  • internal/i18n/service/service.go
  • internal/server/middleware/auth/grpcauth/interceptor.go
  • internal/i18n/service/service_test.go
  • internal/service/service.go
  • internal/i18n/models/i18n_meta_test.go

@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: 3 🔵🔵🔵⚪⚪
🧪 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 ✨

buke and others added 2 commits August 6, 2026 23:57
- Cover TranslationTerm Search/Count/GetTranslations dial paths via bufconn fixtures.
- Exercise missing-table migrate fallback, positive terminology.editor ACL seeding, and TermStore warm recovery.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Remove EnsureTerminologyEditorAllows and its migrator hook so installs no longer seed TranslationTerm allows.

- Clarify PermissionDenied on PO/Search gateway to mention the terminology.editor role.

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

@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

🧹 Nitpick comments (3)
internal/i18n/import/import_test.go (1)

105-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the error content, not only that an error occurred.

The test passes if any stage of UpsertPackagedTerms fails. A future change that fails earlier, for example in parsePoTerms or the transactor, would keep the test green while the migration path is no longer covered. Assert the migration wrap text.

💚 Proposed change
 	_, err = i18nimport.UpsertPackagedTerms(rs, nil, "auth", "auth", "zh_CN", poText)
-	if err == nil {
-		t.Fatal("expected migrate error for missing table on closed DB")
+	if err == nil || !strings.Contains(err.Error(), "migrate auth_translation_term") {
+		t.Fatalf("expected migrate error for missing table on closed DB, got %v", err)
 	}

Add the strings import if it is not already present.

🤖 Prompt for 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.

In `@internal/i18n/import/import_test.go` around lines 105 - 108, Update the test
around UpsertPackagedTerms to assert that the returned error contains the
migration wrap text indicating the missing table, rather than only checking err
is non-nil; add the strings import if needed and retain the existing failure
assertion.
internal/i18n/gateway/terms_rpc_fixture_test.go (2)

487-534: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the shared bufconn server setup.

newListValueResponseDialer duplicates the listener, server start, cleanup, and lazy-connection logic of newTranslationTermDialer. Extract a helper that takes the grpc.StreamHandler and returns the grpcclient.ServiceDialer. This also removes the inconsistency where newListValueResponseDialer does not validate serviceName.

🤖 Prompt for 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.

In `@internal/i18n/gateway/terms_rpc_fixture_test.go` around lines 487 - 534,
Extract the shared bufconn listener, gRPC server lifecycle, cleanup, and lazy
connection logic from newListValueResponseDialer and newTranslationTermDialer
into a helper that accepts a grpc.StreamHandler and returns a
grpcclient.ServiceDialer. Update both dialers to use this helper, preserving
each handler’s behavior and ensuring the shared dialer validates serviceName
consistently.

181-186: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace deprecated grpc.DialContext with grpc.NewClient.

Pass "passthrough:///bufnet" as the target. Apply the same change to newListValueResponseDialer.

🤖 Prompt for 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.

In `@internal/i18n/gateway/terms_rpc_fixture_test.go` around lines 181 - 186,
Replace deprecated grpc.DialContext with grpc.NewClient in the fixture dialer,
using "passthrough:///bufnet" as the target while preserving the existing
context dialer and insecure transport credentials. Apply the same target and
constructor change to newListValueResponseDialer.
🤖 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/models/translation_term_test.go`:
- Around line 176-191: Update TestMigrateTranslationTermTableUniqueIndexError to
pin the database pool to one connection by calling SetMaxOpenConns(1) before
enabling PRAGMA query_only, ensuring the subsequent migration uses the read-only
connection and deterministically exercises the unique-index error path.

---

Nitpick comments:
In `@internal/i18n/gateway/terms_rpc_fixture_test.go`:
- Around line 487-534: Extract the shared bufconn listener, gRPC server
lifecycle, cleanup, and lazy connection logic from newListValueResponseDialer
and newTranslationTermDialer into a helper that accepts a grpc.StreamHandler and
returns a grpcclient.ServiceDialer. Update both dialers to use this helper,
preserving each handler’s behavior and ensuring the shared dialer validates
serviceName consistently.
- Around line 181-186: Replace deprecated grpc.DialContext with grpc.NewClient
in the fixture dialer, using "passthrough:///bufnet" as the target while
preserving the existing context dialer and insecure transport credentials. Apply
the same target and constructor change to newListValueResponseDialer.

In `@internal/i18n/import/import_test.go`:
- Around line 105-108: Update the test around UpsertPackagedTerms to assert that
the returned error contains the migration wrap text indicating the missing
table, rather than only checking err is non-nil; add the strings import if
needed and retain the existing failure assertion.
🪄 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: ba0527e6-881b-4b1c-953d-c9d53164e715

📥 Commits

Reviewing files that changed from the base of the PR and between b317109 and 7359a99.

📒 Files selected for processing (10)
  • internal/i18n/gateway/po_export.go
  • internal/i18n/gateway/term_search.go
  • internal/i18n/gateway/terms_client_test.go
  • internal/i18n/gateway/terms_rpc_fixture_test.go
  • internal/i18n/import/import_test.go
  • internal/i18n/models/translation_term_test.go
  • internal/i18n/store/term_store_test.go
  • internal/module/evolution/schema/migrator.go
  • internal/module/evolution/schema/migrator_test.go
  • modules/base/web/route/routes.ts
💤 Files with no reviewable changes (3)
  • internal/i18n/gateway/po_export.go
  • internal/module/evolution/schema/migrator_test.go
  • internal/i18n/store/term_store_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • modules/base/web/route/routes.ts
  • internal/i18n/gateway/terms_client_test.go

Comment thread internal/i18n/models/translation_term_test.go
buke and others added 2 commits August 7, 2026 10:00
- Set MaxOpenConns(1) so PRAGMA query_only applies to the migrate connection.

- Assert UpsertPackagedTerms missing-table failures include the migrate wrap text.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Extract migrateTranslationTermTableIfMissing and stub it in-package to force migrate failures.

- Split the err check so patch coverage no longer leaves a partial if-init line.

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

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 34 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread internal/i18n/gateway/po_export.go Outdated
Comment thread internal/i18n/gateway/terms_client.go Outdated
Comment thread internal/i18n/import/import.go Outdated
Comment thread internal/i18n/import/import.go
- Correct UpsertPackagedTerms docs: MetaModel owns schema; missing-table create is fallback only.

- Keep paging when probe Total is unset, and backfill Total from later pages.

- Stop inferring fuzzy from Comments; those fields store PO file refs only.

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

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread internal/i18n/gateway/po_export.go
- When search hooks omit Total and export stops at poExportMaxItems, set truncated so clients are not silently capped.

Co-authored-by: Cursor <cursoragent@cursor.com>
@buke
buke merged commit d382bf3 into main Aug 7, 2026
46 checks passed
@buke
buke deleted the refactor/i18n-p5-lookup-remove-go-i18n branch August 7, 2026 03:03
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