# AC E2E 质量反馈闭环（人工缺陷 → 门禁补强）

> 案例来源：ADI V2.3.4 AC-11「自定义列 Drawer」列名渲染为 `() => h(NTooltip, …)` 函数源码，但 `deliver` 仍 exit 0。

## 1. 症状

- 自定义列 Drawer 左侧/右侧展示 JS 渲染函数源码，而非「下单总价」等中文列名。
- `ac-literal-binding.spec.ts` 存在 `expect(true).toBe(true)`。
- `ac-e2e-depth.spec.ts` 的 AC-11 仅 `body.click({ x: 8, y: 8 })`，未打开列配置 Drawer。

## 2. 根因（门禁漏洞）

| 门禁 | 漏洞 | 修复（v1.7.7+） |
|------|------|----------------|
| `assess-ac-assertion-binding` | `literals.length === 0` 时任意 `expect` 即通过 | e2e AC 须 `testBlockIsMeaningfulBrowserE2e`；拒绝 `expect(true)` |
| `assess-e2e-assertion-depth` | 未检测 `expect(true)` | `detectPseudoAssertions` 新增恒真断言规则 |
| `extractCriterionLiterals` | 只抽引号内文案，漏掉「搜索字段、恢复默认」 | 增加冒号后顿号分隔步骤抽取；合并「预期结果」列 |
| `e2e-scope.config` | `ac-literal-binding.spec.ts` 未纳入 change scope | 项目侧须在 scope 中包含全部 AC 绑定 spec |

## 3. 反向推动流程（项目 → sdd-flow-kit → 项目）

```text
人工发现 UI 缺陷
  → 在 openspec/PRD/<runId>/ 登记 gate-remediate 说明（证据截图 + 根因）
  → 在 sdd-flow-kit 补强 assess-*.mjs / src/core/*.ts + 单测
  → npm test && npm version patch（发布或 link 到项目）
  → 项目内修 E2E（删空壳、补 Drawer 断言）
  → 重跑 npx sdd-flow-kit gate --expect prd-coverage && deliver
```

### 项目侧命令

```bash
cd frontend

# 本地门禁（应先 FAIL，修完 PASS）
node node_modules/sdd-flow-kit/scripts/assess-e2e-assertion-depth.mjs --change <change>
node node_modules/sdd-flow-kit/scripts/assess-ac-assertion-binding.mjs --run-dir openspec/PRD/<runId>

# SDD 交付链
npx sdd-flow-kit gate --project-root . --run-id <runId> --expect prd-coverage
npx sdd-flow-kit deliver --project-root . --run-id <runId> --change <change>
```

## 4. AC-11 推荐 E2E 断言清单

- 打开列配置：`[title="列配置"]` click
- Drawer 内：`toContainText("搜索字段")`、`toContainText("恢复默认")`、`toContainText("清空")`
- 列名：`toContainText("下单总价")` 或 `toContainText("实际收入")`
- 负向：`not.toContainText("NTooltip")`、`not.toContainText("() => h(")`

## 5. 05 文档写法（便于机器绑定）

在「验收标准」或「预期结果」中写清步骤名（顿号分隔）或书名号文案，避免仅写「五步可走通」等不可抽取描述。

## 6. 变更记录

| 版本 | 日期 | 说明 |
|------|------|------|
| 1.7.7 | 2026-07-20 | 恒真断言检测；ac-assertion-binding 收紧；字面量抽取增强；AC-11 回归单测 |
