Files
novalon-website/docs/acceptance/2026-10-08-baselines/attribution.md
T
zhangxiang c66dfcac26 docs(qa): 基线判红归因改判,作废「运行期漂移」初判并补 lessons §5.33
台账 §9.4 初稿把 chromium-mobile 两页 +30/+21px 记为「零源码改动 ⇒ 只能来自
运行期」,参照系用错:旧参照的采集树是 040951c(09-22),当前树含 a366bd1
(09-28 第五轮),参照比树旧了一个修复轮次。

- 实测归因:row-diff.cjs(sharp 逐行比对)定位发散行 y=7440 落在 /products/erp
  的 benefits 段;git diff 显示 Q-6 把指标 count-up 从 render 体迁入 useEffect
  并加取消 ⇒ 旧参照冻结的是动画中间帧,新参照是稳定终态,属预期改进
- 排除数据侧:prisma/seeds/products.ts 在该窗口零改动
- 三条口径落到 lessons §5.33:归因须对「采集树 vs 当前树」;基线数量须标「例/张」
  (本轮 38 张 = 31 例);裸 --update-snapshots 实为 changed 模式,不重写通过项
- §9.5 的 G 项就此关闭,取证脚本随证据目录入库
2026-10-08 17:03:24 +08:00

57 lines
7.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-10-08 视觉基线写入(AUTH-D3 / 台账 §8.5 D)归因与取证
- 授权:用户裁定「两者都授权」= 写入 20 例缺参照 **并** 覆盖 11 例已过时参照;§8.5 E(healer 清死选择器)裁定本轮不动。
- 生成树:`1396666`(见 `head.txt`),采集前后工作树对 `e2e/visual-snapshots` 干净(`pre-run-worktree.txt` 空、`pre-run-count.txt` = 107)。
- 命令:`npm run test:visual:all -- --update-snapshots`(dev 目标,5 project × 25 例 = 125)。日志 `update-run.txt`,**125 passed / 4.3m / EXIT=0**。
- 复核:`npm run test:visual:all -- --update-snapshots=none`。日志 `readonly-rerun.txt`,**125 passed / 0 failed / 4.1m / EXIT=0**,复跑期间 `git status --porcelain e2e/visual-snapshots` 仍为 25 `??` + 13 ` M` ⇒ **只读性成立,零写入**。
## 1. `-u` 的真实语义(决定「13 张覆盖是否都是真判红」)
`node_modules/playwright/lib/program.js:202` 实读:`["-u, --update-snapshots [mode]", { choices: ["all","changed","missing","none"], preset: "changed" }]`,`node_modules/playwright/lib/common/index.js:584` 缺省为 `missing`。
⇒ 裸 `--update-snapshots` = **`changed`**,只在「缺参照」或「比对不符」时写盘,**不会**重写通过的参照。因此 13 张覆盖全部是真判红,不存在「通过但被顺手改写」的污染。
## 2. 38 张文件 vs 台账 31 例的对账
台账 §8.3 的 `20 缺参照 + 11 已过时 = 31` 是**用例级**读数,本轮写盘是**文件级**(一例可含多张 shot),两者不矛盾:
| 组 | 用例 | shot 文件 | 说明 |
|---|---|---|---|
| 缺参照 | 20(4 subject × 5 project) | **25** | 「L2 输入框」一例两 shot(`input-default` + `input-focused`,`e2e/visual-regression.spec.ts:200,204`)⇒ 每 project 5 张 |
| 已过时 | 11 | **13** | `product-erp-fullpage` ×5 + `solution-manufacturing-fullpage` ×5 = 10 例 10 张;chromium-mobile「按钮组件」一例三 shot(`button-default/hover/focus`,`:112,116,120`)= 1 例 3 张 |
| 合计 | **31** | **38** | `update-run.txt` 内 `writing actual` 行数现取 = **38**,与 `git status` 的 25 `??` + 13 ` M` 逐项吻合 |
新参照 subject(每 project 5 张,共 25):`about-brand-fullpage`、`product-erp-upgrade-fullpage`、`product-card`、`input-default`、`input-focused`。磁盘参照总数 105(`visual-regression.spec.ts` 目录内)+ 25 = **130**,另 `manual-acceptance/` 2 张 = 132。
## 3. 13 张覆盖的像素级归因(`sips` 现取,宽×高)
| 参照 | 旧 | 新 | 定性 |
|---|---|---|---|
| `product-erp-fullpage` chromium-desktop | 1280x9211 | 1280x**7194** | −2017px,Q-5/S-2 网格修复的预期版面收缩 |
| `product-erp-fullpage` firefox-desktop | 1280x9211 | 1280x7194 | 同上,跨引擎同数 |
| `product-erp-fullpage` webkit-desktop | 2548x18422 | 2548x**14388** | 同上(DPR 2 档) |
| `product-erp-fullpage` chromium-tablet | 1668x16326 | 1668x**14426** | 同上 |
| `product-erp-fullpage` chromium-mobile | 1170x24453 | 1170x**24483** | **+30px**,非收缩形态,见 §5 观察项 |
| `solution-manufacturing-fullpage` desktop / firefox | 1280x9287 | 1280x**8282** | −1005px,同族网格收缩 |
| `solution-manufacturing-fullpage` webkit | 2548x18572 | 2548x**16562** | 同上 |
| `solution-manufacturing-fullpage` tablet | 1668x18904 | 1668x**16710** | 同上 |
| `solution-manufacturing-fullpage` mobile | 1170x27759 | 1170x**27780** | **+21px**,同 §5 |
| `button-default/focus/hover` chromium-mobile | **186x96** | **132x132** | N-15(c) `:visible` 修正后目标元素变更:旧参照拍桌面导航下拉触发器(186x96),新参照拍 390px 下真实可见的 `mobile-menu-button`(44x44 CSS 逻辑像素 × DPR3 = 132) |
## 4. 人工核看(本轮以「逐张读图」代替批量放行)
- `input-default-visual-chromium-desktop.png`:真实姓名框,placeholder「请输入您的姓名」⇒ 未拍成反垃圾蜜罐。规格侧有双护栏:`visual-regression.spec.ts:197-199` 断言 `name ∈ /^(name|email|phone|subject)$/` 且 `not aria-hidden`。
- `product-card-visual-chromium-desktop.png`:`bento-product-card-erp` 卡(标题 + 研发中/企业套装徽标 + 指标三格 + 目标口径注 + 能力标签)。中部留白**不是**渲染缺失:`products-content-v3.tsx:137` 的 `<p className="... flex-1">` 在 large 卡里撑高,文本仅占顶部一行——同一形态在**已批准**的 `products-fullpage-visual-chromium-desktop.png` 里逐字一致,故新参照与既有批准基线同形。选择器锚点为 `[data-testid^="bento-product-card-"]` + `role="listitem"` + `data-bento-size` 三重钉住(`:154-157`)。
- `button-default-visual-chromium-mobile.png`:44x44 汉堡按钮(三横线),与 N-15(c) 实测结论一致。
## 5. 观察项与归因更正(2026-10-08 本轮内自我改判)
1. **chromium-mobile 两页 +30 / +21px 已归因,且不是运行期漂移**(本条初稿曾误判为「位移只能来自运行期」,已作废):
- 归因错在参照系。旧参照的**采集树**是 `040951c`(2026-09-22 规范模式重生成),最后一次被改动是 `6bb7c55`(2026-09-28 10:48);而当前树含 `a366bd1`(第五轮修复,2026-09-28 10:48:07)与 `a0328a6`。⇒ 判红须对「采集树 vs 当前树」做 diff,而不是「上一轮提交 vs 本轮提交」。本轮「相对 `a0328a6` 零生产源码改动」只保证**门禁绿灯可平移**,不保证**参照与树同源**。
- 机理已定位:`src/components/detail/detail-product-value.tsx` 在 `a366bd1` 里做了 Q-6 修复——指标数字 count-up 动画原先写在 **render 体内**(每帧 `setState` 再 spawn 一条从 0 开始的 rAF 链、从不取消),改为 `useEffect` 驱动并在卸载/重跑时取消(diff 见 `:70-100`)。旧参照拍到的是**动画竞态中的中间帧**,新参照拍到稳定终态 ⇒ 指标卡文本/高度小幅位移,属预期改进。
- 现场取证:`node docs/acceptance/2026-10-08-baselines/row-diff.cjs <参照路径> <outdir>`(sharp 逐行比对)现取首个发散行 = **y 7440**(`product-erp-fullpage` mobile,共 24453/24483 行),该处正是 `/products/erp` 的 `benefits` 价值列表段;裁图对照显示新参照出现发丝分隔线且条目间距收紧。
2. **仓库体积**:新增 25 张 PNG 共 **17,192 KB**(最大单张 `product-erp-upgrade-fullpage-visual-chromium-mobile.png` 2,472 KB),13 张覆盖净变化为负(如 webkit erp 2,303,020 → 2,066,938 字节)。
3. **采集口径**:dev 目标。`docs/testing.md` §确定性约束 1 已实证「快照与 `E2E_TARGET` 无关」(`e2e/fixtures.ts` 剥 `nextjs-portal`),故 production 复核不会因此全红;`e2e/visual-snapshots` 现共 132 张(含 `manual-acceptance/` 2 张)。
4. **只读比对的前置**:跑前 `lsof :3000` 空闲、无 `next-server` 残留 ⇒ 未落入 `reuseExistingServer` 静默复用旧构建的坑(`docs/development/quality-gates.md:163`)。
5. **残留风险(改判后仍留一条)**:Q-6 族的其他 count-up 消费点若仍有 render 体内动画,基线仍可能拍到中间帧。本轮 125/0 只证明**当前树自洽可复现**,不证明「参照=用户所见」;下一次跨树复核(如 production 目标或换 DPR 档)若出现指标卡判红,按本条查。