# Prompt — Phase A4.0 follow-up: complete canonical theme axis identity detection

> **角色**：executor
> **范围**：A4.0 fix (commit c623544) 实施依赖 `globalAxisAliases` + `componentPropAliases` 双 fallback，遗漏 figma axis 名**已经是 canonical 'theme'**且**没在 Known Entries 段登记**的 identity case —— 导致 Progress / Rating / Slider 仍缺 variant.theme 字段。补 1 行 identity fallback 完成 A4.0 设计意图。
>
> ⚠️ **不要 commit / 不要 git add**——dirty 累积到本 follow-up 通过后 commit。
> ⚠️ 完成后 **STOP**，按底部"完成报告"格式回报；**§4 完成报告必须含 §4.X 完整改动清单段**。
> ⚠️ **不扩范围**：只动 `figma-sync/generate-docs-figma-members.mjs` 一个文件 + 重跑生成产物。

---

## §0 — Plan owner 已定裁定

### Gap 实证（commit 8679c3a 后状态）

```
| 组件 | figma axis 名 | A4.0 path | variant.theme 字段 |
|---|---|---|---|
| Tooltip | 'dark theme' | alias (Table A → 'theme') | 12/12 ✅ |
| CheckBox | 'dark theme' | alias | 12/12 ✅ |
| Radio | 'dark theme' | alias | 8/8 ✅ |
| Switch | 'dark theme' | alias | 18/18 ✅ |
| Notification | 'theme' | Known Entries (`Notification.theme` exact match) | 14/14 ✅ |
| Progress | 'theme' | ❌ neither path | 0/16 ❌ |
| Rating | 'theme' | ❌ neither path | 0/10 ❌ |
| Slider | 'theme' | ❌ neither path | 0/4 ❌ |
```

3 个 Tier 1 组件（Progress / Rating / Slider）figma axis 已经是 canonical 'theme'，但**没在 prop-aliases.md "Known Entries" 段** 登记（Notification 偶然 matched 因为 PromptMessage 风格的 status/size exact-match entries 也有 Notification 的）。

### Fix 设计

[`figma-sync/generate-docs-figma-members.mjs:276-277`](../../../figma-sync/generate-docs-figma-members.mjs#L276) 现状：

```js
const derivedAxis = aliases.globalAxisAliases.get(figmaAxis)
  ?? aliases.componentPropAliases.get(canonicalName)?.get(figmaAxis)
```

加 identity fallback（第 3 条 chain）：

```js
const derivedAxis = aliases.globalAxisAliases.get(figmaAxis)
  ?? aliases.componentPropAliases.get(canonicalName)?.get(figmaAxis)
  ?? (figmaAxis === 'theme' ? 'theme' : undefined)
```

理由：figma axis 名直接是 canonical 'theme' 时，`derivedAxis = 'theme'`（identity）—— 后续逻辑 `if (derivedAxis === 'theme')` 触发，A4.0 既有的 `hasCanonicalThemeValues` 检查会通过（Progress/Rating/Slider 的 theme axis 值都是 `'dark'/'light'` canonical），variant.theme 派生走 identity path：

```js
themeByDerivedAxis[themeAxis.derivedAxis] = props[codeProp]  // 'dark' or 'light' 直接
```

### 受影响 .ts 文件（修后）

- `progress.ts`：16 variants 加 variant.theme（8 dark + 8 light）
- `rating.ts`：10 variants 加 variant.theme
- `slider.ts`：4 variants 加 variant.theme
- 其他 16 .ts：byte-identical 除 generatedAt（包括 Notification——之前通过 Known Entries 走，现在 globalAxisAliases / componentPropAliases 仍 first 命中，identity fallback 不影响）

### Audit baseline 预期变化

3 个 page（ProgressPage / RatingPage / SliderPage）α verdict 当前 N/A，修后变化取决于：
- 现状 page 没用 `<FigmaMembersGrid>` + 没传 `site-theme` → α 检测到有 theme axis 但 page 不可证 isolation → 应 fail（与 NotificationPage A4.0 修后路径一致）
- 这是 **correctness improvement**，不是 regression

15 其他 audit reports（含 Notification baseline）一致除 timestamps。

### 不动

- `prop-aliases.md`（fix 是 generator algorithm 改进，不动 alias 真源）
- `backlog.md` / `AGENTS.md` / `icon-aliases.ts`
- types.ts / canonical / 任何 page / audit script

---

## §1 — 必读输入

1. [`figma-sync/generate-docs-figma-members.mjs`](../../../figma-sync/generate-docs-figma-members.mjs) — 修目标，line 276-277
2. [`src/design-system/translation/prop-aliases.md`](../../../src/design-system/translation/prop-aliases.md) "Figma axis 处理规则" 段（**只读**）—— 单值 axis 跳过规则参考
3. 现有 19 个 `figma-data/normalized/docs-figma-members/*.ts` —— regression 对照基线
4. [`docs/internal/t2-sample-audit-report.ProgressPage.md`](../../t2-sample-audit-report.ProgressPage.md) / `RatingPage.md` / `SliderPage.md` —— 当前 α=N/A 实证

---

## §2 — 任务清单

### 任务 2.1 — Generator 加 identity fallback

按 §0 fix 加 1 行（或 1 三元 expression）到 derivedAxis fallback chain。

### 任务 2.2 — 跑 generator 全量

```bash
node figma-sync/generate-docs-figma-members.mjs
```

预期 stats 不变（19 Tier 1 / 2 no-canonical / 1 single-value axis warn / 8 Tier 2 skipped / 21 Tier 3 skipped）。

### 任务 2.3 — Verify variant.theme on 3 affected components

```bash
grep -c "^      theme:" figma-data/normalized/docs-figma-members/progress.ts   # expect 16
grep -c "^      theme:" figma-data/normalized/docs-figma-members/rating.ts     # expect 10
grep -c "^      theme:" figma-data/normalized/docs-figma-members/slider.ts     # expect 4
```

### 任务 2.4 — 16 其他 .ts byte-identical 除 generatedAt

```bash
git diff --stat figma-data/normalized/docs-figma-members/
```

预期 progress / rating / slider 实质 diff（+ 行数对应新增 variant.theme），其他 16 .ts 各 2 行（generatedAt only）。

### 任务 2.5 — typecheck

```bash
pnpm exec vue-tsc --noEmit
```

### 任务 2.6 — 跑 audit 全量

```bash
node figma-sync/audit-page-t2-sample.mjs
```

预期 audit 变化：
- ProgressPage / RatingPage / SliderPage α: N/A → fail（correctness improvement）
- 15 其他 audit reports: 一致除 timestamps

---

## §3 — 验收清单

- [ ] generator 加 1 行 identity fallback (`figmaAxis === 'theme' ? 'theme' : undefined`)
- [ ] progress.ts 16 variants 全 含 variant.theme
- [ ] rating.ts 10 variants 全 含 variant.theme
- [ ] slider.ts 4 variants 全 含 variant.theme
- [ ] 16 其他 .ts byte-identical 除 generatedAt
- [ ] vue-tsc 0 错误
- [ ] ProgressPage / RatingPage / SliderPage α: N/A → fail
- [ ] 15 其他 audit reports 一致除 timestamps（含 Notification baseline）
- [ ] generator / audit / canonical / page / 真源 .md 除 generator 1 文件外 没动
- [ ] 没 commit / 没 git add

---

## §4 — 完成报告

```
## Phase A4.0 follow-up identity fallback 完成报告

### 改动文件
- figma-sync/generate-docs-figma-members.mjs (+1/-0 行 identity fallback)
- figma-data/normalized/docs-figma-members/progress.ts (+M 行 variant.theme)
- figma-data/normalized/docs-figma-members/rating.ts (+M 行 variant.theme)
- figma-data/normalized/docs-figma-members/slider.ts (+M 行 variant.theme)
- 其他 16 .ts (regenerated, generatedAt only)
- docs/internal/t2-sample-audit-report.<page>.md × 18 (re-run)

### §4.X 完整改动清单 (All M / A / D)
[git status --short 全列表]

### Generator hunk
[贴 1 行 diff]

### variant.theme verify
- progress.ts: <count>
- rating.ts: <count>
- slider.ts: <count>

### Baseline regression
- 16 其他 .ts byte-identical 除 generatedAt: <OK / 偏离>
- 15 其他 audit reports 一致除 timestamps: <OK / 偏离>
- ProgressPage / RatingPage / SliderPage α: N/A → fail (correctness): <verified>

### typecheck
- vue-tsc: 0 错误

### 验收 self-check
- [ ] identity fallback 实施
- [ ] 3 .ts 加 variant.theme
- [ ] 16 其他 byte-identical
- [ ] vue-tsc 0 错
- [ ] 3 page α 转 fail
- [ ] 15 baseline 一致
- [ ] 不动其它文件
- [ ] 没 commit
- [ ] §4.X 完整改动清单已列

### 未解决项 / blocker
[如有，列出；无则写"无"]

STOP — 等 plan owner 复审 → commit A4.0 follow-up → 进 A4.2 sample (ProgressPage)。
```

---

## §5 — 严守约束总览

- ⚠️ **不要 commit / 不要 git add**
- ⚠️ §0 fix**精确 1 行**——不要重构其它 generator 逻辑
- ⚠️ §4 完成报告**必须含 §4.X 完整改动清单段**
- ⚠️ Baseline regression（16 其他 .ts + 15 其他 audit reports）必须 pass
- ⚠️ ProgressPage / RatingPage / SliderPage α: N/A → fail 是**期望事实**（correctness improvement）不是 regression
- ⚠️ 完成 STOP，按 §4 格式回报
