fix: address review feedback - cfg(test), \u{26a0}, revert vi fanout, expand tests
This commit is contained in:
@@ -82,6 +82,7 @@ npm/*/bin/downloads/
|
||||
apps/
|
||||
|
||||
# Claude Code runtime artifacts
|
||||
.claude/settings.json
|
||||
.claude/scheduled_tasks.lock
|
||||
.claude/worktrees/
|
||||
.worktrees/
|
||||
|
||||
@@ -323,13 +323,8 @@ impl DeepSeekClient {
|
||||
.and_then(|s| s.as_str())
|
||||
.unwrap_or("completed");
|
||||
let stop_reason = match status {
|
||||
"completed" => {
|
||||
if saw_tool_call {
|
||||
"tool_use"
|
||||
} else {
|
||||
"end_turn"
|
||||
}
|
||||
}
|
||||
"completed" if saw_tool_call => "tool_use",
|
||||
"completed" => "end_turn",
|
||||
"incomplete" => "max_tokens",
|
||||
_ => "end_turn",
|
||||
};
|
||||
|
||||
@@ -1593,8 +1593,7 @@ fn english(id: MessageId) -> &'static str {
|
||||
MessageId::ApprovalIntentLabel => "Intent: ",
|
||||
MessageId::ApprovalMoreLines => " … (+{count} lines)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " ⚠ Sandbox Denied ",
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} Sandbox Denied ",
|
||||
MessageId::ElevationTitleRequired => " Sandbox Elevation Required ",
|
||||
MessageId::ElevationFieldTool => " Tool: ",
|
||||
MessageId::ElevationFieldCmd => " Cmd: ",
|
||||
@@ -1625,7 +1624,6 @@ fn english(id: MessageId) -> &'static str {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "Cancel this tool execution",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "Context inspector",
|
||||
MessageId::CtxInspSessionContext => "Session Context",
|
||||
MessageId::CtxInspSystemPrompt => "System Prompt Structure",
|
||||
@@ -2133,7 +2131,7 @@ fn vietnamese(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::CtxMenuHelp => "Trợ giúp",
|
||||
MessageId::CtxMenuHelpDesc => "phím tắt và lệnh",
|
||||
MessageId::FanoutCounts => {
|
||||
"{done} đã xong · {running} đang chạy · {failed} thất bại · {pending} chờ"
|
||||
"{done} hoàn thành · {running} đang chạy · {failed} thất bại · {pending} chờ"
|
||||
}
|
||||
|
||||
// Approval dialog.
|
||||
@@ -2161,7 +2159,7 @@ fn vietnamese(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "Ý định: ",
|
||||
MessageId::ApprovalMoreLines => " … (+{count} dòng)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} Sandbox Bị Từ Chối ",
|
||||
MessageId::ElevationTitleRequired => " Yêu Cầu Nâng Cấp Sandbox ",
|
||||
MessageId::ElevationFieldTool => " Công cụ: ",
|
||||
@@ -2193,7 +2191,6 @@ fn vietnamese(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "Hủy thực thi công cụ này",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "Trình kiểm tra ngữ cảnh",
|
||||
MessageId::CtxInspSessionContext => "Ngữ cảnh phiên",
|
||||
MessageId::CtxInspSystemPrompt => "Cấu trúc lời nhắc hệ thống",
|
||||
@@ -2283,7 +2280,7 @@ fn traditional_chinese(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "意圖:",
|
||||
MessageId::ApprovalMoreLines => " … (還有 {count} 行)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} 沙箱拒絕 ",
|
||||
MessageId::ElevationTitleRequired => " 沙箱提權 ",
|
||||
MessageId::ElevationFieldTool => " 工具:",
|
||||
@@ -2307,7 +2304,6 @@ fn traditional_chinese(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "取消此工具呼叫",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "上下文檢查器",
|
||||
MessageId::CtxInspSessionContext => "會話上下文",
|
||||
MessageId::CtxInspSystemPrompt => "系統提示結構",
|
||||
@@ -2808,7 +2804,7 @@ fn japanese(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "意図:",
|
||||
MessageId::ApprovalMoreLines => " … (+{count} 行)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} サンドボックス拒否 ",
|
||||
MessageId::ElevationTitleRequired => " サンドボックス昇格 ",
|
||||
MessageId::ElevationFieldTool => " ツール:",
|
||||
@@ -2838,7 +2834,6 @@ fn japanese(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "このツール実行をキャンセル",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "コンテキストインスペクタ",
|
||||
MessageId::CtxInspSessionContext => "セッションコンテキスト",
|
||||
MessageId::CtxInspSystemPrompt => "システムプロンプト構造",
|
||||
@@ -3277,7 +3272,7 @@ fn chinese_simplified(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "意图:",
|
||||
MessageId::ApprovalMoreLines => " … (还有 {count} 行)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} 沙箱拒绝 ",
|
||||
MessageId::ElevationTitleRequired => " 沙箱提权 ",
|
||||
MessageId::ElevationFieldTool => " 工具:",
|
||||
@@ -3301,7 +3296,6 @@ fn chinese_simplified(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "取消此工具调用",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "上下文检查器",
|
||||
MessageId::CtxInspSessionContext => "会话上下文",
|
||||
MessageId::CtxInspSystemPrompt => "系统提示结构",
|
||||
@@ -3816,7 +3810,7 @@ fn portuguese_brazil(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "Intenção: ",
|
||||
MessageId::ApprovalMoreLines => " … (+{count} linhas)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} Sandbox Negado ",
|
||||
MessageId::ElevationTitleRequired => " Elevação de Sandbox Necessária ",
|
||||
MessageId::ElevationFieldTool => " Ferramenta: ",
|
||||
@@ -3848,7 +3842,6 @@ fn portuguese_brazil(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "Cancelar esta execução de ferramenta",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "Inspetor de contexto",
|
||||
MessageId::CtxInspSessionContext => "Contexto da sessão",
|
||||
MessageId::CtxInspSystemPrompt => "Estrutura do prompt do sistema",
|
||||
@@ -4377,7 +4370,7 @@ fn spanish_latin_america(id: MessageId) -> Option<&'static str> {
|
||||
MessageId::ApprovalIntentLabel => "Intención: ",
|
||||
MessageId::ApprovalMoreLines => " … (+{count} líneas)",
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
// Sandbox elevation dialog.
|
||||
MessageId::ElevationTitleSandboxDenied => " \u{26a0} Sandbox Denegado ",
|
||||
MessageId::ElevationTitleRequired => " Elevación de Sandbox Requerida ",
|
||||
MessageId::ElevationFieldTool => " Herramienta: ",
|
||||
@@ -4409,7 +4402,6 @@ fn spanish_latin_america(id: MessageId) -> Option<&'static str> {
|
||||
}
|
||||
MessageId::ElevationOptionAbortDesc => "Cancelar esta ejecución de herramienta",
|
||||
|
||||
|
||||
MessageId::CtxInspTitle => "Inspector de contexto",
|
||||
MessageId::CtxInspSessionContext => "Contexto de la sesión",
|
||||
MessageId::CtxInspSystemPrompt => "Estructura del prompt del sistema",
|
||||
|
||||
@@ -1026,7 +1026,7 @@ pub enum ElevationOption {
|
||||
|
||||
impl ElevationOption {
|
||||
/// Get the display label for this option.
|
||||
#[allow(dead_code)]
|
||||
#[cfg(test)]
|
||||
pub fn label(&self) -> &'static str {
|
||||
match self {
|
||||
ElevationOption::WithNetwork => "Allow outbound network",
|
||||
@@ -1037,7 +1037,7 @@ impl ElevationOption {
|
||||
}
|
||||
|
||||
/// Get a short description.
|
||||
#[allow(dead_code)]
|
||||
#[cfg(test)]
|
||||
pub fn description(&self) -> &'static str {
|
||||
match self {
|
||||
ElevationOption::WithNetwork => {
|
||||
@@ -2166,6 +2166,10 @@ mod tests {
|
||||
"Reason:",
|
||||
"Impactifapproved",
|
||||
"Choosehowtoproceed",
|
||||
"Allowoutboundnetwork",
|
||||
"Allowextrawriteaccess",
|
||||
"Fullaccess",
|
||||
"Abort",
|
||||
];
|
||||
for artifact in &en_artifacts {
|
||||
assert!(
|
||||
@@ -2175,6 +2179,58 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_elevation_render_ja_has_translated_copy() {
|
||||
let view = ElevationView::new(elevation_shell_request(), Locale::Ja);
|
||||
let lines = render_elevation_lines(&view, 70, 22);
|
||||
let joined = compact_elevation_text(&lines);
|
||||
assert!(
|
||||
joined.contains("サンドボックス拒否"),
|
||||
"missing ja title:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("ツール:"),
|
||||
"missing ja tool label:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("コマンド:"),
|
||||
"missing ja cmd label:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("理由:"),
|
||||
"missing ja reason label:\n{joined}"
|
||||
);
|
||||
for eng in &["SandboxDenied", "Tool:", "Cmd:", "Reason:"] as &[&str] {
|
||||
assert!(
|
||||
!joined.contains(eng),
|
||||
"English leak '{eng}' in ja:\n{joined}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_elevation_render_zh_hant_has_translated_copy() {
|
||||
let view = ElevationView::new(elevation_shell_request(), Locale::ZhHant);
|
||||
let lines = render_elevation_lines(&view, 70, 22);
|
||||
let joined = compact_elevation_text(&lines);
|
||||
assert!(
|
||||
joined.contains("沙箱拒絕"),
|
||||
"missing zh-Hant title:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("工具:"),
|
||||
"missing zh-Hant tool label:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("命令:"),
|
||||
"missing zh-Hant cmd label:\n{joined}"
|
||||
);
|
||||
assert!(
|
||||
joined.contains("原因:"),
|
||||
"missing zh-Hant reason label:\n{joined}"
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// ElevationOption Tests
|
||||
// ========================================================================
|
||||
|
||||
Reference in New Issue
Block a user