docs(grammar): 落 ADR-0008 并改掉说谎的那一方,含四条经验教训与台账 §11

对标实测证伪了 ADR-0004 的两条视觉判据,所以本笔的主体是**改文档**:
判据错在文档里,而不是错在代码里,不一起改就是文档变成说谎的那一方。

新增 `docs/adr/0008-benchmark-grammar-takeover.md`(取证方法、实测对照表、
四项裁定、已知偏差 6 条、验证契约):
- Bain 走 archive.org 快照 2026-08-31(1600×846)绕开 Cloudflare,
  Porsche 取 live 国际站 + 中国站导航,逐元素 `getComputedStyle`。
- **被证伪 ①**(决策四)「关键数字 = 超大字号 + 品牌色」:
  Bain 成果数字实测 **40px / 字重 500 / 纯黑**;
  本仓 `--font-size-5xl: 2.25rem` 在桌面根字号 18px 下 = 40.5px ⇒ 现档正好命中,零新增令牌。
- **被证伪 ②**(决策一)「4px 色条为辅」:两家**都不用颜色给内容分类**,
  饱和红用作"面"的次数为 **0**(Bain #CC0000 出现 65 次全是字与线,
  Porsche 红出现 4 次全是按钮)。
  ADR-0004 决策一、决策四两处就地加 ⚠️ 修订块并指向 ADR-0008。
  ADR 不重写历史,但必须让读者不会把已废判据当现状。

`DESIGN.md`:front-matter 的 `rounded:` 改成 0–4px 记档 + 新增 `cta: "0px"`;
`components.cta-*/badge-pill/card-bain/input-field` 的 `rounded` 从
  `{rounded.full}` 改 `{rounded.cta}` 或 `{rounded.md}`,
padding 按实测 `14px 28px`;Elevation 段删掉「hover 升至 card-shadow-hover + translateY(-4px)」;
数据条段把「font-black + 品牌红」改为「text-5xl / 500 / text-ink」并注明是被实测推翻的那条;
Navigation 段写入双轴与「真源是代码、CMS 行须满足 IA 契约才采纳」。

`CONTEXT.md` 关键决策表 +9 行:对标双轴导航 / 导航真源=代码 / 视觉语法记档 /
僵尸令牌 / 彩色编码适用面 / 成果槽 ResultsSlot / 替代信号槽 / 承诺单一真源 /
「注释写在 JSX children 位 = 页面文字」。

`docs/development/quality-gates.md`:
- §1 的 lint warning **权威计数就地更新**:本树 `EXIT=0 / 0 error / 81 warning`,
  分项相加必须等于总数(55+12+8+4+1+1 = 81 ✓),
  并给出与 2026-09-23 那 104 条的逐项对账(`no-explicit-any` 25→4 等,净 −23 ✓)。
  归因**已实证到文件**而不是只看方向一致:逐个 `git show da9a5cb6:<被删文件>` 数出
  33 处 `any` 命中(v15.test 12 / NewsDetailClient.test 8 / v15 4 / …),
  并说明命中数 ≠ 告警数的差额来源,附可复算命令。
- §5.1 `check:motion` 现状 23 处 → **8 处 / 4 文件**,
  并写明残留 8 处全部经 `git show` 自证为基线 `da9a5cb6` 既有红、非本轮引入。
- 新增 §5.2 记录 `check:visual`(R1–R11 每条的分母口径与两条闸的**适用边界**),
  §7 的 `test:all` 组成改为八段并注明自证先跑。
- 另记一条:这条计数一度被读成 0 error,是因为管道吞掉了 EXIT=1(见 §5.38)。

`docs/lessons-learned.md` 四条(§5.38–§5.41)+ 更新记录 4 行:
管道吞退出码复犯 / 合法 JSX 的注释渲染成页面文字而三道门禁全绿 /
仪器只在被复用时才坏(module 层累加器 + 互斥前提塞进同一份夹具)/
僵尸令牌(删了值没删引用,R5 与 R7 各看一侧所以两条都绿)。

`docs/acceptance/qa-tracker.md` §11:四台仪器表(每台的可失败证据)、
本轮 5 条缺陷与根因、6 个 spec 的重锚对照表、
新登记 4 条待拍(DEC-N1 彩色编码第二通道 / N2 stagger 默认值 /
N3 motion 残留 8 处 / N4 既有案例区无门槛)+ 2 条待授权(AUTH-VISUAL / AUTH-NAV)。

`config/test/lighthouserc.json`:URL 集补 `/insights`(新的一级轴)与
`/solutions/manufacturing`(本批 tracer-bullet 承载页)——
不补就是新页没有任何 Lighthouse 覆盖。

`README.md`:加本批进度条目,并把「check:motion 仍 23 处」的旧数改为指向
quality-gates §5.1 的现取口径。

探针 7 份入库 `docs/acceptance/2026-10-17-ia-e2e/`(导航结构 / 面板链接 /
首页 testid 与文案 / 段序文档坐标 / 页脚入口),是本批所有 E2E 断言的取证来源。

本笔纯文档 + 配置,不改运行时代码;同树已跑过的验证仍成立:
`npm run test:all` EXIT=0、`type-check` EXIT=0、`lint` EXIT=0(0/81)、
`test:unit` 141 套件 / 1747 例、`check:visual` 11/11 + accents 成立、`build` EXIT=0。
This commit is contained in:
zhangxiang committed 2026-10-17 01:08:45 +08:00
1 parent ec543ff242
commit f23500ff07
18 files changed
+522 -29

No files matched your search

@@ -0,0 +1,14 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
const inCard = await p.locator('[data-testid="card-products"] a[href="/products"]').count();
console.log('card-products 内 /products 链接数:', inCard);
if (inCard) console.log(' 文本:', (await p.locator('[data-testid="card-products"] a[href="/products"]').first().innerText()).trim());
console.log('home-cta-button 数:', await p.locator('[data-testid="home-cta-button"]').count(),
'href:', await p.locator('[data-testid="home-cta-button"]').first().getAttribute('href'));
console.log('l3 heading:', await p.locator('#l3-signals-heading').count());
console.log('方法论 link:', await p.locator('a[href="/methodology"]').count());
console.log('team link:', await p.locator('a[href="/team"]').count());
await b.close();
@@ -0,0 +1,15 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
const ids = await p.evaluate(() =>
[...document.querySelectorAll('[data-testid]')].map(e => e.getAttribute('data-testid')));
console.log('TESTIDS:', JSON.stringify([...new Set(ids)]));
const cta = await p.locator('[data-testid="hero-primary-cta"]').count();
console.log('hero-primary-cta count:', cta);
const bodyText = await p.locator('body').innerText();
for (const k of ['共创', '数据来源', '口径', '暂无案例数据', '成为首批共创客户', '首批客户共创']) {
console.log(` 「${k}」出现 ${bodyText.split(k).length - 1} 次`);
}
await b.close();
@@ -0,0 +1,22 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
// 桌面:取 CTA href、ledger signals 文案、basis note 文案
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
const cta = p.locator('[data-testid="hero-cta"]').first();
console.log('hero-cta count=', await p.locator('[data-testid="hero-cta"]').count(),
'href=', await cta.getAttribute('href'), 'text=', (await cta.innerText()).trim().replace(/\n/g,''));
console.log('ledger-signals:', (await p.locator('[data-testid="home-ledger-signals"]').innerText()).replace(/\n/g,' | ').slice(0,220));
console.log('basis-note:', await p.locator('[data-testid="metrics-basis-note"]').innerText());
console.log('l3 heading visible:', await p.locator('#l3-signals-heading').isVisible());
await p.close();
// 移动端:CTA 是否在首屏内 + 横向溢出
const m = await b.newPage({ viewport: { width: 390, height: 844 } });
await m.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await m.waitForTimeout(3000);
const box = await m.locator('[data-testid="hero-cta"]').first().boundingBox();
console.log('mobile hero-cta box:', JSON.stringify(box), '在首屏内=', !!box && box.y >= 0 && box.y + box.height <= 844);
const of = await m.evaluate(() => ({ sw: document.documentElement.scrollWidth, cw: document.documentElement.clientWidth }));
console.log('mobile overflow:', JSON.stringify(of));
await b.close();
@@ -0,0 +1,16 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForSelector('nav[aria-label="主导航"]', { timeout: 15000 });
await p.waitForTimeout(2500);
const nav = p.locator('nav[aria-label="主导航"]');
const btn = nav.locator('button:has-text("能力")');
await btn.hover(); await p.waitForTimeout(700);
// 找到面板容器:按钮的父级里除按钮外的文本
const html = await nav.evaluate(n => n.outerHTML);
console.log('NAV HTML length', html.length);
const txt = await nav.innerText();
console.log('--- innerText after hovering 能力 ---');
console.log(txt.replace(/\n{2,}/g, '\n').slice(0, 900));
await b.close();
@@ -0,0 +1,11 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
console.log('ledger:', (await p.locator('[data-testid="home-ledger"]').innerText()).replace(/\n+/g,' | ').slice(0, 400));
const metrics = await p.locator('[data-testid="ledger-metric"]').count();
console.log('ledger-metric count:', metrics);
console.log('results-slot:', (await p.locator('[data-testid="results-slot-placeholder"]').innerText()).replace(/\n+/g,' | ').slice(0, 260));
console.log('co-creation block:', await p.locator('[data-testid="results-slot-co-creation"]').count());
await b.close();
@@ -0,0 +1,20 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForSelector('nav[aria-label="主导航"]', { timeout: 15000 });
await p.waitForTimeout(2500);
const nav = p.locator('nav[aria-label="主导航"]');
console.log('BUTTONS:', await nav.locator('button').allTextContents());
console.log('LINKS:', await nav.locator('a').evaluateAll(a => a.map(x => x.getAttribute('href') + '|' + x.textContent.trim())));
// hover 能力,看面板
const cap = nav.locator('button:has-text("能力")');
console.log('cap count:', await cap.count());
if (await cap.count()) {
await cap.first().hover();
await p.waitForTimeout(600);
console.log('expanded:', await cap.first().getAttribute('aria-expanded'));
const panel = await p.locator('[id*="dropdown"], [role="menu"], [data-testid*="mega"]').allTextContents();
console.log('PANEL texts (first 300 chars):', panel.join(' /// ').slice(0, 300));
}
await b.close();
@@ -0,0 +1,12 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
for (const id of ['hero-section','home-ledger','results-slot-placeholder','home-insights','home-industries','home-capabilities','home-cta']) {
const el = p.locator(`[data-testid="${id}"]`).first();
if (!(await el.count())) { console.log(id, 'MISSING'); continue; }
const y = await el.evaluate(e => e.getBoundingClientRect().top + window.scrollY);
console.log(id.padEnd(24), Math.round(y));
}
await b.close();
@@ -0,0 +1,20 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForSelector('nav[aria-label="主导航"]', { timeout: 15000 });
await p.waitForTimeout(2500);
const nav = p.locator('nav[aria-label="主导航"]');
for (const label of ['行业', '能力', '洞察']) {
const btn = nav.locator(`button:has-text("${label}")`);
await p.mouse.move(0, 0); await p.waitForTimeout(200);
await btn.hover(); await p.waitForTimeout(700);
const expanded = await btn.getAttribute('aria-expanded');
const controls = await btn.getAttribute('aria-controls');
const links = await p.locator('a').evaluateAll(a => a.map(x => x.getAttribute('href')).filter(h => h && (h.startsWith('/solutions') || h.startsWith('/services') || h.startsWith('/products') || h.startsWith('/insights') || h.startsWith('/news') || h.startsWith('/methodology'))));
const viewAll = await p.locator('a:has-text("查看全部")').evaluateAll(a => a.map(x => x.textContent.trim() + ' -> ' + x.getAttribute('href')));
console.log(`\n### ${label} expanded=${expanded} controls=${controls}`);
console.log(' 面板内相关链接:', [...new Set(links)].join(' '));
console.log(' 查看全部:', viewAll.join(' | '));
}
await b.close();
@@ -0,0 +1,10 @@
import { chromium } from 'playwright';
const b = await chromium.launch();
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' });
await p.waitForTimeout(3000);
const links = await p.locator('a[href="/products"], a[href^="/products/"]').evaluateAll(a =>
a.map(x => ({ href: x.getAttribute('href'), text: x.textContent.trim().slice(0,24), visible: !!(x.offsetWidth || x.offsetHeight) })));
console.log(JSON.stringify(links, null, 0).slice(0, 900));
console.log('可见的 /products 链接数:', links.filter(l => l.href === '/products' && l.visible).length);
await b.close();