Files
zhangxiang a57826f710 docs(brand): 品牌全案手册与落库证据入库(判据、门禁、负例都在场)
BRAND-MANUAL.md 收敛识别方案裁定与实测判据;TOKEN-MIGRATION.md 记 P1/P3/P4 迁移面与孪生缺陷;
TEST-PATCH.md 记 P7 的 1→0 实测。随包入库的是结论赖以成立的仪器与证据:check-assets、check-manual、
verify-assets-cross、check-wordmark-copies、check-docsync、check-probes(四段闸,每段带能失败的负例)、
check-baseline-shift.cjs(平移感知基线判据,四合成样本两绿两红自测通过;它取代被证伪的
「diff 包围盒不许越页眉带」)与 measured/baseline-shift-p1.json(第一批 104 张逐张分类,带 _src 出处戳)。

大体积工作件不入库:样机 HTML 与栅格截图 100+MB、字体母版 45MB 留在盘上,入库 690 个文本/矢量件。
2026-10-16 19:23:28 +08:00

70 lines
4.2 KiB
Bash
Executable File
Raw Permalink 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.
#!/usr/bin/env bash
# 视觉基线影响面实测:在**补丁态副本**上跑只读比对(--update-snapshots=none),
# 把「87 张预期变 / 45 张必须逐字节不变」从静态分类变成实测清单。
# 只写 /tmp,绝不写仓库:真仓的 e2e/visual-snapshots 全程只读(本脚本只 cp 出来)。
set -uo pipefail
SRC=/Users/zhangxiang/Codes/Novalon/novalon-website
DEL=$SRC/deliverables/logo-redesign-2026-10-13
SB=/tmp/visual-copy
LOG=/tmp/visual-blast.log
echo "【0】准备副本(含 e2e 与 140 MB 基线;排除 node_modules/.git/.next/deliverables)"
rm -rf $SB; mkdir -p $SB
rsync -a --exclude node_modules --exclude .next --exclude .git --exclude deliverables \
--exclude vibe_images --exclude '*.log' --exclude playwright-report --exclude test-results \
$SRC/ $SB/ >/dev/null 2>&1 || { echo "rsync 失败"; exit 1; }
mkdir -p $SB/deliverables/logo-redesign-2026-10-13
cp -R $DEL/landing/. $SB/landing/
echo " 复制 node_modules(Next 拒绝 node_modules 是指向项目外的符号链接:
\"Symlink [project]/node_modules is invalid\" ⇒ 必须真复制,不能用软链)"
rsync -a $SRC/node_modules/ $SB/node_modules/ >/dev/null 2>&1 || { echo "node_modules 复制失败"; exit 1; }
echo " 基线份数(副本):$(find $SB/e2e/visual-snapshots -name '*.png' | wc -l | tr -d ' ') 张 | 真仓 $(find $SRC/e2e/visual-snapshots -name '*.png' | wc -l | tr -d ' ') 张"
BEFORE=$(cd $SRC && git status --porcelain | wc -l | tr -d ' ')
cd $SB && git init -q && git config user.email t@t && git config user.name t \
&& git add -A >/dev/null 2>&1 && git commit -qm seed >/dev/null 2>&1
echo "【1】在副本上跑同一条 apply.sh(补丁态)"
REPO_ROOT=$SB LAND_DIR=landing SANDBOX=1 SKIP_NPM=1 bash landing/apply.sh > /tmp/vb-apply.log 2>&1
RC=$?
HITS=$(grep -c 'width={106}' src/components/layout/header.tsx)
STALE=$(ls public/logo-calligraphy.svg public/logo-light.svg public/logo-v4-backup.svg 2>/dev/null | wc -l | tr -d ' ')
echo " apply EXIT=$RC | width={106} 命中 $HITS(期望 2)| 陈旧件残留 $STALE(期望 0)"
if [ "$RC" != 0 ] || [ "$HITS" != 2 ] || [ "$STALE" != 0 ]; then
echo "⇒ 补丁未真正落地,**不跑视觉比对**(否则会拿到未打补丁状态的读数)。tail:"
tail -5 /tmp/vb-apply.log; exit 1
fi
echo "【2】只读比对(--update-snapshots=none:只比不写;缺省不带它才会静默创建基线)"
cd $SB/e2e && npx --no-install playwright test visual-regression.spec.ts \
--update-snapshots=none --reporter=list > $LOG 2>&1
echo " 视觉比对 EXIT=$?"
if grep -q "config.webServer was not able to start" $LOG; then
echo "⇒ 服务器没起来:**本轮读数无效**(不是"没有基线变化",而是根本没跑)。最后 8 行:"; tail -8 $LOG; exit 1
fi
grep -E "[0-9]+ (passed|failed|flaky|skipped)" $LOG | tail -3
tail -4 $LOG
echo "【3】汇总:哪些基线判为不符(=会随本次改动而变)"
python3 - <<'PY'
import re, os, json
log = open('/tmp/visual-blast.log', encoding='utf-8', errors='ignore').read()
fails = re.findall(r'\S+\.png[^\n]*', log)
names = sorted(set(re.findall(r'([\w.-]+\.png)', log)))
snap = {}
for root, _d, fs in os.walk('/tmp/visual-copy/e2e/visual-snapshots'):
for f in fs:
if f.endswith('.png'):
snap.setdefault(f, os.path.relpath(os.path.join(root, f), '/tmp/visual-copy/e2e/visual-snapshots'))
logo = [n for n in names if ('fullpage' in n or 'header-navigation' in n or 'footer-section' in n
or 'home-hero' in n)]
other = [n for n in names if n not in logo]
print(' 日志里被点名的 png:%d 个 | 其中含字标类:%d | 非字标类:%d' % (len(names), len(logo), len(other)))
print(' 非字标类(这些**不该**变,变了就是外溢):', ', '.join(other[:12]) or '(无)')
json.dump({'named': names, 'logo': logo, 'other': other, 'snap_total': len(snap)},
open('/tmp/visual-blast.json', 'w', encoding='utf-8'), ensure_ascii=False, indent=1)
PY
AFTER=$(cd $SRC && git status --porcelain | wc -l | tr -d ' ')
echo "【4】真仓洁净:改前 $BEFORE 行 → 现在 $AFTER 行(必须相等)"
[ "$BEFORE" = "$AFTER" ] && echo " ✓ 未写仓库" || echo " ✗ 副本之外有改动,立刻查"