Skip to content

Commit 5cda5bd

Browse files
committed
refactor(components): 按裁决删除 structuredBlocks 死导出
1 parent 58a1cdb commit 5cda5bd

4 files changed

Lines changed: 32 additions & 165 deletions

File tree

‎app/src/components/session-detail/SessionRawView.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
* `<span>` 上 —— `transform` 对行内元素无效,见 `useRevealChoreography.ts` 文件头),
3333
* 所以两者**互不覆盖**:那条 CSS `animation` 动 `opacity`,显影的 GSAP 只动 `transform`。
3434
* ④ `data-reveal-epoch` 把「持有的世代号」暴露到 DOM(R8.5:结构锚点优先于时间判据)。
35-
* ⚠️ 因此本件新增一条 import 边:`components/structuredBlocks.ts`(它顶层 `import katex`
36-
* + `katex.min.css`)⇒ **KaTeX 会成为会话详情惰性 chunk 的依赖**(首屏静态闭包不含本件,
37-
* `check-bundle-budget` 的首屏口径不变;代价逐字登记在 `task-28-report.md` 的诚实边界)。
35+
* ⚠️ 本件当时因此新增了一条通往 `components/structuredBlocks.ts` 的依赖边(该模块顶层持有
36+
* 数学排版库及其样式表两条静态边)⇒ **KaTeX 一度成为会话详情惰性 chunk 的依赖**(首屏静态
37+
* 闭包不含本件,`check-bundle-budget` 的首屏口径不变;代价逐字登记在 `task-28-report.md`
38+
* 的诚实边界)。**批 7 已按裁决收口**:T2 把类名函数析出到 `utils/lowConfidence.ts`
39+
* (零依赖)⇒ 依赖改道;T3 删除了 `components/structuredBlocks.ts` ⇒ 本件不再持有该边。
3840
* @ai-context: **逐条自审(控制方回执③)后仍保留的字面量**:`fontSize: 13`(三处 `<h3>` 标题,
3941
* 合法档 —— 规格 §4.2 字阶下界是 12px)· `fontSize: 12`(术语表折叠块)·
4042
* `borderRadius: 8`(= `radiusScale.panel` 档)· `background: "#fafafa"`(**未迁移**:
@@ -129,7 +131,7 @@ export default function SessionRawView({
129131
>
130132
{SOURCE_LABEL[seg.source] ?? seg.source}
131133
</Text>
132-
{/* 低置信段(`confidence < 0.5`,阈值真源 = `structuredBlocks.lowConfidenceClass`)追加
134+
{/* 低置信段(`confidence < 0.5`,阈值真源 = `utils/lowConfidence.ts` 的 `lowConfidenceClass`)追加
133135
`ed-text--low-confidence`(R11.3 ③ 的环境层落点;样式规则在 `ui/primitives/Text.css`)。 */}
134136
<Text
135137
as="span"

‎app/src/components/structuredBlocks.test.ts‎

Lines changed: 0 additions & 92 deletions
This file was deleted.

‎app/src/components/structuredBlocks.ts‎

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* lowConfidence.test.ts — 低置信类名判定(批 7 T3:自 `components/structuredBlocks.test.ts` 的
3+
* `describe("lowConfidenceClass")` 原样迁入;用例与断言逐字保留,只换 import 源)。
4+
*
5+
* @ai-context Why 必须迁而不是随模块删除:`lowConfidenceClass` 是 C4.2 里的**活导出**
6+
* (生产调用点 = `components/session-detail/SessionRawView.tsx`),被删的只有测试-only 的两个
7+
* 渲染器(`renderLatex` / `renderMarkdownTable`)。删除与迁移**同批**做,才不会留下
8+
* 「实现还在、覆盖已丢」的中间态(控制方裁决)。
9+
* @ai-context 本文件守的是**阈值语义**(`< 0.5` 命中;`0.5` / `null` / `undefined` ⇒ 空串);
10+
* 类名**字面量**的镜像一致性另由 `motion/env.test.ts` 的 V6 对拍守住(两者分工不重叠)。
11+
* @ai-context 副作用:无(纯函数用例,不读 store、不发请求、不写盘)。
12+
*/
13+
import { describe, expect, it } from "vitest";
14+
import { lowConfidenceClass } from "./lowConfidence";
15+
16+
describe("lowConfidenceClass", () => {
17+
it("低置信(<0.5)返回标记类名,其余返回空串", () => {
18+
// Assert
19+
// 批 6 T13(R12.1):类名由 `ed-low-confidence` 改为 `<既有基类>--<修饰>` 形状
20+
// (`ed-text` 基类的修饰类)—— 旧名字会被 motion-coverage.test.ts 的「未登记基类」判据拦下。
21+
expect(lowConfidenceClass(0.3)).toBe("ed-text--low-confidence");
22+
expect(lowConfidenceClass(0.5)).toBe("");
23+
expect(lowConfidenceClass(null)).toBe("");
24+
expect(lowConfidenceClass(undefined)).toBe("");
25+
});
26+
});

0 commit comments

Comments
 (0)