Repository navigation
Translate the approval notes with the window's language - #3131
Conversation
The waiting notice and the reject note the host writes beside an approval card were English constants, so a Chinese window read a Chinese card with English system lines next to it. The host has no translator of its own: it now reads the DSH interface language the last browser reported (`flybot.uiLanguage`, the same locale the card is drawn in) and picks the Chinese pair for `zh`/`zh-*`. Every other or unknown locale, and a host no window has asked yet, keeps today's English words unchanged. The plugin API gains `uiLanguage()` in core/src/host/hooks.js, mirrored into patches/ds-bot/files; both subsystem docs record it, and one changelog fragment names the user-visible part. The notes are chosen when they are posted, so a note already in the history reads as it was written. Fixes ThinkFlowLab#3124
|
@Birfy review request — tip 35572a4 (T3) PR #3131, What changed. The approval card is translated, but the note the host writes into the chat was still two English constants. The host now exposes the language signal it already has — Why not the browser side. That would touch Tier. T3 — Checks at this tip (18): 15 success + 2 skipped + 0 cancelled + 1 failure. The only failure is Red first / green after. Red first: 3 tests, 2 pass, 1 fail — in a Written-by: FlyBot Dev-1 (posted by FlyBot Lead) |
|
Verdict: PASS at 35572a4 Ran at this tip: T3, judged on the four criteria. 1. One line of seam, not a rewrite. 2. Red first. Base blob of 3. Both languages. 4. No gate file. core/ mirror.
Checks on the tip. 18: 15 success, 2 skipped ( Base. Full social suite 704/704 at the tip (own run, not the author's), focus 3/3, red 2/3 on the base blob. |
|
Ready for queue — tip 35572a4 (T3) PR #3131, Checks at this tip: 17 success + 2 skipped + 0 cancelled + 0 failure — Written-by: FlyBot Lead |
Fixes #3124
Owner: Dev-1
Reviewer: Birfy
Written-by: Dev-1
Bot: FlyBot Dev-1
Claim-Id: a116d3a6c4904312a16a0b576d59e7d0
Tier: T3
Base: 8f01c23
Verified commit: fd4a8f2135c36b44cff931384f180f3cb80dee25
Tree: 992c8435e9f61dc187cb246aa4a223740d860a32
What changed
An approval card is drawn in the browser and is translated there; the two system notes the host writes
under it were English constants, so a Chinese window read a Chinese card followed by
Waiting for the owner's approvalandRejected..core/src/host/hooks.jsgains exactly one line —uiLanguage: () => rt.uiLanguage?.() ?? 'English'—the plugin API seam onto the value the host already keeps:
rt.uiLanguage()(core/src/host/channel.js:41)is the DSH interface language of the last browser that asked for the team, written from that browser's
statereadlocale(channel.js:329), andEnglishuntil a browser asks. That is the same locale thewindow draws the plugin's own cards in, and it is the only such signal on the host side.
plugins/social/src/hidden-remotes.jskeeps the two English constants untouched and addswaitingNote(language)/rejectNote(language)beside them, plus the Chinese pair(
等待主人批准/已拒绝。, the words the card uses).plugins/social/src/social.jsreadsflybot.uiLanguage?.()once (noteLanguage) and uses it at the twopostChatNotesites — the waitingnote on a held room line and the reject note. The text is chosen when the note is posted and stored as it
reads then; a note already in a chat's history is not rewritten. A host without the seam (an older
flybot) keeps the English notes.core/types/flybot.d.tsdeclares the new field, anddocs/subsystems/plugin-runtime.mdplusdocs/subsystems/social.mdrecord it.patches/ds-bot/files/src/host/hooks.jsandpatches/ds-bot/files/types/flybot.d.tsare the generator's mirrors (both files are stored whole underpatches/ds-bot/files/), rewritten bynode scripts/ds-bot-patches.mjs generate, not by hand.changelog.d/3124-approval-note-language.fixed.mdnames the user-visible part.Language semantics
Only the browser-reported locale decides, never the sender's language:
zh,zh-*—zh-CN,zh-TW, any case — gets both Chinese notes.en/en-USwindow, a windowwhose locale is
fr/fr-FR(a language this host does not translate), an empty locale, and a host nowindow has asked yet (
English, the host's own fallback).plugins/social/src/**changes onlyhidden-remotes.jsandsocial.js, and the constantsWAITING_OTHERS/REJECT_NOTEkeep their exact bytes (they are stillused by
chatApprovalTitle).Why not the browser side (option B, rejected)
core/src/client/**and regeneratescore/client.js(carried bypatches/ds-bot/0008). That isa single-lane file and
#3126is flying on it; only one pull request at a time may move it.translation in the browser cannot reach that path: the note is posted by the host, outside the window.
rt.uiLanguage(), fed by the browserstateread'slocale,Englishwhen no window has asked. It was simply not exposed to plugins, so exposing it is oneline, and A is the smallest surface.
core/src/client/**,core/client.jsandpatches/ds-bot/0008areuntouched here.
Tier:
core/src/host/hooks.jsis not inpolicy/gates.json'sgateFiles(14 entries, nocore/src/host/directory entry either — checked at this base), so it needs no
Policy-sign; the tier stays T3, set byplugins/social/src/**.Red first
On a clean
fc198e33e89121fbcfab472cde66773207306660worktree carrying the three new tests and none of thesource change (
TZ=UTC node --import ./test/resolve.mjs --test --test-name-pattern '#3124' test/social.test.js,log
repo/tmp/red-3124.log):# tests 3 / # pass 2 / # fail 1, and the Chinese test fails on the texts thehost actually posts:
The other two cases pin today's behaviour (an English window, no window,
fr-FR) and pass before and afterby design — they are the regression half, so a "make everything Chinese" fix cannot pass them.
Verification at the tip
Ran at
fd4a8f2135c36b44cff931384f180f3cb80dee25(rebased onto livemain8f01c231after #3128 landed;the first verify of this change ran at the pre-rebase
1dd401302138c4d0cbbaf189460de7b568728afdwith thesame result):
TZ=UTC node --import ./test/resolve.mjs --test --test-name-pattern '#3124' test/social.test.js→# tests 3 / # pass 3 / # fail 0(logrepo/tmp/green-3124-focus.log).TZ=UTC npm --prefix plugins/social test→# tests 704 / # pass 704 / # fail 0.TZ=UTC npm run verify→arch-docs: OK, plugin lint,build-client --check,ds-bot-patches check(
ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5),ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/) andcanonical(ok patches/ds-bot/ is what generate writes (generate is a no-op)) green; core suite# tests 3271 / # pass 3270 / # fail 1.The one red is this box's PATH, not the change:
not ok 152 - bench.sh shows a failed pnpm install and leaves no half-built profile,core/dev/bench.sh: 91: mkdir: not found(the harness filters pnpm out ofPATH and, on this host,
/usr/binand/binare one directory, so coreutils go with it) — reproducedidentically on a pristine
fc198e33eworktree (# tests 7 / # pass 6 / # fail 1, logrepo/tmp/benchpre-3124-base.log).plugins/social704,plugins/tree149,plugins/timeline172,plugins/workflow537,plugins/project147,.github/scripts/*.test.mjs+policy/*.test.mjs685,lint:interop,test:interop37,lint:live-e2e,test:live-e2e34 — every one# fail 0, exit 0.node .github/scripts/changelog.mjs check→changelog: 1 fragment(s) in changelog.d/ are well formed.cd core && ARCH_DOCS_BASE=8f01c231a46a1c15b0d1344764cbd4747f4b55d4 node scripts/check-arch-docs.mjs→arch-docs: OK (10 changed file(s))on the committed tree.Not run: the host smoke test (
core/dev/bench.sh smoke 3096 8796 reset+node dev/smoke.mjs smoke 3096),which
AGENTS.mdasks for on a change undersrc/host/. It cannot start on this box, and the reason is theenvironment, not the change: the first attempt died because the sandbox makes pnpm's store
(
~/.local/share/pnpm/store) read-only —EROFS: read-only file system, symlink … -> …/pnpm/store/v11/projects/…,pnpm install failed; the bench profile was not created; withXDG_DATA_HOMEmoved inside the workspace theprofile installs, and the bench then stops at
cd: can't cd to …/repo/deepseek-harness— this box has only theinstalled
@deepseek-ai/dshpackage, no DeepSeek Harness checkout at../deepseek-harnessorDSH_HARNESS,and
bench.shstartsdsh webfrom that checkout'sapps/web. Logs:repo/tmp/smoke-3124.log,repo/tmp/smoke2-3124.log,repo/tmp/smoke3-3124.log. What the one-line seam changes is an additive field onflybot; no turn, delivery or channel path is touched, and the plugin suite posts through the real host forboth notes, so the behaviour this could break is covered above.
Files
git diff --name-only 8f01c231a46a1c15b0d1344764cbd4747f4b55d4...HEAD:Ten files, three of them the change itself (
plugins/social/src/hidden-remotes.js,plugins/social/src/social.js,plugins/social/test/social.test.js) plus the one-line host seam(
core/src/host/hooks.js). The rest are forced by this repository's rules, not by choice: two generatedpatch mirrors (hard rule 4:
core/andpatches/change together), the type declaration for the new hook,two subsystem docs (
arch-docsfails without them), and one changelog fragment (a user-visible change).No gate file, no
core/src/client/**, nocore/client.js, nopatches/ds-bot/0008.Checkpoint
{ "pr": 3131, "claim": "Dev-1", "issue": 3124, "summary": "The two system notes the host writes beside an approval card were English constants, so a Chinese window read a Chinese card with English lines under it. The host now exposes the interface language the last browser reported (one line in hooks.js onto rt.uiLanguage), and the social plugin picks its words by it: zh and zh-* get 等待主人批准 and 已拒绝。, every other or unknown locale and a host no window has asked keep today's English text unchanged. A note is chosen when it is posted, so history is not rewritten.", "files": ["plugins/social/src/hidden-remotes.js", "plugins/social/src/social.js", "plugins/social/test/social.test.js", "core/src/host/hooks.js", "core/types/flybot.d.ts", "docs/subsystems/plugin-runtime.md", "docs/subsystems/social.md", "changelog.d/3124-approval-note-language.fixed.md"], "checks": { "ran": "TZ=UTC node --import ./test/resolve.mjs --test --test-name-pattern '#3124' test/social.test.js; TZ=UTC npm --prefix plugins/social test; TZ=UTC npm run verify (known host-PATH bench red only); per-segment re-runs after it; node .github/scripts/changelog.mjs check; ARCH_DOCS_BASE=8f01c231 node scripts/check-arch-docs.mjs", "result": "green", "at": "fd4a8f2135c36b44cff931384f180f3cb80dee25" }, "next": "none — ready for review" }