Skip to content

Read the Social share cards in the window's language (#3114) - #3210

Merged
Birfy merged 1 commit into
mainfrom
dev/3114-social-share-cards-zh
Nov 19, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/3114-social-share-cards-zh

Conversation

@Birfy

@Birfy Birfy commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev
Fixes #3209
Part of #3114
Owner: Dev
Reviewer: Reviewer
Tier: T2

Checkpoint

{
"pr": 3210,
"claim": "Dev",
"issue": 3209,
"summary": "The Social panel's share-request card and invite-accepted card now draw through the panel's existing tr(), so a Chinese window reads the dictionary's sentence, hint line, buttons and Sharing title instead of bare English. Seven zh entries land in core/src/client/i18n.js and reuse the existing Dismiss and your Bot. The three i18n baselines drop the eight entries that pinned those draws, and a window whose host has no translator keeps today's English character for character. Adds plugins/social/test/share-cards-i18n.test.js: 3 cases, red 3/0/3 then green 3/3.",
"files": [
"plugins/social/client.js",
"plugins/social/test/share-cards-i18n.test.js",
"core/src/client/i18n.js",
"core/test/i18n-plugins.baseline.json",
"core/test/i18n-template-draws.baseline.json",
"core/test/i18n-missing-entries.baseline.json",
"changelog.d/3114-social-share-cards-zh.changed.md"
],
"checks": { "ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify", "result": "green", "at": "1cc8ee0794dbb096634d0f772c8a571021bec59e" },
"next": "none — ready for review"
}

What changed

Eleven lines in plugins/social/client.js moved to the tr() the rest of that file already uses: the
share-request sentence, the accepted-invite sentence (and the two your Bot fallbacks), the
You asked them to share a Bot. hint, the Ask them to share a Bot button, both Dismiss buttons, the
Open {bot}'s Sharing title and Share {bot}…. core/src/client/i18n.js gains the seven matching
zh entries (A friend is one of them; Dismiss and your Bot were already there and are reused, never
duplicated). The three i18n baselines lose exactly the eight entries that pinned these draws: Dismiss#1
and Dismiss#2 from i18n-plugins.baseline.json, three from i18n-template-draws.baseline.json, three
from i18n-missing-entries.baseline.json. Nothing else in those files changed, and no new baseline entry
was added — the ratchet only shrinks.

Why

Two grounds, both on this repository, neither borrowed from the parent issue's wish list:

  1. The repository's own i18n ratchet pins this copy. core/test/i18n-missing-entries.test.js says in its
    header that "a value with no zh key cannot be translated — it is the gap, and the baseline pins today's
    gaps", and that the baseline "may only shrink … each leaves the baseline when its zh entry lands — never
    by editing the baseline". core/test/i18n-plugins.test.js (bare draws) and
    core/test/i18n-template-draws.test.js (${} template draws) are the other two views of the same debt,
    and on main all eight entries above are pinned by them.
  2. A reproducible mixed-language panel: with the window language set to Chinese, the Social panel's other
    chrome is Chinese while these two cards still read Helper (Eve) tried to start a chat with Writer. Writer is not shared with them. / Dismiss / Share Writer… and Chief Grant (SelfB1025) accepted your invite. … / Dismiss / Ask them to share a Bot.

Scope

Only the two cards. The rest of Social's i18n debt stays in the baselines (Close, Copy, Copy link,
New link, Your Bots, …) — this PR does not claim to finish it. Nothing under core/src/host/**,
core/src/shared/**, plugins/social/src/**, plugins/social/index.js, .github/**, policy/** or
authz.js is touched. Generated files are core/client.js and patches/ds-bot/**, rebuilt in the fixed
order (build-client → add → generate → check → canonical → mojibake).

Overlap with #3112

#3112 is still open (mergeable_state: dirty) and adds its own 'A friend': '一位好友' next to
'Friend requests'. Both hunks are in core/src/client/i18n.js but do not overlap, so git will keep both
and leave a duplicate key: whichever lands second deletes its own 'A friend' and keeps the other's
position; grantRequestSentence's tr('A friend') then uses the remaining key. If #3112 lands first, this
card drops that one line and the handwritten count becomes +200/−19 (see A12 in the spec).

Docs-not-needed: the two cards keep their layout, state and server calls; this cut adds seven zh dictionary entries and routes eleven existing literals through the panel's own tr(). docs/subsystems/social.md and core-client.md describe the panel and the bundle, not its copy.

Verification at the tip (1cc8ee0794dbb096634d0f772c8a571021bec59e)

Ran: cd plugins/social && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test test/share-cards-i18n.test.js → # tests 3 / # pass 3 / # fail 0 (red first, unmodified implementation, same command: 3 / 0 / 3, messages below).
Ran: cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/i18n-plugins.test.js test/i18n-template-draws.test.js test/i18n-missing-entries.test.js test/i18n-plugins-missing-zh.test.js test/i18n.test.js → 39 / 39 / 0.
Ran: cd plugins/social && … --test test/social.test.js → 500 / 500 / 0; … --test test/social-readonly.test.js test/face-chip-i18n.test.js → 20 / 20 / 0.
Ran: cd core && node scripts/build-client.mjs; node scripts/ds-bot-patches.mjs generate → check → three ok lines; canonical → ok patches/ds-bot/ is what generate writes; node .github/scripts/check-mojibake.mjs --check → ok — 0 occurrences of U+FFFD.
Ran: node .github/scripts/changelog.mjs check → 13 fragment(s) in changelog.d/ are well formed.
Ran: TZ=UTC TMPDIR=/data/flybot-tmp npm run verify → exit 0 (arch-docs: OK (13 changed file(s))).
Ran: git diff --numstat base -- plugins/social core/src core/test changelog.d → +201 / −19, 7 handwritten files, 220 lines; git diff --name-only base → 13 paths (7 handwritten + 6 generated). base is the tarball commit 5068074de86e, whose tree 50616cdc31eee0febb3b3b18c6df2c313378d043 is c0061ba's tree.

Red-first messages, verbatim from the unmodified implementation:

  • the share request still reads: Helper (Eve) tried to start a chat with Writer. Writer is not shared with them.
  • the accept notice still reads: Chief Grant (SelfB1025) accepted your invite. They can message Chief. You cannot message them until they share a Bot with you.
  • the baselines still pin an English draw: plugins/social/client.js:Open {}'s Sharing, plugins/social/client.js:Share {}…, plugins/social/client.js:{} tried to start a chat with {}. {} is not shared with them., plugins/social/client.js:Ask them to share a Bot, plugins/social/client.js:You asked them to share a Bot., plugins/social/client.js:{} accepted your invite. They can message {}. You cannot message them until they share a Bot with you.

Not run: a real browser check of the mixed-language panel — the zh dictionary and the rendered tree are
covered here, but nobody opened Social in a Chinese window.
Not run: the #3112 interaction — that PR is open and dirty, so the duplicate 'A friend' key cannot be
observed on main yet; the rule for whichever lands second is written under Overlap with #3112.
Not run: Social's other i18n debt (Close, Copy, Copy link, New link, Your Bots, …) — it stays
pinned in i18n-plugins.baseline.json; this PR only shrinks the eight entries it settles.

The share-request card and the invite-accepted card drew their sentence, the
asked hint, both buttons, the two `your Bot` fallbacks and the Sharing title as
bare English, so a Chinese window read English on those two cards while the rest
of the Social panel followed the window. `plugins/social/client.js` already has
`tr()`; these eleven lines now go through it and the seven entries land in
`core/src/client/i18n.js`, so the three i18n baselines drop the eight entries
that pinned the draws. A window without a translator keeps today's English word
for word.

Fixes #3209
Part of #3114
Docs-not-needed: the two cards keep their layout, state and server calls; this cut adds seven zh dictionary entries and routes eleven existing literals through the panel's own tr(). docs/subsystems/social.md and core-client.md describe the panel and the bundle, not its copy.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 19, 2026
@Birfy Birfy self-assigned this Nov 19, 2026
@Birfy

Birfy commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at 1cc8ee0
Written-by: Reviewer
Attestation: 1cc8ee0 role=Reviewer

Ran at this tip:

$ cd plugins/social && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot node --import ./test/resolve.mjs --test test/share-cards-i18n.test.js
$ cd plugins/social && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot npm test
$ cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/i18n-plugins.test.js test/i18n-template-draws.test.js test/i18n-missing-entries.test.js test/i18n-plugins-missing-zh.test.js test/i18n.test.js
$ cd core && TZ=UTC TMPDIR=/data/flybot-tmp DSH_HARNESS=/opt/flybot npm test
$ cd <tip copy> && node core/scripts/build-client.mjs --check
$ cd <tip copy> && PATH=<tools/git/bin>:$PATH node scripts/ds-bot-patches.mjs check
$ cd <tip copy> && PATH=<tools/git/bin>:$PATH node scripts/ds-bot-patches.mjs canonical
$ cd <tip copy> && TZ=UTC node .github/scripts/changelog.mjs check && node .github/scripts/check-mojibake.mjs --check && node .github/scripts/testing-layers.mjs --check
$ cd <tip copy with client.js + i18n.js + 3 baselines from c0061ba, new test kept> && <the new-test command above>
# tests 3  # pass 3  # fail 0

Red first: with the implementation alone reverted to c0061ba (the new test kept) the same command gives # tests 3 # pass 0 # fail 3, the three messages from spec §4 verbatim: the share request still reads: Helper (Eve) tried to start a chat with Writer. Writer is not shared with them., the accept notice still reads: Chief Grant (SelfB1025) accepted your invite. They can message Chief. You cannot message them until they share a Bot with you., the baselines still pin an English draw: …Open {}'s Sharing, …Share {}…, …{} tried to start a chat with {}…, …Ask them to share a Bot, …You asked them to share a Bot., …{} accepted your invite…. Measured nuance: reverting only plugins/social/client.js leaves case 3 green (2/1), because that case reads the baselines and the no-translator English, not the client — so the body's 3/0/3 is the full-revert number, which is what I reproduced.

Tier: recomputed with the repository's own gate at this tip — the risk tier (report only) job on 1cc8ee07 logs risk-gate (report only): PR #3210 tier T2, and plugins/** is a T2 path in .github/agent/risk-rules.json. T2: green CI + this PASS, no second approval needed.

Scope (13 files, +233/−29; handwritten 7 files +201/−19): plugins/social/client.js +11/−11 (11 draws moved to tr()), core/src/client/i18n.js +12/−0, plugins/social/test/share-cards-i18n.test.js +177/−0, three baselines −3/−2/−3, one changelog fragment +1. Generated: core/client.js +9, patches/ds-bot/0001-core-fixes.patch, 0008-client-bundle.patch and their three baseline mirrors. git diff --name-only carries no core/src/host/**, core/src/shared/**, plugins/social/src/**, plugins/social/index.js, .github/**, policy/**, ds-bot/**, ds-bot.pin.json; topics.json untouched; no core/node_modules.

Baselines only shrink: parsed arrays show 3 removed from i18n-missing-entries (Ask them…, You asked…, {} accepted your invite…), 2 from i18n-plugins (Dismiss#1, Dismiss#2), 3 from i18n-template-draws (Open {}'s Sharing, Share {}…, {} tried to start…), 0 added, order preserved, every other field byte-identical; the three patches/ds-bot/files/test/ mirrors are cmp-identical to the core/test/ copies.

Reuse, no new duplicates: the dictionary gains exactly 7 keys (5 single-line + 2 wrapped across two lines), the ZH object has no duplicate key, and Dismiss: '关闭' / 'your Bot': '你的 Bot' are still one entry each, as on base.

Generated files agree with source: build-client.mjs --check exit 0; ds-bot-patches.mjs check → ok 10 patches apply cleanly in order + ok core/ equals ds-bot/ + patches/ds-bot/ (no differs from, no committed but not produced); canonical → ok patches/ds-bot/ is what generate writes (generate is a no-op); re-running generate changed nothing (diff -r against the tarball clean).

No-translator window: case 3 pins the bare-window English draw (Dismiss, Share Writer…, Open Writer's Sharing, A friend accepted your invite…your Bot) character for character, and it is green at the tip.

Suites at the tip: new test 3/3; plugins/social whole npm test 720/720 exit 0; the five core i18n tests 39/39; core whole suite 3339 tests / 3329 pass / 8 fail — all 8 (activity-row-host, client-cut-sites, composer-label, header-effects, read-page, thinking-row, bench-preflight, check-arch-docs) fail identically on c0061ba in this container (Cannot find module 'jsdom', missing pnpm, git), so they are an environment gap, not this diff. changelog.mjs check → 13 fragments well formed; check-mojibake.mjs --check → 0 occurrences of U+FFFD; testing-layers.mjs --check → every test file and workflow classified.

CI at the head: 21 check-runs, all completed; enqueue-guard: failure is the expected pre-PASS state, agent-audience and judge each carry one superseded cancelled; every other run is success (tests-ok, merge-gate, risk tier, reviewed tip, plugins (social|timeline|tree|workflow), mock · ubuntu, package, policy-sign, ubuntu-latest). It should turn green once this PASS exists.

Grounds in the body are the two §1.1 ones — the repo's own i18n ratchet (the i18n-missing-entries header plus the two sibling baselines) and the reproducible mixed-language panel. The body cites neither #3110 L93 nor L205/L207, so the withdrawn reference is not in play. Nit only, no change needed: the new test's three case names still carry a #3110: prefix (attribution, not a citation).

#3112 is still open (mergeable_state: dirty) and main's core/src/client/i18n.js has no 'A friend' yet, so the two 'A friend' keys may coexist after both land: whichever merges second deletes its own 'A friend' and keeps the other's position; grantRequestSentence then reads the remaining key. Note for the second merger, not a gap here.

Checkpoint block: valid JSON, pr=3210, claim=Dev, issue=3209, summary 563 chars, 7 files (all in this diff), checks.ran/result/at present, next 26 chars, whole block 1214 chars — under the 1500 limit. Body carries Reviewer: Reviewer (not the Owner) and the PR carries agent-pr.

Not run: npm run verify end to end — in this container it stops at core/scripts/lint.mjs with exit 2 because /opt/flybot has no node_modules/oxlint, so I ran its steps one by one (core suite, social suite, build-client --check, ds-bot-patches check+canonical, changelog/mojibake/testing-layers) instead. Not run: a real browser render of the two cards in a Chinese window.

@github-actions github-actions Bot added the pass label Nov 19, 2026
@Birfy
Birfy added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit f436255 Nov 19, 2026
19 of 21 checks passed
@Birfy
Birfy deleted the dev/3114-social-share-cards-zh branch November 19, 2026 08:05
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Social 两张通知卡(分享请求 / 已接受邀请)在中文窗口里仍是硬编码英文

1 participant