Skip to content

chore(desktop): move inline bilingual copy into catalogs - #4526

Merged
Astro-Han merged 2 commits into
apache:mainfrom
orangeCatDeveloper:chore/locale-inline-catalogs
Sep 5, 2026
Merged

chore(desktop): move inline bilingual copy into catalogs#4526
Astro-Han merged 2 commits into
apache:mainfrom
orangeCatDeveloper:chore/locale-inline-catalogs

Conversation

@orangeCatDeveloper

@orangeCatDeveloperorangeCatDeveloper commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Traditional Chinese Peer Mesh members can have blank connection-state labels, and invalid provider identifiers show raw English errors in Simplified Chinese or a generic error in the other locales.

Move Peer Mesh, Agent Graph, and task-readiness copy into typed UiCatalog modules; consolidate notification and MCP copy into typed locale tables. Settings reuse Peer Mesh identity copy directly, and Agent Graph callers import its catalog rather than a component re-export. No packages/ui or generalized-error-helper migration is included.

Two intentional behavior changes remain: align zh-TW route labels with the five protocol states (the old keys missed all four non-local states), and present required/format/length slug errors in all three locales. validateSlug returns stable issue codes; the catalog codec maps them back to its existing readable diagnostics. Validation rules are unchanged. Runtime Host badges remain Direct/Member transit, with transport names only in the tooltip.

Verification

  • Core build and clean desktop main build passed; nine affected test files: 81 passed, 0 failed, including actual React rendering for three-locale badges/tooltips and slug errors, and zh-TW member states.
  • Desktop npm run typecheck passed all four tsconfigs, including Storybook.
  • npm run lint, npm run format:check, npm run check:tui-copy, and npm run check:locale-hygiene passed.
  • Renderer architecture ledger regenerated; check passed against rebased main 03b5a2cc5. git diff --check passed.

Before the review fixes (84353649e, new regression tests):

'WebRTC' !== 'Direct'
+ message: 'connection slug too_long',
- message: 'connection slug: Slug must be 64 characters or fewer',

After (db06d3437, test output excerpts):

ok 1 - zh-CN: peer path badges describe the route, while tooltips retain the protocol
ok 6 - zh-TW: peer path badges describe the route, while tooltips retain the protocol
ok 11 - en: peer path badges describe the route, while tooltips retain the protocol
ok 2 - zh-CN: AddProviderForm renders the required slug error
ok 9 - zh-TW: AddProviderForm renders the too_long slug error
ok 14 - en: AddProviderForm renders the too_long slug error
ok 16 - zh-TW: expanded Peer Mesh members render localized route states
ok 25 - catalog decoding preserves the diagnostic: Slug must be 64 characters or fewer

UI assertions use React with linkedom; full Electron E2E and manual Desktop/Storybook acceptance were not run.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code for the original catalog migration; OpenCode for review fixes, regression tests, validation, and this description. The respective commits carry Generated-by: Claude Code and Generated-by: OpenCode; retain both when squashing. Human review is still required.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes - described under Summary above
  • No

@github-actionsgithub-actionsBot added the effort/XL Under 2500 readable lines label Sep 2, 2026
@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch 4 times, most recently from 82b4195 to b02d78bCompareSeptember 3, 2026 08:50
@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch 5 times, most recently from ec167f5 to e524215CompareSeptember 5, 2026 01:55
@orangeCatDeveloper
orangeCatDeveloper marked this pull request as ready for review September 5, 2026 03:45
@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch from e524215 to 2baac07CompareSeptember 5, 2026 04:44
@orangeCatDeveloper
orangeCatDeveloper marked this pull request as draft September 5, 2026 05:01
@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch 2 times, most recently from f74b16a to b01cb0cCompareSeptember 5, 2026 08:05
@orangeCatDeveloper
orangeCatDeveloper marked this pull request as ready for review September 5, 2026 08:50

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at b01cb0c against 1e543a73. The move itself is right: locales/ is where the other 25 catalogs live, the 14 MCP entries × 3 locales, the notification, agent-graph, task-readiness and peer-mesh catalogs are verbatim against the removed code, the ledger only gains three leaf modules and one edge, and the two large deletions remove copy functions and their ReturnType references, nothing else. But the body describes a different PR than the head, and two of the undeclared changes are user-visible.

The body does not match this head. It says 28 files; the diff is 19. It says 19 generalizedErrorMessageChinese / generalizedErrorMessage sites move to generalizedErrorMessageForLocale across desktop and packages/ui; the diff contains no occurrence of generalizedError and touches nothing in packages/ui. The rebase note says main's new route-state vocabulary is synced verbatim; main still has the old keys (see the zh-TW item below). Please rewrite it from the diff, including the behavior answer.

P2: the direct-path badge in Runtime Host settings changes from "直连" / "Direct" to a hardcoded WebRTC / QUIC / TCP.main renders peerMeshCopy.peerPathDirect for every direct path (runtime-host-profiles-section.tsx:702-704); the new peerPathLabel (:861-873) returns three English literals written into the component, which is the opposite of what this PR is for, and the transport already appears in the tooltip through peerPathDetail. Delete peerPathLabel and keep the badge on peerPathDirect / peerPathTransit. (Path ①.)

P2: decodeConnectionSlug now throws connection slug too_long / connection slug format.validateSlug returning a SlugValidationIssue is fine for the form, but the codec still interpolates the return value into its domain error (connection-catalog-codec.ts:759), and the : went with it, so a catalog with a bad slug reports a machine token instead of "Slug must be 64 characters or fewer". Map the issue back to a sentence in the codec, or leave validateSlug's message and add the code beside it. (Path ①: importing or decoding a catalog.) pi-tui-pickers.ts:1278 only tests truthiness, so the CLI is unaffected.

Smaller:

  • zh-TW route states are a real fix, not a relocation: main's zh-TW branch still keys route_available / coordination_only / stale / unknown (runtime-host-peer-mesh-dialog.tsx:2087-2093) while PeerMeshMemberProjection.state is local | connecting | reachable | reconnecting | needs_repair (peer-mesh/node.ts:205), so zh-TW users see nothing today; peer-mesh-copy.ts:422-428 gives them four new strings. Say so in the body, and add those keys to traditional-chinese-peer-mesh-copy.test.ts, which is the test that exists for exactly this.
  • The slug error copy changes in all three locales, not only zh (en goes from one sentence to three), so "the one behavior change" is understated.
  • copyPeerId and peerIdCopied now exist in both peer-mesh-copy.ts and settings-projects-copy.ts; on main the settings section read them from the dialog's catalog. One of the two should import the other.
  • agent-graph-panel.tsx keeps export { getAgentGraphPanelCopy } as a pass-through of the moved function; point the callers at the catalog and drop it.

Ordering: shares settings-provider-copy.ts with #4524, #4641 and #4551, and settings-projects-copy.ts plus the ledger with #4641. git merge-tree is clean against #4524 at 2f75546; whichever of #4641 / #4551 lands second rebases.

Manual acceptance (three locales, none run here): Runtime Host settings direct/transit badge and tooltip; Peer Mesh member list in zh-TW across the five states; the three slug errors in the add-provider form; the error text on importing a catalog with a bad slug.

Evidence boundary: static read of the diff against main, plus a literal-multiset comparison of removed vs added strings per catalog; no build, no suites, no Desktop.

AI-assisted review: drafted with Maka; I verified the badge label on main, the codec message, the zh-TW route-state keys and the body mismatch myself.

Typed locale catalogs are the mandated home for user-visible copy;
inline locale ternaries scattered through components bypass that and
make copy audits miss strings. This is the mechanical consolidation
wave: zh and en strings are moved verbatim into UiCatalog-shaped
tables with no behavior or string changes. The one exception is the
peer route state catalog, which loses a sixth key that the closed
five-value union could never render.
Generated-by: Claude Code
Claude-Session: https://claude.ai/code/session_01AqdSkg56F2x55wEGRWvzcB
@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch from b01cb0c to db06d34CompareSeptember 5, 2026 11:29
@orangeCatDeveloper

orangeCatDeveloper commented Sep 5, 2026

Copy link
Copy Markdown
ContributorAuthor

Thanks, all addressed at 8efea18 (rebased on 03b5a2cc5; same tree as db06d34, re-pushed to rerun CI):

  • Body: rewritten from the diff. No generalizedError / packages/ui claims; both behavior changes (zh-TW route states, slug errors in all three locales) are declared and the behavior answer is Yes.
  • Direct-path badge: peerPathLabel is gone. The badge renders peerPathDirect / peerPathTransit again; transport stays in the tooltip via peerPathDetail. connection-settings-locale-render.test.ts renders the badge and tooltip in all three locales.
  • decodeConnectionSlug: maps the SlugValidationIssue back to the original three sentences, : included, so a bad catalog slug still reports connection slug: Slug must be 64 characters or fewer. Covered in runtime-policy-codec.test.ts.
  • zh-TW route states: traditional-chinese-peer-mesh-copy.test.ts now asserts the five routeState keys.
  • copyPeerId / peerIdCopied: live only in peer-mesh-copy.ts; the settings section imports getPeerMeshCopy. peerIdCopyFailed and the peerPath* labels moved the other way into the settings catalog since only that section uses them.
  • agent-graph-panel.tsx: pass-through export dropped; the story and test import from locales/agent-graph-copy.

Manual acceptance in the three locales is still not run; the React/linkedom render tests are what stands in for it.

@orangeCatDeveloper
orangeCatDeveloperforce-pushed the chore/locale-inline-catalogs branch from db06d34 to 8efea18CompareSeptember 5, 2026 11:46

@Astro-HanAstro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed at 8efea18. Everything from last round is closed in code, and the body now describes this diff:

  • The direct-path badge is back on peerPathDirect / peerPathTransit with the transport only in the tooltip, and peerPathLabel is gone.
  • decodeConnectionSlug maps the issue code back to the three original sentences with the : ; runtime-policy-codec.test.ts pins all three.
  • zh-TW route states are declared as a behavior change and asserted key by key in the zh-TW copy test; the slug errors are declared for all three locales.
  • copyPeerId / peerIdCopied have one home again, the settings section imports the peer-mesh catalog for them, and the agent-graph pass-through export is gone.

The new connection-settings-locale-render.test.ts renders the badge, tooltip, slug errors and the five zh-TW member states through the real components in all three locales, using the same esbuild-into-dist bundling that password-input.test.ts already uses, so it is not a new harness. The ledger delta is three leaf catalog modules plus one edge, no owner growth.

Nothing left to ask for. Ordering: shares settings-provider-copy.ts with #4641 and #4551 and the ledger with #4641; merge-tree is clean against all three at their current heads, whichever lands later rebases.

Manual acceptance was not run by either of us; the render tests stand in for it, and the two user-visible changes are small (five zh-TW labels, three slug sentences).

Evidence boundary: static read of the delta since b01cb0c against 03b5a2cc5a; no build, no suites.

AI-assisted review: drafted with Maka; I verified the badge, the codec message and the ledger delta myself.

@Astro-Han
Astro-Han merged commit 52cc0e4 into apache:mainSep 5, 2026
1 check passed
@orangeCatDeveloper
orangeCatDeveloper deleted the chore/locale-inline-catalogs branch September 5, 2026 20:31
orangeCatDeveloper added a commit to orangeCatDeveloper/maka that referenced this pull request Sep 6, 2026
The permission-center guidance list was removed in 02604e2 (no
producer fills guidance; apache#4526's layered rows carry the actionable
lines), but the snapshot-side plumbing survived: the
CapabilitySnapshot.guidance field, staticCapability's guidance input,
botCapability's empty array, and the fixtures' guidance: [] entries.
Every future producer had to keep feeding a write-only field.
Delete the field, the producer parameter, the botCapability entry, and
the fixture entries; fix the permission-center comment that still named
the removed guidance list.
Generated-by: Claude Code
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XLUnder 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@orangeCatDeveloper@Astro-Han