service-ai: complete I18nLabelSchema migration for Setup nav labels#1127
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/390c0b1d-0e2c-40d6-9484-79c46d1aa91a Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix i18n object format in AIServicePlugin
service-ai: complete I18nLabelSchema migration for Setup nav labels
Apr 14, 2026
xuyushun441-sys
marked this pull request as ready for review
April 14, 2026 03:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AIServicePluginwas still contributing Setup App navigation labels using the deprecated{ key, defaultValue }i18n object shape, whileI18nLabelSchemanow requires plain strings. This alignsservice-aiwith the post-#1054 label contract and with already-migrated plugins.Plugin migration (service-ai)
packages/services/service-ai/src/plugin.tssetup navigation contributions:nav_ai_conversationslabel →'Conversations'nav_ai_messageslabel →'Messages'Focused regression coverage
packages/services/service-ai/src/__tests__/ai-service.test.tsto verifysetupNav.contribute()receives plain string labels for AI nav items.Changelog
Unreleased > Fixedentry inCHANGELOG.mddocumenting theservice-aimigration completion for deprecated i18n label objects.Original prompt
Problem
In
packages/services/service-ai/src/plugin.ts(lines 234-235), theAIServicePlugincontributes navigation items to the Setup App using the old i18n object format{ key, defaultValue }instead of plain strings:This violates the
I18nLabelSchemachange documented in CHANGELOG.md (related to #1054):All other plugins (
plugin-auth,plugin-security,plugin-audit) were already migrated —service-aiwas missed.Required Fix
In
packages/services/service-ai/src/plugin.ts, change thesetupNav.contribute()call:Additional Tasks
label: { key:pattern in navigation contributions or setupNav calls that may have been missed during the i18n: label 应为纯字符串,key 由框架自动生成 #1054 migration.pnpm testor the relevant test suite for service-ai and related packages).## Unreleasedsection (or the latest section) documenting the fix:{ key, defaultValue }i18n objects with plain string labels inAIServicePlugin's Setup App navigation contributions, completing theI18nLabelSchemamigration from i18n: label 应为纯字符串,key 由框架自动生成 #1054.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: 这是本项目的问题嘛 https://github.com/objectstack-ai/objectui/tasks/f8914881-2ceb-488c-812a-2bfb4734546a
问题源头在上游⚠️
@objectstack/plugin-auth 的源代码中贡献的是纯字符串标签
但在运行时,这些标签被转换成了 i18n 对象格式
这是 @objectstack framework 内部的转换逻辑问题
Assistant: Now I can see the issue clearly. The
@objectstack/plugin-authcontributes plain string labels (e.g.,label: 'Users'), but somewhere in the framework runtime, these are being wrongly transformed into i18n object format (e.g.,{ key: '...', defaultValue: 'Users' }). Let me dig deeper into the runtime transformation logic.Assistant: Now I can see the key issue. Let me look at the
service-aiplugin more closely since it's still using the old i18n object format, and also check for any other plugins that might not have been updated:Assistant: 我已经完整地分析了这个问题。以下是我的发现:
问题分析
你提到的问题是:
@objectstack/plugin-auth贡献的导航项使用纯字符串label,但在运行时被显示为 i18n 对象格式{ key, defaultValue }。根本原因定位
经过代码追踪,问题源头不在
@objectstack/plugin-auth,而在@objectstack/service-ai:@objectstack/plugin-auth(packages/plugins/plugin-auth/src/auth-plugin.ts第 120-128 行) — ✅ 已正确使用纯字符串标签:@objectstack/plugin-security/@objectstack/plugin-audit— ✅ 也已正确使用纯字符串。@objectstack/service-ai(packages/services/service-ai/src/plugin.ts第 234-235 行) — ❌ 仍在使用旧的 i18n 对象格式:这违反了 CHANGELOG 中记录的
I18nLabelSchema变更(string | I18nObject→stringonly),该变更已在 #1054 中完成。为什么 Studio 侧边栏能容忍这个问题
Studio 的
app-sidebar.tsx(第 142-147 行)有一个resolveLabel()防御函数来兼容两种格式: