Repository navigation
Commit 4bf6e8f
fix(metadata-protocol): the packaged app base carries contributed navigation, so Setup entries translate (#30553)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg8oKsEJp8L8ojaxxRT7yAhQ)_
domain:server#4 · os-bill · session_01Utp6CZMkHvuDeVYgTD73qF
Fixes #30504
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
改了什么:服务端给翻译器的「打包基准」应用,现在带上了各插件往这个应用里贡献的菜单项(用的是读取时本来就在用的同一个合并函数)。中文控制台的设置侧栏
45 个子菜单从全英文变成按翻译目录显示中文;account 应用里贡献进去的「连接智能体」同样修好。
-
为什么改:这些子菜单都是插件贡献的,基准里没有它们,翻译器就把它们当成定制包自己写的菜单,跳过翻译目录,于是全显示英文,而目录里其实有译文(如
nav_users = 用户)。
-
风险与回滚:只改一个服务端读取函数,接口返回的结构不变,只是标签值变成译文;定制包(.custom)自己新写的菜单仍然只读定制包自己的译文(ADR-0146
D2 不变)。回滚就是 revert。
- 先看:`packages/metadata-protocol/src/protocol-discovery-and-bases.ts` 的
`getPackagedAppBase`;`packages/objectql/src/protocol-custom-override-bare-slot-envelope.test.ts`
末尾新增的 `[#30504]` 用例。
- 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run
src/protocol-custom-override-bare-slot-envelope.test.ts -t 30504`,应看到 4
个用例通过;或用中文打开控制台的设置,侧栏子菜单显示「用户」「权限集分配」等中文。
- 需要你做的:无,席位落地。
## What changes
`getPackagedAppBase(name)` (the body in
`protocol-discovery-and-bases.ts`; `protocol.ts` and
`meta-item-read-gate.ts` are untouched) now answers the app's packaged
declaration with the code layer's navigation contributions folded in,
through the one fold every served app read already applies,
`SchemaRegistry.applyNavContributions` (ADR-0029 D7). No second copy of
the fold. When the registry has no such method (a double) the
declaration alone is answered, and a throw from the fold answers the
declaration alone, which is the base `main` answered.
Why this is the fix: the served app is `declaration + contributions`
(`protocol-meta-item-reads.ts` folds them on read), while the base
handed to `translateApp` was the declaration alone. For a node id the
known base lacks, `packagedNavNodes` answers `{}`,
`valueOverridesPackagedBase` reads the label as changed, and a changed
label reads only the pair's translations (ADR-0146 D2). Outside a pair
that bundle is empty, so every contributed entry kept its source text.
With the contributions in the base, a contributed node is judged against
its own packaged label and the catalog applies.
ADR-0146 D2 is preserved: a node a `.custom` override authors is in no
contribution, so it is still absent from the base and still reads only
the pair's translations, else its own text. Shape B (`packagedNavNodes`
answering "no base knowledge" for an unknown id) was not taken, as the
dispatch ruled: it would let the base catalog relabel an
override-authored node.
## Tests
- New top-level describe `[#30504]` in
`packages/objectql/src/protocol-custom-override-bare-slot-envelope.test.ts`
(the #29613/#30062 real-boot harness that already pins the packaged app
base), with and without a metadata service:
- the packaged base carries the contributed entry, and the registry's
own item is not mutated by the fold;
- the base's own app, translated against that base, reads the
contributed entry as `用户` in `zh-CN` and `Users` in `en`;
- on the pair's declared override, the override-authored `nav_custom`
keeps `Custom entry` with no pair translation (the catalog's `基包译文` is
not taken) and reads the pair's `自定义入口` when the pair ships one, while
the contributed `nav_users` reads `用户` in both.
- Red on `main`: the test committed first (`97886306`),
`@objectstack/metadata-protocol` built without the fix: 4 failed / 87
skipped (`expected {} to deeply equal { nav_users: 'Users' }`). With the
fix and a rebuild: the file 91/91 passed.
- After merging `origin/main` and rebuilding the objectql closure: this
file plus `registry-nav-contribution-group-semantics.test.ts` and
`registry-nav-contribution-disabled-package.test.ts`, 112/112 passed.
- `pnpm --filter @objectstack/metadata-protocol exec vitest run`: 316
files passed / 4 skipped, 22425 tests passed / 26 skipped (before the
main merge; the merge brought only two metadata-protocol test files).
- `pnpm --filter @objectstack/metadata-protocol --filter
@objectstack/objectql typecheck`: lock VERDICT command-exit 0.
## Acceptance notes
- Measured whether other apps are hit the same way: every code-level
contribution in the tree targets `setup`, plus one into `account`
(`packages/mcp/src/connect-ui.ts`, `nav_connect_agent`), the same code
path, fixed here (live: served `连接智能体`). Studio carries no code-level
contributions, so it is not on this path.
- `protocol.ts`'s public docblock for `getPackagedAppBase` still reads
"answered the same way" as the page base; it is left untouched to stay
off seat 5's facade series, and the new behaviour is documented on the
body in `protocol-discovery-and-bases.ts`. A one-line docblock follow-up
there can ride a later `protocol.ts` PR.
- `nav_webhooks` reads `Webhooks` in zh-CN: that is the catalog's own
zh-CN value, not a miss.
## Verification
<details><summary>Live: showcase stack, GET /api/v1/meta/app/setup,
signed in as the seeded admin</summary>
`examples/app-showcase`, `objectstack dev --seed-admin --fresh` on this
branch's build (fix included):
- `Accept-Language: zh-CN`: 9/9 group headings and 45/45 leaf entries in
the catalog's zh-CN text (44 contain CJK; the 45th is `nav_webhooks` =
`Webhooks`, the catalog's value). First leaves:
`nav_system_overview=系统概览 | nav_packaged_actions=打包动作 |
nav_marketplace_browse=浏览应用市场 | nav_marketplace_installed=已安装应用 |
nav_users=用户 | nav_organization=当前组织 | nav_business_units=业务单元 |
nav_teams=团队`. On `main` the ui seat's dev measured 0/45 (os-dev-report
6660644606).
- `Accept-Language: en`: 0/9 and 0/45 CJK, labels unchanged (`Users`,
`Organization`, …).
- `GET /api/v1/meta/app/account` in zh-CN: `nav_connect_agent=连接智能体`.
</details>
<details><summary>Gates (local subset, derived by dispatch-gates
--commands on this diff)</summary>
58 derived families, all `:: exit 0`; `--ran` reconciles 58 run, 0
NOT-MEASURED. Two first ran as exit 3, PREREQUISITE NOT MET, and were
re-run once their prerequisite was met: `check-plugin-teardown-shape.mjs
--self-test` (shallow clone, after fetching its pinned fixture commit
`621a4876`) and `check:dual-build-cjs-loads` (seven packages had no
`dist/`; 116 entry points across 71 packages load). Record: project
files `server-seat4/30504/`. `pnpm lint`: no findings. Taken on head
`5eef4217`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CayrDmiTYnJJzkKhec)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f5aaa0b commit 4bf6e8f
3 files changed
Lines changed: 124 additions & 4 deletions
File tree
- .changeset
- packages
- metadata-protocol/src
- objectql/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | | - | |
277 | | - | |
278 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
279 | 304 | | |
280 | 305 | | |
281 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
0 commit comments