fix(m197): 复审 r1 的 P1 + 三条 P2(描述对齐行为 / 内部编号下屏 / kind 守卫 / gh-proxy 可覆盖)

P1(阻断)`java.auto_install` 的描述与行为不一致——那句会进 AI 工具的 JSON Schema
`description`,等于让助手对用户说一件实现刻意不做的事:
- `crates/core/src/setting/keys.rs`:改成「缺 Java 时在 Java 页标出推荐版本并可一键安装;
  不会自动下载」,去掉 `(D13 基准 JDK17)`。
- `SettingsJavaAutoInstallHint` 中英两侧各补一句显式否定(「不会自己开始下载 —— 点「安装」
  才会下」/ "Nothing is downloaded on its own — you press Install."),标签从「自动准备」改成
  「缺 JDK 时推荐一档」;金表同步。
- 新增守卫 `the_auto_install_description_says_it_never_downloads_by_itself`(描述必须含
  「不会自动下载」、不含旧说法与内部编号)。

P2-1 内部决策编号印在界面上:`SettingsJavaDownloadBaseline` 的 `Baseline (D13)` /
`基准版本(D13)` → `Recommended baseline` / `推荐基准版本`(金表同步)。另加两条目录级守卫
(`no_user_visible_string_mentions_an_internal_decision_id` /
`no_user_visible_string_carries_markdown_backticks`);后者顺带清掉 M168 遗留的
`FontCjkStatusHint` 里的 `ui.font_cdn` 反引号——全仓最后一条。

P2-2 `ProgressEvent::SourceFailed.kind` 没有守卫:`engine_mock_test`
- `reports_progress_events_and_errors_when_all_sources_fail` 的解构补 `kind`,断言
  `ServerError`;
- 新增 `a_404_is_classified_as_not_found_and_never_cools_the_source_down`(404 → `NotFound`,
  与「源坏了」分开)。

P2-3 交付任务书那句「(默认值可改)」:新增 `download.gh_proxy`(空 = 跟随内置默认 /
`off` = 关 / 其它 = 覆盖前缀),`engine_with` 是它的真消费者(改 `RegionProfile`,因为
`gh_proxy_candidates` 读的就是档案里的前缀);Java 页不画 UI(归 M193)。**内置默认值没动**。
schema minor 1.7.0 → 1.8.0(新键必须推 minor),三处硬编码 minor 的用例同步。

另:真下载用例改成 panic 也清理(复审顺带项 7④);`downloads/refusal.rs` 的「四档」改「五档」。
This commit is contained in:
AskaEth committed 2026-11-08 21:35:13 +08:00
1 parent 9a7b138d08
commit a14b00aced
15 files changed
+387 -28

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ macro_rules! font_install_entries {
"无法探测系统字体,因此没有下载"
),
FontCjkStatusHint => (
"Downloaded once into the data directory and cached; the next start does not download it again. A mirror can be set with `ui.font_cdn`.",
"Downloaded once into the data directory and cached; the next start does not download it again. A mirror can be set with ui.font_cdn.",
"只下这一次,缓存在数据目录里,下次启动不重下。镜像可用配置键 ui.font_cdn 指定。"
),
} }
+3 -3
View File
@@ -100,7 +100,7 @@ pub(super) const ROWS: &[(&str, &str, &str)] = &[
("SettingsJavaDownloadTitle", "Download a JDK", "下载一个 JDK"),
("SettingsJavaDownloadHint", "Downloads go through the built-in mirror table: in China the campus mirrors are tried first (Temurin over Tsinghua TUNA), and GitHub-hosted archives are fetched through gh-proxy. Every archive is verified against its SHA-256 before it is unpacked.", "下载走内置镜像表:国内先试院校镜像(Temurin 走清华 TUNA),GitHub 上的归档套 gh-proxy。落盘前一律按 SHA-256 校验。"),
("SettingsJavaDownloadLts", "LTS", "长期支持版(LTS)"),
("SettingsJavaDownloadBaseline", "Baseline (D13)", "基准版本(D13)"),
("SettingsJavaDownloadBaseline", "Recommended baseline", "推荐基准版本"),
("SettingsJavaDownloadVendors", "Vendors: {vendors}", "发行版:{vendors}"),
("SettingsJavaDownloadNoVendor", "No vendor publishes this major version on this platform.", "这个平台上没有发行版发这个大版本。"),
("SettingsJavaDownloadAction", "Install", "安装"),
@@ -155,8 +155,8 @@ pub(super) const ROWS: &[(&str, &str, &str)] = &[
("SettingsJavaVendorDown", "Down", "下移"),
("SettingsJavaVendorReset", "Reset to the region default", "恢复地区默认序"),
("SettingsJavaVendorSupports", "ships {majors}", "发 {majors}"),
("SettingsJavaAutoInstall", "Prepare a JDK when none is found", "缺 JDK 时自动准备"),
("SettingsJavaAutoInstallHint", "On: the catalog below marks the version the current instance needs, and a freshly installed JDK becomes the default when no default is set yet. Off: you pick everything yourself.", "开:下面的目录会按当前实例的要求标出该装哪一档,装完之后若还没有默认 JDK 就自动设为默认。关:全部自己挑。"),
("SettingsJavaAutoInstall", "Recommend a JDK when none is found", "缺 JDK 时推荐一档"),
("SettingsJavaAutoInstallHint", "On: the catalog below marks the version the current instance needs, and a freshly installed JDK becomes the default when no default is set yet. Nothing is downloaded on its own — you press Install. Off: nothing is marked and you pick everything yourself.", "开:下面的目录会按当前实例的要求标出该装哪一档,装完之后若还没有默认 JDK 就自动设为默认。不会自己开始下载 —— 点「安装」才会下。关:什么也不标,全部自己挑。"),
("SettingsJavaAutoInstallOn", "on", "开"),
("SettingsJavaAutoInstallOff", "off", "关"),
("SettingsJavaPrefsSave", "Save", "保存"),
+1 -1
View File
@@ -220,5 +220,5 @@ pub(super) const ROWS: &[(&str, &str, &str)] = &[
("FontCjkReasonDisk", "cannot write to the data directory", "写不进数据目录"),
("FontCjkStatusUnknown", "Not determined yet; nothing was downloaded", "尚未判定;没有下载任何字体"),
("FontCjkStatusUnprobeable", "System fonts cannot be probed, so nothing was downloaded", "无法探测系统字体,因此没有下载"),
("FontCjkStatusHint", "Downloaded once into the data directory and cached; the next start does not download it again. A mirror can be set with `ui.font_cdn`.", "只下这一次,缓存在数据目录里,下次启动不重下。镜像可用配置键 ui.font_cdn 指定。"),
("FontCjkStatusHint", "Downloaded once into the data directory and cached; the next start does not download it again. A mirror can be set with ui.font_cdn.", "只下这一次,缓存在数据目录里,下次启动不重下。镜像可用配置键 ui.font_cdn 指定。"),
];
+4 -4
View File
@@ -160,7 +160,7 @@ macro_rules! settings_java_entries {
"下载走内置镜像表:国内先试院校镜像(Temurin 走清华 TUNA),GitHub 上的归档套 gh-proxy。落盘前一律按 SHA-256 校验。"
),
SettingsJavaDownloadLts => ("LTS", "长期支持版(LTS)"),
SettingsJavaDownloadBaseline => ("Baseline (D13)", "基准版本(D13)"),
SettingsJavaDownloadBaseline => ("Recommended baseline", "推荐基准版本"),
SettingsJavaDownloadVendors => ("Vendors: {vendors}", "发行版:{vendors}"),
SettingsJavaDownloadNoVendor => (
"No vendor publishes this major version on this platform.",
@@ -292,10 +292,10 @@ macro_rules! settings_java_entries {
SettingsJavaVendorDown => ("Down", "下移"),
SettingsJavaVendorReset => ("Reset to the region default", "恢复地区默认序"),
SettingsJavaVendorSupports => ("ships {majors}", "发 {majors}"),
SettingsJavaAutoInstall => ("Prepare a JDK when none is found", "缺 JDK 时自动准备"),
SettingsJavaAutoInstall => ("Recommend a JDK when none is found", "缺 JDK 时推荐一档"),
SettingsJavaAutoInstallHint => (
"On: the catalog below marks the version the current instance needs, and a freshly installed JDK becomes the default when no default is set yet. Off: you pick everything yourself.",
"开:下面的目录会按当前实例的要求标出该装哪一档,装完之后若还没有默认 JDK 就自动设为默认。关:全部自己挑。"
"On: the catalog below marks the version the current instance needs, and a freshly installed JDK becomes the default when no default is set yet. Nothing is downloaded on its own — you press Install. Off: nothing is marked and you pick everything yourself.",
"开:下面的目录会按当前实例的要求标出该装哪一档,装完之后若还没有默认 JDK 就自动设为默认。不会自己开始下载 —— 点「安装」才会下。关:什么也不标,全部自己挑。"
),
SettingsJavaAutoInstallOn => ("on", "开"),
SettingsJavaAutoInstallOff => ("off", "关"),
+49
View File
@@ -201,3 +201,52 @@ fn split_keeps_every_translation() {
assert_eq!(got.2, expected.2, "{} 的中文译文变了", expected.0);
}
}
/// 用户可见文案里**不许**出现内部决策编号(`(D13)` / `(M175)` 这类)。
///
/// 为什么要在目录这一层守:`(D13)` 对用户没有任何意义(他不知道 D13 是什么),而这类串一旦
/// 混进来就再没人记得删。M197 出图时实测到下载目录的基准版本徽标写着 `基准版本(D13)`。
///
/// 变异证明:把 `SettingsJavaDownloadBaseline` 的译文改回 `Baseline (D13)` / `基准版本(D13)`
/// ⇒ 本用例红(中英两侧都扫)。判据是 `(`/`(` + `D`/`M` + 数字,不误伤 `(404)` / `(5xx / 429)`
/// 这类真对用户有意义的括号短语。
#[test]
fn no_user_visible_string_mentions_an_internal_decision_id() {
for (key, en, zh) in super::golden::rows().copied() {
for (side, text) in [("en", en), ("zh-CN", zh)] {
assert!(
!mentions_decision_id(text),
"{key} 的{side}译文里出现了内部决策编号:{text}"
);
}
}
}
/// 用户可见文案里**不许**出现 markdown 反引号。
///
/// 渲染层没有内联代码通道(M175 r3 复审已核实 `RichText|markdown|Span::|spans(` 全树只命中
/// 进度条与注释),反引号会原样上屏。M175 修过三处、M197 又修了三处;M168 的
/// `FontCjkStatusHint` 是最后一条(M197 复审 r1 指出的),这里一并钉住。
///
/// 变异证明:给任意一条译文加一对反引号 ⇒ 本用例红。
#[test]
fn no_user_visible_string_carries_markdown_backticks() {
for (key, en, zh) in super::golden::rows().copied() {
for (side, text) in [("en", en), ("zh-CN", zh)] {
assert!(
!text.contains('`'),
"{key} 的{side}译文里还有 markdown 反引号:{text}"
);
}
}
}
/// 串里有没有「(D13)」「(M175)」这类内部编号(全角半角括号都算)。
fn mentions_decision_id(text: &str) -> bool {
let chars: Vec<char> = text.chars().collect();
chars.windows(3).any(|window| {
(window[0] == '(' || window[0] == '(')
&& (window[1] == 'D' || window[1] == 'M')
&& window[2].is_ascii_digit()
})
}