feat(tools): fidelity 加分区域阈值(抓全屏百分比淹没的局部错位)

针对「顶栏右组错位全屏 diff 3.5% 没报红」的盲区:
- screens.mjs shell 加 zones(顶栏/侧栏/状态栏逻辑坐标 + 各自紧阈,顶栏收到 4%)
- fidelity.mjs:有 zones 时全屏仅参考,逐 zone 判定(按 dpr crop)
- skill diff.mjs 加 --crop 仅比矩形区域(全局工具,不在本 repo)
- 验证:错位版 golden 顶栏带 9.48% > 4% 报红;修正版 3.16% 通过

仍存盲区:弹出态(用户菜单/dropdown/dialog)不进静态 golden,需单独补浮层 golden。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
wangjia
2026-06-25 18:21:15 +08:00
parent 4bfb79becd
commit e03bdd8bd1
2 changed files with 43 additions and 11 deletions
+10 -2
View File
@@ -11,15 +11,23 @@
// waitFor 原型截图前等待的选择器
// threshold fidelity 该屏校准阈值(差异像素比例上限);人工目检「像」后定
// shell true=外壳(顶栏/侧栏/状态栏整框),与普通屏一同对比
// zones 分区域阈值(逻辑坐标):把屏切带各自判定,抓「全屏百分比淹没」的局部错位
// (如顶栏元素水平偏移)。x/y/w/h 为逻辑像素,fidelity 按 dpr 换算。
export const SCREENS = {
// 外壳:顶栏(两级品牌+主题器+通知) + 侧栏(分组) + 状态栏。Phase 1 重建后校准阈值。
// 外壳:顶栏(两级品牌+主题器+通知) + 侧栏(分组) + 状态栏。
// 全屏阈值松(内容区空白 vs 原型满表),真正判定看 zones(顶栏带收紧到 4%)。
shell: {
html: '.superpowers/prototype/screens/inventory.html', // 外壳含在每个全框屏里,借库存页取整框
prefix: 'app_shell',
width: 1280, height: 900, dpr: 2,
waitFor: '.app',
threshold: 0.20,
threshold: 0.20, // 全屏仅参考;判定以 zones 为准
shell: true,
zones: [
{ name: 'top', x: 0, y: 0, w: 1280, h: 56, threshold: 0.04 },
{ name: 'side', x: 0, y: 56, w: 218, h: 810, threshold: 0.14 },
{ name: 'status', x: 0, y: 866, w: 1280, h: 34, threshold: 0.10 },
],
},
inventory: {
html: '.superpowers/prototype/screens/inventory.html',