Repository navigation
Commit 6c7c002
authored
fix(social): read the face-card time in the interface language (#3099)
Fixes #3098
Owner: Dev-1
Reviewer: Birfy
Written-by: Dev-1
Bot: FlyBot Dev-1
Claim-Id: b575535a2ed847ffa24bfe8952d25e0e
Tier: T2
Base: 3431164
Verified commit: 67a9f69285f4588283c6736be331fc36e726a9db
Tree: 470371f
Tip SHA: 77c3880
## What was wrong
A Past face-to-face card drew its two times in English inside a Chinese
window. The row's day came from a month table written at the draw site
(`Oct 19`), the hover prefix was a bare `Ended` / `Started` literal, and
the title rebuilt from the room's members hardcoded `Face-to-face` plus
the same English month table. So a zh window read `Ended Oct 19 14:05`
on hover and `Face-to-face · Alice · Oct 19 14:05` as the row's title.
The dictionary already held `'Face-to-face': '面对面'` and, since #3097,
`Ended: '已结束'`; nothing that draws this card asked for them.
## The change
Two drawing points, both display only:
- `faceRowTime` (`plugins/social/client.js:2030`) — the day goes through
`faceDay` (`2018`, `10月19日` in a zh window, `Oct 19` otherwise) and the
hover prefix through `tr(Number.isFinite(ended) ? 'Ended' : 'Started')`.
`core/src/client/i18n.js` gains `Started: '开始'` next to the `Ended`
#3097 already put in place; the duplicate this branch had carried is
dropped on rebase.
- `shownFaceTitle` (`1979`) — the first word through
`tr('Face-to-face')`, the created-time day through `faceDay`, and a
stored auto name's own English stamp through the new `faceStamp`
(`2024`), which rewrites the stamp only in a zh window and returns its
input byte for byte otherwise.
The language probe is `zhUi()` (`1020`):
`globalThis.__flybot__.t('Tasks') === '任务'`, the same shape the workflow
client uses. A plain browser script cannot import core's `language()`,
and a date's word order is the one thing a translator cannot carry.
**The parsing side is untouched, on purpose.**
`named.startsWith('Face-to-face · ')`, `/ · ([A-Z][a-z]{2} \d{1,2}
\d{2}:\d{2})$/`, `/ · (\d{6})$/`, `isAutoFaceTitle` and
`formatFaceRoomTitle` all still read `room.name` exactly as before, and
the stored name is never rewritten — it is what the server saved and
what the next render parses again. Only what the title shows follows the
window.
Before touching the title I checked for a read-back: `shownFaceTitle` is
called at the draw site only (`2079`) and from the test; its output also
feeds the row's `aria-label: 'Open <title>'`, an accessible name that
nothing parses. There is no storage and no re-parse of the rebuilt
string, so the display/parse split is safe.
## Red first, at `34311643`, twice
With the new test file in place and both source files reverted to the
base (`git checkout 3431164 -- plugins/social/client.js
core/src/client/i18n.js`), `node --import ./test/resolve.mjs --test
test/zh-face-time.test.js` → **6 tests, 2 pass, 4 fail**, exit 1, both
runs:
```
not ok 1 - #P769b: a Past row's hover names the end and the day in the window's language
not ok 2 - #P769b: a room that never ended says when it started, in the window's language
not ok 3 - #P769b: today's row keeps its bare clock and still hovers in the window's language
ok 4 - #P769b: an English window keeps the row and hover bytes it drew before
not ok 5 - #P769b: a Past row's rebuilt title reads the window's language too
ok 6 - #P769b: an English window keeps the rebuilt title bytes it drew before
```
Observed vs expected on the acceptance cases: the row's own day saw
`"Oct 19"` where `10月19日` is required; the hover gave `Ended Nov 15
02:35` where the row's word must be zh; the rebuilt title saw
`"Face-to-face · Alice · Oct 19 14:05"` where `面对面 · Alice · 10月19日
14:05` is required.
The two English cases are controls and pass before the change on
purpose: this PR must not move an English window's bytes.
## Green after, twice, plus a second time zone
Same command on this tree → **6 tests, 6 pass, 0 fail**, exit 0, twice
(`sha256` of the logs `d3a2e40fb5722390`, `b098842c62ef8990`), and
**6/6/0** under `TZ=Asia/Shanghai`, so the day comparison does not
depend on the machine's zone.
## Generated side, on the new base
`node core/scripts/build-client.mjs` rewrote the bundle and `node
scripts/ds-bot-patches.mjs generate` rewrote `patches/ds-bot/` on
`34311643`; after that:
- `node core/scripts/build-client.mjs --check` → exit 0, clean
- `node scripts/ds-bot-patches.mjs check` → three `ok` lines (ds-bot =
Fei2411/DeepSeek-Bot@2b10c70, 10 patches apply cleanly in order, `core/`
equals `ds-bot/` + `patches/ds-bot/`)
- `node scripts/ds-bot-patches.mjs canonical` → `generate` is a no-op
Relative to the base the two patch files move `+3/−1` each, which is the
header renumbering #3097 caused above them in `i18n.js`; the regenerated
bytes are exactly what `generate` writes, which the `canonical` run
above confirms.
## Full verify on tree `470371ff`
`unset ARCH_DOCS_BASE; TZ=UTC npm run verify` (the gate then reads live
`origin/main`, which is this branch's base `34311643`) → **exit 0**:
core 3255, social 698, tree 149, timeline 172, workflow 535, project
147, gate/policy 681, interop 37, live-e2e 34 — **0 fail** in every
suite (`sha256` of the log `57fd8f955b3d79a2`).
Also `arch-docs: OK (9 changed file(s))`; core lint 88 warnings / 0
errors and plugin lint social 40 warnings / 0 errors (all pre-existing);
`changelog: 5 fragment(s) in changelog.d/ are well formed`; `mojibake:
ok — 0 occurrences of U+FFFD in 1714 text file(s)`; `testing-layers:
every test file and every workflow is classified` (886 files, 16
workflows).
## Docs
The gate wants the subsystem page under a user-visible change like this
one, so both pages move with it:
- `docs/subsystems/social.md`: the Past row's time entry now says the
day, the hover word and the first word of the rebuilt title follow the
interface language, that the stored `room.name` and every parser of it
stay English, and names `plugins/social/test/zh-face-time.test.js`.
- `docs/subsystems/core-client.md`: the i18n map row now lists the Past
row's hover words **Ended** / **Started** next to the chip words #3090
already put there.
`node core/scripts/check-arch-docs.mjs` against live `main` (no
`ARCH_DOCS_BASE`) → `arch-docs: OK (9 changed file(s))`, exit 0. Run the
same way in the single-commit shape CI sees (`git log <base>..HEAD`
holding one commit) → same answer, so the gate no longer depends on
branch commit granularity.
## Files
9 files, `+219/−12`:
- `plugins/social/client.js` `+33/−8` — the two drawing points and the
three helpers
- `plugins/social/test/zh-face-time.test.js` `+173/−0` — six cases: four
zh acceptance, two English byte controls
- `core/src/client/i18n.js` `+2/−0` — `Started: '开始'`
- `core/client.js` `+2/−0` — generated bundle
- `patches/ds-bot/0001-core-fixes.patch` `+3/−1`,
`patches/ds-bot/0008-client-bundle.patch` `+3/−1` — regenerated
- `docs/subsystems/social.md` `+1/−1`, `docs/subsystems/core-client.md`
`+1/−1` — the two subsystem pages
- `changelog.d/3098-past-room-time-zh.fixed.md` `+1/−0`
## Checkpoint
<!-- flybot:checkpoint -->
```json
{
"pr": 3099,
"claim": "Dev-1",
"issue": 3098,
"summary": "A Past face-to-face card drew its day, its hover prefix and the title rebuilt from the room's members in English inside a zh window. Both drawing points now follow the window's language: faceDay writes 10月19日, the hover prefix goes through the dictionary (Started added; Ended came with #3097), and the first word of the rebuilt title is tr('Face-to-face'). The stored room name and every rule that parses it are untouched, so an English window's bytes do not move. Six cases mount the card: four zh acceptance, two English byte controls that are green before and after.",
"files": [
"plugins/social/client.js",
"plugins/social/test/zh-face-time.test.js",
"core/src/client/i18n.js",
"core/client.js",
"patches/ds-bot/0001-core-fixes.patch",
"patches/ds-bot/0008-client-bundle.patch",
"docs/subsystems/social.md",
"docs/subsystems/core-client.md",
"changelog.d/3098-past-room-time-zh.fixed.md"
],
"checks": { "ran": "TZ=UTC npm run verify; node --import ./test/resolve.mjs --test test/zh-face-time.test.js (red x2 before, green x2 after, plus TZ=Asia/Shanghai); build-client --check; ds-bot-patches check and canonical; arch-docs, changelog, testing-layers, check-mojibake", "result": "green", "at": "77c3880056f526d87fd5ad2e8c387354526b94cc" },
"next": "review; no further commit on this branch"
}
```
<!-- /flybot:checkpoint -->1 parent 3431164 commit 6c7c002
9 files changed
Lines changed: 219 additions & 12 deletions
File tree
- changelog.d
- core
- src/client
- docs/subsystems
- patches/ds-bot
- plugins/social
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
855 | | - | |
| 855 | + | |
856 | 856 | | |
857 | 857 | | |
858 | 858 | | |
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
| 889 | + | |
| 890 | + | |
889 | 891 | | |
890 | 892 | | |
891 | 893 | | |
| |||
0 commit comments