Repository navigation
fix(service-storage): Setup storage Test connection answers in the caller's language (#30335) - #30627
Merged
Merged
Conversation
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 Bill · project thread
domain:server#2 · os-bill · session_01Utp6CaWLG2RrgKub5oRNjC
维护者速读
Storage round-trip succeeded (adapter=local).,管理员可能读不懂下一步。fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551 已让设置动作拿到调用者语言,本 PR 让存储这个按钮用上它。storage/test处理器和一个新文案文件;ok、severity、探针上传下载删除、运维日志都不变;英文调用方的句子一字不变。回滚即还原本 PR。packages/services/service-storage/src/storage-test-copy.ts(文案表与storageTestCopyLocaleOf语言查找);其次storage-service-plugin.ts里storage/test的四处copy.调用。pnpm --filter @objectstack/service-storage exec vitest run --maxWorkers=2 src/storage-test-locale.test.ts,预期 10 个全绿,第一个用例的消息是存储连接测试成功(适配器:local)。Refs #30335
Clause-②: no
Metadata-protocol: none
What changes
The console prints the
storage/testsettings action'smessageas the toast, bare. Since #30551 the settings action route hands each action handler the caller's display language as the input'slocale(Accept-Language, else?locale;settings-routes.tsrequestLocaleOf). The storage handler now writes its answer in that language.packages/services/service-storage/src/storage-test-copy.ts: one entry per language on the platform locale table (PLATFORM_LOCALES):en,zh-CN,zh-Hant,es-ES,ar,fr,pt-BR,ru,de,ja-JP,ko. The four codes this package's bundles already used keep their keys. Four sentences each: success (still names the adapter), probe read back not the one written, S3 settings missing a bucket or a region, and a lead-in for an adapter's own error.storage/testreadslocalefrom the handler input, the same source as the mail test notice in fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551. The adapter's own error text (S3 SDK, file system) stays verbatim: alone in English, as before; in another language behind the lead-in (存储连接测试失败:…), so the reader knows the rest is the adapter's untranslated report.buildAdapterFromValuesthrows a newS3SettingsIncompleteErrorwith the same English message as before, so the settings re-apply path and itswarnlog line are byte-identical; only thestorage/testanswer reads the type to localise the refusal.ok,severity, the adapter name, the probe and its cleanup, everyctx.loggerline, and every sentence an English or locale-less caller gets.Where the strings live, and one deviation from the precedent. The precedent is #30376 (
mfa-required-enrollment-predicate.ts): a settings handler's prose sits in a module-level copy table beside its code, not in the package'stranslations/bundles (those carry object metadata). This PR follows it, with one difference: the lookup does not use@objectstack/core'sresolveLocale. With bothzh-CNandzh-Hantin one table, that ladder's base-language and first-variant steps answerzh-TWby key order, which is the trap the platform table's own reader warns about (packages/spec/src/system/platform-locales.ts, theplatformLocaleTagOfnote). SostorageTestCopyLocaleOfreads the caller's code throughplatformLocaleTagOf(aliaseszh-TW,pt,en-US; table tagszh-Hans,ja), then drops one subtag at a time (RFC 4647 lookup:fr-CA→fr,zh-Hant-TW→zh-Hant), and falls back to English. This is the gap #30538 names (resolveBundleLocale/resolveLocaledo not readplatformLocaleTagOf); once #30538 lands this module can go back to the shared resolver.Tests
New
packages/services/service-storage/src/storage-test-locale.test.ts, 10 cases, all through the REAL handler the plugin registers, on a real local adapter, with the inputlocaleset or absent:ok: true,severity: 'info'; en-US success is the old English sentence;tr-TR(not on the table) and''answer the old English sentence;zhresolves to the zh-CN copy;ok: false,severity: 'error'), and the probe object is still removed;PLATFORM_LOCALE_TAGStag finds its own entry;Existing pins in
storage-service-plugin.test.tsandstorage-service-plugin.probe-cleanup-store.test.ts(English messages, no locale) pass unchanged.Acceptance notes
c23eafa8):locale: 'zh-CN'and no locale both answeredStorage round-trip succeeded (adapter=local).; mismatchProbe download did not match upload.; S3StorageServicePlugin: S3 adapter requires s3_bucket and s3_region.Clause-②: no: nothing outside this package's own tests matches the English text (git grep -n "round-trip succeeded\|did not match upload"hits onlyservice-storage). The console prints the message and readsok.dir.SettingsService+ routes was not added here: service-storage has no service-settings dependency, and fix: Setup form help speaks to an administrator; queue pages, mail status banner and test toast read in Chinese #30551 pins the route → handlerlocalehop.Verification
All on head
47c43908c(merge ofmainatbdbaf80c, which carries #30551).Local runs
pnpm --filter @objectstack/service-storage test: Test Files 73 passed (73), Tests 1353 passed (1353).pnpm --filter @objectstack/service-storage typecheck: exit 0 (check:test-typecheck: OK).node scripts/check-i18n-bundles.mjs: exit 0 (10 packages, all bundles in sync).node scripts/pm/dispatch-gates.mjs --commands: 62 derived families, all 62 exit 0;--ran: 62 derived, 62 run, 0 NOT-MEASURED.eslint --no-inline-configon the three changed source files: exit 0.pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test):VERDICT command-exit 0, Test Files 420 passed, 3 skipped (423); Tests 3496 passed, 36 skipped (3532).Ablations (scripts/ablation-replace.mjs, each restored, git diff HEAD empty after)
locale: 5 failed, 5 passed (the five zh cases).en→zh-CN: 4 failed (no-locale English, no-locale S3, the lead-in case, the mapping pin).koentry: 1 failed (all 11 languages pin).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CaWLG2RrgKub5oRNjC