Repository navigation
fix(console): a create form states identifier errors in the reader's language, and its banner wraps them - #28395
Merged
Conversation
…d wrap the create banner Claude-Session: https://claude.ai/code/session_01L6bhgUDuwt5hhPwSTHYJ4h Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUDuwt5hhPwSTHYJ4h Co-authored-by: Claude <noreply@anthropic.com>
…ext is picked by Claude-Session: https://claude.ai/code/session_01L6bhgUDuwt5hhPwSTHYJ4h Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#4 · os-sales · session_01L6bhgWqjXeTcS3jtug46Dv 维护者速读
席位意见:ACCEPT。按 issue 的 code 与 pattern 选译文,不匹配英文,spec 文字未动,符合分诊路线。 席位核对 — ACCEPT · domain:ui#4 · Head-sha
|
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.
Requested by Sales · project thread
Fixes #28369
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
ui/packages/app-shell/src/views/metadata-admin/i18n.ts(translateSchemaIssue与 pattern 表);ui/packages/app-shell/src/views/metadata-admin/clientValidation.ts(issueDetail,只给too_small/invalid_format带 detail);ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx(横幅li的换行)。pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/ResourceEditPage.identifierIssueI18n-28369.test.tsx,预期 8 个用例全绿;或在中文界面新建权限集,显示名称填「销售运营」,横幅两条都是中文、完整换行显示。What changes
The door carries what an issue is, not only what it says.
validateMetadataDraft(clientValidation.ts) still returns each issue's spec message unchanged, and now adds an optionaldetail(Zodcodeplusorigin/minimum/inclusive/format/pattern) on the two codes a rendering reads:too_smallandinvalid_format. Every other issue keeps exactly the{ path, message }it had, so the existing exact-shape pins (clientValidation.viewDiagnostics.test.ts,clientValidation.metricMeasureArity-8894.test.ts) are untouched. Presentation only, after the verdict, like the two passes already there.SchemaFormIssuegains the optionaldetail.The text is picked by code and pattern. New
translateSchemaIssue(i18n.ts):too_smallon a string, inclusive bound →engine.validation.spec.stringTooShort("至少需要 {minimum} 个字符").invalid_formatwithformat: 'regex'→ a row chosen by the regex source, from a table of the spec's two identifier grammars inshared/identifiers.zod.ts:SnakeCaseIdentifierSchema→engine.validation.spec.snakeCaseIdentifier,SystemIdentifierSchema→engine.validation.spec.systemIdentifier.detail(server diagnostics, CEL lint findings) → the existingtranslateValidationMessage, unchanged.English stays the spec's. The
engine.validation.spec.*rows are zh-only in thestudionamespace and read throughtOptional, so an en console finds no row and shows the message@objectstack/specwrote, never a copy kept in this repo (the same shape asengine.packages.form.help.*). The family is registered inSTUDIO_ZH_ONLY_FAMILIESand, with its reason and anchor, inZH_ONLY_REASONS/ZH_ONLY_FLOORofinspectorStrings.studioNamespace-25922.test.ts. The other eight locales fall back to the English as for every Studio string. ⛔ Nopackages/spec/**change.Callers. The summary banner and the canvas preview diagnostics in
ResourceEditPage.tsx, and the inline field errors inSchemaForm.tsx, now calltranslateSchemaIssue. The banner's item iswhitespace-normal break-wordsinstead oftruncate, with ametadata-diagnostics-itemtest id.Tests
New
ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.identifierIssueI18n-28369.test.tsx(8), the real page with the live registrations and the real served permission form, mocked client, copied from the #28232 rig:SnakeCaseIdentifierSchemarefuses an empty name withtoo_smalltheninvalid_format; the zh rows exist.truncate).Red on main, ablations, local runs (head c5e54f7)
Red through the real form on main: the three page files restored to the merge base
a878ff6c(helper kept so the file imports) →Tests 4 failed | 4 passed (8): (a), (b), (c) and (d)-door red; (b) is red there only because main's banner item has no test id.Ablations, each through
scripts/ablation-replace.mjs(anchor 1 → 0, restored blob == HEAD,git diff HEADempty):translateValidationMessage(i.message)→ (a) red,1 failed | 7 passed.truncate→ (c) red,1 failed | 7 passed.detail→ (a) + (d)-door red,2 failed | 6 passed(re-run on the final head c5e54f7, same result).3 failed | 5 passed; (d)-system stays green.stringTooShortlookup removed → 4 red,4 failed | 4 passed.Local, under the shared verify lock:
pnpm --filter @object-ui/app-shell run type-checkexit 0 (on c5e54f7);pnpm --filter @object-ui/i18n run type-checkexit 0.pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/→Test Files 684 passed (684),Tests 7251 passed | 1 skipped. The first full run (before narrowingdetailto two codes) reds 37 exact-shape cases in two files; that run pluspackages/i18n/andpackages/app-shell/src/views/studio-design/was otherwise green.node scripts/pm/dispatch-gates.mjs --commands: 34 derived commands, all exit 0 (check:type-check-debtre-run under the lock after a queue-timeout exit 3 on the first pass);--ran: 34 derived, 34 run, 0 NOT-MEASURED (derived zero).check-sdui-manifest.mjsexit 0.git merge-tree --write-treeagainst feat(console): name the records a bulk run wrote, hint which required fields to fill, and show CRM expected revenue as money #28378, feat(plugin-report): a summary report with two or more row levels draws per-group subtotals #28376 and feat(plugin-auth): opt-in Cloudflare Turnstile on email sign-up #28365 (the open PRs touchingui/packages/i18n): all exit 0, no conflict.Acceptance notes
shared/identifiers.zod.tsand the string minimum are translated. A schema with another regex (for example the dotted metadata item-name grammar) keeps its spec message in zh, as before.translateValidationMessagecall sites (EmbeddedItemEditor,PermissionMatrixEditor,studio-design) render server diagnostics, which carry no issue code, and are unchanged.content/docs/frontend/page describes the banner's text orSchemaFormIssue; nothing to update.Verification
Live, Chromium at 820 px, own backend (
objectstack dev --seed-admin, examples/app-showcase) and the Console dev server from this branch, Setup → Permission Sets → New, label 销售运营 (screenshots in the project folderissue-28369/):名称: Identifier must be at least 2 charactersand the snake_case sentence, bothtext-overflow: ellipsis, the second cut (scrollWidth > clientWidth).名称: 至少需要 2 个字符and名称: 须为小写 snake_case:以字母开头,只能包含字母、数字和下划线(例如 “user_profile”),white-space: normal, nothing cut.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgUDuwt5hhPwSTHYJ4h