test(core,presenter): 夹具口径跟随 M240 收窄(长类名不再被抹)
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

M240 让词形长路径不再被当成不透明串,而 M241 的两份夹具仍断言「必须被抹成
<redacted:opaque>」——两条各自的 pre-rebase 门禁都绿,合并 tip 上才互相矛盾,
维护主线短暂变红。

- core:raw_evidence_hits_... 改成断言「脱敏文本也保留类名、两边都能命中」,
  并改名 ..._and_m240_keeps_it_visible_after_scrubbing;保留一条守卫:若将来
  又把词形长路径抹掉,这条会红并提示改用 raw 窗口的用例说明其必要性。
- presenter:展示面与盘上的断言从「不许出现类名」翻成「应保留类名、且不许
  出现凭据」——类名不是凭据,留着才看得懂崩溃原因。
This commit is contained in:
AskaEth committed 2026-11-11 10:48:16 +08:00
1 parent 8a65562595
commit 0b40e1dfe2
2 files changed
+26 -14

No files matched your search

+15 -7
View File
@@ -26,11 +26,14 @@ fn record_id(record: &Value) -> Option<&str> {
.and_then(Value::as_str)
}
/// **判据 ①**:原始证据行能命中 `fabric.loader_0_12`;同一行被脱敏后命不中。
/// **判据 ①**:原始证据行能命中 `fabric.loader_0_12`;M240 收窄脱敏之后,同一行在脱敏文本里**也**能命中。
///
/// 后半句不是「补充说明」,它是这个模块存在的理由——会话 JSONL 里只有脱敏文本。
/// 这半边在 M240 之前是「命不中」(那是 M239 报的 bug)。M240 把词形长路径从「不透明串」里放了出来,
/// 于是这条证据不再被抹——**证据能留在盘上正是 M240 的目的**,所以这里改成断言「两边都能命中」。
/// 原始窗口(`RawWindow`)对「证据本身含凭据、被迫抹掉」的行依然必需,但那种行需要一条
/// 真的依赖凭据字面量的规则才能演示,本仓当前没有这样的规则。
#[test]
fn raw_evidence_hits_the_fabric_rule_while_scrubbed_evidence_misses_it() {
fn raw_evidence_hits_the_fabric_rule_and_m240_keeps_it_visible_after_scrubbing() {
let raw = [EVIDENCE.to_string()];
let empty: [String; 0] = [];
@@ -41,15 +44,20 @@ fn raw_evidence_hits_the_fabric_rule_while_scrubbed_evidence_misses_it() {
let scrubbed = [Redactor::new().scrub(EVIDENCE).into_owned()];
assert!(
scrubbed[0].contains("<redacted:opaque>"),
"夹具前提:这条证据行确实会被抹:{}",
!scrubbed[0].contains("<redacted:opaque>"),
"夹具前提(M240 之后):词形长路径不再被抹成不透明串:{}",
scrubbed[0]
);
assert!(
scrubbed[0].contains("FabricMixinTransformerProxy"),
"夹具前提:类名应原样留在脱敏文本里:{}",
scrubbed[0]
);
let after = conclude(&facts(&empty, &scrubbed));
assert_ne!(
assert_eq!(
after.as_ref().and_then(record_id),
Some("fabric.loader_0_12"),
"脱敏后的文本不该再命中——这就是 M239 报的那个 bug"
"M240 之后脱敏文本也能命中;若这条变红,说明长类名又被抹了——那时请改用 raw 窗口的用例重新说明它为什么必要"
);
}
+11 -7
View File
@@ -68,18 +68,19 @@ fn raw_evidence_hits_the_rule_while_the_export_surface_stays_redacted() {
Some("fabric.loader_0_12".to_string())
);
// ② 展示面(日志行 DTO)仍是被脱敏的。
// ② 展示面(日志行 DTO):M240 收窄之后词形长路径不再被抹,所以类名会**原样出现**——
// 这是有意的(它不是凭据,留着才看得懂崩溃原因)。凭据仍然必须被抹。
assert!(
opened
.iter()
.any(|line| line.text.contains("<redacted:opaque>")),
"长类名必须被抹成占位符:{opened:?}"
.any(|line| line.text.contains("FabricMixinTransformerProxy")),
"M240 之后展示行应保留类路径:{opened:?}"
);
assert!(
!opened
.iter()
.any(|line| line.text.contains("FabricMixinTransformerProxy")),
"展示行不许出现原始类路径:{opened:?}"
.any(|line| line.text.contains("<redacted:opaque>")),
"类路径不该再被当成不透明串:{opened:?}"
);
assert!(
!opened.iter().any(|line| line.text.contains(TOKEN)),
@@ -88,8 +89,11 @@ fn raw_evidence_hits_the_rule_while_the_export_surface_stays_redacted() {
// ②' 盘上那份(= 导出包收进去的同一份文件)也没有原文——修 bug 不等于把密钥写进盘。
let disk = std::fs::read_to_string(event_path(&env, &entry)).expect("读会话文件");
assert!(!disk.contains("FabricMixinTransformerProxy"), "{disk}");
assert!(!disk.contains(TOKEN), "{disk}");
assert!(
disk.contains("FabricMixinTransformerProxy"),
"M240 之后盘上应保留类路径(它不是凭据):{disk}"
);
assert!(!disk.contains(TOKEN), "盘上不许出现凭据:{disk}");
std::fs::remove_dir_all(&root).ok();
}