style: cargo fmt --all(合并期整合修复)
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / unsafe 落点守门(集合必须恰好一个文件) (push) Canceled after 0s
Guards / design 零第三方依赖守门 (push) Canceled after 0s
Guards / presenter 零 UI 守门 (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Dev Guards / 架构与合规守门(同 main 口径) (push) Canceled after 0s
Dev Guards / fmt (rustfmt --check) (push) Canceled after 0s
Dev Guards / clippy (ubuntu) (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / unsafe 落点守门(集合必须恰好一个文件) (push) Canceled after 0s
Guards / design 零第三方依赖守门 (push) Canceled after 0s
Guards / presenter 零 UI 守门 (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Dev Guards / 架构与合规守门(同 main 口径) (push) Canceled after 0s
Dev Guards / fmt (rustfmt --check) (push) Canceled after 0s
Dev Guards / clippy (ubuntu) (push) Canceled after 0s
M187/M188 并入后全仓 fmt --check 为红(CI 的 fmt job 会红)。 本次仅 cargo fmt --all 的换行/缩进变化,无语义改动; cargo fmt --check 与 cargo check 均已复验为绿。
This commit is contained in:
1 parent
edd12b38ab
commit
44a0c87a11
7 files changed
+32
-14
No files matched your search
@@ -94,7 +94,10 @@ mod tests {
|
||||
#[test]
|
||||
fn lines_without_a_tag_fall_back_to_the_default_scope() {
|
||||
assert_eq!(split_scope("没有标签的一行"), ("app", "没有标签的一行"));
|
||||
assert_eq!(split_scope("[a b] 空白不是标签"), ("app", "[a b] 空白不是标签"));
|
||||
assert_eq!(
|
||||
split_scope("[a b] 空白不是标签"),
|
||||
("app", "[a b] 空白不是标签")
|
||||
);
|
||||
}
|
||||
|
||||
/// 守门②:**启动器日志的滚动真的会发生**,写超上限之后文件仍然有界。
|
||||
|
||||
@@ -68,7 +68,8 @@ pub(crate) fn prepare(dir: &Path) -> Result<PathBuf, String> {
|
||||
/// 返回的文本永远带路径(`...logs` 那一串),可以直接贴给用户/贴进 issue。
|
||||
pub(crate) fn open() -> Result<PathBuf, String> {
|
||||
let dir = logs_dir().ok_or_else(|| {
|
||||
"日志目录:数据根没解析出来(启动器拿不到自己所在的目录;用 --data-dir 指定一个)".to_string()
|
||||
"日志目录:数据根没解析出来(启动器拿不到自己所在的目录;用 --data-dir 指定一个)"
|
||||
.to_string()
|
||||
})?;
|
||||
let dir = prepare(&dir)?;
|
||||
crate::app::dialog::export::open_dir(&dir)?;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
//! `requirement_for(mc_version)` 是 core 的纯函数(静态表,读不到版本 JSON 时也成立)。
|
||||
//! 页面自己不看盘:本文件在每次 hydrate 时算好 [`Context`] 塞进状态,渲染器只负责画。
|
||||
|
||||
use crate::app::diag::diag;
|
||||
use super::super::*;
|
||||
use crate::app::diag::diag;
|
||||
|
||||
use crate::pages::settings::java::{Context, Layer, Notice, Requirement};
|
||||
|
||||
|
||||
@@ -103,8 +103,8 @@ fn action_button<'a>(ui: &'a Ui, label: &'a str, message: Message) -> Element<'a
|
||||
.height(height)
|
||||
.padding(Padding::from([0.0, ui.space(Space::X3)]))
|
||||
.style(move |_theme: &IcedTheme, status| {
|
||||
let background = matches!(status, button::Status::Hovered | button::Status::Pressed)
|
||||
.then(|| {
|
||||
let background =
|
||||
matches!(status, button::Status::Hovered | button::Status::Pressed).then(|| {
|
||||
Background::Color(ui.state_over(StateLayer::Hover, Role::OnSurface, Role::Surface))
|
||||
});
|
||||
button::Style {
|
||||
|
||||
@@ -228,7 +228,11 @@ fn the_logs_row_names_the_real_paths_and_the_real_limit() {
|
||||
&format!("{LOGS_DIR}/{GAME_LOG_DIR}/"),
|
||||
"data/agent/sessions",
|
||||
] {
|
||||
assert!(hint.contains(needle), "{} 缺 `{needle}`:{hint}", lang.tag());
|
||||
assert!(
|
||||
hint.contains(needle),
|
||||
"{} 缺 `{needle}`:{hint}",
|
||||
lang.tag()
|
||||
);
|
||||
}
|
||||
assert!(!hint.contains('⟪'), "{} 目录里缺词:{hint}", lang.tag());
|
||||
assert!(
|
||||
|
||||
@@ -241,10 +241,7 @@ fn find_entry(ctx: &Ctx, key: &str) -> Result<SessionIndexEntry, CliError> {
|
||||
fn event_path(ctx: &Ctx, entry: &SessionIndexEntry) -> std::path::PathBuf {
|
||||
// M188:新会话在 `logs/game/`,旧会话在 `data/agent/sessions/game/`(只读兼容)。
|
||||
// 先看新根,再回落旧家;两处都没有就把新根路径交出去(错误信息据此说「该去哪找」)。
|
||||
let primary = ctx
|
||||
.sessions_root()
|
||||
.join(GAME_LOG_DIR)
|
||||
.join(&entry.log_path);
|
||||
let primary = ctx.sessions_root().join(GAME_LOG_DIR).join(&entry.log_path);
|
||||
if primary.is_file() {
|
||||
return primary;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,11 @@ fn legacy_sessions_are_still_listed_and_openable() {
|
||||
let env = HostEnv::at_root(&root);
|
||||
let legacy_game = env.legacy_sessions_root().join("game");
|
||||
std::fs::create_dir_all(&legacy_game).expect("建旧家目录");
|
||||
let entry = sample_entry("old-session", "old-session.jsonl", "2026-11-01T10:00:00.000Z");
|
||||
let entry = sample_entry(
|
||||
"old-session",
|
||||
"old-session.jsonl",
|
||||
"2026-11-01T10:00:00.000Z",
|
||||
);
|
||||
session_index::append(
|
||||
&session_index::index_path(&env.legacy_sessions_root()),
|
||||
&entry,
|
||||
@@ -144,7 +148,10 @@ fn legacy_sessions_are_still_listed_and_openable() {
|
||||
listed.iter().any(|session| session.id == "old-session"),
|
||||
"旧家的会话没有出现在列表里:{listed:?}"
|
||||
);
|
||||
assert_eq!(event_path(&env, &entry), legacy_game.join("old-session.jsonl"));
|
||||
assert_eq!(
|
||||
event_path(&env, &entry),
|
||||
legacy_game.join("old-session.jsonl")
|
||||
);
|
||||
let (lines, _) = open(&env, "old-session");
|
||||
assert!(
|
||||
lines.iter().any(|line| line.text.contains("旧会话这一行")),
|
||||
@@ -196,7 +203,10 @@ fn the_new_root_wins_when_both_indexes_know_the_same_id() {
|
||||
let legacy_game = env.legacy_sessions_root().join("game");
|
||||
std::fs::create_dir_all(&legacy_game).expect("建旧家目录");
|
||||
let old = sample_entry("same", "same.jsonl", "2026-10-01T00:00:00.000Z");
|
||||
session_index::append(&session_index::index_path(&env.legacy_sessions_root()), &old)
|
||||
session_index::append(
|
||||
&session_index::index_path(&env.legacy_sessions_root()),
|
||||
&old,
|
||||
)
|
||||
.expect("写旧索引");
|
||||
std::fs::write(
|
||||
legacy_game.join("same.jsonl"),
|
||||
@@ -235,7 +245,10 @@ fn the_location_receipt_names_both_roots_and_the_policy() {
|
||||
std::fs::write(legacy_game.join("a.jsonl"), "{}\n").expect("写旧文件");
|
||||
|
||||
let path = note_location(&env).expect("记录应当写得出来");
|
||||
assert_eq!(path, env.logs_dir().join(super::location::SESSION_LOCATION_FILE));
|
||||
assert_eq!(
|
||||
path,
|
||||
env.logs_dir().join(super::location::SESSION_LOCATION_FILE)
|
||||
);
|
||||
let value: serde_json::Value =
|
||||
serde_json::from_slice(&std::fs::read(&path).expect("读记录")).expect("记录是 JSON");
|
||||
assert_eq!(value["policy"], "read-only-compat");
|
||||
|
||||
Reference in new issue
Block a user