# F25 Phase A — Audit suite baseline (2026-05-09)

> 4 个 read-only audit script + 配套 npm scripts + 空白白名单初始化。
> 跑一次产生本 baseline。Phase B / C 修复后重跑同款 audit 验 finding 数下降。
> JSON 完整数据通过命令行重跑获取（baseline 仅汇总）。
>
> **⚠️ 2026-05-09 update**：Phase A 审计规则在落地后被 plan owner 收窄（详见
> [`f25-cleanup-2026-05-09.md`](f25-cleanup-2026-05-09.md)）。本 baseline 数据保留作历史
> 参照，但当前规则下：
> - audit:icon-fill-currentcolor 收窄到只 ERROR `#dbdbdb`（删 mono/multi 二分类）
> - audit:no-hardcoded-design-tokens 范围收窄到 `src/components/` + `src/canonical/`（删 docs/pages 扫描）
> - audit:docs-page-bg-contrast 已删除（等 F20 visual snapshot 兜底）
> - 空白名单 `icon-multicolor.json` 已删除（不再需要）
>
> 本文件下面的"baseline 命中数"反映**收窄前**的统计，对应初次落地版本（commit 236062c2）。

## 总览

| Audit | findings | 严重度分布 | 文件命中数 |
|---|---:|---|---:|
| icon-fill-currentcolor | 624 | mono 584 (error) / multi 40 (warn) | 28 |
| component-no-inline-svg | 0 | error (n/a if 0) | 0 |
| no-hardcoded-design-tokens | 456 | color 10 / spacing 351 / radius 95 (exact 280 / no-match 176) | 42 |
| docs-page-bg-contrast | 36 | error（撞色 .docs-demo-card bg #262626） | 25 |

## A1 — audit:icon-fill-currentcolor

624 findings 跨 28 个 catalog 文件。
- mono-color (error)：584 — 单色 path 应改 `fill="currentColor"` 让外部 CSS `color` 驱动 theme
- multi-color (warn)：40 — 多色 path 保留 hex 但需 review，确认是设计意图（如 mark/flag 红，mark/safe 绿）后入 `figma-sync/audit-allowlist/icon-multicolor.json`
- 当前白名单豁免：0

### 命中最多的 catalog 文件 top 12

| file | findings |
|---|---:|
| src/icons/catalog/generated/output.ts | 65 |
| src/icons/catalog/generated/video.ts | 57 |
| src/icons/catalog/generated/indicator.ts | 51 |
| src/icons/catalog/generated/input.ts | 41 |
| src/icons/catalog/generated/file.ts | 40 |
| src/icons/catalog/generated/meeting.ts | 38 |
| src/icons/catalog/generated/edit.ts | 36 |
| src/icons/catalog/generated/preview.ts | 31 |
| src/icons/catalog/generated/user.ts | 29 |
| src/icons/catalog/generated/picture.ts | 24 |
| src/icons/catalog/generated/mark.ts | 21 |
| src/icons/catalog/generated/others.ts | 21 |

**修复路径**：Phase B export-icons.mjs 从 figma 拉 SVG 时单色自动转 currentColor + 一次性 transform 现有 catalog .ts 文件。预期 mono finding 应大幅下降。

## A2 — audit:component-no-inline-svg

0 findings — 组件层已全部通过 `<Icon :name="..."/>` 引用 catalog，无内联 SVG。本 audit 当前作为回归保护网。

## A3 — audit:no-hardcoded-design-tokens

456 findings 跨 42 个文件（src/components / src/canonical / playground/docs/pages style 段）。
- color：10
- spacing：351
- radius：95
- 含 exact-match token：280 —— 候选 Phase C auto-tokenize
- 无 exact-match：176 —— 需人工评估（新 domain token / 接受字面量）

### 命中最多的文件 top 12

| file | findings |
|---|---:|
| playground/docs/pages/ButtonPage.vue | 30 |
| playground/docs/pages/TopBarPage.vue | 30 |
| playground/docs/pages/ColorPage.vue | 25 |
| playground/docs/pages/StepsPage.vue | 24 |
| playground/docs/pages/IconPage.vue | 21 |
| playground/docs/pages/TablePage.vue | 21 |
| playground/docs/pages/PromptMessagePage.vue | 18 |
| playground/docs/pages/BadgePage.vue | 16 |
| playground/docs/pages/FormItemPage.vue | 16 |
| playground/docs/pages/NotificationPage.vue | 15 |
| playground/docs/pages/RatingPage.vue | 15 |
| playground/docs/pages/TooltipPage.vue | 15 |

**修复路径**：Phase C auto-tokenize-exact-match.mjs 仅替换 exactMatch=true 的 finding，no-match 保留并注 `/* TODO F25-followup */`。预期 finding 下降 ≥ 30%。

## A4 — audit:docs-page-bg-contrast

36 findings 跨 25 个 page。
- `.docs-demo-card` 默认 bg 解析后 hex：#262626
- 命中：page 内出现 `background: var(--bg-layer3)` 等同色 token 的 wrapper 声明，与 .docs-demo-card 撞色

### 命中最多的 page top 12

| file | findings |
|---|---:|
| playground/docs/pages/ButtonPage.vue | 4 |
| playground/docs/pages/NotificationPage.vue | 3 |
| playground/docs/pages/BreadcrumbPage.vue | 2 |
| playground/docs/pages/ColorPage.vue | 2 |
| playground/docs/pages/FormItemPage.vue | 2 |
| playground/docs/pages/IconPage.vue | 2 |
| playground/docs/pages/StepsPage.vue | 2 |
| playground/docs/pages/TooltipPage.vue | 2 |
| playground/docs/pages/BadgePage.vue | 1 |
| playground/docs/pages/BorderPage.vue | 1 |
| playground/docs/pages/DateTimePage.vue | 1 |
| playground/docs/pages/EffectPage.vue | 1 |

**注意**：本 audit 是静态启发式扫描，不区分嵌套子元素撞色（真问题）vs同级声明（语义上不直接撞色）。需逐条人工 review 后入 backlog 修复（在内层加 `var(--bg-layer1/2)` 形成层级，参考 ProgressPage commit 596acb05 修复范式）。本 phase A 不自动修。

## 验收 self-check

- [x] 4 个 audit script 文件存在 + 各跑通 (exit 0)
- [x] 1 个 unified baseline 报告文件存在（合并 4 phase A audit summary）
- [x] `package.json` 加了 4 个 npm script
- [x] `figma-sync/audit-allowlist/` 下 2 个 json 存在（空数组初始化）
- [x] vue-tsc 0 errors（仅添加 .mjs 不动 src/ playground/）
- [x] 不动 src/ playground/docs/ 文件（read-only）

## 未解决项 / 后续

- A2 当前 0 finding，作回归保护网（防未来内联 SVG 回滚）
- A3 noMatch=176 条非 exact-match 留 Phase D（plan owner 决策：新 domain token 还是接受字面量）
- A4 36 条 contrast finding 静态分析有假阳，逐条 review 后再批量修
- multi-color icon 白名单（`figma-sync/audit-allowlist/icon-multicolor.json`）目前空数组——Phase B 后人工列出实际多色 icon 名（如 mark/flag-on / mark/safe-on / mark/thumb-up-on / mark/favorite-on / icon/Message/Error 系列）填入

## File 清单（本 commit 内）

- figma-sync/audit-icon-fill-currentcolor.mjs (new)
- figma-sync/audit-component-no-inline-svg.mjs (new)
- figma-sync/audit-no-hardcoded-design-tokens.mjs (new)
- figma-sync/audit-docs-page-bg-contrast.mjs (new)
- figma-sync/audit-allowlist/icon-multicolor.json (new, [])
- figma-sync/audit-allowlist/dimension-tokens.json (new, [])
- package.json (modified, +4 npm scripts)
- docs/internal/_reports/f25-phase-a-baseline-2026-05-09.md (this file)
