diff --git a/CHANGELOG.md b/CHANGELOG.md index 9396ca3..588cfd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,10 @@ M4-B5 批次。用户能感知的是**深色画布上节点的连接端口看得 验收:计算样式逐属性 diff(节点/标题带/端口/浮条/生图参数/任务卡),变化全部为预期项; `verify:ci` 全绿;审计:字号写死 212→188、圆角 128→104、间距 483→416、`style.css` 2314→2307 行。 +**顺带修掉视觉基线的一处「假绿灯」**:`toHaveScreenshot` 的 `threshold` 默认 0.2, +而 `maxDiffPixels: 0` 只约束「超阈值像素数」,两者叠加并不等于逐像素精确 —— 端口描边改的 19 级差异 +正好被吃掉,基线没更新、比对还报 12/12 通过。已把 `threshold` 压到 0 并重生成基线(仍 12/12)。 + ## v3.26.47(2026-11-23)设置页:输入框与按钮终于一样高,半像素字号清零 > **状态:待发布**(`verify:ci` 全绿、12 张视觉基线只有设置弹窗 2 张变化且已核对;未打 tag) diff --git a/docs/plans/design-tokens-rollout.md b/docs/plans/design-tokens-rollout.md index 0a9333c..ccda772 100644 --- a/docs/plans/design-tokens-rollout.md +++ b/docs/plans/design-tokens-rollout.md @@ -256,6 +256,13 @@ hover 完全没反馈。改成 `color-mix(text 10%, transparent)` 后两个主 **验收偏差**:12 张基线里变了 **8 张**(②④⑤⑥ × 亮/暗),不是预期的 2 张 —— ④⑤⑥ 三个场景的画布背后 也有节点,端口与标题带的改动同样会显现。逐张看过:无裁切、无重叠、无错位。 +**本批抓到的最有价值的一条:视觉基线一直在「假绿灯」**。`toHaveScreenshot` 的 `threshold` 默认 **0.2** +(每像素 YCbCr 距离),而 `maxDiffPixels: 0` 只约束「超阈值像素数」——两者叠加**不等于逐像素精确**。 +端口描边从 `#ababab` 改成 `color-mix(text 55%)` 后亮色只差约 19 级,正好落在 0.2 里:基线没更新、 +比对报 12/12 通过、`--update-snapshots` 也不写盘(它同样按阈值判断「有没有变」)。 +已把 `threshold` 显式压到 **0**,重生成 8 张基线后仍 12/12 通过(同机渲染是确定性的), +「0 diff」从此名副其实。**此前各批写的「逐像素 0 diff」都应按这个口径重读**:真实含义是「没有超过 0.2 的像素」。 + **每批三条硬验收**: 1. 亮/暗两张截图 `0 diff`(B1 例外:允许 tab 视觉变化,需人工确认) 2. `token-audit.js` 对应计数下降 diff --git a/tests/_visual-tokens.spec.js b/tests/_visual-tokens.spec.js index 5fdb75d..8a52b5d 100644 --- a/tests/_visual-tokens.spec.js +++ b/tests/_visual-tokens.spec.js @@ -76,6 +76,10 @@ async function shot(page, name) { animations: 'disabled', caret: 'hide', maxDiffPixels: 0, + // threshold 默认 0.2(每像素 YCbCr 距离),`maxDiffPixels: 0` 只是「超阈值的像素数为 0」—— + // 两者叠加并不等于逐像素精确。B5 踩到:端口描边色改了约 19 级,全被 0.2 吃掉, + // 基线没更新、比对还显示 12/12 通过(假绿灯)。这里显式压到 0,让「0 diff」名副其实。 + threshold: 0, }) } diff --git a/tests/_visual-tokens.spec.js-snapshots/02-canvas-light-darwin.png b/tests/_visual-tokens.spec.js-snapshots/02-canvas-light-darwin.png index d7b4a89..e8dda93 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/02-canvas-light-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/02-canvas-light-darwin.png differ diff --git a/tests/_visual-tokens.spec.js-snapshots/04-drawer-gallery-light-darwin.png b/tests/_visual-tokens.spec.js-snapshots/04-drawer-gallery-light-darwin.png index f2e0e25..ee5592b 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/04-drawer-gallery-light-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/04-drawer-gallery-light-darwin.png differ diff --git a/tests/_visual-tokens.spec.js-snapshots/05-panel-promptlib-light-darwin.png b/tests/_visual-tokens.spec.js-snapshots/05-panel-promptlib-light-darwin.png index e5854c7..26fc06f 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/05-panel-promptlib-light-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/05-panel-promptlib-light-darwin.png differ diff --git a/tests/_visual-tokens.spec.js-snapshots/06-ctxmenu-light-darwin.png b/tests/_visual-tokens.spec.js-snapshots/06-ctxmenu-light-darwin.png index de633c6..c2c32ff 100644 Binary files a/tests/_visual-tokens.spec.js-snapshots/06-ctxmenu-light-darwin.png and b/tests/_visual-tokens.spec.js-snapshots/06-ctxmenu-light-darwin.png differ