From 4f41480fa1dfae90a2dd6741dcb585233e4cd907 Mon Sep 17 00:00:00 2001 From: argszero Date: Sat, 12 Sep 2026 14:39:05 +0800 Subject: [PATCH] docs(i18n): drop the stale per-update count log from the gate comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `src/i18n_pack.rs`'s positive-control comment block described "本次更新" with the numbers of the release that wrote it (the sharing 本月新增 card: 783 -> 786 keys, 531 -> 535 call sites, 426 -> 429 distinct) while the six constants directly beneath it read 785 / 785 / 330 / 305 / 537 / 430. C2015 wrote that narrative and C2019 moved the constants to 785/537/430 without touching it, so the comment has contradicted its own code for two commits. Why it survived: only the comment was wrong. The constants are internally consistent, so `cargo test` stayed green throughout — there is no assertion on prose. Fix: delete the per-update narrative and keep only the orientation-independent rule (calibrate against the extractor's real output, never hand-compute), which cannot rot. Each cycle's delta belongs to the commit history (`git log -p src/i18n_pack.rs`), not to a copy maintained in the file. The replacement block deliberately contains no "old -> new" notation: in this position that notation reads as an assertion about the current value, and the constants below are the only authority for that. (Writing the clean-up this way first re-created the confusion it removes — the checker flagged the fix itself.) Also records which set T_LITERAL_COUNT counts: it is the T() call-site total, neither the key count nor the distinct count (three different sets). Comment-only change: src/i18n_pack.rs is a #[cfg(test)]-only module, so no production behaviour changes and no constants move. 165 tests pass. Co-authored-by: argszero --- src/i18n_pack.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/i18n_pack.rs b/src/i18n_pack.rs index 5ecce8f..9f8a6d0 100644 --- a/src/i18n_pack.rs +++ b/src/i18n_pack.rs @@ -32,17 +32,22 @@ const EN_END: &str = "\n };"; /// 阳性对照真值:**改动语言包/前端文案时应刻意更新这些数字**。 /// 它们的作用是把「提取器静默失真」与「语言包真的变了」区分开(见 `packs()`)。 /// -/// 本次更新(共享页「本月新增」卡):783 → 786 = **+3 键** -/// (`share.stats.newthis{,.sub,.none}`),531 → 535 / 426 → 429 = **+4 个 `T()` 字面量调用点 / +3 个去重键** -/// (卡片 1 个 + 副标题三元 3 个:单个模型取模型名不上键、多个 / 空各 1 个 `T()`,共 4 处调用 3 个新键)。 -/// `STATIC_ATTR_*` 不变:本次未改 `ui/index.html` 的静态属性(仅 cache-bust 串)。 +/// ⚠️ 加数时**别口算**:C2013 先把增量估成 +6(漏了 `fmtUptime` 里的重复调用), +/// 门禁把真值报了出来。改动后请以提取器的实际输出校准,再核对是否与 diff 相符: +/// 先让门禁报出真值、再照抄,**不要**先写一个自己算的数。 /// -/// 上一轮(运营概览「服务版本 / 运行时长」两张卡):775 → 783 键,520 → 531 / 418 → 426。 +/// ⚠️ 这里**不记录「本次改了多少」**(C2024):那段叙述只在写下它的那一次提交里正确, +/// 下一次改语言包的人会改这 6 个常量,却几乎不会想起回来改注释 —— 注释就会在一行之隔 +/// 自相矛盾。真实发生过:C2015 按当时实得把键数写成 786,C2019 把常量改成 785 而未动注释, +/// 相隔仅两个提交;`cargo test` 全程是绿的,因为**错的只是注释**(常量本身自洽)。 +/// **每一轮的增量属于提交历史**(`git log -p src/i18n_pack.rs`),不在文件里维护副本; +/// 这里只留「改的时候怎么做」的规则,它不随版本腐烂。 /// -/// ⚠️ 加数时**别口算**:C2013 我先把增量估成 +6(漏了 `fmtUptime` 里的重复调用), -/// 是这条阳性对照把 531 报了出来。改动后请以提取器的实际输出校准,再核对是否与 diff 相符。 -/// 本轮实测的校准路径就是这条规则:783/531/426 三处**依次**报出 786 → 535 → 429, -/// 每一步都是先让门禁报出真值、再照抄,而不是先写一个自己算的数。 +/// ⚠️ 因此本段刻意不含任何「旧值 → 新值」写法:那种写法读起来就是在断言当前值, +/// 而当前值只有下面这 6 个常量是权威。历史请查 `git log -L 32,52:src/i18n_pack.rs`。 +/// +/// ⚠️ `T_LITERAL_COUNT` 是 `T("…")` **调用点**总数,不是键数,也不是去重后的键数 —— +/// 三个集合各不相同(坑 99);说「这个数不该变」之前先确认它在数哪个集合。 const ZH_KEY_COUNT: usize = 785; const EN_KEY_COUNT: usize = 785; const STATIC_ATTR_COUNT: usize = 330;